F1e: the hospital test trains the curves and the association before the page cases

This commit is contained in:
2026-12-01 14:05:40 -06:00
parent 323240dd30
commit edd3093d5d
+34
View File
@@ -11,6 +11,7 @@ from pathlib import Path
import httpx
import pytest
from models.tea.jobs import ASSOCIATION, MODELS
from synthetic import tea
ROOT = Path(__file__).parents[2]
@@ -57,6 +58,38 @@ def _sensor_run(api: httpx.Client, seconds: int = 300) -> str:
return runs[0]["id"]
def _train_tea(api: httpx.Client) -> None:
for names in (list(MODELS), [ASSOCIATION]):
training = _ok(
api.post(
"/models/tea/train",
json={
"models": names,
"source": {"kind": "site"},
},
)
)
_wait(api, training["run_id"])
for name in names:
versions = f"/models/tea/{name}/versions"
version = _ok(api.get(versions))[-1]["version"]
path = f"{versions}/{version}"
_ok(
api.post(
f"{path}/reports/clinical_validation",
files={
"file": ("synthetic-validation.txt", b"Synthetic hospital test fixture")
},
)
)
_ok(api.post(f"{path}/promote"))
assert any(
v["version"] == version and v["status"] == "champion"
for v in _ok(api.get(versions))
), name
_wait(api, _ok(api.post("/tea/eegs/analyze", json={}))["run_id"])
@contextmanager
def _platform(data: Path):
from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore
@@ -137,6 +170,7 @@ def test_the_tea_pages_load_from_the_synthetic_hospital(tmp_path):
_ok(api.put("/ingest/pipelines/tea", json=pipeline))
_wait(api, _ok(api.post("/ingest/pipelines/tea/runs", json={}))["run_id"])
_wait(api, _sensor_run(api))
_train_tea(api)
subprocess.run(
["npx", "playwright", "test"], cwd=ROOT / "WebApp", check=True,
env={**os.environ, **files, "API_URL": str(api.base_url).rstrip("/")},