CaCu: show screening rounds and restore category palettes

This commit is contained in:
Angel Capetillo Zavala
2026-12-01 14:22:23 -06:00
parent fe4dd55452
commit 81894a3777
11 changed files with 929 additions and 69 deletions
+93 -28
View File
@@ -1,4 +1,19 @@
import type { Mode } from './bars';
import {
AGE_COLORS,
BIOPSY_COLORS,
CYTOLOGY_COLORS,
DURATION,
HPV_COLORS,
PPV_CYTOLOGY_COLORS,
PPV_DONUT,
PPV_LEVEL_COLORS,
QUARTILE,
REQUEST_COLORS,
ROUND_COLORS,
STATUS_COLORS,
VPH_DONUT,
} from './cacu-palette';
import type { Catalog, Page, ReadingsCard } from './pages';
const OLIVE = '#A8C243';
@@ -11,12 +26,12 @@ const CYTOLOGY: Catalog = {
{ id: 'abnormal', label: 'Anormal', color: ROSE },
],
categories: [
{ code: 'NILM', label: 'Normal', color: '#A8C243', group: 'normal' },
{ code: 'ASC-US', label: 'ASC-US', color: '#92324F', group: 'abnormal' },
{ code: 'LSIL', label: 'LIEBG', color: '#AA3A5C', group: 'abnormal' },
{ code: 'ASC-H', label: 'ASC-H', color: '#C24269', group: 'abnormal' },
{ code: 'HSIL', label: 'LIEAG', color: '#C54C71', group: 'abnormal' },
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C9577A', group: 'abnormal' },
{ code: 'NILM', label: 'Normal', color: CYTOLOGY_COLORS['NILM'], group: 'normal' },
{ code: 'ASC-US', label: 'ASC-US', color: CYTOLOGY_COLORS['ASC-US'], group: 'abnormal' },
{ code: 'LSIL', label: 'LIEBG', color: CYTOLOGY_COLORS['LSIL'], group: 'abnormal' },
{ code: 'ASC-H', label: 'ASC-H', color: CYTOLOGY_COLORS['ASC-H'], group: 'abnormal' },
{ code: 'HSIL', label: 'LIEAG', color: CYTOLOGY_COLORS['HSIL'], group: 'abnormal' },
{ code: 'CIS', label: 'Carcinoma in situ', color: CYTOLOGY_COLORS['CIS'], group: 'abnormal' },
],
};
@@ -27,31 +42,50 @@ const BIOPSY: Catalog = {
{ id: 'high', label: 'LIEAG o más', color: ROSE },
],
categories: [
{ code: 'normal', label: 'Normal', color: '#7E9232', group: 'low' },
{ code: 'LSIL', label: 'LIEBG (CIN 1)', color: '#B2C958', group: 'low' },
{ code: 'HSIL', label: 'LIEAG (CIN 2 y 3)', color: '#92324F', group: 'high' },
{ code: 'CIS', label: 'Carcinoma in situ', color: '#C24269', group: 'high' },
{ code: 'carcinoma', label: 'Carcinoma invasor', color: '#C9577A', group: 'high' },
{ code: 'normal', label: 'Normal', color: BIOPSY_COLORS['normal'], group: 'low' },
{ code: 'LSIL', label: 'LIEBG (CIN 1)', color: BIOPSY_COLORS['LSIL'], group: 'low' },
{ code: 'HSIL', label: 'LIEAG (CIN 2 y 3)', color: BIOPSY_COLORS['HSIL'], group: 'high' },
{ code: 'CIS', label: 'Carcinoma in situ', color: BIOPSY_COLORS['CIS'], group: 'high' },
{
code: 'carcinoma',
label: 'Carcinoma invasor',
color: BIOPSY_COLORS['carcinoma'],
group: 'high',
},
],
faded: ['normal', 'LSIL'],
};
/** HPV reports by genotype, and biopsy requests by what became of them. */
const HPV = [
{ code: 'negative', label: 'Negativo', color: '#A8C243' },
{ code: 'positive_16', label: 'VPH 16', color: '#C24269' },
{ code: 'positive_18', label: 'VPH 18', color: '#9C42C2' },
{ code: 'positive_16_18', label: 'VPH 16 y 18', color: '#92324F' },
{ code: 'positive_other', label: 'Otro de alto riesgo', color: '#C54C71' },
{ code: 'positive_incomplete', label: 'Positivo, genotipo incompleto', color: '#C9577A' },
{ code: 'negative', label: 'Negativo', color: HPV_COLORS['negative'] },
{ code: 'positive_16', label: 'VPH 16', color: HPV_COLORS['positive_16'] },
{ code: 'positive_18', label: 'VPH 18', color: HPV_COLORS['positive_18'] },
{ code: 'positive_16_18', label: 'VPH 16 y 18', color: HPV_COLORS['positive_16_18'] },
{ code: 'positive_other', label: 'Otro de alto riesgo', color: HPV_COLORS['positive_other'] },
{
code: 'positive_incomplete',
label: 'Positivo, genotipo incompleto',
color: HPV_COLORS['positive_incomplete'],
},
];
const REQUESTS = [
{ code: 'high_grade', label: 'LIEAG o más', color: '#C24269' },
{ code: 'below_high_grade', label: 'Menor que LIEAG', color: '#A8C243' },
{ code: 'pending', label: 'Pendiente', color: '#C9CDD2' },
{ code: 'no_grade', label: 'Sin grado', color: '#9AA3AB' },
{ code: 'high_grade', label: 'LIEAG o más', color: REQUEST_COLORS['high_grade'] },
{ code: 'below_high_grade', label: 'Menor que LIEAG', color: REQUEST_COLORS['below_high_grade'] },
{ code: 'pending', label: 'Pendiente', color: REQUEST_COLORS['pending'] },
{ code: 'no_grade', label: 'Sin grado', color: REQUEST_COLORS['no_grade'] },
];
/** The screening route's bars: a median, and the marks of its quartiles. */
const TINT = { bar: DURATION, mark: QUARTILE };
/** The screening rounds, in the order the cards draw them. */
const ROUNDS = ['initial', 'subsequent', 'no_data'];
const ROUND_CAPTION =
'Cada paciente está en un solo grupo, según su muestra (fecha de toma): detección inicial (primera vez en la vida), ' +
'subsecuente (detección previa registrada, o ya con colposcopía o tratamiento) o «Sin dato». ' +
'Un grupo sin pacientes se muestra en cero; sin porcentaje.';
/** A PPV's card: the whole, and by each of its stratifiers. */
const ppv = (measure: string, title: string, note: string, ...more: Mode[]): ReadingsCard => ({
kind: 'readings',
@@ -59,13 +93,14 @@ const ppv = (measure: string, title: string, note: string, ...more: Mode[]): Rea
headline: measure,
note: `${note} Confirma la histología LIEBG o mayor.`,
modes: [
{ kind: 'figure', label: 'Total', measure, figure: 'donut' },
{ kind: 'figure', label: 'Total', measure, figure: 'donut', colors: PPV_DONUT },
{
kind: 'shares',
label: 'Citología previa',
caption: 'La última válida de los 365 días anteriores; cada grupo incluye los más severos.',
measure,
stratum: 'cytology',
colors: PPV_CYTOLOGY_COLORS,
order: ['ascus_plus', 'lsil_plus', 'hsil_plus', 'no_data'],
},
{
@@ -74,6 +109,7 @@ const ppv = (measure: string, title: string, note: string, ...more: Mode[]): Rea
caption: 'Los grupos se traslapan.',
measure,
stratum: 'hpv',
colors: HPV_COLORS,
order: ['negative', 'positive', 'hpv_16', 'hpv_18', 'no_data'],
},
{
@@ -81,14 +117,18 @@ const ppv = (measure: string, title: string, note: string, ...more: Mode[]): Rea
label: 'Nivel de histología',
measure,
stratum: 'level',
colors: PPV_LEVEL_COLORS,
order: ['cin1_plus', 'cin2_plus', 'carcinoma'],
},
{
kind: 'shares',
label: 'Tamizaje',
label: 'Por detección inicial y subsecuente',
caption: ROUND_CAPTION,
measure,
stratum: 'round',
order: ['initial', 'subsequent', 'no_data'],
colors: ROUND_COLORS,
order: ROUNDS,
complete: true,
},
...more,
],
@@ -136,6 +176,7 @@ export const CACU: Page = {
modes: [
{
kind: 'days',
tint: TINT,
label: 'Acumulado desde la toma',
steps: [
{ label: 'Resultado de citología', measure: 'CACU_EU_TIEMPO_REPORTE' },
@@ -146,6 +187,7 @@ export const CACU: Page = {
},
{
kind: 'days',
tint: TINT,
label: 'Por pasos',
caption: 'Cada paso mide a sus propias pacientes: las medianas no se suman.',
steps: [
@@ -157,6 +199,7 @@ export const CACU: Page = {
},
{
kind: 'days-by',
tint: TINT,
label: 'Por CIE-10',
caption: 'Días de la toma al diagnóstico, por el código de la nota que lo fecha.',
measure: 'CACU_TIEMPO_DIAGNOSTICO_CIE10',
@@ -183,10 +226,20 @@ export const CACU: Page = {
},
{
kind: 'figure',
label: 'Por escenario clínico',
label: 'Por detección inicial y subsecuente',
caption:
'Cada paciente cuenta una vez, con su última muestra válida del periodo; la detección es la de esa muestra (fecha de toma). ' +
'«Detección inicial»: primera vez en la vida y sin colposcopía ni tratamiento a la toma. ' +
'«Detección subsecuente»: con detección previa registrada, o ya con colposcopía o tratamiento a la toma. ' +
'«Sin dato»: sin detección previa registrada y sin colposcopía ni tratamiento. ' +
'Cada barra suma 100 % de las pacientes del grupo con resultado citológico (n indica cuántas son). ' +
'Si hay pacientes en «Sin dato», una barra vacía significa que no hay pacientes clasificadas en esa detección según la información disponible.',
measure: 'CACU_EU7',
figure: 'scenarios',
catalog: CYTOLOGY.categories,
stratum: 'round',
order: ROUNDS,
complete: true,
},
],
},
@@ -217,12 +270,19 @@ export const CACU: Page = {
headline: 'CACU_VPH',
note: 'Una vez cada paciente, por su última muestra con resultado.',
modes: [
{ kind: 'figure', label: 'Total', measure: 'CACU_VPH', figure: 'donut' },
{
kind: 'figure',
label: 'Total',
measure: 'CACU_VPH',
figure: 'donut',
colors: VPH_DONUT,
},
{
kind: 'positives',
label: 'Por grupo de edad',
measure: 'CACU_VPH',
stratum: 'age_group',
colors: AGE_COLORS,
order: ['<25', '25-34', '35-44', '45-54', '55-64', '65+', 'no_data'],
},
{
@@ -230,6 +290,7 @@ export const CACU: Page = {
label: 'Por estatus de seguimiento',
measure: 'CACU_VPH',
stratum: 'follow_up_status',
colors: STATUS_COLORS,
order: ['pre_colposcopy', 'post_colposcopy', 'post_treatment', 'case'],
},
{
@@ -237,13 +298,17 @@ export const CACU: Page = {
label: 'Por genotipo',
measure: 'CACU_VPH',
strata: ['hpv_16', 'hpv_18'],
colors: HPV_COLORS,
},
{
kind: 'positives',
label: 'Por tamizaje',
label: 'Por detección inicial y subsecuente',
caption: `${ROUND_CAPTION} Positivas sobre las pacientes con resultado de VPH del grupo.`,
measure: 'CACU_VPH',
stratum: 'round',
order: ['initial', 'subsequent', 'no_data'],
colors: ROUND_COLORS,
order: ROUNDS,
complete: true,
},
],
},