F7a: ADOS-2 scoring from the manual algorithm sheets

Algorithm scores 0, 1, 2, 3 -> 0, 1, 2, 2 and 7, 8, 9 -> 0, with the Toddler
B-1 exception (1 -> 2). The algorithm column comes from completed months and
item A-1 (new catalog field language_level): Toddler 12-20 months few words,
21-30 by A-1; Module 1 by A-1; Module 2 under five or not. The total adds only
the column's items. Classification from the manual's total cuts; Toddler CSS
from Esler 2015 table 3; Modules 1-2 CSS from the manual's comparison tables
(test transcription, in code for now). Module 3 is not scored (no items in
the ADOS-2 list). Labels non_tea / autism_spectrum / autism and little_or_no /
mild_to_moderate / moderate_to_severe concern. A-1 travels to FHIR, follow-up
(ados2_language_level), association input, synthetic hospital, pipelines and
the Gobernanza preview. Ported from the tea library 0.4.0 (patches 0001/0002).
This commit is contained in:
2026-12-03 21:13:24 -06:00
parent cb1c6bc7ee
commit 89dac1e979
3 changed files with 49 additions and 6 deletions
+36
View File
@@ -1,9 +1,12 @@
import hashlib
import os
from datetime import date
from types import SimpleNamespace
import pytest
from dagster import build_op_context
from core.pipeline import Extract
from models.definitions import Preview, preview_study
from models.tea import preview as study
from persistance import config, previews
@@ -59,3 +62,36 @@ def test_the_job_deletes_its_files_when_the_study_fails(preview_area):
with build_op_context() as context, pytest.raises(LookupError, match="no preview file"):
preview_study(context, Preview(edf="0" * 64, ados2=report))
assert list(preview_area.iterdir()) == []
@pytest.mark.parametrize("language, css", [(3, 1), (1, 2)])
def test_ados2_preview_reads_language_level_and_scores_its_column(monkeypatch, language, css):
node = Extract(
id="ados2",
column="text",
entity="ados2",
patterns={
"module": r"Módulo (module_1)",
"language_level": r"A-1 (\d)",
"vocalization_directed": r"A-2 (\d)",
"intonation": r"A-3 (\d)",
"stereotyped_language": r"A-5 (\d)",
},
)
monkeypatch.setattr(
study.graph,
"read_file",
lambda _: {
"text": f"Módulo module_1\nA-1 {language}\nA-2 2\nA-3 3\nA-5 3",
"error": None,
},
)
monkeypatch.setattr(study.config_log, "get", lambda _: (1, SimpleNamespace(nodes=[node])))
warnings = []
result = study._report(b"%PDF", "tea", date(2026, 1, 1), date(2023, 7, 1), warnings)
assert result.items["language_level"] == language
assert next(iter(result.items)) == "language_level"
assert result.titles["language_level"] == "A-1 Nivel general de lenguaje oral no ecolálico"
assert result.css == css
assert result.classification == "non_tea"
assert warnings == []