Commit Graph

4 Commits

Author SHA1 Message Date
AlbertoPMDM 4956f36d80 serving (MLflow), HK1K verification command and the tea-verify DaskJob
- serving: plans and biomarkers as MLflow "models from code" (standalone
  wrapper files), code_paths = only the module's package + contracts;
  plan.json artifact and plan params; biomarker models pin plan_uri and
  plan_hash. privacy: no study codes / dates / paths, binary artifacts
  refused, baselines from fewer than 5 children refused.
- verify: python -m tea_modulo.verify hk1k lists HK1K in a worker task, runs
  the pipeline remotely (line 50 Hz), checks the remote run equals a plain
  sequential run in one task, summarizes the posterior rhythm by age group
  (groups < 5 suppressed) and writes the summary under processed/usuarios/.
  Any input prefix but raw/eeg-helsinki/ is refused.
- deploy: Dockerfile.verify (dask:1.1 + antropy, fhir.resources, meegkit,
  pytest; tea-modulo from the local checkout), .dockerignore keeping .venv,
  eeg/ and any signal or patient file out, dask-verify.yaml (own 2x4-worker
  cluster, no eeg-data PVC, keys only on workers), verify.sh.

Tests: MLflow round trips on sqlite, model loads with only its own code in
a fresh interpreter, privacy refusals, verify guards.
2026-11-18 20:24:03 -06:00
AlbertoPMDM 038836a701 pipeline: module registry, run_study, Dask runner and legacy serial executor
- Modules are looked up by name through entry points (tea_modulo.modules,
  tea_modulo.legacy_modules) and checked against their protocol.
- run_study: one EDF to one small row (key, verdict, features, plan hash,
  module versions; failures become error rows with paths removed).
- Modern batches are Dask-native: a dask.delayed graph under
  annotate(priority=-10, retries=1), run on cluster='remote'|'local'|'sync'|
  'auto'. Remote: Client(direct_to_workers=False), get_versions(check=True),
  only close(). Local: processes, 1 thread, BLAS threads 1, closed by us.
- Legacy batches: tea_modulo.legacy.executor.run_serial, a plain loop.
- storage.local_copy fetches s3:// objects to a temp file inside the task.

Tests: legacy loop, Dask sync and a 2-worker LocalCluster give the same
table; error rows; positive priority refused; remote never shut down.
2026-11-18 20:18:07 -06:00
AlbertoPMDM 25dd95a8ad legacy.validation: director's validation behind the Validator protocol
The director's scripts (biomarcadores-tea/preproceso @ 7dfc641) are vendored
unchanged except imports by tools/vendor_legacy.py, one copy per legacy
module; --check re-derives them from the pinned submodule.

LegacyValidation runs steps 1-4 of un_estudio.procesar for an EDF
(edf_convert, lote.excluidos_para_qc + qc_estudio + veredicto, triaje.triar,
60% clean windows) plus preproceso.MIN_CUERO, and returns an R4B FHIR Bundle
and 0/1. Tests: identical to the submodule on a synthetic EDF, contract
suite, not-valid case, vendor check.
2026-11-18 20:00:46 -06:00
AlbertoPMDM 449acf8b44 contracts: shared data classes, protocols and contract test suites
Step 1 of the tea_modulo plan: Recording (MNE Raw from EDF), ValidationSummary,
Preprocessed, Labels, Study, the Validator/Preprocessor/Process/Biomarker
protocols with check_module(), reusable contract suites in contracts.testing,
and an AST test that enforces the module boundary rule.
2026-11-18 19:54:15 -06:00