Use the models router for curves and training inputs, the EEG router for summary, and a separate preview router. Keep the preview result typed with the existing persistence model and declare multipart binary schemas for generated Blob parameters.
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.py. Wait for sensor analysis immediately after ingest. Keep training and promotion before scoring and submit the pending scope to apply curves.
Use monotonic polling deadlines, check failures before success, and allow 900 seconds for the expected-failure run to reach a terminal state. Pick the first valid API study, resolve its EDF through silver, compare verdict and level exactly, and compare numeric fields and code-keyed metrics with pytest.approx.
test_runs.py: 17 passed on SQLite and Postgres
(compose test stack). test_conectar.py fails on an identity-merge count, as it does on tea/parity
without this change.