CaMa survival figure: the whole cohort's points from the pipeline's survival stage
This commit is contained in:
@@ -133,7 +133,9 @@ def refresh_subgroups(domain: str) -> list[str]:
|
|||||||
|
|
||||||
def _subgroup_rows(domain: str, scenario: str, version: str) -> list[dict]:
|
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
|
"""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)
|
current = _current_build(domain, scenario)
|
||||||
if current is not None and current[0] == str(version):
|
if current is not None and current[0] == str(version):
|
||||||
path = _subgroups_path(domain, scenario, *current)
|
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"))
|
return json.loads(path.read_text(encoding="utf-8"))
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
log.warning("no se pudo leer %s", path)
|
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]:
|
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")
|
name = (request.get_json(silent=True) or {}).get("escenario")
|
||||||
try:
|
try:
|
||||||
spec, model, labelled, version = _live_context(domain, scenario)
|
spec, _, labelled, version = _live_context(domain, scenario)
|
||||||
except LookupError as error:
|
except LookupError as error:
|
||||||
return jsonify({"error": f"sin curvas: {error}"}), 404
|
return jsonify({"error": f"sin curvas: {error}"}), 404
|
||||||
published = live.published_points(_subgroup_rows(domain, scenario, version), name)
|
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)
|
record = _ANSWERS.get(key)
|
||||||
if record is None:
|
if record is None:
|
||||||
try:
|
try:
|
||||||
record = live.curves(spec, model, labelled, name, published)
|
record = live.curves(spec, labelled, name, published)
|
||||||
except live.QueryError as error:
|
except live.QueryError as error:
|
||||||
return jsonify({"error": str(error)}), 422
|
return jsonify({"error": str(error)}), 422
|
||||||
with _LOCK:
|
with _LOCK:
|
||||||
|
|||||||
Reference in New Issue
Block a user