feat(normalizer): overrides loader + xlsx/csv writers

Recovered from an entangled commit: these files were correct but had been
bundled into an unrelated reader-dashboard commit by a concurrent session.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-25 14:39:28 +02:00
parent 366b484815
commit ff1a7c07f1
3 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
"""Load human-supplied corrections. Missing files are not an error."""
import csv
from pathlib import Path
def load_overrides(dates_path: Path, names_path: Path):
date_overrides: dict[str, tuple[str, str]] = {}
name_overrides: dict[str, str] = {}
if Path(dates_path).exists():
with open(dates_path, encoding="utf-8", newline="") as f:
for row in csv.DictReader(f):
raw = (row.get("raw") or "").strip()
if raw:
date_overrides[raw] = ((row.get("iso") or "").strip(), (row.get("precision") or "UNKNOWN").strip())
if Path(names_path).exists():
with open(names_path, encoding="utf-8", newline="") as f:
for row in csv.DictReader(f):
raw = (row.get("raw") or "").strip()
if raw:
name_overrides[raw] = (row.get("person_id") or "").strip()
return date_overrides, name_overrides