Skip to content

[WIP] fix: job_description cannot support null value#32

Closed
pandalow with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-31
Closed

[WIP] fix: job_description cannot support null value#32
pandalow with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-31

Conversation

Copilot AI commented Sep 12, 2025

Copy link
Copy Markdown

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Bug Report

Describe the bug

A clear and concise description of what the bug is. For example: "AI job description extraction fails when processing job postings due to database constraint violation on employment_type field."

To Reproduce

Steps to reproduce the behavior:

  1. Navigate to the AI extraction management page
  2. Select job descriptions to process with AI extraction
  3. Click on 'Start Extraction' or run the extraction command
  4. See error: IntegrityError: NOT NULL constraint failed: application_jobdescription.employment_type

Expected behavior

The AI extraction should successfully process job descriptions and create JobDescription records in the database, even when some fields like employment_type are not detected or are null in the extracted data.

Environment Information:

Backend (Django)

  • OS: macOS
  • Python Version: [e.g. 3.11]
  • Django Version: [e.g. 4.2]
  • Database: [e.g. SQLite/PostgreSQL]

Frontend (if applicable)

  • OS: macOS
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 116]

AI Services

  • OpenAI API Version: [e.g. gpt-4]
  • LangChain Version: [e.g. 0.0.340]

Error Details

Traceback (most recent call last):
  File "/path/to/applyday/backend/applyday/ai/services/extract_jd.py", line X, in process_extract
    jd = JobDescription.objects.create(job_text=job, **data)
django.db.utils.IntegrityError: NOT NULL constraint failed: application_jobdescription.employment_type

Affected Components

  • AI Job Description Extraction (ai/services/extract_jd.py)
  • JobDescription Model (application/models.py)
  • Database Schema
  • Admin Interface
  • API Endpoints

Severity

  • Critical - System unusable
  • High - Major functionality broken
  • Medium - Some functionality affected
  • Low - Minor issue

Additional context

  • This issue occurs when the AI extraction service returns None or missing values for required database fields
  • The JobDescription model has non-nullable fields that conflict with incomplete AI extraction results
  • Related to the database migration and model constraints setup
  • May affect batch processing of multiple job descriptions

Proposed Solution

  1. Modify JobDescription model to allow null values for AI-extracted fields
  2. Add default values in the extraction service for required fields
  3. Create and apply database migration to update constraints
  4. Add validation and error handling for incomplete extractions

Related Files

  • backend/applyday/application/models.py
  • backend/applyday/ai/services/extract_jd.py
  • backend/applyday/ai/schemas/job_description.py

Fixes #31.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI commented Sep 12, 2025

Copy link
Copy Markdown
Author

@pandalow 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: job_description cannot support null value

2 participants