Files
WebApi/docs/cama-analysis.md
Angel Capetillo Zavala b1bbbc25b4 Integrate CaMa follow-up, descriptive analysis and L3 with dev
Preserve dev risk batches and governance, individual patient selection, optional access and explicit cohort reader overrides. Register one CaMa implementation and retain legacy Python blueprint consumers. Validated with 681 WebApi tests on the integrated parent and submodules.
2026-11-17 10:44:07 -06:00

75 lines
6.2 KiB
Markdown

# CaMa descriptive analysis
Counts and proportions of the BI-RADS cohort, by group and over time, under `/cama/analisis`. It describes the
patients of the cohort; it estimates no incidence, survival or risk. The cohort is the follow-up list's (see
`cama-follow-up.md`): each patient through her latest reported mammogram, kept when its BI-RADS is 4 to 6.
## Routes
All `GET`, with the selection of the follow-up list (all routes but the trend): `corte` (default today), `meses` (`0` whole cohort, default; `1`, `3`,
`6`, `12`), the filters `birads`, `grupo_edad` and `biopsia`, and the context `cohorte`, `escenario`, `revision` together.
Unknown, repeated or empty parameters are a 400. The trend takes only `corte`, `tipo` and `periodos`: a window, a filter or the cohort
context sent to it is a 400, never ignored.
| Route | Own parameters | Answers |
| --- | --- | --- |
| `/cama/analisis` | | Dimensions with their options, measures, horizons (30, 90, 180, 365 days), period types, sections and the analyses that are not available, each with its reason |
| `/cama/analisis/resumen` | `horizonte` (default 90) | The indicator cards |
| `/cama/analisis/distribucion` | `por`: `birads`, `grupo_edad`, `biopsia` | Patients per category: count, share and its Wilson interval, and the filter that opens them in the list |
| `/cama/analisis/comparacion` | `por`: `birads`, `grupo_edad`; `medida`: `maligno` (default), `invasor` | Per group, cases among the patients with a known biopsy result, its interval, and the chi-square test of homogeneity |
| `/cama/analisis/mapa` | `filas`, `columnas` (two different of `birads`, `grupo_edad`); `medida` | Cells of the two crossed: patients and the share of cases |
| `/cama/analisis/tendencia` | `tipo`: `mes`, `semestre`; `periodos`: 1 to 36 (12 months, 6 semesters by default) | Reports of mammogram and biopsy per period and the share of malignant results; general activity, not the cohort |
| `/cama/analisis/indicadores` | | The cohort's patients by BI-RADS category, with `simulado: true` (the aggregate the tab has always read); a category is published only from the threshold, so an empty one is not published either |
Every answer carries `cohorte`, `escenario`, `revision`, `corte`, `ventana`, `filtros` and `umbral_supresion`, and only
`/indicadores` carries `simulado`. Errors as in the list: 400, 403 (`motivo: supresion`), 409 (`motivo: revision`) and 503
(`motivo: cohorte`, the cohort view is missing).
A proportion is `{estado, casos, total, valor, ic_bajo, ic_alto}` with values in percent; `estado` is `disponible`,
`suprimido` or `sin_datos` (nobody in the denominator). An item with `seleccion` gives the list's filters that open its
patients; the page adds the selection's own filters.
## Definitions (working conventions, for review)
* **Result** of a patient: the grade of the biopsy the list shows (latest report at the cut-off); `SIN_BIOPSIA` without a
report, `SIN_DATO` for a report without a grade. **Known**: benign, in situ or invasive. **Malignant**: a grade in
`cama.biopsia_cancer`; **invasive**: `CARCINOMA_INVASOR`.
* **Cards.** Cohort (patients). With a biopsy report: of the cohort. Malignant and invasive among the known results: not
an incidence, the denominator is patients already biopsied. Biopsy reported within `h` days and malignant result within
`h` days of the mammogram: of the cohort's mammograms that have had `h` days by the cut-off (a recent one isn't read as
one without a biopsy); the earliest report counts. Days from the mammogram to the first biopsy report: median and
quartiles (linear interpolation) among the patients with a report, from five of them.
* **Comparison and map.** The proportion's denominator is the patients with a known result; the test needs two or more
published groups and every expected count of at least 5, otherwise it says why it is not given.
* **Trend.** General activity, not the cohort. It counts reports (`unidad: "reportes"`), not patients: each mammogram report
with a BI-RADS and each biopsy report in its period, over every patient; a patient with several reports counts several
times. It depends only on `corte`, `tipo` and `periodos`, so it doesn't change with the window or filters of the other
sections, and its answer carries no cohort, revision, window or filters. Biopsies: only those that can be linked to a
mammogram with a reported BI-RADS (mammogram, order, report); a biopsy without a linked mammogram isn't counted
(`alcance_biopsias`). The share is malignant among the biopsy reports with a known grade. The period the cut-off falls in is
marked `incompleto`. Counts and shares are descriptive: no test is applied, because reports of one patient aren't
independent. The answer needs the cohort view (503 without it) and a `corte` not after today.
* **Intervals.** Wilson, 95 %. Shares of the selection (distribution) are descriptive proportions of the patients.
## Suppression
Same threshold as the list (`comun.umbral_supresion`, 5). Applied here as:
* A count of 1 to 4 is never published. A hidden cell takes the smallest published one of its line with it, until the
hidden patients are at least 5, so a published total minus the published cells gives nothing away. Tables do the same
along every row and column. Zero is published.
* A proportion is published only when its group, its cases and its non-cases are each zero or at least 5.
* A period's total is published from 5 reports.
* The selection itself follows the list's rule (a window or filter that selects 1 to 4 patients is a 403).
Residual risk: the list shows individual rows of every selection it allows, so what an aggregate hides can be read from
the list. The rule bounds the aggregates, not the list.
## Not available
Survival, recurrence, treatment adherence, time-to-event curves (cumulative incidence, Kaplan-Meier), hazard ratios, log-rank
and restricted mean survival, and BRCA, stage and tumour size. The sources hold no vital status, recurrence, treatment or
follow-up visits, and a patient without the event is not known to have been followed: censoring and a common time zero
cannot be established. In the synthetic data every malignant biopsy report falls 12 to 42 days after its mammogram, so a
24-month curve would be an extrapolation of a diagnostic work-up, not a follow-up.