@@ -59,6 +59,7 @@ class Location(BaseModel):
5959 state : str | None = None
6060 country : str | None = None
6161
62+
6263class ContactLinks (BaseModel ):
6364 telegram : str | None = None
6465 linkedin : str | None = None
@@ -89,19 +90,19 @@ class PersonalInfo(BaseModel):
8990 contact : Contact
9091 demographics : Demographics | None = None
9192
92- @model_validator (mode = ' before' )
93+ @model_validator (mode = " before" )
9394 @classmethod
9495 def accept_legacy_demographics (cls , v : dict ):
95- if isinstance (v , dict ) and (' current_location' in v or ' work_authorization' in v ):
96- demo = v .get (' demographics' ) or {}
97- if ' current_location' in v and ' current_location' not in demo :
98- demo [' current_location' ] = v .pop (' current_location' )
99- if ' work_authorization' in v and ' work_authorization' not in demo :
100- demo [' work_authorization' ] = v .pop (' work_authorization' )
101- v [' demographics' ] = demo
102- if isinstance (v , dict ) and ' links' in v .get (' contact' , {}):
103- links = v [' contact' ].pop (' links' )
104- v [' contact' ][ ' links' ] = links
96+ if isinstance (v , dict ) and (" current_location" in v or " work_authorization" in v ):
97+ demo = v .get (" demographics" ) or {}
98+ if " current_location" in v and " current_location" not in demo :
99+ demo [" current_location" ] = v .pop (" current_location" )
100+ if " work_authorization" in v and " work_authorization" not in demo :
101+ demo [" work_authorization" ] = v .pop (" work_authorization" )
102+ v [" demographics" ] = demo
103+ if isinstance (v , dict ) and " links" in v .get (" contact" , {}):
104+ links = v [" contact" ].pop (" links" )
105+ v [" contact" ][ " links" ] = links
105106 return v
106107
107108
@@ -111,6 +112,7 @@ class JobPreferences(BaseModel):
111112 work_modes : list [WorkMode ] = Field (default_factory = list )
112113 salary : str | None = None
113114
115+
114116class CompanyInfo (BaseModel ):
115117 name : str
116118 url : str | None = None
@@ -145,24 +147,24 @@ class EmploymentHistoryItem(BaseModel):
145147 key_points : list [KeyPoint ] = Field (default_factory = list )
146148 technologies : list [Technology ] = Field (default_factory = list )
147149
148- @model_validator (mode = ' before' )
150+ @model_validator (mode = " before" )
149151 @classmethod
150152 def accept_legacy_employment (cls , v : dict ):
151- if ' company' in v and isinstance (v [' company' ], str ):
152- v [' company' ] = {"name" : v [' company' ]}
153- if ' tech_stack' in v and ' technologies' not in v :
154- v [' technologies' ] = v .pop (' tech_stack' )
155- if ' start_date' in v or ' end_date' in v or ' date_format' in v or ' duration_months' in v :
156- v [' duration' ] = {
157- ' date_format' : v .pop (' date_format' , ' MM.YYYY' ),
158- ' start' : v .pop (' start_date' , '' ),
159- ' end' : v .pop (' end_date' , '' ),
160- ' duration_months' : v .pop (' duration_months' , 0 ),
153+ if " company" in v and isinstance (v [" company" ], str ):
154+ v [" company" ] = {"name" : v [" company" ]}
155+ if " tech_stack" in v and " technologies" not in v :
156+ v [" technologies" ] = v .pop (" tech_stack" )
157+ if " start_date" in v or " end_date" in v or " date_format" in v or " duration_months" in v :
158+ v [" duration" ] = {
159+ " date_format" : v .pop (" date_format" , " MM.YYYY" ),
160+ " start" : v .pop (" start_date" , "" ),
161+ " end" : v .pop (" end_date" , "" ),
162+ " duration_months" : v .pop (" duration_months" , 0 ),
161163 }
162- if ' key_points' in v :
163- v [' key_points' ] = [kp if isinstance (kp , dict ) else {' text' : kp } for kp in v [' key_points' ]]
164- if ' technologies' in v :
165- v [' technologies' ] = [t if isinstance (t , dict ) else {' name' : t } for t in v [' technologies' ]]
164+ if " key_points" in v :
165+ v [" key_points" ] = [kp if isinstance (kp , dict ) else {" text" : kp } for kp in v [" key_points" ]]
166+ if " technologies" in v :
167+ v [" technologies" ] = [t if isinstance (t , dict ) else {" name" : t } for t in v [" technologies" ]]
166168 return v
167169
168170
@@ -172,15 +174,15 @@ class Project(BaseModel):
172174 technologies : list [Technology ] = Field (default_factory = list )
173175 key_points : list [KeyPoint ] = Field (default_factory = list )
174176
175- @model_validator (mode = ' before' )
177+ @model_validator (mode = " before" )
176178 @classmethod
177179 def accept_legacy_project (cls , v : dict ):
178- if ' tech_stack' in v and ' technologies' not in v :
179- v [' technologies' ] = v .pop (' tech_stack' )
180- if ' technologies' in v :
181- v [' technologies' ] = [t if isinstance (t , dict ) else {' name' : t } for t in v [' technologies' ]]
182- if ' key_points' in v :
183- v [' key_points' ] = [kp if isinstance (kp , dict ) else {' text' : kp } for kp in v [' key_points' ]]
180+ if " tech_stack" in v and " technologies" not in v :
181+ v [" technologies" ] = v .pop (" tech_stack" )
182+ if " technologies" in v :
183+ v [" technologies" ] = [t if isinstance (t , dict ) else {" name" : t } for t in v [" technologies" ]]
184+ if " key_points" in v :
185+ v [" key_points" ] = [kp if isinstance (kp , dict ) else {" text" : kp } for kp in v [" key_points" ]]
184186 return v
185187
186188
@@ -207,19 +209,19 @@ class EducationItem(BaseModel):
207209 coursework : list [Coursework ] = Field (default_factory = list )
208210 extras : list [EducationExtra ] = Field (default_factory = list )
209211
210- @model_validator (mode = ' before' )
212+ @model_validator (mode = " before" )
211213 @classmethod
212214 def accept_legacy_education (cls , v : dict ):
213- if ' institution' in v and isinstance (v [' institution' ], str ):
214- v [' institution' ] = {' name' : v [' institution' ]}
215- if ' start_date' in v and ' start' not in v :
216- v [' start' ] = v .pop (' start_date' )
217- if ' end_date' in v and ' end' not in v :
218- v [' end' ] = v .pop (' end_date' )
219- if ' coursework' in v :
220- v [' coursework' ] = [c if isinstance (c , dict ) else {' text' : c } for c in v [' coursework' ]]
221- if ' extras' in v :
222- v [' extras' ] = [e if isinstance (e , dict ) else {' text' : e } for e in v [' extras' ]]
215+ if " institution" in v and isinstance (v [" institution" ], str ):
216+ v [" institution" ] = {" name" : v [" institution" ]}
217+ if " start_date" in v and " start" not in v :
218+ v [" start" ] = v .pop (" start_date" )
219+ if " end_date" in v and " end" not in v :
220+ v [" end" ] = v .pop (" end_date" )
221+ if " coursework" in v :
222+ v [" coursework" ] = [c if isinstance (c , dict ) else {" text" : c } for c in v [" coursework" ]]
223+ if " extras" in v :
224+ v [" extras" ] = [e if isinstance (e , dict ) else {" text" : e } for e in v [" extras" ]]
223225 return v
224226
225227
@@ -247,11 +249,11 @@ class LanguageProficiency(BaseModel):
247249 self_assessed : str
248250 cefr : str
249251
250- @model_validator (mode = ' before' )
252+ @model_validator (mode = " before" )
251253 @classmethod
252254 def accept_legacy_language (cls , v : dict ):
253- if isinstance (v , dict ) and isinstance (v .get (' language' ), str ):
254- v [' language' ] = {' name' : v [' language' ]}
255+ if isinstance (v , dict ) and isinstance (v .get (" language" ), str ):
256+ v [" language" ] = {" name" : v [" language" ]}
255257 return v
256258
257259
@@ -301,16 +303,16 @@ class Resume(BaseModel):
301303 awards : list [Award ] = Field (default_factory = list )
302304 scientific_contributions : list [ScientificContribution ] = Field (default_factory = list )
303305
304- @model_validator (mode = ' before' )
306+ @model_validator (mode = " before" )
305307 @classmethod
306308 def accept_legacy_profile (cls , v : dict ):
307- if ' professional_profile' not in v and (' summary' in v or ' preferences' in v ):
308- v [' professional_profile' ] = {
309- ' summary' : v .pop (' summary' , None ),
310- ' preferences' : v .pop (' preferences' , None ),
309+ if " professional_profile" not in v and (" summary" in v or " preferences" in v ):
310+ v [" professional_profile" ] = {
311+ " summary" : v .pop (" summary" , None ),
312+ " preferences" : v .pop (" preferences" , None ),
311313 }
312- if ' skills' in v :
313- v [' skills' ] = [s if isinstance (s , dict ) else {' name' : s } for s in v [' skills' ]]
314+ if " skills" in v :
315+ v [" skills" ] = [s if isinstance (s , dict ) else {" name" : s } for s in v [" skills" ]]
314316 return v
315317
316318 def years_of_experience (self ) -> float :
0 commit comments