Indicators: CaCu and CaMa pages read by rounds, genotypes and steps; history to a chosen period; NCI and indicator references; CaMa follow-up export; API client for eligibility and risk series
This commit is contained in:
+28
-355
@@ -1,11 +1,14 @@
|
||||
import type { Mode } from './bars';
|
||||
import { CACU } from './pages-cacu';
|
||||
import { CAMA } from './pages-cama';
|
||||
|
||||
/** A domain's Indicadores page as the old app showed it (tests/fixtures/reference/<domain>/ui):
|
||||
* the timeliness cards with their own words, then the clinical sections and their figures.
|
||||
* Measures are named by their code (`Measure.name`). */
|
||||
export interface Page {
|
||||
kpis: Kpi[];
|
||||
/** the clinical indicators before the timeliness ones (CaCu) */
|
||||
clinicalFirst?: boolean;
|
||||
/** Under the cards, before the clinical indicators (CaMa's timeliness boxes). */
|
||||
opportunity?: Section[];
|
||||
clinical: Section[];
|
||||
@@ -25,33 +28,48 @@ export interface ReadingsCard {
|
||||
kind: 'readings';
|
||||
title: string;
|
||||
headline?: string;
|
||||
/** the headline said under the figure, not above it */
|
||||
footnote?: boolean;
|
||||
/** what the headline proportion counts, in the plural (default: pacientes) */
|
||||
unit?: string;
|
||||
note?: string;
|
||||
modes: Mode[];
|
||||
/** in `columns` with `views`, the mode its section's selector picks */
|
||||
follows?: boolean;
|
||||
}
|
||||
export type Section =
|
||||
| ReadingsCard
|
||||
/** Cards side by side; the last one alone when odd. */
|
||||
| { kind: 'columns'; title: string; sections: ReadingsCard[] }
|
||||
/** One section at a time. */
|
||||
| { kind: 'choice'; title: string; choices: { label: string; section: ReadingsCard }[] }
|
||||
/** Cards side by side, the last one alone when odd; `views`: one selector (its first view
|
||||
* by default) for the cards that follow it */
|
||||
| {
|
||||
kind: 'columns';
|
||||
title: string;
|
||||
sections: ReadingsCard[];
|
||||
views?: string[];
|
||||
viewsLabel?: string;
|
||||
}
|
||||
/** One section at a time; `card`: the title, the toggle and the chosen card in one card */
|
||||
| {
|
||||
kind: 'choice';
|
||||
title: string;
|
||||
choices: { label: string; section: ReadingsCard }[];
|
||||
card?: boolean;
|
||||
}
|
||||
| { kind: 'figures'; title?: string; figures: FigureSpec[] }
|
||||
| {
|
||||
kind: 'boxes';
|
||||
/** none: the boxes stand alone (TEA) */
|
||||
title?: string;
|
||||
cards: { measure?: string; title: string }[];
|
||||
/** the measure's own title under each card's (CaMa) */
|
||||
subtitles?: boolean;
|
||||
}
|
||||
/** Each figure in its own card, titled, two to a row (TEA). */
|
||||
| { kind: 'grid'; figures: FigureSpec[] }
|
||||
/** TEA's period summary in words, its numbers from the measures. */
|
||||
| { kind: 'tea-summary' }
|
||||
| ({ kind: 'card' } & Kpi);
|
||||
| { kind: 'tea-summary' };
|
||||
/** Figure titles may carry `{p}`, the applied period. */
|
||||
export type FigureSpec =
|
||||
| {
|
||||
kind: 'donut' | 'share-donut';
|
||||
kind: 'share-donut';
|
||||
title: string;
|
||||
measure: string;
|
||||
catalog: Catalog;
|
||||
@@ -65,18 +83,6 @@ export type FigureSpec =
|
||||
measure: string;
|
||||
/** the numerator's and the rest's names (stack), or the axis (share) */
|
||||
names: [string, string];
|
||||
}
|
||||
| {
|
||||
kind: 'rates';
|
||||
title: string;
|
||||
measure: string;
|
||||
stratum: string;
|
||||
rows: Category[];
|
||||
/** each row in its category's colour (else all rose) */
|
||||
colored?: boolean;
|
||||
/** the categories (of the measure) that count as a positive */
|
||||
positive: string[];
|
||||
axis: string;
|
||||
};
|
||||
|
||||
export interface Category {
|
||||
@@ -93,37 +99,6 @@ export interface Catalog {
|
||||
}
|
||||
|
||||
const OLIVE = '#A8C243';
|
||||
const ROSE = '#C24269';
|
||||
|
||||
const CAMA_DAYS = {
|
||||
value: '{median} días (mediana)',
|
||||
note: '{obs} mastografías; Q1 a Q3: {q1} a {q3} días.',
|
||||
};
|
||||
const PENDING = 'Indicador no publicado en el catálogo institucional.';
|
||||
|
||||
/** BI-RADS 4 to 6 as the old app named and coloured them. */
|
||||
const BIRADS: Catalog = {
|
||||
groups: [],
|
||||
categories: [
|
||||
{ code: '4', label: 'BI-RADS 4 (sin subcategoría)', color: '#C24269', group: '' },
|
||||
{ code: '4A', label: 'BI-RADS 4A', color: '#9C42C2', group: '' },
|
||||
{ code: '4B', label: 'BI-RADS 4B', color: '#5C42C2', group: '' },
|
||||
{ code: '4C', label: 'BI-RADS 4C', color: '#C2429C', group: '' },
|
||||
{ code: '5', label: 'BI-RADS 5', color: '#8E2F62', group: '' },
|
||||
{ code: '6', label: 'BI-RADS 6', color: '#7A3496', group: '' },
|
||||
],
|
||||
};
|
||||
const BREAST_BIOPSY: Catalog = {
|
||||
groups: [
|
||||
{ id: 'benign', label: 'No maligno', color: '#42C29C' },
|
||||
{ id: 'malignant', label: 'Maligno', color: ROSE },
|
||||
],
|
||||
categories: [
|
||||
{ code: 'benign', label: 'Benigno', color: OLIVE, group: 'benign' },
|
||||
{ code: 'in_situ', label: 'Carcinoma in situ', color: '#9C42C2', group: 'malignant' },
|
||||
{ code: 'invasive', label: 'Carcinoma invasor', color: '#5C42C2', group: 'malignant' },
|
||||
],
|
||||
};
|
||||
|
||||
export const PAGES: Record<string, Page> = {
|
||||
tea: {
|
||||
@@ -218,308 +193,6 @@ export const PAGES: Record<string, Page> = {
|
||||
},
|
||||
],
|
||||
},
|
||||
cama: {
|
||||
anchor: 'CAMA_BIRADS456_PACIENTE',
|
||||
kpis: [
|
||||
{
|
||||
measure: 'CAMA_BIRADS456_PACIENTE',
|
||||
title: 'Pacientes evaluadas con BI-RADS 4, 5 o 6',
|
||||
value: '{n} pacientes',
|
||||
note: 'Pacientes con mastografía BI-RADS 4, 5 o 6 en el periodo.',
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_TASA_DETECCION_HISTOPATOLOGICA',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
value: '{pct} %',
|
||||
note: '{num} de {den} biopsias con riesgo a carcinoma.',
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_EU38A',
|
||||
title: 'Tiempo de toma de mastografía a interpretación radiológica',
|
||||
...CAMA_DAYS,
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_DIAS_RESULTADO_DIAGNOSTICO',
|
||||
title: 'Tiempo de interpretación radiológica a diagnóstico',
|
||||
...CAMA_DAYS,
|
||||
},
|
||||
{
|
||||
title: 'Tiempo de diagnóstico a tratamiento',
|
||||
value: 'Indicador no disponible',
|
||||
note: PENDING,
|
||||
},
|
||||
],
|
||||
opportunity: [
|
||||
{
|
||||
kind: 'boxes',
|
||||
title: 'Tiempo de tamizaje a diagnóstico',
|
||||
subtitles: true,
|
||||
cards: [
|
||||
{
|
||||
measure: 'CAMA_EU38A',
|
||||
title: 'Tiempo de toma de mastografía a interpretación radiológica',
|
||||
},
|
||||
{
|
||||
measure: 'CAMA_DIAS_RESULTADO_DIAGNOSTICO',
|
||||
title: 'Tiempo de interpretación radiológica a diagnóstico',
|
||||
},
|
||||
{ title: 'Tiempo de interpretación radiológica a resultado de biopsia' },
|
||||
{ title: 'Tiempo de diagnóstico a tratamiento' },
|
||||
{ measure: 'CAMA_DIAS_TOMA_DIAGNOSTICO', title: 'Tiempo de tamizaje a diagnóstico' },
|
||||
],
|
||||
},
|
||||
],
|
||||
clinical: [
|
||||
{
|
||||
kind: 'figures',
|
||||
figures: [
|
||||
{
|
||||
kind: 'share-donut',
|
||||
title: 'Porcentaje de mastografías con resultado BI-RADS 4, 5 ó 6 en {p}',
|
||||
measure: 'CAMA_BIRADS456_MASTOGRAFIA',
|
||||
catalog: BIRADS,
|
||||
center: 'mastografías',
|
||||
},
|
||||
{
|
||||
kind: 'share-donut',
|
||||
title: 'Porcentaje de pacientes con resultados BI-RADS 4, 5 ó 6 en {p}',
|
||||
measure: 'CAMA_BIRADS456_PACIENTE',
|
||||
catalog: BIRADS,
|
||||
center: 'pacientes',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'figures',
|
||||
title: 'Resultado histopatológico por categoría BI-RADS',
|
||||
figures: [
|
||||
{
|
||||
kind: 'rates',
|
||||
title: 'Por categoría BI-RADS, {p}',
|
||||
measure: 'CAMA_HISTOPATOLOGIA_BIRADS',
|
||||
stratum: 'birads',
|
||||
rows: BIRADS.categories,
|
||||
colored: true,
|
||||
positive: ['in_situ', 'invasive'],
|
||||
axis: 'Porcentaje con resultado maligno',
|
||||
},
|
||||
{
|
||||
kind: 'donut',
|
||||
title: 'Resultado de la biopsia, {p}',
|
||||
measure: 'CAMA_HISTOPATOLOGIA_BIRADS',
|
||||
catalog: BREAST_BIOPSY,
|
||||
center: 'con resultado',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: 'card',
|
||||
measure: 'CAMA_CONFIRMACION_BIRADS45',
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
value: '{pct} %',
|
||||
note: '{num} de {den} mastografías BI-RADS 4 y 5 con reporte de biopsia.',
|
||||
},
|
||||
],
|
||||
},
|
||||
cama: CAMA,
|
||||
cacu: CACU,
|
||||
};
|
||||
|
||||
/** One panel of Trazabilidad (tests/fixtures/reference/<domain>/ui, tab "Trazabilidad"): a
|
||||
* measure month by month, as stacked counts by category, a percentage with its 95 % interval,
|
||||
* or a median with its quartiles. `group` heads a run of panels (TEA's "Tiempos del tamizaje"). */
|
||||
export interface HistoryPanel {
|
||||
title: string;
|
||||
measure: string;
|
||||
kind: 'stack' | 'percent' | 'median';
|
||||
/** stack: the categories, in the old order, with their names and colours */
|
||||
series?: { code: string; label: string; color: string }[];
|
||||
/** stack: the y axis */
|
||||
axis?: string;
|
||||
group?: string;
|
||||
}
|
||||
export interface History {
|
||||
panels: HistoryPanel[];
|
||||
/** the line's colour (percent and median) */
|
||||
line: string;
|
||||
/** how many of the latest months the tab opens with (none: from the first with data) */
|
||||
months?: number;
|
||||
}
|
||||
|
||||
const GREY = '#C9CDD2';
|
||||
const stack = (
|
||||
title: string,
|
||||
measure: string,
|
||||
axis: string,
|
||||
series: [string, string, string][],
|
||||
): HistoryPanel => ({
|
||||
title,
|
||||
measure,
|
||||
kind: 'stack',
|
||||
axis,
|
||||
series: series.map(([code, label, color]) => ({ code, label, color })),
|
||||
});
|
||||
const BIRADS_SERIES: [string, string, string][] = [
|
||||
['4A', 'BI-RADS 4A', '#C24269'],
|
||||
['4B', 'BI-RADS 4B', '#9C42C2'],
|
||||
['4C', 'BI-RADS 4C', '#5C42C2'],
|
||||
['5', 'BI-RADS 5', '#C2429C'],
|
||||
['6', 'BI-RADS 6', '#8E2F62'],
|
||||
['4', 'BI-RADS 4 (sin subcategoría)', '#7A3496'],
|
||||
];
|
||||
|
||||
export const HISTORY: Record<string, History> = {
|
||||
cacu: {
|
||||
line: '#6A8000',
|
||||
months: 5,
|
||||
panels: [
|
||||
stack('Distribución de resultados citológicos', 'CACU_EU7', 'Pacientes', [
|
||||
['NILM', 'Normal', '#9DBFE3'],
|
||||
['ASC-US', 'ASC-US', '#2F6DB3'],
|
||||
['LSIL', 'LIEBG', '#9C42C2'],
|
||||
['ASC-H', 'ASC-H', '#5C42C2'],
|
||||
['HSIL', 'LIEAG', '#C2429C'],
|
||||
['CIS', 'Carcinoma in situ', '#8E2F62'],
|
||||
['no_data', 'Sin dato', GREY],
|
||||
]),
|
||||
{ title: 'Pacientes con citología anómala', measure: 'IND1', kind: 'percent' },
|
||||
{ title: 'Tasa de detección histopatológica', measure: 'CACU_EU13', kind: 'percent' },
|
||||
stack(
|
||||
'Resultado de biopsia tras citología de alto grado',
|
||||
'CACU_CONFIRMACION_CITOLOGIA',
|
||||
'Pacientes',
|
||||
[
|
||||
['normal', 'Normal', '#9DBFE3'],
|
||||
['LSIL', 'LIEBG (CIN 1)', '#69C242'],
|
||||
['HSIL', 'LIEAG (CIN 2 y 3)', '#C24269'],
|
||||
['CIS', 'Carcinoma in situ', '#9C42C2'],
|
||||
['carcinoma', 'Carcinoma invasor', '#5C42C2'],
|
||||
['no_biopsy', 'Sin biopsia aún', GREY],
|
||||
['no_data', 'Biopsia sin grado', GREY],
|
||||
],
|
||||
),
|
||||
{
|
||||
title: 'Días de la toma de la citología a su resultado',
|
||||
measure: 'CACU_EU_TIEMPO_REPORTE',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Tiempo de tamizaje a diagnóstico',
|
||||
measure: 'CACU_DIAS_TOMA_DIAGNOSTICO',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Tiempo de tamizaje a tratamiento',
|
||||
measure: 'CACU_DIAS_TOMA_TRATAMIENTO',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Tiempo de diagnóstico a tratamiento',
|
||||
measure: 'CACU_DIAS_DIAGNOSTICO_TRATAMIENTO',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Riesgo CIN2+ por banda',
|
||||
measure: 'CACU_RIESGO_BANDA',
|
||||
kind: 'stack',
|
||||
axis: 'Pacientes',
|
||||
},
|
||||
],
|
||||
},
|
||||
cama: {
|
||||
line: '#9C42C2',
|
||||
panels: [
|
||||
{
|
||||
title: 'Días de la toma de la mastografía a su resultado',
|
||||
measure: 'CAMA_EU38A',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Días del resultado de la mastografía al diagnóstico',
|
||||
measure: 'CAMA_DIAS_RESULTADO_DIAGNOSTICO',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
title: 'Días de tamizaje a diagnóstico',
|
||||
measure: 'CAMA_DIAS_TOMA_DIAGNOSTICO',
|
||||
kind: 'median',
|
||||
},
|
||||
stack(
|
||||
'Porcentaje de mastografías con resultado BI-RADS 4, 5 ó 6',
|
||||
'CAMA_BIRADS456_MASTOGRAFIA',
|
||||
'Mastografías',
|
||||
BIRADS_SERIES,
|
||||
),
|
||||
stack(
|
||||
'Pacientes con resultado BI-RADS 4, 5 ó 6',
|
||||
'CAMA_BIRADS456_PACIENTE',
|
||||
'Pacientes',
|
||||
BIRADS_SERIES,
|
||||
),
|
||||
stack('Resultado histopatológico', 'CAMA_HISTOPATOLOGIA_BIRADS', 'Pacientes', [
|
||||
['benign', 'Benigno', '#9DBFE3'],
|
||||
['in_situ', 'Carcinoma in situ', '#C24269'],
|
||||
['invasive', 'Carcinoma invasor', '#9C42C2'],
|
||||
['no_biopsy', 'Sin biopsia reportada', GREY],
|
||||
['no_data', 'Sin dato', GREY],
|
||||
]),
|
||||
{
|
||||
title: 'Tasa de confirmación histopatológica',
|
||||
measure: 'CAMA_CONFIRMACION_BIRADS45',
|
||||
kind: 'percent',
|
||||
},
|
||||
],
|
||||
},
|
||||
tea: {
|
||||
line: '#9C42C2',
|
||||
panels: [
|
||||
{
|
||||
group: 'Tiempos del tamizaje',
|
||||
title: 'Días de M-CHAT a ADOS-2',
|
||||
measure: 'M26_DIAS_MCHAT_ADOS2',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
group: 'Tiempos del tamizaje',
|
||||
title: 'Días de ADOS-2 a diagnóstico',
|
||||
measure: 'M27_DIAS_ADOS2_DIAGNOSTICO',
|
||||
kind: 'median',
|
||||
},
|
||||
{
|
||||
group: 'Tiempos del tamizaje',
|
||||
title: 'Días de M-CHAT a diagnóstico positivo',
|
||||
measure: 'M25_DIAS_MCHAT_DIAGNOSTICO',
|
||||
kind: 'median',
|
||||
},
|
||||
stack('Progresión del proceso diagnóstico', 'M23_PACIENTES_EVALUADOS', 'Pacientes', [
|
||||
['confirmed', 'Diagnóstico confirmado', '#A8C243'],
|
||||
['in_process', 'En proceso', '#B8433A'],
|
||||
]),
|
||||
{
|
||||
title: 'Porcentaje de confirmación diagnóstica',
|
||||
measure: 'M24_CONFIRMACION_DIAGNOSTICO',
|
||||
kind: 'percent',
|
||||
},
|
||||
{
|
||||
title: 'Porcentaje de pacientes con diagnóstico de TEA con EEG',
|
||||
measure: 'M21_DIAGNOSTICADOS_CON_EEG',
|
||||
kind: 'percent',
|
||||
},
|
||||
{
|
||||
title: 'Porcentaje de pacientes con diagnóstico de TEA sin EEG',
|
||||
measure: 'M22_DIAGNOSTICADOS_SIN_EEG',
|
||||
kind: 'percent',
|
||||
},
|
||||
stack('Flujo del proceso diagnóstico y estudios de EEG', 'M28_CASOS_POR_ESTADO', 'Casos', [
|
||||
['mchat_only', 'Solo M-CHAT', '#B8433A'],
|
||||
['psychology', 'Hasta evaluación psicológica', '#42C29C'],
|
||||
['neuropediatrics', 'Hasta evaluación neuropediátrica', '#7184A2'],
|
||||
['eeg', 'Con EEG', '#A8C243'],
|
||||
]),
|
||||
stack('Calidad del EEG', 'M29_CALIDAD_EEG', 'Estudios de EEG', [
|
||||
['good', 'Bueno', '#A8C243'],
|
||||
['bad', 'No aceptable', '#B8433A'],
|
||||
['not_analyzed', 'Sin analizar', GREY],
|
||||
]),
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user