Add governance and TEA preview REST endpoints

Use the models router for curves and training inputs, the EEG router for summary, and a separate preview router. Keep the preview result typed with the existing persistence model and declare multipart binary schemas for generated Blob parameters.
This commit is contained in:
2026-11-29 19:44:45 -06:00
parent 9e5aa20092
commit 80b3d23b75
6 changed files with 274 additions and 7 deletions
+8
View File
@@ -345,11 +345,19 @@ def test_tea_from_the_hospital_to_indicators(api, scored_hospital, monkeypatch):
expected = summary["body"]
assert (len(listed), sum(e["analysed"] for e in listed), sum(bool(e["valid"]) for e in listed)
) == (expected["eegs"], expected["analysed"], expected["valid"]) # fmt: skip
actual_summary = ok(api.get("/tea/eegs/summary"))
assert actual_summary == {
key: count for key, count in expected.items() if key not in ("fhir_eegs", "fhir_metrics")
}
one = next(e for e in listed if e["valid"])
shown = ok(api.get(f"/tea/eegs/{one['id']}"))
assert shown["valid"] and shown["metrics"] and all(m["value"] is not None
for m in shown["metrics"]) # fmt: skip
assert shown["checks"] and shown["regions"]
curve = ok(api.get("/models/tea/eeg-posterior-rhythm/versions/1/curve"))
assert [row["age_months"] for row in curve] == list(range(16, 37))
_preview_matches_the_analysis_and_leaves_bronze_unchanged(scored_hospital, monkeypatch)
_reanalysis_by_id_in_local_mode_matches_sync(api, scored_hospital)
_cancel_during_analysis_leaves_bronze_and_gold_untouched(api, scored_hospital)