From 1048175531b2dd6592c1489ff4c48c4ff761118e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o=20Cervantes?= Date: Sun, 22 Nov 2026 23:46:57 -0600 Subject: [PATCH] CaMa survival figure: the whole cohort's points from the pipeline's survival stage --- webapi/model_analysis.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/webapi/model_analysis.py b/webapi/model_analysis.py index 4c85121..89a4c58 100644 --- a/webapi/model_analysis.py +++ b/webapi/model_analysis.py @@ -133,7 +133,9 @@ def refresh_subgroups(domain: str) -> list[str]: def _subgroup_rows(domain: str, scenario: str, version: str) -> list[dict]: """The scenario points of the latest build computed by the cycle (`refresh_subgroups`), or the ones the version published - when it trained while the cycle hasn't computed them.""" + when it trained while the cycle hasn't computed them, the whole cohort's among them as `WHOLE_COHORT`.""" + from models.cama.survival.development import WHOLE_COHORT + current = _current_build(domain, scenario) if current is not None and current[0] == str(version): path = _subgroups_path(domain, scenario, *current) @@ -142,7 +144,8 @@ def _subgroup_rows(domain: str, scenario: str, version: str) -> list[dict]: return json.loads(path.read_text(encoding="utf-8")) except (OSError, ValueError): log.warning("no se pudo leer %s", path) - return _summary(domain, scenario, version, table="subgrupos_puntos") + return _summary(domain, scenario, version, table="subgrupos_puntos") + [ + {**row, "subgrupo": WHOLE_COHORT} for row in _summary(domain, scenario, version, table="cohorte_puntos")] def warm(domain: str) -> list[str]: @@ -243,7 +246,7 @@ def model_analysis_blueprint(domain: str, scenario: str) -> Blueprint: name = (request.get_json(silent=True) or {}).get("escenario") try: - spec, model, labelled, version = _live_context(domain, scenario) + spec, _, labelled, version = _live_context(domain, scenario) except LookupError as error: return jsonify({"error": f"sin curvas: {error}"}), 404 published = live.published_points(_subgroup_rows(domain, scenario, version), name) @@ -252,7 +255,7 @@ def model_analysis_blueprint(domain: str, scenario: str) -> Blueprint: record = _ANSWERS.get(key) if record is None: try: - record = live.curves(spec, model, labelled, name, published) + record = live.curves(spec, labelled, name, published) except live.QueryError as error: return jsonify({"error": str(error)}), 422 with _LOCK: