diff --git a/src/app/features/indicadores/indicador-kpi-panel.spec.ts b/src/app/features/indicadores/indicador-kpi-panel.spec.ts
index 429e79c..9e5ede1 100644
--- a/src/app/features/indicadores/indicador-kpi-panel.spec.ts
+++ b/src/app/features/indicadores/indicador-kpi-panel.spec.ts
@@ -187,7 +187,7 @@ describe('KPI integración con autoridad global', () => {
expect(cards.map(card => card.querySelector('.value')?.firstChild?.textContent?.trim())).toEqual(['5', undefined, '7', undefined, undefined]);
expect(cards.map(card => card.querySelector('.value span')?.textContent.trim())).toEqual(['pacientes', undefined, 'días (mediana)', undefined, undefined]);
expect(cards.map(card => card.querySelector('.kpi-state')?.textContent.trim())).toEqual(domain === 'cacu'
- ? ['Disponible', 'Selección no consolidable', 'Disponible', 'Indicador no disponible', 'Indicador no disponible']
+ ? ['Disponible', 'Selección no consolidable', 'Disponible', 'Integración pendiente', 'Integración pendiente']
: ['Disponible', 'Integración pendiente', 'Disponible', 'Integración pendiente', 'Indicador no disponible']);
expect(cards.map(card => card.textContent)).toEqual(expect.arrayContaining([
expect.stringContaining(domain === 'cacu' ? '5 citologías; primer cuartil: 3 días; tercer cuartil: 9 días.' : '5 mastografías; Q1 a Q3: 3 a 9 días.'),
diff --git a/src/app/features/indicadores/indicadores-cacu-final.spec.ts b/src/app/features/indicadores/indicadores-cacu-final.spec.ts
index bc3a893..acaf5ff 100644
--- a/src/app/features/indicadores/indicadores-cacu-final.spec.ts
+++ b/src/app/features/indicadores/indicadores-cacu-final.spec.ts
@@ -87,8 +87,8 @@ describe('CaCu: oportunidad y selección independiente de todos los reportes', (
'Pacientes evaluadas', 'Días de toma a resultado', 'Tiempo de tamizaje a diagnóstico', 'Tiempo de tamizaje a tratamiento', 'Tiempo de diagnóstico a tratamiento',
]);
for (const kpi of kpis.slice(3)) {
- expect(kpi.querySelectorAll('p')).toHaveLength(1);
- expect(kpi.querySelector('p')?.textContent).toBe('Indicador no disponible');
+ expect(kpi.querySelector('.kpi-state')?.textContent?.trim()).toBe('Integración pendiente');
+ expect(kpi.textContent).toContain('aún no está publicado');
}
expect(root.querySelector('.kpi-grid')?.getAttribute('style')).toContain('--kpi-count: 5');
expect(fixture.debugElement.queryAll(By.directive(IndicadorKpiPanel))).toHaveLength(3);
diff --git a/src/app/features/indicadores/indicadores-kpi-resultado.spec.ts b/src/app/features/indicadores/indicadores-kpi-resultado.spec.ts
index c41e96c..7ce6983 100644
--- a/src/app/features/indicadores/indicadores-kpi-resultado.spec.ts
+++ b/src/app/features/indicadores/indicadores-kpi-resultado.spec.ts
@@ -130,7 +130,8 @@ describe('P0-C.1: cinco tarjetas de oportunidad', () => {
expect(cards.map(c => c.querySelector('.value')?.firstChild?.textContent?.trim())).toEqual(['20', '12', '52', undefined, undefined]);
expect(cards.map(c => c.querySelector('.value span')?.textContent)).toEqual(['pacientes', 'días (mediana)', 'días (mediana)', undefined, undefined]);
for (const card of cards.slice(3)) {
- expect(card.querySelectorAll('p')).toHaveLength(1); expect(card.querySelector('p')!.textContent).toBe('Indicador no disponible');
+ expect(card.querySelector('.kpi-state')?.textContent?.trim()).toBe('Integración pendiente');
+ expect(card.textContent).toContain('aún no está publicado');
}
http.expectNone(() => true);
} finally { f.destroy(); vi.unstubAllGlobals(); http.verify(); }
diff --git a/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts b/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts
index 9b6b3f4..83a991a 100644
--- a/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts
+++ b/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts
@@ -1,12 +1,22 @@
-// What this module covers: CaCu's two times to treatment: their ids from the API's measures.
+// What this module covers: CaCu's two times to treatment: their ids from the API's measures, and their cards, which wait
+// as pending until the catalog publishes them and then give way to the real ones.
import { CACU_MEASURE_IDS } from './indicadores-cacu-fhir';
-
+import { CACU_TRATAMIENTO_KPIS, cacuPendingKpiCards } from './indicadores-kpi';
describe('Tiempos a tratamiento de CaCu', () => {
it('las medidas del API se traducen a los ids de la web, sin quedar en mayúsculas', () => {
// Fails if a measure is missing from the map: it would reach the page as CACU_DIAS_TOMA_TRATAMIENTO.
expect(CACU_MEASURE_IDS['CACU-DIAS-TOMA-TRATAMIENTO']).toBe('cacu_dias_toma_tratamiento');
expect(CACU_MEASURE_IDS['CACU-DIAS-DIAGNOSTICO-TRATAMIENTO']).toBe('cacu_dias_diagnostico_tratamiento');
-
+ expect(CACU_TRATAMIENTO_KPIS.map(k => k.id)).toEqual(['cacu_dias_toma_tratamiento', 'cacu_dias_diagnostico_tratamiento']);
+ });
+ it('sin ninguna tarjeta dibujada no se agrega nada', () => {
+ expect(cacuPendingKpiCards([])).toEqual([]);
+ });
+ it('las que el catálogo aún no publica quedan pendientes, y las publicadas ya no', () => {
+ expect(cacuPendingKpiCards(['cacu_eu7']).map(c => [c.definition.id, c.pending])).toEqual([
+ ['cacu_dias_toma_tratamiento', true], ['cacu_dias_diagnostico_tratamiento', true]]);
+ expect(cacuPendingKpiCards(['cacu_eu7', 'cacu_dias_toma_tratamiento']).map(c => c.definition.id)).toEqual(['cacu_dias_diagnostico_tratamiento']);
+ expect(cacuPendingKpiCards(['cacu_eu7', ...CACU_TRATAMIENTO_KPIS.map(k => k.id)])).toEqual([]);
});
});
diff --git a/src/app/features/indicadores/indicadores-kpi.ts b/src/app/features/indicadores/indicadores-kpi.ts
index b2c40b6..16c2f63 100644
--- a/src/app/features/indicadores/indicadores-kpi.ts
+++ b/src/app/features/indicadores/indicadores-kpi.ts
@@ -79,6 +79,16 @@ export function camaKpiCards(published: (id: string) => boolean): KpiCardSlot[]
const cards = CAMA_OPORTUNIDAD_KPIS.map(definition => ({ definition, pending: !published(definition.id) }));
return cards.some(card => !card.pending) ? cards : [];
}
+// CaCu's two times to treatment stay outside KPI_BY_DOMAIN: they are queried only once the catalog publishes them, and
+// keep their cards, pending, until then. Nothing is added until some other card is drawn.
+export const CACU_TRATAMIENTO_KPIS: KpiDefinition[] = [
+ { id: 'cacu_dias_toma_tratamiento', title: 'Tiempo de tamizaje a tratamiento', contrato: 'C3r', unit: 'días (mediana)' },
+ { id: 'cacu_dias_diagnostico_tratamiento', title: 'Tiempo de diagnóstico a tratamiento', contrato: 'C3r', unit: 'días (mediana)' },
+];
+export function cacuPendingKpiCards(drawn: readonly string[]): KpiCardSlot[] {
+ if (!drawn.length) return [];
+ return CACU_TRATAMIENTO_KPIS.filter(definition => !drawn.includes(definition.id)).map(definition => ({ definition, pending: true }));
+}
// Published CaMa indicators whose card the summary does not draw.
// The summary draws the paired card and the histopathology card; the rest of CaMa's indicators are in Histórico
// and in Datos y definiciones, which still list the whole catalog.
diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html
index b03db42..7961ceb 100644
--- a/src/app/features/indicadores/indicadores-page.html
+++ b/src/app/features/indicadores/indicadores-page.html
@@ -52,7 +52,7 @@
@if (resumen) {