EEG metrics carry their age band; reference comparisons skip crossed strata; the no-session test reads no platform data

This commit is contained in:
Roberto Treviño
2026-11-28 13:29:22 -06:00
parent 052fb23fab
commit 7222cbdb49
5 changed files with 12 additions and 2 deletions
+2
View File
@@ -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)
+2
View File
@@ -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
+2
View File
@@ -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)
+2 -1
View File
@@ -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
+4 -1
View File
@@ -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