Spaces:
Running on Zero
Running on Zero
File size: 1,648 Bytes
e01a936 | 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 | """Affiche la structure réelle du dataset opt-nc/odata-avps, sans rien modifier.
Lancer depuis la racine du projet : python -m scripts.inspecter_dataset
"""
from collections import Counter
from datetime import date
from huggingface_hub import list_repo_files
from app import config
from app.avp_store import CHAMPS_ATTENDUS, CHAMPS_PREREQUIS, est_ouvert, extraire, lire_avps
print("=== Fichiers du dataset ===")
print("\n".join(f for f in list_repo_files(config.DATASET_REPO, repo_type="dataset")
if not f.startswith("data/20"))) # l'archive data/AAAA/MM/ est masquée
avps = lire_avps()
ouverts = [a for a in avps if est_ouvert(a)]
print(f"\n=== {len(avps)} AVP, dont {len(ouverts)} ouverts au {date.today()} ===")
for a in sorted(avps, key=lambda a: str(a.get("validThrough"))):
print(f" {str(a.get('id_avp')):18s} {str(a.get('validThrough'))[:10]:10s} "
f"{'ouvert' if est_ouvert(a) else 'clos '} {a.get('title') or a.get('name')}")
print("\n=== Nombre d'attendus notés par AVP ===")
nb = [len(extraire(a, CHAMPS_ATTENDUS)) for a in avps]
print(f" min {min(nb, default=0)} · moyenne {sum(nb) / max(len(nb), 1):.0f} · max {max(nb, default=0)}")
print("\n=== Compétences les plus fréquentes (texte identique) ===")
compte = Counter(t for a in avps for t, _ in extraire(a, CHAMPS_ATTENDUS))
for texte, n in compte.most_common(10):
print(f" {n:3d} AVP {texte}")
print("\n=== Prérequis rencontrés (jamais notés) ===")
for texte, n in Counter(t for a in avps for t, _ in extraire(a, CHAMPS_PREREQUIS)).most_common(10):
print(f" {n:3d} AVP {texte}")
|