CaCu page: the times to treatment are real cards again (the strip's hiding is what was reverted)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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.'),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
@if (resumen) { <app-tea-resumen-periodo [periodo]="resumen" [paneles]="kpiPanels()" /> }
|
||||
<!-- With the summary the panels keep loading the data, but their cards are not shown. -->
|
||||
<div class="kpi-grid" [class.kpi-grid-oculto]="resumen" [style.--kpi-count]="kpis.length + (dominio === 'cacu' ? 2 : dominio === 'cama' ? 1 : 0)">
|
||||
<div class="kpi-grid" [class.kpi-grid-oculto]="resumen" [style.--kpi-count]="kpis.length + (dominio === 'cama' ? 1 : 0)">
|
||||
@for (card of kpis; track dominio + ':' + card.definition.id) {
|
||||
@if (card.pending) {
|
||||
<app-indicador-kpi-card [title]="card.definition.title" state="Integración pendiente"
|
||||
@@ -62,10 +62,7 @@
|
||||
[applied]="filters?.applied" [availability]="availability()" [initialPresentation]="false" />
|
||||
}
|
||||
}
|
||||
@if (dominio === 'cacu') {
|
||||
<app-indicador-kpi-card title="Tiempo de tamizaje a tratamiento" state="Indicador no disponible" />
|
||||
<app-indicador-kpi-card title="Tiempo de diagnóstico a tratamiento" state="Indicador no disponible" />
|
||||
} @else if (dominio === 'cama') {
|
||||
@if (dominio === 'cama') {
|
||||
<app-indicador-kpi-card title="Tiempo de diagnóstico a tratamiento" state="Indicador no disponible"
|
||||
additionalInfo="Este indicador aún no está publicado por el catálogo institucional." />
|
||||
}
|
||||
|
||||
@@ -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, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, KpiCardSlot, camaKpiCards } from './indicadores-kpi';
|
||||
import { CACU_RESULTADO_KPI, CACU_TRATAMIENTO_KPIS, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, KpiCardSlot, cacuPendingKpiCards, camaKpiCards } from './indicadores-kpi';
|
||||
import { TeaResumenPeriodo } from './tea-resumen-periodo';
|
||||
import { IndicadorKpiPanel } from './indicador-kpi-panel';
|
||||
import { IndicadorScreeningRoute } from './indicador-screening-route';
|
||||
@@ -342,7 +342,10 @@ export class IndicadoresPage {
|
||||
return this.dominio === 'cacu' && ROUTE_IDS.every(id => this.catalog().some(item => item.id === id));
|
||||
}
|
||||
// How many indicators the graphic section shows: all the catalog, except in CaMa, which draws only some of them.
|
||||
get availableKpis() { return this.kpisByDomain[this.dominio].filter(definition => this.catalog().some(item => item.id === definition.id)); }
|
||||
get availableKpis() {
|
||||
const definitions = this.dominio === 'cacu' ? [...this.kpisByDomain.cacu, ...CACU_TRATAMIENTO_KPIS] : this.kpisByDomain[this.dominio];
|
||||
return definitions.filter(definition => this.catalog().some(item => item.id === definition.id));
|
||||
}
|
||||
// TEA shows a summary paragraph instead of its cards for exactly one explicitly chosen period.
|
||||
get teaResumenPeriodo(): string | undefined {
|
||||
const selection = this.filters?.applied.selection;
|
||||
@@ -359,7 +362,8 @@ export class IndicadoresPage {
|
||||
// What the KPI grid draws. CaMa adds explicit pending cards for opportunity indicators the catalog does not publish.
|
||||
get kpiCards(): KpiCardSlot[] {
|
||||
if (this.dominio === 'cama') return camaKpiCards(id => this.catalog().some(item => item.id === id));
|
||||
return this.opportunityKpis.map(definition => ({ definition, pending: false }));
|
||||
const cards = this.opportunityKpis.map(definition => ({ definition, pending: false }));
|
||||
return this.dominio === 'cacu' ? [...cards, ...cacuPendingKpiCards(cards.map(card => card.definition.id))] : cards;
|
||||
}
|
||||
private readonly catalogRequests = new Subject<void>();
|
||||
readonly catalog = signal<Indicador[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user