Subgroup reports for CaCu's survival and PIM scenarios, as version files and as notebooks in the code

Every CaCu PIM scenario (cin2_pim, post-colposcopy, post-treatment) and the survival scenario now keep, per
combination of their covariates, the model against its empirical estimate, with the methods each used:

- PIM (models/cacu/cin2_pim/report.py): Turnbull's interval-censored estimate (prevalent = mass at 0, free in (l, r],
  unknown baseline in [0, r]; ported from bayes-pim chapter 24) with a bootstrap band, against the mixture refitted on
  every coded member with a delta-method band over the likelihood (inverse numerical Hessian, numerical gradient of
  CR(t), log scale); E/O at each horizon with log(E/O) taken as normal.
- Survival (models/cacu/survival/report.py): Kaplan-Meier with Greenwood's band against the SEER pipeline's own
  subgroup points and bootstrap interval (survival_curves.sv_sub_weights and sv_sub_points, called as they are).

A version keeps the record as analisis/subgrupos.json and a self-contained Plotly page as reportes/subgrupos.html
(TrainingRun.log_report; the saver publishes a dataflow's `reports`). The same drawing is a notebook in the code,
models/cacu/{cin2_pim,survival}/notebooks/reporte_subgrupos.ipynb: chart names and computed results only, a
`parameters` cell, `#| echo: false` cells. models.reports.templates lists those notebooks with the scenarios each serves
and reads one by id, for the WebApi's /governance/notebook-templates. The Jupyter renderer now drops the code of
`#| echo: false` cells, as Quarto does.

plotly>=5.18 joins the `survival-curves` extra (installed by the WebApi) and the dev group.

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-21 22:41:04 -06:00
parent 9cba11c2ec
commit e8c264e571
21 changed files with 964 additions and 24 deletions
+4 -1
View File
@@ -40,10 +40,12 @@ seer-survival = [
"matplotlib>=3.8",
"lifelines>=0.28", # the recurrence analysis' penalised Cox model (`models.cama.recurrence`)
]
# The population curves of a CaMa training run (`models.cama.survival.population`): the fractional Weibull's series.
# The population curves of a survival training run (`models.cama.survival.population`): the fractional Weibull's series;
# plotly for the CaCu survival scenario's subgroup page.
survival-curves = [
"scipy>=1.11",
"mpmath>=1.3",
"plotly>=5.18", # the CaCu survival scenario's subgroup report page (`models.cacu.survival.report`)
]
seer-survival-dca = ["dcurves>=1.1"]
@@ -72,6 +74,7 @@ dev = [
"networkx>=3.0",
"mpmath>=1.3",
"matplotlib>=3.8",
"plotly>=5.18",
"nbclient>=0.10",
"nbconvert>=7.16",
"ipykernel>=6.29",