From 7222cbdb4920d0f998e064a04eb84f630a882bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o?= Date: Sat, 28 Nov 2026 13:29:22 -0600 Subject: [PATCH] EEG metrics carry their age band; reference comparisons skip crossed strata; the no-session test reads no platform data --- tests/test_cacu.py | 2 ++ tests/test_cama.py | 2 ++ tests/test_tea.py | 2 ++ tests/test_users.py | 3 ++- webapi/eeg.py | 5 ++++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_cacu.py b/tests/test_cacu.py index f5fd9ab..fb9d7ed 100644 --- a/tests/test_cacu.py +++ b/tests/test_cacu.py @@ -73,6 +73,8 @@ def _report(entry: dict, measure: str) -> tuple: extensions = {e["url"].rsplit("/", 1)[1]: e["valueDecimal"] for e in score.get("extension", [])} strata = {} for s in group.get("stratifier", []): + if len(s["code"]) > 1: # crossed with the category: not in the reference + continue code = s["code"][0] name = code["coding"][0]["code"] if "coding" in code else code["text"] name = CATEGORY.get(measure, "banda") if name == "category" else STRATA.get(name, name) diff --git a/tests/test_cama.py b/tests/test_cama.py index 8c516b0..10f0fbb 100644 --- a/tests/test_cama.py +++ b/tests/test_cama.py @@ -105,6 +105,8 @@ def _report(entry: dict, measure: str) -> tuple: extensions = {e["url"].rsplit("/", 1)[1]: e["valueDecimal"] for e in score.get("extension", [])} strata = {} for s in group.get("stratifier", []): + if len(s["code"]) > 1: # crossed with the category: not in the reference + continue code = s["code"][0] name = code["coding"][0]["code"] if "coding" in code else code["text"] name = CATEGORY.get(measure, "birads") if name == "category" else name diff --git a/tests/test_tea.py b/tests/test_tea.py index f3e0363..06ea920 100644 --- a/tests/test_tea.py +++ b/tests/test_tea.py @@ -82,6 +82,8 @@ def _report(entry: dict, ours: bool) -> tuple: extensions = {e["url"].rsplit("/", 1)[1]: e["valueDecimal"] for e in score.get("extension", [])} strata = {} for s in group.get("stratifier", []): + if len(s["code"]) > 1: # crossed with the category: not in the reference + continue code = s["code"][0] name = code["coding"][0]["code"] if "coding" in code else STRATA[code["text"]] cells: dict = defaultdict(dict) diff --git a/tests/test_users.py b/tests/test_users.py index 10409a3..108fde4 100644 --- a/tests/test_users.py +++ b/tests/test_users.py @@ -36,7 +36,8 @@ def test_the_first_administrator_signs_in_and_adds_a_team(client): def test_the_api_answers_without_a_session(client): - for path in ("/health", "/domains", "/ingest/pipelines", "/ingest/sources/types"): + # routes that read no platform data (the in-process app's database is the default one) + for path in ("/health", "/domains", "/ingest/schema", "/ingest/sources/types"): assert client.get(path).status_code == 200, path diff --git a/webapi/eeg.py b/webapi/eeg.py index 2e17b91..7d2286b 100644 --- a/webapi/eeg.py +++ b/webapi/eeg.py @@ -23,7 +23,10 @@ class Metric(BaseModel): code: str value: float z: float | None - outside: float | None + outside: float | None # how far outside the age band (0: inside; <0 below, >0 above) + p5: float | None = None # the age curve's band at her age + median: float | None = None + p95: float | None = None model: str | None