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//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[]; /** The measure whose data decides the default period. */ anchor: string; } /** A card: its measure (none: not published yet), its title, and its value and note as * templates (figures.fill). */ export interface Kpi { measure?: string; title: string; value?: string; note?: string; } /** A card read one mode at a time; `headline` is the measure its score comes from. */ 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; `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 }[]; } /** 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' }; /** Figure titles may carry `{p}`, the applied period. */ export type FigureSpec = | { kind: 'share-donut'; title: string; measure: string; catalog: Catalog; center: string; } | { kind: 'scenario-bars'; title: string; measure: string; catalog: Catalog; stratum: string } | { kind: 'counts'; title: string; measure: string; catalog: Catalog; axis: string } | { kind: 'age-stack' | 'age-share'; title: string; measure: string; /** the numerator's and the rest's names (stack), or the axis (share) */ names: [string, string]; }; export interface Category { code: string; label: string; color: string; group: string; } export interface Catalog { groups: { id: string; label: string; color: string }[]; categories: Category[]; /** categories drawn faded (not the ones the figure is about) */ faded?: string[]; } const OLIVE = '#A8C243'; export const PAGES: Record = { tea: { anchor: 'M23_PACIENTES_EVALUADOS', kpis: [], opportunity: [ { kind: 'tea-summary' }, { kind: 'boxes', cards: [ { measure: 'M26_DIAS_MCHAT_ADOS2', title: 'Días de M-CHAT a ADOS-2' }, { measure: 'M27_DIAS_ADOS2_DIAGNOSTICO', title: 'Días de ADOS-2 a diagnóstico' }, { measure: 'M25_DIAS_MCHAT_DIAGNOSTICO', title: 'Días de M-CHAT a diagnóstico positivo' }, ], }, ], clinical: [ { kind: 'grid', figures: [ { kind: 'counts', title: 'Pacientes evaluados por resultado diagnóstico', measure: 'M23_PACIENTES_EVALUADOS', axis: 'Conteo (paciente)', catalog: { groups: [], categories: [ { code: 'confirmed', label: 'Diagnóstico confirmado', color: OLIVE, group: '' }, { code: 'in_process', label: 'En proceso', color: '#B8433A', group: '' }, ], }, }, { kind: 'age-stack', title: 'Porcentaje de confirmación diagnóstica', measure: 'M24_CONFIRMACION_DIAGNOSTICO', names: ['Diagnóstico confirmado', 'En proceso'], }, { kind: 'age-share', title: 'Porcentaje de pacientes con diagnóstico de TEA con EEG', measure: 'M21_DIAGNOSTICADOS_CON_EEG', names: ['% de pacientes con EEG', ''], }, { kind: 'age-share', title: 'Porcentaje de pacientes con diagnóstico de TEA sin EEG', measure: 'M22_DIAGNOSTICADOS_SIN_EEG', names: ['% de pacientes sin EEG', ''], }, { kind: 'counts', title: 'Casos por estatus', measure: 'M28_CASOS_POR_ESTADO', axis: 'Conteo (paciente)', catalog: { groups: [], categories: [ { code: 'mchat_only', label: 'Solo M-CHAT', color: '#B8433A', group: '' }, { code: 'psychology', label: 'Hasta evaluación psicológica', color: '#42C29C', group: '', }, { code: 'neuropediatrics', label: 'Hasta evaluación neuropediátrica', color: '#7184A2', group: '', }, { code: 'eeg', label: 'Con EEG', color: OLIVE, group: '' }, ], }, }, { kind: 'counts', title: 'Calidad del EEG', measure: 'M29_CALIDAD_EEG', axis: 'Conteo (examen)', catalog: { groups: [], categories: [ { code: 'good', label: 'Bueno', color: OLIVE, group: '' }, { code: 'bad', label: 'No aceptable', color: '#B8433A', group: '' }, { code: 'not_analyzed', label: 'Sin analizar', color: '#C9CDD2', group: '' }, ], }, }, ], }, ], }, cama: CAMA, cacu: CACU, };