A domain maps its own studies to FHIR; TEA's served resources pass the validator
This commit is contained in:
+12
-1
@@ -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 == []
|
||||
|
||||
Reference in New Issue
Block a user