No servir los riesgos ni listar los modelos ocultos
This commit is contained in:
+4
-1
@@ -32,12 +32,14 @@ from fhir_checks import follow_up, pages, served, unscored, validate
|
||||
from test_conectar import ok, wait_for
|
||||
|
||||
from conftest import put_concept_map
|
||||
from core.cacu import visibility
|
||||
|
||||
ROOT = Path(__file__).parents[2]
|
||||
HOSPITAL = ROOT / "tests" / "fixtures" / "hospital"
|
||||
REFERENCE = ROOT / "tests" / "fixtures" / "reference" / "cacu"
|
||||
PIPELINE = ROOT / "tests" / "fixtures" / "pipelines" / "hospital_cacu.json"
|
||||
REFERENCE_CUTOFF = "2026-11-23" # the current platform's cohort cut-off (follow-up ends)
|
||||
|
||||
CAPTURED_ON = "2026-11-25" # the day the indicators were captured: durations counted to it
|
||||
PERIODS = [f"{y}-S{s}" for y in range(2021, 2027) for s in (1, 2)]
|
||||
COHORTS = {
|
||||
@@ -189,7 +191,8 @@ def test_cacu_from_the_hospital_to_indicators_and_risks(api, platform, tmp_path)
|
||||
# none is promoted without the clinical validation.
|
||||
wait_for(api, ok(api.post("/models/cacu/train", json={"as_of": REFERENCE_CUTOFF}))["run_id"])
|
||||
names = [m["name"] for m in ok(api.get("/models/cacu"))]
|
||||
assert set(names) == set(current)
|
||||
# the hidden models (core.models.HIDDEN) are neither trained nor listed
|
||||
assert set(names) == {n for n in current if visibility.model(f"cacu.{n}")}
|
||||
for name in names:
|
||||
(version,) = ok(api.get(f"/models/cacu/{name}/versions"))
|
||||
assert version["reports"] == ["interpretability", "technical_validation"]
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ from fhir.resources.R4B.resource import Resource
|
||||
from core import catalog, models
|
||||
from core import fhir as f
|
||||
from core import measures as m
|
||||
from core.cacu import currency, risk_series
|
||||
from core.cacu import currency, risk_series, visibility
|
||||
from core.cacu import reference_risk as reference
|
||||
from core.domains import Domain, measures, part
|
||||
from core.follow_up import window_start
|
||||
@@ -83,7 +83,7 @@ def _risks(domain: Domain, persons: list[str], cutoff: date) -> list[dict]:
|
||||
rows = [
|
||||
r
|
||||
for r in reads.rows(domain.value, "risk", persons=persons)
|
||||
if r["model"] not in models.DEVELOPMENT
|
||||
if r["model"] not in models.DEVELOPMENT and visibility.model(r["model"])
|
||||
]
|
||||
history = _history(domain, persons)
|
||||
gone = {person: currency.withheld(found, cutoff) for person, found in history.items()}
|
||||
|
||||
+6
-1
@@ -9,6 +9,7 @@ from fastapi import APIRouter, Depends, HTTPException, UploadFile
|
||||
from fastapi.responses import Response
|
||||
from pydantic import BaseModel
|
||||
|
||||
from core.cacu import visibility
|
||||
from core.domains import Domain
|
||||
from core.models import title
|
||||
from persistance import registry
|
||||
@@ -35,7 +36,11 @@ class Model(BaseModel):
|
||||
def models(domain: Domain) -> list[Model]:
|
||||
"""The domain's registered models, with their names on screen."""
|
||||
prefix = f"{domain.value}."
|
||||
return [Model(name=n.removeprefix(prefix), title=title(n)) for n in registry.names(prefix)]
|
||||
return [
|
||||
Model(name=n.removeprefix(prefix), title=title(n))
|
||||
for n in registry.names(prefix)
|
||||
if visibility.model(n)
|
||||
]
|
||||
|
||||
|
||||
@router.get("/{domain}/{name}/versions")
|
||||
|
||||
Reference in New Issue
Block a user