Merge dev into the CaCu risk record branch

dev already names the history tab «Trazabilidad» for the three domains, so its version of those files stays. CaCu's
diagnosis-to-treatment time keeps one presentation, its card: it has no figure of its own next to the screening
route chart.
This commit is contained in:
2026-11-22 23:17:21 -06:00
46 changed files with 794 additions and 349 deletions
@@ -37,6 +37,7 @@ import { IndicadoresHistorico } from './indicadores-historico';
import { historicoDeDominio } from './indicadores-historico-config';
import { IndicadorHistopatologiaPendiente } from './indicador-histopatologia-pendiente';
import { TITULO_MASTOGRAFIAS_CAMA } from './indicadores-figure-labels';
import { M30_RESULTADO_EEG } from './indicadores-historico-figures';
type DashboardSection = 'resumen' | 'historico' | 'analisis' | 'seguimiento' | 'datos';
const SECTIONS: readonly { id: DashboardSection; label: string }[] = [
@@ -44,10 +45,11 @@ const SECTIONS: readonly { id: DashboardSection; label: string }[] = [
{ id: 'seguimiento', label: 'Análisis de riesgos' },
{ id: 'datos', label: 'Datos y definiciones' },
];
// TEA and CaMa have enough periods for their history to say anything; the epidemiological analysis is CaMa's,
// between its history and its follow-up list.
const SECTIONS_WITH_HISTORY: readonly { id: DashboardSection; label: string }[] = [SECTIONS[0], { id: 'historico', label: 'Histórico' }, SECTIONS[1], SECTIONS[2]];
const SECTIONS_CACU: typeof SECTIONS_WITH_HISTORY = [SECTIONS[0], { id: 'historico', label: 'Trazabilidad' }, SECTIONS[1], SECTIONS[2]];
const SECTIONS_TEA: typeof SECTIONS = [
{ id: 'resumen', label: 'Resumen' }, { id: 'historico', label: 'Trazabilidad' }, { id: 'seguimiento', label: 'Análisis de Riesgo' }, SECTIONS[2],
];
const SECTIONS_CACU: typeof SECTIONS = [SECTIONS[0], { id: 'historico', label: 'Trazabilidad' }, SECTIONS[1], SECTIONS[2]];
// Whether CaMa offers the Análisis tab. While off, its panel is a placeholder and the component is not rendered.
export const CAMA_ANALYSIS_ENABLED = false;
// TEA's figures in the order of its two sections; the indicators the sections do not name keep the catalog's order after them.
@@ -57,7 +59,7 @@ function ordenTea(catalog: Indicador[]): Indicador[] {
return [...first, ...catalog.filter(item => !named.includes(item.id))];
}
const SECTIONS_CAMA: readonly { id: DashboardSection; label: string }[] = [
SECTIONS_WITH_HISTORY[0], SECTIONS_WITH_HISTORY[1],
SECTIONS_WITH_HISTORY[0], { id: 'historico', label: 'Trazabilidad' },
...(CAMA_ANALYSIS_ENABLED ? [{ id: 'analisis' as const, label: 'Análisis' }] : []),
SECTIONS_WITH_HISTORY[2], SECTIONS_WITH_HISTORY[3]];
@@ -68,7 +70,11 @@ const SECTIONS_CAMA: readonly { id: DashboardSection; label: string }[] = [
styleUrl: './indicadores-page.scss',
})
export class IndicadoresPage {
get sections(): readonly { id: DashboardSection; label: string }[] { return this.dominio === 'cama' ? SECTIONS_CAMA : this.dominio === 'cacu' ? SECTIONS_CACU : this.conHistorico ? SECTIONS_WITH_HISTORY : SECTIONS; }
get sections(): typeof SECTIONS {
if (this.dominio === 'tea') return SECTIONS_TEA;
if (this.dominio === 'cacu') return SECTIONS_CACU;
return this.dominio === 'cama' ? SECTIONS_CAMA : this.conHistorico ? SECTIONS_WITH_HISTORY : SECTIONS;
}
get conHistorico() { return this.dominio === 'tea' || historicoDeDominio(this.dominio) !== undefined; }
get conAnalisis() { return CAMA_ANALYSIS_ENABLED && this.dominio === 'cama'; }
readonly activeSection = signal<DashboardSection>('resumen');
@@ -393,7 +399,7 @@ export class IndicadoresPage {
return this.dominio === 'cacu'
? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7' && !route.includes(item.id))]
: this.dominio === 'cama' ? this.cardsDeCama(catalog)
: this.dominio === 'tea' ? ordenTea(catalog.filter(item => !item.vistas || item.vistas.includes('resumen')))
: this.dominio === 'tea' ? ordenTea(catalog.filter(item => item.id !== M30_RESULTADO_EEG && (!item.vistas || item.vistas.includes('resumen'))))
: catalog.filter(item => !item.vistas || item.vistas.includes('resumen'));
});
readonly selectedIndicators = computed(() => this.indicatorSelection() ?? this.catalog().map(item => item.id));
@@ -424,10 +430,10 @@ export class IndicadoresPage {
return item ? { item: { ...item, titulo: figura.titulo }, titulo: figura.titulo } : { titulo: figura.titulo };
});
}
// Preserve the route chart; individual figures require a published figure contract.
if (this.dominio !== 'cacu' || !this.catalog().length) return [];
// With the screening route chart, CaCu has no separate time figures: the chart shows every time from the sample to
// each event. Without it, each time the catalog publishes with a figure keeps its own.
if (this.dominio !== 'cacu' || !this.catalog().length || this.screeningRouteAvailable) return [];
return CACU_FIGURAS_OPORTUNIDAD.flatMap(figura => {
if (this.screeningRouteAvailable && figura.id !== 'cacu_dias_diagnostico_tratamiento') return [];
const item = items.find(candidate => candidate.id === figura.id && candidate.figuras.length > 0);
return item ? [{ item, titulo: item.titulo }] : [];
});