ADOS-2 scoring step in the indicators cycle, run after the document import commits; EEG analysis ordered before the relation steps

This commit is contained in:
ulises
2026-11-22 22:01:50 -06:00
parent 430d165594
commit eb88cb7eb0
10 changed files with 139 additions and 9 deletions
+15
View File
@@ -4,6 +4,8 @@ ADOS-2 association fitted on what it left.
`EEG_ANALYSIS_CLUSTER` says where the batch runs: `auto` (the default: the scheduler in `DASK_SCHEDULER_ADDRESS` if
set, otherwise a local cluster), `local`, `remote`, `sync` (in the cycle's own process), or `off`, which leaves the
analysis out of the cycle (`python -m models tea analyze` and `POST /governance/eeg/run` still run it).
`ADOS2_SCORING=off` leaves the ADOS-2 CSS and classification out of the cycle (`python -m models tea score-ados2`
still computes them).
`ADOS2_RELATION=off` leaves the association out (`python -m models tea relate-ados2` still runs it).
"""
import os
@@ -14,6 +16,7 @@ from typing import Any
CLUSTER_ENV = "EEG_ANALYSIS_CLUSTER"
CLUSTERS = ("auto", "local", "remote", "sync")
RELATION_ENV = "ADOS2_RELATION"
SCORING_ENV = "ADOS2_SCORING"
def cluster() -> str:
@@ -42,3 +45,15 @@ def live_ados2_relation(domain: str) -> Callable[[], Any] | None:
from models.ados2_relation import relate
return relate
def live_ados2_scoring(domain: str) -> Callable[[], Any] | None:
"""The domain's ADOS-2 scoring for the cycle, or none: only TEA has one, and `off` leaves it out."""
value = os.environ.get(SCORING_ENV, "on")
if value not in ("on", "off"):
raise ValueError(f"{SCORING_ENV} must be on or off, not {value!r}")
if domain != "tea" or value == "off":
return None
from models.ados2_scoring import score_pending
return score_pending