core.tea no longer has module-independent SA/RRB lists: the preview parses
all ADOS2_ITEMS and the scoring takes each module's own items from
core.tea.ados2_items.
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.
Share log-age interpolation with scoring and preserve nulls outside coverage. Use a synthetic geometric midpoint and values on both sides of the median to check numeric parity.
Port the association estimator and add its source-parity tests in models.
Wire cohort selection, fingerprint deduplication, MLflow registration, and
champion scoring into the TEA jobs. Add both bronze tables, gold models
and key tests, and extend the existing WebApi hospital gate.
Follow the spec's resolved silver/bronze cohort and full CSV fingerprint.
No adaptations beyond the resolved spec. Preserve the source numerical
code with Ruff formatting and reflowed docstrings.
Internal choices:
- Select the first ADOS-2 with a SQL window and assemble predictor columns
by EDF in pandas. Normalize dates to days across SQLite and PostgreSQL
and use the undated CSS path if evaluation date is absent.
- Treat unstaged analysis or score tables as empty inputs. Retain the
existing as_of argument without a cutoff in the specified cohort.
- Keep missing and non-finite report and bronze values as null, including
open confidence limits. Store counts as bigint and direction as boolean.
Reuse the EEG bronze merge writer after deleting the prior projection.
- Use a NumPy default_rng seeded with 0, uniform ages, normal predictors,
and independent draws of module, item codes, and CSS for source parity.
Load the reference modules in a test-only namespace with stub contracts.
- Record model and WebApi changes in their existing submodule branches
and update the corresponding gitlinks in the parent commit.
Checks: Ruff lint and format check passed. lint-imports kept both
contracts. The association unit suite passed all five tests. Eight
lightweight TEA job tests passed, with two integration tests deselected.
SQLite smoke checks passed for cohort, registration and deduplication, promotion,
prediction, bronze writes, and both dbt models and their four key tests.
Fixture replay matched the 15 published pairs and 470 published scores.
The full hospital API gate runs on the test machines.
Update tests/test_tea_job.py. Use the synthetic TEA builder with the existing pipeline and concept map, ingest via the platform fixture without a daemon, and run first_n synchronously in process.
Use SQLite and its temporary platform environment, count an absent analysis table as zero, and clear the cached engine around the in-process calls.
Analysis and the reference cohort's measuring run on execution.map; relate is the
Phase 2 seam. A LocalCluster starts inside a multiprocess Dagster step (checked on a
real run), so the ops keep the default executor.