feat: Adding Diplomas section + adding an OPTIONNAL tag_stuffing invisible section for ATS bamboozling

This commit is contained in:
gauvainboiche
2026-07-25 15:15:02 +02:00
parent 577d2af30f
commit 0d34fcafc1
8 changed files with 161 additions and 79 deletions
+27 -5
View File
@@ -1,21 +1,44 @@
import json
import sys
from datetime import datetime
from pathlib import Path
from loader import load_json_data
from pdf_builder import generate_pdf
def get_tags() -> str:
"""Récupère les tags ATS ou interagit avec l'utilisateur si absent."""
tag_file = Path(__file__).parent / "data" / "tag_stuff.json"
if not tag_file.exists():
print("\n⚠️ [ATTENTION] Le fichier 'data/tag_stuff.json' est introuvable.")
print("Il est utilisé pour le tag stuffing (IA/ATS).")
choice = input("Voulez-vous poursuivre la génération SANS le tag stuffing ? (o/N) : ").strip().lower()
if choice not in ['o', 'oui']:
print("Génération annulée par l'utilisateur.")
sys.exit(0)
return ""
try:
with open(tag_file, "r", encoding="utf-8") as f:
content = json.load(f)
return content.get("tags", "")
except Exception as e:
print(f"❌ Erreur lors de la lecture de tag_stuff.json : {e}")
sys.exit(1)
def main():
# 1. Chargement et validation des données JSON
try:
data = load_json_data()
except Exception as e:
print(f"❌ Erreur lors du chargement des données : {e}")
return
# Vérification et récupération des tags
tags = get_tags()
# 2. Préparation du dossier de sortie
export_dir = Path(__file__).parent / "exports"
export_dir.mkdir(exist_ok=True)
# 3. Formatage du nom de fichier
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
title_raw = data.get("context", {}).get("title", "CV")
title_clean = "".join(c if c.isalnum() else "_" for c in title_raw)
@@ -23,8 +46,7 @@ def main():
filename = f"{timestamp}_{title_clean}.pdf"
output_path = export_dir / filename
# 4. Génération du PDF
generate_pdf(data, str(output_path))
generate_pdf(data, tags, str(output_path))
if __name__ == "__main__":
main()