Files
Support-Agent/labeling/auto/revue-croisee/2026-11-04/carte/outils/controle_carte.py
T
maximeandClaude Opus 5.5 35b5ed4d74 Auto labels reviewed per station and cross-reviewed; all labeling knowledge in labeling/ (D-130)
- Every station's auto labels reviewed by an analyst (/review-auto-labels), then a
  cross-review per family across all stations (new skill /cross-review-labels),
  a finishing pass, and descriptions rewritten in words (no numeric values).
- The three never-labeled ranges (WILDSTRUBEL 07/09-01/10, NORDEND 16/08-01/10)
  labeled and reviewed: 991 auto labels on 11 stations, labeling/controle.py at 0 errors.
- Labeling knowledge gathered in labeling/: regles-d-etiquetage.md (new), familles.md
  (settled boundaries), connaissances/ (notes moved from docs/, links updated),
  the label map rebuilt from reviewed labels, events and cases; events tied to their
  stations (PS_DES_COUDRES is JUNGFRAU). The labeler and reviewers read only labeling/.
- labels-map reads auto labels and events; decision D-130; living plan points 73-75.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:21:57 +01:00

41 lines
1.8 KiB
Python

"""Contrôle de labeling/carte-des-etiquettes.md : clés, events, étiquettes de l'expert, identifiants.
python3 labeling/auto/revue-croisee/2026-11-04/carte/outils/controle_carte.py
Rend : clés citées absentes de labeling/manual/ et labeling/auto/, events cités absents de
events/INDEX.md, étiquettes revues de l'expert jamais citées, identifiants, taille.
"""
import glob
import json
import os
import re
RACINE = os.path.normpath(os.path.join(os.path.dirname(__file__), *[".."] * 6))
CLE = r"[A-Z][A-Z0-9_]{3,} \d\d\.\d\d \d\d:\d\d"
def cle(station, debut):
return f"{station} {debut[8:10]}.{debut[5:7]} {debut[11:16]}"
connues, expert = set(), set()
for chemin in glob.glob(f"{RACINE}/labeling/manual/*.jsonl") + glob.glob(f"{RACINE}/labeling/auto/*.jsonl"):
station = os.path.basename(chemin)[: -len(".jsonl")]
for ligne in open(chemin, encoding="utf-8"):
e = json.loads(ligne)
connues.add(cle(station, e["debut"]))
if "/manual/" in chemin and "revue" in e:
expert.add(cle(station, e["debut"]))
carte = open(f"{RACINE}/labeling/carte-des-etiquettes.md", encoding="utf-8").read()
index = open(f"{RACINE}/events/INDEX.md", encoding="utf-8").read()
citees = set(re.findall(CLE, carte))
events = set(re.findall(r"E-\d{3}", carte))
print("Clés inconnues :", sorted(citees - connues) or "aucune")
print("Events inconnus :", sorted(e for e in events if f"[{e}]" not in index) or "aucun")
print("Étiquettes de l'expert non citées :", sorted(expert - citees) or "aucune")
print("Identifiants :", re.findall(r"SIM_CCID|\bip(?:_\w+)?\b|\d+\.\d+\.\d+\.\d+", carte) or "aucun")
print(f"{len(citees)} clés, {len(events)} events, {len(carte.encode())} octets, {len(carte.splitlines())} lignes")
assert re.findall(CLE, "x [NORDEND 03.09 18:01] y") == ["NORDEND 03.09 18:01"]