From 34b26d8c85d81342f6199ec82516192346caab5c Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 15:04:03 -0600 Subject: [PATCH] CaCu survival: an estimand that shows the probability of surviving The model gives the probability of dying (`muerte`, like every batch the probability of its outcome); `complement = "supervivencia"` tells the screens to show its complement as the probability of surviving, from the first invasive biopsy, with its covariates. --- models/cacu/survival/model.toml | 11 +++++++++++ tests/cacu/test_cacu_survival.py | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/models/cacu/survival/model.toml b/models/cacu/survival/model.toml index f75b63d..dcccec8 100644 --- a/models/cacu/survival/model.toml +++ b/models/cacu/survival/model.toml @@ -14,6 +14,17 @@ recientes hasta él. Supervivencia por intervalos del pipeline SEER (regresión como la de CaMa. Sin estadio, tratamiento ni validación clínica; la defunción se conoce solo si el hospital la \ registra.""" +# What the model's number is, as the patient's screen shows it. The model gives the probability of dying; the screen +# shows its complement, the probability of surviving, with the interval's ends swapped. +[estimand] +quantity = "Probabilidad de supervivencia" +description = "Probabilidad de que la paciente siga viva a cada horizonte desde el diagnóstico de cáncer." +outcome = "Muerte por cualquier causa" +index_date = "la primera biopsia con carcinoma invasor" +horizons_unit = "años" +covariates = "grupo de edad al diagnóstico, citología (categorías de KPNC) y VPH más recientes hasta él" +complement = "supervivencia" + [config] train_fraction = 0.7 # The model's horizons, in years; `survival.horizons` are the same in months. diff --git a/tests/cacu/test_cacu_survival.py b/tests/cacu/test_cacu_survival.py index a210e1e..14575cd 100644 --- a/tests/cacu/test_cacu_survival.py +++ b/tests/cacu/test_cacu_survival.py @@ -281,3 +281,12 @@ def test_the_subgroup_notebook_runs_on_a_builds_file(cohort_file, monkeypatch): found = _run_notebook(path, cohort_file, "cacu", "survival", monkeypatch) assert sum(r["n"] for r in found["survival"]) == N + + +def test_the_survival_scenario_shows_the_probability_of_surviving(): + """Pins down: the scenario's estimand names the probability of surviving and marks it as the complement of the + model's number (the probability of dying), so the patient's record shows survival, with its covariates. Fails if + `complement` is dropped: the record would show a death probability labelled as survival.""" + estimand = Scenario.load("cacu", "survival").estimand + assert estimand["quantity"] == "Probabilidad de supervivencia" and estimand["complement"] == "supervivencia" + assert estimand["index_date"] == "la primera biopsia con carcinoma invasor" and "VPH" in estimand["covariates"]