Cleanup of the TEA parity work: no prose in code, no hacks, everything in its place

1. No prose in code
- Remove parity-added comments and docstrings from TEA jobs, analysis and
  scoring helpers, execution, definitions, and tests. Keep base prose and
  Ruff and type-checker directives.

2. No hacks, no glued code
- Delegate both association cohort queries to persistance.eeg. Keep the
  predictor mapping and DataFrame shaping in the job, sharing biomarker
  codes and EEG study IDs with Core. Preserve column names and order, row
  selection, score filtering, and earliest fitting study.
- Use the existing MODELS registry for curve scoring in place of CURVES.
  Keep GOLD because the generic score job reads it.
- Catch lookup, database, and validation failures when loading a preview
  pipeline, preserving the existing warning. Keep execution-boundary
  exception handling for submitted tasks, telemetry and shutdown.
- Name the association test for the missing-champion case. Preserve its
  assertion and the other test assertions.

3. Everything in its place
- Keep SQL in Persistance, cohort shaping in models, and tests in their
  existing testpaths. Keep the association fits together with their
  shared design and result machinery.
This commit is contained in:
2026-11-30 13:39:51 -06:00
parent a818847b99
commit d8445fcabf
13 changed files with 60 additions and 217 deletions
+3 -4
View File
@@ -1,9 +1,9 @@
"""Analyse a single study and its optional report without persisting the results."""
import math
from dataclasses import replace
from datetime import date
from sqlalchemy.exc import SQLAlchemyError
from core import concept_map, tea
from core.pipeline import apply_patterns
from core.tea import ados2 as scoring
@@ -32,7 +32,6 @@ def _deviations(models: dict, study: analysis.Analysis) -> dict:
if part != "value"
}
if "value" in scenario.parts and "value" not in baseline:
# A missing value short-circuits curves.score, while the sites still get scored.
models[name] = baseline | {"value": {}}
changes["value"] = None
missing_values.add(metric.code)
@@ -124,7 +123,7 @@ def _report(
try:
saved = config_log.get(pipeline)
except Exception: # noqa: BLE001 -- an unavailable saved pipeline is reported in the result
except (LookupError, SQLAlchemyError, ValueError):
saved = None
if saved is None:
warnings.append(f"no saved pipeline {pipeline}: the ADOS-2 report is not read")