Integra seguimiento y visualizaciones CaCu

This commit is contained in:
Angel Capetillo Zavala
2026-11-26 12:49:10 -06:00
parent bd3f63b20a
commit f04c40b1e1
41 changed files with 2098 additions and 228 deletions
@@ -2,6 +2,7 @@ import { IndicadorDatos, PlotlyFigure, Tema } from './indicadores.models';
import { c2Theme } from './indicadores-c2-palette';
import { cacuClinicalColor, cacuGroupColor, cacuRgba } from './indicadores-cacu-palette';
import { percentNumber, shareText } from './indicadores-format';
import { ConjuntoBarras } from './indicadores-barras';
// Adapted from entregable_eu7_dona_escenario/eu7-dona-escenario.ts.
// This boundary is intentionally specific to EU7. Unknown cells never become zero.
@@ -163,6 +164,15 @@ export function modelo(general: IndicadorDatos, porEscenario: IndicadorDatos, pe
}
const hijas = (m: Modelo, grupo: string) => m.categorias.filter(c => c.grupo === grupo);
const nGrupo = (m: Modelo, grupo: string) => suma(hijas(m, grupo).map(c => m.celdas[c.id]));
/** The cytology bars: the groups of the inner ring as headers, the categories of the outer ring as bars; «Sin dato» stays outside. */
export function barrasCitologia(m: Modelo, sel: Seleccion): ConjuntoBarras {
return {
grupos: m.grupos.map(g => ({ id: g.id, etiqueta: g.etiqueta, color: g.color, subtotal: nGrupo(m, g.id),
filas: hijas(m, g.id).map(c => ({ id: c.id, etiqueta: c.etiqueta, n: m.celdas[c.id].n, estado: m.celdas[c.id].estado, color: c.color })) })),
den: m.total, unidad: 'pacientes con resultado',
activas: sel.categoria ? new Set([sel.categoria]) : sel.grupo ? new Set(hijas(m, sel.grupo).map(c => c.id)) : null,
};
}
export function seleccionEtiqueta(m: Modelo, sel: Seleccion): string {
return sel.categoria ? m.categorias.find(c => c.id === sel.categoria)!.etiqueta
: sel.grupo ? m.grupos.find(g => g.id === sel.grupo)!.etiqueta : 'TOTAL';
@@ -212,7 +222,7 @@ export function dona(m: Modelo, sel: Seleccion, tema: Tema): PlotlyFigure {
labels: m.categorias.map(c => escapar(c.etiqueta)), text: rotulos(exterior, m.categorias.map(c => c.etiqueta), true),
textfont: { size: 11 }, hovertext: hoverText(exterior),
marker: { colors: m.categorias.map(c => cacuRgba(c.color, alpha(c.id))), line: { color: p.background, width: 2 } } },
], layout: { autosize: true, height: 440, margin: { t: 10, l: 10, r: 10, b: 10 }, paper_bgcolor: p.background, font: { color: p.text } },
], layout: { autosize: true, height: 360, margin: { t: 10, l: 10, r: 10, b: 10 }, paper_bgcolor: p.background, font: { color: p.text } },
config: { displayModeBar: false } };
}
/** Absolute counts, one independent bar per category inside each clinical scenario. The selection only chooses which