Dejar de servir la comparación con la tabla maestra NCI

This commit is contained in:
2026-12-04 16:02:37 -06:00
parent 21b76ed95e
commit 1ba00f5c3d
+5 -34
View File
@@ -209,40 +209,11 @@ def reference_risk(
cutoff: date | None = Query(None, description="Only what was reported by this day"), cutoff: date | None = Query(None, description="Only what was reported by this day"),
sample: date | None = Query(None, description="The cytology's sample day"), sample: date | None = Query(None, description="The cytology's sample day"),
) -> Response: ) -> Response:
"""EXPERIMENTAL, off unless CACU_NCI_REFERENCE=1. The NCI/ASCCP CIN3+ reference risk of one """Disabled: the master table's provenance is not verified. The workbooks' series are in
patient's cytology by a cut-off, how it was resolved and, beside it, the institutional models' `$risk-series`."""
risks when they measure the same thing. Research only: not validated, not a recommendation.""" if domain != Domain.CACU or os.environ.get(NCI_REFERENCE) != "1":
facts, day = _reference_facts(domain, id, cutoff) raise HTTPException(404, "the NCI reference comparison is not enabled")
resolution = reference.resolve(facts, day, sample) raise HTTPException(503, "NCI master table is unavailable: its provenance is unverified")
latest: dict[str, dict] = {} # each model's latest assessment by the cut-off
for r in _risks(domain, [id], day):
index = str(r["index_date"])[:10]
if index > day.isoformat():
continue
found = latest.setdefault(
r["model"],
{
"model": r["model"],
"index_date": index,
"title": models.title(r["model"]),
"predictions": [],
},
)
if index > found["index_date"]:
found.update(index_date=index, predictions=[])
if index == found["index_date"]:
found["predictions"].append(
{
"years": int(r["horizon_years"]),
"p": r["probability"],
"low": r["ci_low"],
"high": r["ci_high"],
}
)
comparison = (
reference.compare(resolution, list(latest.values())) if resolution["horizons"] else []
)
return fhir(f.reference_risk(resolution, comparison, reference.tables()))
@router.get("/Patient/{id}/$risk-series", responses=_OK, response_class=Response) @router.get("/Patient/{id}/$risk-series", responses=_OK, response_class=Response)