File size: 2,549 Bytes
ff7b177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
from dataclasses import dataclass, field
from typing import Optional
from enum import Enum


class MatchTier(str, Enum):
    STRONG = "Strong Match"
    GOOD = "Good Match"
    PARTIAL = "Partial Match"
    WEAK = "Weak Match"


@dataclass
class SkillEntry:
    name: str        # normalized (lowercase, aliased)
    raw: str         # original text
    level: int       # 1–5
    qualifier: Optional[str] = None


@dataclass
class SkillRequirement:
    name: str
    level: int       # required proficiency 1–5
    is_required: bool = True
    raw: str = ""


@dataclass
class WorkExperience:
    company: str
    role: str
    duration: str
    description: str


@dataclass
class CandidateData:
    id: str
    name: str
    current_position: str
    current_title: Optional[str]
    years_of_experience: float   # -1.0 means unknown
    engineer_type: str
    gen_ai_experience: Optional[str]
    parsed_skills: str
    parsed_summary: str
    parsed_work_experience_raw: str
    parsed_work_experience_text: str  # flattened plain text
    work_experiences: list[WorkExperience]
    extracted_skills: list[SkillEntry]
    most_recent_company: Optional[str]
    notice_period: Optional[str]
    is_actively_looking: Optional[bool]
    flags: list[str] = field(default_factory=list)
    penalties: list[float] = field(default_factory=list)


@dataclass
class JDRequirements:
    id: str
    title: str
    engineer_type: Optional[str]  # None = unknown → skip type filter
    min_years: float              # 0.0 = not specified
    required_skills: list[SkillRequirement]
    preferred_skills: list[SkillRequirement]
    responsibilities: list[str]
    raw_text: str
    full_text: str


@dataclass
class SkillMatchDetail:
    skill: str
    candidate_level: int
    required_level: int
    score: float
    status: str   # "met", "exceeded", "below_level", "missing", "inferred"


@dataclass
class ScoreBreakdown:
    skill_score: float
    semantic_score: float
    position_score: float
    special_score: float
    final_score: float
    penalties_applied: list[dict]
    matched_skills: list[SkillMatchDetail]
    below_level_skills: list[SkillMatchDetail]
    missing_skills: list[str]


@dataclass
class MatchResult:
    candidate_id: str
    candidate_name: str
    current_position: str
    years_of_experience: float
    engineer_type: str
    final_score: float
    tier: MatchTier
    score_breakdown: ScoreBreakdown
    flags: list[str]
    notice_period: Optional[str]
    most_recent_company: Optional[str]
    rank: int = 0