QuentinL52 commited on
Commit
fc1fade
·
verified ·
1 Parent(s): fb8d0c2

Update src/services/cv_service.py

Browse files
Files changed (1) hide show
  1. src/services/cv_service.py +9 -29
src/services/cv_service.py CHANGED
@@ -19,38 +19,18 @@ class CVParsingService:
19
  if not cv_text or not cv_text.strip():
20
  return self._create_fallback_data()
21
 
 
22
  sections = self.orchestrator.split_cv_sections(cv_text)
 
23
  cv_data = self.orchestrator.extract_all_sections(sections)
24
-
25
  if cv_data and cv_data.get("candidat"):
 
26
  scores = self.scoring_agent.calculate_scores(cv_data["candidat"])
27
  cv_data["candidat"].update(scores)
 
 
 
 
28
 
29
- return cv_data
30
-
31
- def _create_fallback_data(self) -> Dict[str, Any]:
32
- return {
33
- "candidat": {
34
- "informations_personnelles": {
35
- "nom": "Non spécifié",
36
- "email": "Non spécifié",
37
- "numero_de_telephone": "Non spécifié",
38
- "localisation": "Non spécifiée"
39
- },
40
- "compétences": {
41
- "hard_skills": [],
42
- "soft_skills": []
43
- },
44
- "expériences": [],
45
- "projets": {
46
- "professional": [],
47
- "personal": []
48
- },
49
- "formations": [],
50
- "reconversion": {
51
- "is_reconversion": False,
52
- "analysis": "Analyse non disponible"
53
- },
54
- "analyse_competences": []
55
- }
56
- }
 
19
  if not cv_text or not cv_text.strip():
20
  return self._create_fallback_data()
21
 
22
+ logger.info(f"CV text loaded: {len(cv_text)} characters")
23
  sections = self.orchestrator.split_cv_sections(cv_text)
24
+ logger.info(f"Sections extracted: {list(sections.keys())}")
25
  cv_data = self.orchestrator.extract_all_sections(sections)
26
+ logger.info(f"CV data extracted: {cv_data is not None}")
27
  if cv_data and cv_data.get("candidat"):
28
+ logger.info("Calculating scores...")
29
  scores = self.scoring_agent.calculate_scores(cv_data["candidat"])
30
  cv_data["candidat"].update(scores)
31
+ logger.info(f"Scores calculated: {len(scores.get('analyse_competences', []))} skills scored")
32
+ else:
33
+ logger.warning("No valid CV data extracted, using fallback")
34
+ return self._create_fallback_data()
35
 
36
+ return cv_data