coderound / backend /src /schemas /match.py
ketannnn's picture
feat: implement session-based candidate matching architecture
5655f74
from uuid import UUID
from typing import Any
from pydantic import BaseModel, Field
class ComponentScores(BaseModel):
semantic: float = 0.0
skill: float = 0.0
yoe: float = 0.0
company: float = 0.0
growth: float = 0.0
education: float = 0.0
class GapItem(BaseModel):
type: str
detail: str
mitigated_by_remote: bool | None = None
class MatchedCandidate(BaseModel):
candidate_id: UUID
rank: int
name: str | None = None
email: str | None = None
role_type: str | None = None
engineer_type: str | None = None
years_of_experience: float | None = None
most_recent_company: str | None = None
parsed_summary: str | None = None
programming_languages: list[str] = []
growth_velocity: float = 0.5
stage1_score: float
stage2_score: float | None = None
final_score: float
component_scores: ComponentScores
gaps: list[GapItem] = []
class MatchResponse(BaseModel):
jd_id: UUID
jd_title: str
jd_quality: dict[str, Any] = {}
total_matched: int
results: list[MatchedCandidate]
weights_used: dict[str, float] = {}
session_id: UUID | None = None
class CandidateDetailResponse(BaseModel):
jd_id: UUID
candidate_id: UUID
rank: int | None = None
final_score: float
component_scores: ComponentScores
gaps: list[GapItem] = []
explanation: str | None = None
candidate: dict[str, Any] = {}
jd: dict[str, Any] = {}
class ReRankRequest(BaseModel):
weights: dict[str, float] = Field(
default={
"semantic": 0.20,
"skill": 0.35,
"yoe": 0.15,
"company": 0.10,
"growth": 0.10,
"education": 0.10,
}
)