TEA gate: ADOS-2 is scored by the algorithm sheets, Module 1 only with A-1

This commit is contained in:
Roberto Treviño
2026-12-06 01:47:24 -06:00
parent c8472c705e
commit 2a28e8fc50
+7 -6
View File
@@ -55,8 +55,6 @@ ITEMS = {
"repetitive_interests": {"module_1": "rrb_d4", "module_2": "rrb_d4"},
} # fmt: skip
MODULES = {"MODULO_1": "module_1", "MODULO_2": "module_2"}
CLASSIFICATION = {"NO_ESPECTRO": "non_spectrum", "ESPECTRO_AUTISTA": "autism_spectrum",
"AUTISMO": "autism"} # fmt: skip
METRICS = {"RITMO_POSTERIOR": "posterior_rhythm", "HUSOS_SUENO_N2": "spindles_n2",
"HUSOS_SUENO_N3": "spindles_n3", "PICOS_PAROXISTICOS": "paroxysmal_spikes",
"GRADIENTE_ANTEROPOSTERIOR": "anteroposterior_gradient"} # fmt: skip
@@ -177,11 +175,14 @@ def test_tea_from_the_hospital_to_indicators(api, platform, tmp_path):
for item, by_module in ITEMS.items():
value = theirs["ado_" + by_module[module]] if module in by_module else None
assert row[item] == (None if value is None else pytest.approx(value)), item
# and their scores: the calibrated severity and the classification.
# Their scores are the algorithm sheets' (Phase 7), not the current platform's sum of
# every item: Module 1 picks its column by A-1, which these reports don't print, so it
# is not scored; the Toddler Module picks it by age up to 20 months.
birth = q(f"select birth_date from silver.person where person_id = '{row['person_id']}'")
css, label = ados2.score({**row, "evaluation_date": _day(row["evaluation_date"])},
_day(birth[0][0])) # fmt: skip
assert (css, label) == (theirs["ado_css"], CLASSIFICATION[theirs["ado_clasificacion"]])
born, evaluated = _day(birth[0][0]), _day(row["evaluation_date"])
scored = ados2.score({**row, "evaluation_date": evaluated}, born)
column = ados2.algorithm_column(module, ados2.months_old(evaluated, born), None)
assert (scored is None) == (column is None), row["person_id"]
# The EEG analysis: every signal's verdict, level and metrics are the current platform's.
wait_for(api, ok(api.post("/models/tea/analyze"))["run_id"], 1800)