Merge the TEA labels and sections branch into the TEA indicators branch

This commit is contained in:
ulises
2026-11-22 22:11:34 -06:00
23 changed files with 177 additions and 131 deletions
@@ -17,7 +17,7 @@ import { applyGlobal, domainTypes, GlobalFilterState, IndicadoresMemory, pending
import { IndicadorPeriodFilters } from './indicador-period-filters';
import { IndicadorCatalogCard } from './indicador-catalog-card';
import { esSocioConteos } from './indicadores-conteos-pareados';
import { CACU_RESULTADO_KPI, CACU_TRATAMIENTO_KPIS, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, CACU_FIGURAS_CLINICAS, CACU_FIGURAS_OPORTUNIDAD, CAMA_CONFIRMACION_KPI, CAMA_FIGURAS_OPORTUNIDAD, CACU_FIGURA_CLINICA_PENDIENTE, KpiCardSlot, TEA_FIGURAS_CLINICAS, TEA_FIGURAS_OPORTUNIDAD, camaKpiCards } from './indicadores-kpi';
import { CACU_RESULTADO_KPI, CACU_TRATAMIENTO_KPIS, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, CACU_FIGURAS_CLINICAS, CACU_FIGURAS_OPORTUNIDAD, CAMA_CONFIRMACION_KPI, CAMA_FIGURAS_OPORTUNIDAD, KpiCardSlot, TEA_FIGURAS_CLINICAS, TEA_FIGURAS_OPORTUNIDAD, camaKpiCards } from './indicadores-kpi';
import { TeaResumenPeriodo } from './tea-resumen-periodo';
import { IndicadorKpiPanel } from './indicador-kpi-panel';
import { IndicadorScreeningRoute } from './indicador-screening-route';
@@ -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,11 +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_TEA: readonly { id: DashboardSection; label: string }[] = SECTIONS_WITH_HISTORY.map(section =>
section.id === 'resumen' ? { ...section, label: 'Resumen' } : section.id === 'historico' ? { ...section, label: 'Trazabilidad' } : section);
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.
@@ -58,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]];
@@ -69,8 +70,9 @@ const SECTIONS_CAMA: readonly { id: DashboardSection; label: string }[] = [
styleUrl: './indicadores-page.scss',
})
export class IndicadoresPage {
get sections(): readonly { id: DashboardSection; label: string }[] {
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; }
@@ -391,7 +393,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));
@@ -440,7 +442,6 @@ export class IndicadoresPage {
}
return this.dominio === 'tea' ? items.filter(item => !TEA_FIGURAS_OPORTUNIDAD.includes(item.id)) : items;
});
readonly figuraClinicaPendiente = CACU_FIGURA_CLINICA_PENDIENTE;
// CaMa's confirmation rate closes its clinical section: a number card, pending while the catalog does not publish it.
readonly confirmacionCama = CAMA_CONFIRMACION_KPI;
get confirmacionCamaPendiente() { return !this.catalog().some(item => item.id === CAMA_CONFIRMACION_KPI.id); }