Compare commits

..

1 Commits

Author SHA1 Message Date
Angel Capetillo Zavala fee6a6622d CaMa: account for provisional measure in integration test 2026-12-01 12:27:18 -06:00
+4 -2
View File
@@ -30,6 +30,7 @@ PIPELINE = ROOT / "tests" / "fixtures" / "pipelines" / "hospital_cama.json"
CAPTURED_ON = "2026-11-26" # the day of the capture's load: durations counted to it CAPTURED_ON = "2026-11-26" # the day of the capture's load: durations counted to it
TRAINED_ON = "2026-11-24" # survival's follow-up ended the day the reference was trained TRAINED_ON = "2026-11-24" # survival's follow-up ended the day the reference was trained
PERIODS = [f"{y}-S{s}" for y in range(2021, 2027) for s in (1, 2)] PERIODS = [f"{y}-S{s}" for y in range(2021, 2027) for s in (1, 2)]
NEW = {"CAMA_DIAS_RESULTADO_BIOPSIA"} # tests/test_cama_biopsy_time.py
CODES = { # platform code -> the current platform's CODES = { # platform code -> the current platform's
**{c: f"B{c}" for c in ("0", "1", "2", "3", "4", "5", "6")}, **{c: f"B{c}" for c in ("0", "1", "2", "3", "4", "5", "6")},
"4A": "B4", "4B": "B4", "4C": "B4", "4A": "B4", "4B": "B4", "4C": "B4",
@@ -128,8 +129,9 @@ def test_cama_from_the_hospital_to_indicators(api, platform, tmp_path):
# Indicators: every measure, every semester, as the current platform answers them. # Indicators: every measure, every semester, as the current platform answers them.
reference = json.loads((REFERENCE / "indicators.json").read_text()) reference = json.loads((REFERENCE / "indicators.json").read_text())
(measures,) = pages(api, "/cama/fhir/Measure") (measures,) = pages(api, "/cama/fhir/Measure")
assert {m["resource"]["name"] for m in measures["entry"]} == set(reference) # A measure the current platform never had (not in its capture) is checked by its own tests.
for measure in [e["resource"] for e in measures["entry"]]: assert {m["resource"]["name"] for m in measures["entry"]} == set(reference) | NEW
for measure in [e["resource"] for e in measures["entry"] if e["resource"]["name"] not in NEW]:
params = {"measure": measure["id"], "reporting-period": ",".join(PERIODS), params = {"measure": measure["id"], "reporting-period": ",".join(PERIODS),
"event-cutoff": CAPTURED_ON} # fmt: skip "event-cutoff": CAPTURED_ON} # fmt: skip
found = [e for b in pages(api, "/cama/fhir/MeasureReport", params) for e in b["entry"]] found = [e for b in pages(api, "/cama/fhir/MeasureReport", params) for e in b["entry"]]