From 5a10be44d094756f96ca524a2b43e99d6c3e7d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o=20Cervantes?= Date: Sun, 22 Nov 2026 18:04:57 -0600 Subject: [PATCH] CaMa survival: no member is followed past today --- models/cama/survival/estimator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/cama/survival/estimator.py b/models/cama/survival/estimator.py index f4a3e0e..f752286 100644 --- a/models/cama/survival/estimator.py +++ b/models/cama/survival/estimator.py @@ -103,7 +103,7 @@ def outcome_table(cohort: pd.DataFrame, cutoff, cap_months: int) -> pd.DataFrame frame = _dated(cohort) index = frame.groupby("pac_id")["fecha_indice"].first() death = frame[frame["tipo"] == "defuncion"].groupby("pac_id")["fecha"].min().reindex(index.index) - cutoff = pd.Timestamp(cutoff) + cutoff = min(pd.Timestamp(cutoff), pd.Timestamp.today().normalize()) # nobody is followed past today died = (death.notna() & (death <= cutoff)).to_numpy() end = death.where(died, cutoff) months = np.floor((end - index).dt.days.to_numpy() / DAYS_PER_MONTH).astype(int).clip(min=0)