fix(cacu): ajustar trazabilidad y figuras disponibles #24
@@ -39,16 +39,13 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
const titulos = (selector: string) => [...root().querySelectorAll(selector + ' > *')]
|
||||
.map(e => e.tagName.toLowerCase().replace('app-indicador-', '') + ': ' + e.querySelector('h2')?.textContent?.trim());
|
||||
|
||||
it('las cinco figuras conservan su orden y las ausentes quedan como pendientes', () => {
|
||||
it('las figuras disponibles conservan su orden sin reservas vacías', () => {
|
||||
// Fails if a time figure changes place, if a missing indicator is drawn as a figure or if the published ones lose
|
||||
// the names of the request.
|
||||
abrir(CACU);
|
||||
expect(root().querySelector('.subsection-title')?.textContent).toBe('Tiempo de tamizaje a diagnóstico');
|
||||
expect(titulos('.kpi-section .catalog-grid')).toEqual([
|
||||
'catalog-card: Tiempo de toma de muestra a resultado de citología',
|
||||
'figura-pendiente: Tiempo de toma de muestra a resultado de VPH',
|
||||
'figura-pendiente: Tiempo de toma de muestra a resultado de colposcopía',
|
||||
'figura-pendiente: Tiempo de toma de muestra a resultado de biopsia',
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico']);
|
||||
});
|
||||
|
||||
@@ -68,7 +65,6 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
expect(root().querySelector('app-indicador-screening-route')).toBeNull();
|
||||
expect(titulos('.kpi-section .catalog-grid')).toEqual([
|
||||
'catalog-card: Tiempo de toma de muestra a resultado de citología',
|
||||
'figura-pendiente: Tiempo de toma de muestra a resultado de VPH',
|
||||
'catalog-card: Tiempo de toma de muestra a resultado de colposcopía',
|
||||
'catalog-card: Tiempo de toma de muestra a resultado de biopsia',
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico']);
|
||||
@@ -91,6 +87,20 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
expect(root().querySelector('.graphic-section app-indicador-figura-pendiente')).toBeNull();
|
||||
});
|
||||
|
||||
it('agrega la gráfica publicada de diagnóstico a tratamiento al final', () => {
|
||||
abrir([...CACU, item('cacu_dias_diagnostico_tratamiento', 'Tiempo de diagnóstico a tratamiento', 'C3r', ['fig_c3r_caja'])]);
|
||||
expect(titulos('.kpi-section .catalog-grid')).toEqual([
|
||||
'catalog-card: Tiempo de toma de muestra a resultado de citología',
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico',
|
||||
'catalog-card: Tiempo de diagnóstico a tratamiento']);
|
||||
});
|
||||
|
||||
it('conserva la ruta y muestra la gráfica publicada de diagnóstico a tratamiento', () => {
|
||||
abrir([...CACU, ...RUTA, item('cacu_dias_diagnostico_tratamiento', 'Tiempo de diagnóstico a tratamiento', 'C3r', ['fig_c3r_caja'])]);
|
||||
expect(root().querySelector('app-indicador-screening-route')).not.toBeNull();
|
||||
expect(titulos('.kpi-section .catalog-grid')).toEqual(['catalog-card: Tiempo de diagnóstico a tratamiento']);
|
||||
});
|
||||
|
||||
it('Datos y definiciones conserva todo el catálogo', () => {
|
||||
// Fails if moving the time figures or hiding figure-less indicators removes them from the definitions tab.
|
||||
abrir(CACU);
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('Histórico de CaCu', () => {
|
||||
const panelDe = (titulo: string) => paneles().find(p => p.querySelector('h2')?.textContent === titulo)!;
|
||||
const tituloDe = (id: string) => HISTORICO_CACU.find(p => p.id === id)!.titulo;
|
||||
const graficas = () => fixture.debugElement.queryAll(By.directive(ChartStub)).map(d => d.componentInstance as ChartStub);
|
||||
const graficaDe = (titulo: string) => graficas().find(g => g.label?.startsWith('Histórico de ' + titulo))!;
|
||||
const graficaDe = (titulo: string) => graficas().find(g => g.label?.startsWith('Trazabilidad de ' + titulo))!;
|
||||
|
||||
it('no pide nada hasta que la pestaña está activa, y entonces solo las medidas activas', () => {
|
||||
// Fails if the tab loads data while hidden, or asks for a reserved panel because the catalog publishes it.
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('Pestaña Histórico', () => {
|
||||
// Fails if CaCu loses its history tab or gains CaMa's analysis tab.
|
||||
abrir('cama', []);
|
||||
abrir('cacu', [item('cacu_x', 'C2')]);
|
||||
expect(tabs()).toEqual(['Indicadores', 'Histórico', 'Análisis de riesgos', 'Datos y definiciones']);
|
||||
expect(tabs()).toEqual(['Indicadores', 'Trazabilidad', 'Análisis de riesgos', 'Datos y definiciones']);
|
||||
expect(root().querySelector('#panel-historico')).not.toBeNull();
|
||||
expect(root().querySelector('#panel-analisis')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -117,13 +117,13 @@ function ordenar(paneles: Panel[], orden: readonly string[]): Panel[] {
|
||||
<div class="pasos">
|
||||
@for (paso of pasos; track paso.titulo) {
|
||||
<section><h3>{{ paso.titulo }}</h3>
|
||||
<app-plotly-chart [style.--plot-height]="'340px'" [showNotes]="false" [figure]="paso.figura.figure" [label]="'Histórico de ' + paso.titulo + (panel.rango ? ', ' + panel.rango : '')" />
|
||||
<app-plotly-chart [style.--plot-height]="'340px'" [showNotes]="false" [figure]="paso.figura.figure" [label]="(dominio() === 'cacu' ? 'Trazabilidad de ' : 'Histórico de ') + paso.titulo + (panel.rango ? ', ' + panel.rango : '')" />
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<app-plotly-chart [style.--plot-height]="'400px'" [showNotes]="false" [figure]="panel.figura.figure"
|
||||
[label]="'Histórico de ' + panel.item.titulo + (panel.rango ? ', ' + panel.rango : '')" />
|
||||
[label]="(dominio() === 'cacu' ? 'Trazabilidad de ' : 'Histórico de ') + panel.item.titulo + (panel.rango ? ', ' + panel.rango : '')" />
|
||||
}
|
||||
@if (panel.figura.comoLeer) { <p class="nota">{{ panel.figura.comoLeer }}</p> }
|
||||
@if (panel.figura.suprimidos.length) {
|
||||
|
||||
@@ -66,17 +66,16 @@ export const KPI_RESUMEN_TEA: KpiDefinition[] = [
|
||||
export const TEA_FIGURAS_OPORTUNIDAD: readonly string[] = ['M26_dias_mchat_ados2', 'M27_dias_ados2_diagnostico', 'M25_dias_mchat_diagnostico'];
|
||||
export const TEA_FIGURAS_CLINICAS: readonly string[] = ['M23_pacientes_evaluados', 'M24_confirmacion_diagnostico', 'M21_diagnosticados_con_eeg',
|
||||
'M22_diagnosticados_sin_eeg', 'M28_casos_por_estado', 'M29_calidad_eeg'];
|
||||
// CaCu's figures under «Indicadores de oportunidad» (section «Tiempo de tamizaje a diagnóstico») in display order. A slot
|
||||
// with no `id` has no published indicator yet and draws as pending; `titulo` is the name the page gives the figure.
|
||||
// CaCu's available figures in display order; titles are assigned when the catalog publishes them.
|
||||
export interface FiguraOportunidad { id?: string; titulo: string; }
|
||||
export const CACU_FIGURAS_OPORTUNIDAD: readonly FiguraOportunidad[] = [
|
||||
{ id: 'cacu_eu_tiempo_reporte', titulo: 'Tiempo de toma de muestra a resultado de citología' },
|
||||
{ titulo: 'Tiempo de toma de muestra a resultado de VPH' },
|
||||
{ id: 'cacu_dias_toma_colposcopia', titulo: 'Tiempo de toma de muestra a resultado de colposcopía' },
|
||||
{ id: 'cacu_dias_toma_biopsia', titulo: 'Tiempo de toma de muestra a resultado de biopsia' },
|
||||
{ id: 'cacu_dias_toma_diagnostico', titulo: 'Tiempo de toma de muestra a diagnóstico' },
|
||||
{ id: 'cacu_dias_diagnostico_tratamiento', titulo: 'Tiempo de diagnóstico a tratamiento' },
|
||||
];
|
||||
// CaMa's five times of «Tiempo de tamizaje a diagnóstico», in the order of the request. Same rules as CaCu's: an entry
|
||||
// CaMa's five times of «Tiempo de tamizaje a diagnóstico», in the order of the request. An entry
|
||||
// with no `id` has no published indicator yet and draws as pending.
|
||||
export const CAMA_FIGURAS_OPORTUNIDAD: readonly FiguraOportunidad[] = [
|
||||
{ id: 'cama_eu38a', titulo: 'Tiempo de toma de mastografía a interpretación radiológica' },
|
||||
|
||||
@@ -47,6 +47,7 @@ const SECTIONS: readonly { id: DashboardSection; label: string }[] = [
|
||||
// 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]];
|
||||
// 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.
|
||||
@@ -67,7 +68,7 @@ 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.conHistorico ? SECTIONS_WITH_HISTORY : SECTIONS; }
|
||||
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 conHistorico() { return this.dominio === 'tea' || historicoDeDominio(this.dominio) !== undefined; }
|
||||
get conAnalisis() { return CAMA_ANALYSIS_ENABLED && this.dominio === 'cama'; }
|
||||
readonly activeSection = signal<DashboardSection>('resumen');
|
||||
@@ -423,12 +424,12 @@ export class IndicadoresPage {
|
||||
return item ? { item: { ...item, titulo: figura.titulo }, titulo: figura.titulo } : { titulo: figura.titulo };
|
||||
});
|
||||
}
|
||||
// With the screening route chart, CaCu has no separate time figures: the chart shows every time from the sample to
|
||||
// each event. Without it (the catalog lacks one of its measures) the times keep their figures.
|
||||
if (this.dominio !== 'cacu' || !this.catalog().length || this.screeningRouteAvailable) return [];
|
||||
return CACU_FIGURAS_OPORTUNIDAD.map(figura => {
|
||||
const item = figura.id ? items.find(candidate => candidate.id === figura.id) : undefined;
|
||||
return item ? { item, titulo: item.titulo } : { titulo: figura.titulo };
|
||||
// Preserve the route chart; individual figures require a published figure contract.
|
||||
if (this.dominio !== 'cacu' || !this.catalog().length) 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 }] : [];
|
||||
});
|
||||
});
|
||||
readonly clinicosItems = computed(() => {
|
||||
|
||||
@@ -163,7 +163,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
|
||||
http.expectOne('/' + dominio + '/indicadores').flush([]); await e.asentar();
|
||||
expect(e.page.seleccionSeguimiento()).toBeUndefined();
|
||||
expect(Array.from(e.root.querySelectorAll('[role="tab"]')).map(t => t.textContent?.trim())).toEqual(
|
||||
['Indicadores', 'Histórico', 'Análisis de riesgos', 'Datos y definiciones']);
|
||||
['Indicadores', dominio === 'cacu' ? 'Trazabilidad' : 'Histórico', 'Análisis de riesgos', 'Datos y definiciones']);
|
||||
expect(e.root.querySelector('#panel-analisis')).toBeNull();
|
||||
}
|
||||
e.page.changeDominio('cama'); e.harness.detectChanges();
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('Secciones compartidas por dominio', () => {
|
||||
const root = harness.routeNativeElement!;
|
||||
const tabs = Array.from(root.querySelectorAll<HTMLButtonElement>('[role="tab"]'));
|
||||
// TEA, CaMa and CaCu have Histórico; the follow-up tab is named Análisis de riesgos in every domain.
|
||||
const esperadas = ['Indicadores', 'Histórico', 'Análisis de riesgos', 'Datos y definiciones'];
|
||||
const esperadas = ['Indicadores', domain === 'cacu' ? 'Trazabilidad' : 'Histórico', 'Análisis de riesgos', 'Datos y definiciones'];
|
||||
expect(tabs.map(t => t.textContent?.trim())).toEqual(esperadas);
|
||||
expect(tabs.map(t => t.getAttribute('aria-selected'))).toEqual(esperadas.map((_, i) => String(i === 0)));
|
||||
const tab = (id: string) => tabs.find(t => t.id === 'tab-' + id)!;
|
||||
|
||||
Reference in New Issue
Block a user