A risk carries the model's index date for its member

Risk and risk_rows give (pac_id, fecha_indice, horizonte_anios, probabilidad, ic_bajo, ic_alto), the shape a batch now
stores: the horizons count from the model's index date, taken from the estimate's rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
This commit is contained in:
2026-11-20 23:02:46 -06:00
parent 410de1d3b7
commit 941ae15a3e
5 changed files with 19 additions and 14 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ class CacuStandIn:
missing = [c for c in ("pac_id", "pap_0", "hpv_0") if c not in columns]
if missing:
raise ValueError(f"The frame lacks the columns {missing}: the stand-in needs them.")
i_pac, i_pap, i_hpv = (columns.index(c) for c in ("pac_id", "pap_0", "hpv_0"))
i_pac, i_fecha, i_pap, i_hpv = (columns.index(c) for c in ("pac_id", "fecha_indice", "pap_0", "hpv_0"))
risks = []
for row in rows:
p = CACU_RULE["base"]
@@ -48,5 +48,5 @@ class CacuStandIn:
if row[i_hpv] == "POSITIVO":
p += CACU_RULE["vph_positivo"]
p = min(p, CACU_RULE["tope"])
risks += [Risk(int(row[i_pac]), float(h), round(p, 6)) for h in self.horizons]
risks += [Risk(int(row[i_pac]), row[i_fecha], float(h), round(p, 6)) for h in self.horizons]
return risks