Live survival: no options route
This commit is contained in:
@@ -99,7 +99,6 @@ def live_client(client, monkeypatch):
|
||||
|
||||
monkeypatch.setattr(model_analysis, "_live_context", context)
|
||||
monkeypatch.setattr(live, "curves", curves)
|
||||
monkeypatch.setattr(live, "options", lambda labelled, pac_id=None: {"n": 100, "paciente": {"grade": "G2"} if pac_id == 7 else None})
|
||||
model_analysis._ANSWERS.clear()
|
||||
client.holder = holder
|
||||
return client
|
||||
@@ -125,12 +124,3 @@ def test_a_selection_that_cannot_be_answered_is_a_422_with_the_reason(live_clien
|
||||
answer = live_client.post("/cama/modelo/curvas/consulta", json={"filtros": {"er": ["NEGATIVO"]}})
|
||||
|
||||
assert answer.status_code == 422 and "3 pacientes" in answer.get_json()["error"]
|
||||
|
||||
|
||||
def test_the_options_carry_the_patients_own_values_when_one_is_named(live_client):
|
||||
"""Pins down: `GET /cama/modelo/curvas/opciones?paciente=7` carries patient 7's values, and without it none. Fails if the
|
||||
patient parameter is ignored, which would leave the dashboard unable to offer her subgroup."""
|
||||
named = live_client.get("/cama/modelo/curvas/opciones?paciente=7").get_json()
|
||||
plain = live_client.get("/cama/modelo/curvas/opciones").get_json()
|
||||
|
||||
assert named["opciones"]["paciente"] == {"grade": "G2"} and plain["opciones"]["paciente"] is None
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""What a model's production version found about its cohort: `GET /<domain>/modelo/curvas`, `GET /<domain>/modelo/desarrollo` and, over the data ingested so far, `GET /<domain>/modelo/curvas/opciones` and `POST /<domain>/modelo/curvas/consulta`.
|
||||
"""What a model's production version found about its cohort: `GET /<domain>/modelo/curvas`, `GET /<domain>/modelo/desarrollo` and, over the data ingested so far, `POST /<domain>/modelo/curvas/consulta`.
|
||||
|
||||
The population results a training run publishes (`analisis/curvas.json`, `models.cama.survival.population`): the cohort's
|
||||
survival curves and the model's survival at each horizon with its intervals, for the dashboard to draw. They describe the
|
||||
@@ -82,20 +82,6 @@ def model_analysis_blueprint(domain: str, scenario: str) -> Blueprint:
|
||||
"mlflow_run_id": resolved.run_id},
|
||||
"desarrollo": json.loads(content)})
|
||||
|
||||
@blueprint.get("/modelo/curvas/opciones")
|
||||
def live_options():
|
||||
"""What can be selected for the live figure: each covariate's values, the period, the limits and, given
|
||||
`?paciente=<pac_id>`, that patient's own values."""
|
||||
from models.cama.survival import live
|
||||
|
||||
try:
|
||||
_, _, labelled, version = _live_context(domain, scenario)
|
||||
except LookupError as error:
|
||||
return jsonify({"error": f"sin curvas: {error}"}), 404
|
||||
paciente = request.args.get("paciente")
|
||||
found = live.options(labelled, int(paciente) if paciente and paciente.isdigit() else None)
|
||||
return jsonify({"modelo": {"nombre": f"{domain}-{scenario}", "version": str(version)}, "opciones": found})
|
||||
|
||||
@blueprint.post("/modelo/curvas/consulta")
|
||||
def live_curves():
|
||||
"""The figure's record for the selection in the body (`{filtros, periodo}`), scored with the production version over
|
||||
|
||||
Reference in New Issue
Block a user