feat(cacu): presentar KPI provisionales de tiempo a tratamiento
Adapta 245622b a las secciones de oportunidad del PR #20 y reutiliza el contrato C3r. Conserva la ruta y los paneles reservados del Histórico.
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.'),
|
||||
|
||||
@@ -19,8 +19,8 @@ interface KpiDisplay extends KpiResult { period?: string; earlier?: boolean; ver
|
||||
imports: [IndicadorKpiCard, MatButtonModule],
|
||||
template: `<app-indicador-kpi-card [title]="definition.title" [value]="result().value" [unit]="definition.unit"
|
||||
[state]="result().state" [additionalInfo]="result().info" [temporalReference]="temporalReference"
|
||||
[loading]="result().loading ?? false" [notes]="dominio === 'tea' ? result().notes ?? [] : []" [quietWhenAvailable]="true"
|
||||
[showPeriod]="false" />
|
||||
[loading]="result().loading ?? false" [notes]="notes" [quietWhenAvailable]="true"
|
||||
[showPeriod]="showPeriod" />
|
||||
@if (result().state === 'Error de consulta') {
|
||||
<button type="button" mat-stroked-button (click)="retry()" [attr.aria-label]="'Reintentar ' + definition.title">Reintentar consulta</button>
|
||||
}`,
|
||||
@@ -37,6 +37,7 @@ export class IndicadorKpiPanel implements OnChanges {
|
||||
@Input() applied?: GlobalApplied;
|
||||
@Input() availability?: PeriodAvailability;
|
||||
@Input() initialPresentation = false;
|
||||
@Input() showPeriod = false;
|
||||
private readonly queries = inject(IndicadoresKpiQueries);
|
||||
private readonly snapshots = inject(IndicadoresSnapshots);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
@@ -44,6 +45,10 @@ export class IndicadorKpiPanel implements OnChanges {
|
||||
private key = '';
|
||||
readonly usedPeriod = signal<string | undefined>(undefined);
|
||||
readonly result = signal<KpiDisplay>({ state: 'Esperando catálogo' });
|
||||
get notes(): string[] {
|
||||
const notes = this.dominio === 'tea' ? this.result().notes ?? [] : [];
|
||||
return this.definition.note ? [this.definition.note, ...notes] : notes;
|
||||
}
|
||||
get temporalReference() {
|
||||
if (this.result().earlier) return 'Último dato visible, ' + this.usedPeriod();
|
||||
return this.usedPeriod() ?? (this.applied ? describePeriods(this.applied.tipo, this.applied.selection) : 'Sin filtro aplicado');
|
||||
|
||||
@@ -8,10 +8,12 @@ export const CACU_MEASURE_IDS: Readonly<Record<string, string>> = {
|
||||
'CACU-CONFIRMACION-CITOLOGIA': 'cacu_confirmacion_citologia',
|
||||
'CACU-DIAS-BIOPSIA-DIAGNOSTICO': 'cacu_dias_biopsia_diagnostico',
|
||||
'CACU-DIAS-COLPOSCOPIA-BIOPSIA': 'cacu_dias_colposcopia_biopsia',
|
||||
'CACU-DIAS-DIAGNOSTICO-TRATAMIENTO': 'cacu_dias_diagnostico_tratamiento',
|
||||
'CACU-DIAS-RESULTADO-COLPOSCOPIA': 'cacu_dias_resultado_colposcopia',
|
||||
'CACU-DIAS-TOMA-BIOPSIA': 'cacu_dias_toma_biopsia',
|
||||
'CACU-DIAS-TOMA-COLPOSCOPIA': 'cacu_dias_toma_colposcopia',
|
||||
'CACU-DIAS-TOMA-DIAGNOSTICO': 'cacu_dias_toma_diagnostico',
|
||||
'CACU-DIAS-TOMA-TRATAMIENTO': 'cacu_dias_toma_tratamiento',
|
||||
'CACU-EU-TIEMPO-REPORTE': 'cacu_eu_tiempo_reporte',
|
||||
'CACU-EU13': 'cacu_eu13',
|
||||
'CACU-EU7': 'cacu_eu7',
|
||||
|
||||
@@ -88,8 +88,9 @@ describe('CaCu: oportunidad y selección independiente de todos los reportes', (
|
||||
'Pacientes evaluadas', 'Tiempo desde la toma de muestra al 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(kpi.querySelector('.value, .period')).toBeNull();
|
||||
}
|
||||
expect(root.querySelector('.kpi-grid')?.getAttribute('style')).toContain('--kpi-count: 5');
|
||||
expect(fixture.debugElement.queryAll(By.directive(IndicadorKpiPanel))).toHaveLength(3);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Covers how the Indicadores tab arranges CaCu's figures: the six times of «Tiempo de tamizaje a diagnóstico» under
|
||||
// Covers how the Indicadores tab arranges CaCu's figures: the five times of «Tiempo de tamizaje a diagnóstico» under
|
||||
// «Indicadores de oportunidad» (pending where the catalog publishes nothing) and the clinical figures with the
|
||||
// pending «Progresión por grupo de riesgo». Fixtures: a CaCu catalog shaped like /cacu/indicadores.
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
@@ -40,7 +40,7 @@ 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('los seis tiempos van en su orden; los no publicados quedan como pendientes', () => {
|
||||
it('las cinco figuras conservan su orden y las ausentes quedan como pendientes', () => {
|
||||
// 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);
|
||||
@@ -50,8 +50,7 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
'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',
|
||||
'figura-pendiente: Tiempo de diagnóstico a tratamiento']);
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico']);
|
||||
});
|
||||
|
||||
it('con la ruta del tamizaje la gráfica dibuja colposcopía y biopsia y no hay una segunda tarjeta ni una pendiente', () => {
|
||||
@@ -61,8 +60,7 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
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 diagnóstico',
|
||||
'figura-pendiente: Tiempo de diagnóstico a tratamiento']);
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico']);
|
||||
expect(root().querySelector('app-indicador-screening-route')).not.toBeNull();
|
||||
expect(titulos('.graphic-section .catalog-grid')).toEqual([
|
||||
'catalog-card: Distribución de resultados citológicos', 'catalog-card: Tasa de confirmación histopatológica',
|
||||
@@ -78,8 +76,7 @@ describe('Indicadores de CaCu: tiempos de oportunidad y figuras clínicas', () =
|
||||
'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',
|
||||
'figura-pendiente: Tiempo de diagnóstico a tratamiento']);
|
||||
'catalog-card: Tiempo de toma de muestra a diagnóstico']);
|
||||
});
|
||||
|
||||
it('el resultado de laboratorio se llama «Tiempo desde la toma de muestra al resultado»', () => {
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ActivatedRoute, provideRouter } from '@angular/router';
|
||||
import { datosDeReportes, indicadorDeMeasure, Measure, Report } from './indicadores-fhir';
|
||||
import { CACU_TRATAMIENTO_KPIS, kpiResult } from './indicadores-kpi';
|
||||
import { GlobalApplied, IndicadoresMemory } from './indicadores-memory';
|
||||
import { IndicadoresPage } from './indicadores-page';
|
||||
|
||||
const PERIOD = '2025-S2';
|
||||
const applied: GlobalApplied = { tipo: 'semestre', selection: { mode: 'explicit', periodos: [PERIOD] }, revision: 1 };
|
||||
const measure = (id: string): Measure => ({
|
||||
resourceType: 'Measure', id, title: id, extension: [
|
||||
{ url: 'contrato', valueCode: 'C3r' },
|
||||
{ url: 'tipos-periodo', valueCode: 'semestre' },
|
||||
{ url: 'figuras', valueString: 'fig_c3r_caja' },
|
||||
],
|
||||
});
|
||||
const report = (median: number, q1: number, q3: number, n: number): Report => ({
|
||||
resourceType: 'MeasureReport', period: { start: '2025-07-01', end: '2025-12-31' },
|
||||
group: [{
|
||||
code: { coding: [{ code: 'TOTAL' }] },
|
||||
population: [{ code: { coding: [{ code: 'measure-observation' }] }, count: n }],
|
||||
measureScore: { value: median, unit: 'd', extension: [
|
||||
{ url: 'q1', valueDecimal: q1 },
|
||||
{ url: 'q3', valueDecimal: q3 },
|
||||
] },
|
||||
}],
|
||||
});
|
||||
|
||||
describe('KPI de tratamiento de CaCu', () => {
|
||||
it.each([
|
||||
['CACU-DIAS-TOMA-TRATAMIENTO', 'cacu_dias_toma_tratamiento', 21.5, 8.25, 33.75, 12],
|
||||
['CACU-DIAS-DIAGNOSTICO-TRATAMIENTO', 'cacu_dias_diagnostico_tratamiento', 7.75, 2.5, 14, 9],
|
||||
] as const)('mapea %s y conserva los valores C3r publicados', (fhirId, id, median, q1, q3, n) => {
|
||||
const fhirMeasure = measure(fhirId);
|
||||
const definition = CACU_TRATAMIENTO_KPIS.find(kpi => kpi.id === id)!;
|
||||
expect(indicadorDeMeasure(fhirMeasure)).toMatchObject({ id, contrato: 'C3r' });
|
||||
const data = datosDeReportes(fhirMeasure, [report(median, q1, q3, n)], 'semestre');
|
||||
expect(kpiResult(data, definition, 'cacu', applied)).toEqual({
|
||||
state: 'Disponible', value: median,
|
||||
info: `${n} observaciones. Primer cuartil de ${q1} días y tercer cuartil de ${q3} días.`,
|
||||
});
|
||||
});
|
||||
|
||||
it('distingue una mediana publicada de cero días de la ausencia de observaciones o la supresión', () => {
|
||||
const fhirMeasure = measure('CACU-DIAS-TOMA-TRATAMIENTO');
|
||||
const definition = CACU_TRATAMIENTO_KPIS[0];
|
||||
const empty = datosDeReportes(fhirMeasure, [report(0, 0, 0, 0)], 'semestre');
|
||||
expect(kpiResult(empty, definition, 'cacu', applied)).toEqual({ state: 'Sin valor disponible' });
|
||||
const published = datosDeReportes(fhirMeasure, [report(0, 0, 0, 1)], 'semestre');
|
||||
expect(kpiResult(published, definition, 'cacu', applied).value).toBe(0);
|
||||
const suppressed = { ...published, filas: [{ ...published.filas[0], suprimido: 1 }] };
|
||||
expect(kpiResult(suppressed, definition, 'cacu', applied)).toEqual({ state: 'Dato oculto por tamaño' });
|
||||
});
|
||||
|
||||
it('presenta una sola tarjeta por medida con publicación parcial y conserva el periodo del dato', () => {
|
||||
TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting(), provideRouter([]),
|
||||
{ provide: ActivatedRoute, useValue: { snapshot: { data: { dominio: 'cacu' } } } }] });
|
||||
TestBed.inject(IndicadoresMemory).finishInitialKpiPresentation('cacu');
|
||||
const fixture = TestBed.createComponent(IndicadoresPage), http = TestBed.inject(HttpTestingController);
|
||||
const fhirMeasure = measure('CACU-DIAS-DIAGNOSTICO-TRATAMIENTO');
|
||||
const { id } = indicadorDeMeasure(fhirMeasure);
|
||||
try {
|
||||
http.expectOne('/cacu/indicadores').flush([indicadorDeMeasure(fhirMeasure)]);
|
||||
http.expectOne(`/cacu/indicadores/${id}/periodos`).flush({ id, periodos: [{ periodo: PERIOD, tipo: 'semestre' }] });
|
||||
fixture.detectChanges();
|
||||
const request = http.expectOne(r => r.url === `/cacu/indicadores/${id}/datos`);
|
||||
expect(request.request.params.get('periodos')).toBe(PERIOD);
|
||||
request.flush(datosDeReportes(fhirMeasure, [report(7.75, 2.5, 14, 9)], 'semestre'));
|
||||
fixture.detectChanges();
|
||||
const root = fixture.nativeElement as HTMLElement;
|
||||
const cards = [...root.querySelectorAll('.kpi-grid app-indicador-kpi-card')];
|
||||
expect(cards.map(card => card.querySelector('h3')?.textContent)).toEqual([
|
||||
'Tiempo de tamizaje a tratamiento', 'Tiempo de diagnóstico a tratamiento',
|
||||
]);
|
||||
expect(cards[0].querySelector('.kpi-state')?.textContent).toBe('Integración pendiente');
|
||||
expect(cards[0].querySelector('.value')).toBeNull();
|
||||
expect(cards[1].querySelector('.value')?.firstChild?.textContent).toBe('7.75');
|
||||
expect(cards[1].querySelector('.period')?.textContent).toContain(PERIOD);
|
||||
expect(cards[1].textContent).toContain('El evento de tratamiento se infiere de notas clínicas');
|
||||
expect(root.querySelector('.kpi-section .catalog-grid')?.textContent).not.toContain('diagnóstico a tratamiento');
|
||||
expect(root.querySelector('.graphic-section app-indicador-catalog-card')).toBeNull();
|
||||
http.expectNone(() => true);
|
||||
} finally {
|
||||
fixture.destroy();
|
||||
http.verify();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -8,6 +8,8 @@ export interface KpiDefinition {
|
||||
c1Info?: (numerador: number, denominador: number) => string;
|
||||
// C3r only: a median over zero observations is no value, not zero days.
|
||||
requiresObservations?: boolean;
|
||||
c3rInfo?: (n: number, q1: number, q3: number) => string;
|
||||
note?: string;
|
||||
// C2 only: replaces the domain's explanatory line when the unit counted is not the domain's usual one.
|
||||
c2Info?: string;
|
||||
}
|
||||
@@ -15,6 +17,18 @@ export interface KpiDefinition {
|
||||
export const CACU_RESULTADO_KPI: KpiDefinition = {
|
||||
id: 'cacu_eu_tiempo_reporte', title: 'Tiempo desde la toma de muestra al resultado', contrato: 'C3r', unit: 'días (mediana)', singleAppliedPeriod: true,
|
||||
};
|
||||
const CACU_TRATAMIENTO_C3R = {
|
||||
contrato: 'C3r',
|
||||
unit: 'días (mediana)',
|
||||
requiresObservations: true,
|
||||
c3rInfo: (n, q1, q3) => `${n} ${n === 1 ? 'observación' : 'observaciones'}. Primer cuartil de ${q1} días y tercer cuartil de ${q3} días.`,
|
||||
note: 'Indicador provisional. El evento de tratamiento se infiere de notas clínicas, sin confirmación de que se realizó.',
|
||||
} satisfies Omit<KpiDefinition, 'id' | 'title'>;
|
||||
|
||||
export const CACU_TRATAMIENTO_KPIS: readonly KpiDefinition[] = [
|
||||
{ ...CACU_TRATAMIENTO_C3R, id: 'cacu_dias_toma_tratamiento', title: 'Tiempo de tamizaje a tratamiento' },
|
||||
{ ...CACU_TRATAMIENTO_C3R, id: 'cacu_dias_diagnostico_tratamiento', title: 'Tiempo de diagnóstico a tratamiento' },
|
||||
];
|
||||
export const CAMA_TAMIZAJE_RESULTADO_KPI: KpiDefinition = {
|
||||
id: 'cama_eu38a', title: 'Tiempo de toma de mastografía a interpretación radiológica', contrato: 'C3r', unit: 'días (mediana)', requiresObservations: true,
|
||||
};
|
||||
@@ -62,7 +76,6 @@ export const CACU_FIGURAS_OPORTUNIDAD: readonly FiguraOportunidad[] = [
|
||||
{ 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' },
|
||||
{ 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
|
||||
// with no `id` has no published indicator yet and draws as pending.
|
||||
@@ -186,5 +199,5 @@ export function kpiResult(data: IndicadorDatos, definition: KpiDefinition, domai
|
||||
numerador: numerator, denominador: denominator };
|
||||
}
|
||||
if (!finite(row['mediana']) || !count(row['n']) || ((definition.id === CACU_RESULTADO_KPI.id || definition.requiresObservations) && row['n'] === 0) || !finite(row['q1']) || !finite(row['q3']) || row['q1'] < 0 || row['q1'] > row['mediana'] || row['mediana'] > row['q3'] || row['unidad'] !== 'dias') return empty;
|
||||
return { state: 'Disponible', value: row['mediana'], info: C3R_INFO[domain](row['n'], row['q1'], row['q3']) };
|
||||
return { state: 'Disponible', value: row['mediana'], info: (definition.c3rInfo ?? C3R_INFO[domain])(row['n'], row['q1'], row['q3']) };
|
||||
}
|
||||
|
||||
@@ -52,20 +52,18 @@
|
||||
</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"
|
||||
additionalInfo="Este indicador aún no está publicado por el catálogo institucional." />
|
||||
} @else {
|
||||
<app-indicador-kpi-panel [dominio]="dominio" [definition]="card.definition" [indicador]="kpiIndicator(card.definition.id)"
|
||||
[applied]="filters?.applied" [availability]="availability()" [initialPresentation]="false" />
|
||||
[applied]="filters?.applied" [availability]="availability()" [initialPresentation]="false"
|
||||
[showPeriod]="filters?.applied.selection.mode === 'todos' && esKpiTratamientoCacu(card.definition.id)" />
|
||||
}
|
||||
}
|
||||
@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, 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, CACU_FIGURA_CLINICA_PENDIENTE, 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';
|
||||
@@ -363,11 +363,15 @@ export class IndicadoresPage {
|
||||
return [...definitions.slice(0, diagnosis < 0 ? definitions.length : diagnosis), CACU_RESULTADO_KPI,
|
||||
...definitions.slice(diagnosis < 0 ? definitions.length : diagnosis)];
|
||||
}
|
||||
// What the KPI grid draws. CaMa adds explicit pending cards for opportunity indicators the catalog does not publish.
|
||||
// CaCu's treatment cards follow the existing KPIs without changing the initial-period anchor.
|
||||
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 }));
|
||||
if (this.dominio !== 'cacu') return cards;
|
||||
const tratamiento = CACU_TRATAMIENTO_KPIS.map(definition => ({ definition, pending: !this.kpiIndicator(definition.id) }));
|
||||
return cards.length || tratamiento.some(card => !card.pending) ? [...cards, ...tratamiento] : [];
|
||||
}
|
||||
esKpiTratamientoCacu(id: string) { return this.dominio === 'cacu' && CACU_TRATAMIENTO_KPIS.some(kpi => kpi.id === id); }
|
||||
private readonly catalogRequests = new Subject<void>();
|
||||
readonly catalog = signal<Indicador[]>([]);
|
||||
// Ids of the indicators to render; null shows the whole catalog.
|
||||
@@ -396,7 +400,7 @@ export class IndicadoresPage {
|
||||
const selected = new Set(this.selectedIndicators());
|
||||
return { items: this.catalogOrder().filter(item => selected.has(item.id)) };
|
||||
});
|
||||
// The figures of «Indicadores de oportunidad»: TEA's time figures under its summary, and CaCu's six times, each a
|
||||
// The figures of «Indicadores de oportunidad»: TEA's time figures under its summary, and CaCu's five times, each a
|
||||
// pending slot while the catalog does not publish its indicator. The rest are the clinical ones.
|
||||
// The domain is not a signal: each result reads the items first, so a new catalog recomputes it whichever domain it was last for.
|
||||
readonly oportunidadSlots = computed((): { item?: Indicador; titulo: string }[] => {
|
||||
@@ -424,8 +428,9 @@ export class IndicadoresPage {
|
||||
readonly clinicosItems = computed(() => {
|
||||
const items = this.searchResults().items;
|
||||
if (this.dominio === 'cacu') {
|
||||
// The time figures went to the opportunity section; an indicator with no figure has nothing to draw here.
|
||||
const clinicos = items.filter(item => item.figuras.length && !CACU_FIGURAS_OPORTUNIDAD.some(figura => figura.id === item.id));
|
||||
// The opportunity section already presents the time figures and the treatment KPIs.
|
||||
const clinicos = items.filter(item => item.figuras.length && !this.esKpiTratamientoCacu(item.id)
|
||||
&& !CACU_FIGURAS_OPORTUNIDAD.some(figura => figura.id === item.id));
|
||||
return [...CACU_FIGURAS_CLINICAS.flatMap(id => clinicos.filter(item => item.id === id)), ...clinicos.filter(item => !CACU_FIGURAS_CLINICAS.includes(item.id))];
|
||||
}
|
||||
return this.dominio === 'tea' ? items.filter(item => !TEA_FIGURAS_OPORTUNIDAD.includes(item.id)) : items;
|
||||
|
||||
Reference in New Issue
Block a user