A domain maps its own studies to FHIR; TEA's served resources pass the validator

This commit is contained in:
Roberto Treviño
2026-12-06 04:00:35 -06:00
parent 4ce3a165ad
commit 0f1c59a35f
2 changed files with 17 additions and 1 deletions
+12 -1
View File
@@ -16,7 +16,7 @@ from datetime import date
from pathlib import Path
import pytest
from fhir_checks import pages
from fhir_checks import pages, served, validate
from sqlalchemy import inspect
from test_conectar import ok, wait_for
@@ -276,3 +276,14 @@ def test_tea_from_the_hospital_to_indicators(api, platform, tmp_path):
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
# Every resource TEA serves passes the HL7 validator: her ADOS-2 (CSS and classification
# from its items) and her EEG's report with its checks and metrics among them.
children = [one["person_id"], *(e["person_id"] for e in listed if not e["valid"])][:5]
resources = served(api, "/tea/fhir", PERIODS, children)
entries = [e["resource"] for b in resources for e in b.get("entry", [])]
codes = {(r["resourceType"], r["code"]["coding"][0]["code"]) for r in entries if "code" in r}
assert {("Observation", "ados2"), ("DiagnosticReport", "eeg")} <= codes
errors, warnings = validate(resources, tmp_path)
print(f"HL7 validator: {len(warnings)} warnings")
assert errors == []