Skip to content

Instantly share code, notes, and snippets.

@MinSomai
Created April 2, 2025 10:32
Show Gist options
  • Save MinSomai/31179d448a5a6a88091b5999761f0832 to your computer and use it in GitHub Desktop.
Save MinSomai/31179d448a5a6a88091b5999761f0832 to your computer and use it in GitHub Desktop.
from typing import Optional
from pydantic import BaseModel
class DocumentResult(BaseModel):
"""Information about the candidate extracted from the CV Document."""
first_name: Optional[str] = None
middle_name: Optional[str] = None
last_name: Optional[str] = None
phone: Optional[str] = None
resume_link: Optional[str] = None
resume_submission_date: Optional[str] = None
job_search_status: Optional[str] = None
residence: Optional[str] = None
date_of_birth: Optional[str] = None
estimated_age: Optional[str] = None
age: Optional[str] = None
language: Optional[str] = None
drivers_license_and_mobility: Optional[str] = None
military_national_service: Optional[str] = None
military_service_details: Optional[str] = None
high_school_education: Optional[str] = None
academic_degree: Optional[str] = None
professional_certifications: Optional[str] = None
professional_experience: Optional[str] = None
technical_skills: Optional[str] = None
position_applied_for: Optional[str] = None
@property
def full_name(self) -> str:
"""Return full name."""
name_parts = [self.first_name, self.middle_name, self.last_name]
return " ".join(filter(None, name_parts))
@staticmethod
def get_default_field_descriptions() -> dict[str, str]:
"""Get default field descriptions as a dictionary."""
return {
"first_name": "Candidate's first name",
"middle_name": "Candidate's Middle Name",
"last_name": "Candidate's last name",
"phone": "Candidate's contact number",
"resume_link": "Link to candidate's resume",
"resume_submission_date": "Date when the resume was submitted",
"job_search_status": "Candidate's current job search status",
"residence": "Candidate's current place of residence",
"date_of_birth": "Candidate's date of birth",
"estimated_age": "Estimated age of the candidate",
"age": "Exact age of the candidate",
"language": "Languages spoken by the candidate",
"drivers_license_and_mobility": "Candidate's driver's license status and mobility",
"military_national_service": "Candidate's military or national service status",
"military_service_details": "Additional details about military service",
"high_school_education": "Candidate's high school education details",
"academic_degree": "Candidate's academic degree details",
"professional_certifications": "Certifications earned by the candidate",
"professional_experience": "Details of candidate's professional experience",
"technical_skills": "Technical skills possessed by the candidate",
"position_applied_for": "Position the candidate is applying for",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment