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.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""The HK1K verification command refuses everything but the public HK1K prefix."""
|
||||
|
||||
import pytest
|
||||
|
||||
from tea_modulo.verify import hk1k
|
||||
|
||||
|
||||
@pytest.mark.parametrize("p", ["raw/eeg-data/eeg_001/x.edf", "processed/eeg-edf/eeg_001/eeg_001.edf",
|
||||
"raw/2021-204/a.edf", "raw/eeg-helsinki/../eeg-data/x.edf"])
|
||||
def test_guard_refuses_other_prefixes(p):
|
||||
with pytest.raises(PermissionError):
|
||||
hk1k.guard(p)
|
||||
|
||||
|
||||
def test_guard_accepts_hk1k():
|
||||
assert hk1k.guard("s3://raw/eeg-helsinki/sub-1/x.edf") == "raw/eeg-helsinki/sub-1/x.edf"
|
||||
|
||||
|
||||
def test_group_stats_suppresses_small_groups():
|
||||
assert hk1k.group_stats([1.0, 2.0, 3.0]) == {"n": 3, "suppressed": True}
|
||||
s = hk1k.group_stats([6.0, 6.5, 7.0, 7.5, 8.0])
|
||||
assert s["n"] == 5 and s["median"] == 7.0
|
||||
|
||||
|
||||
def test_summary_writes_only_to_user_area():
|
||||
with pytest.raises(PermissionError):
|
||||
hk1k.write_summary("{}", "processed/eeg-edf/", "x.json")
|
||||
Reference in New Issue
Block a user