From 5d3603740a3eb29ed4e548580e279f8c9198364e Mon Sep 17 00:00:00 2001 From: edgar Date: Sun, 22 Nov 2026 03:54:00 -0600 Subject: [PATCH] CaCu page: with the screening route there, no cards for the times, the unfigured proportions or the risk by band Once the catalog publishes the route, the page keeps the cytology count, the cytology result and its confirmation, and the route chart; the times (also to treatment), IND1, EU13 and the risk by band are in the history. The route's explanatory note goes. Without the route the page is as before. Co-Authored-By: Claude Sonnet 5.5 --- .../indicador-screening-route.html | 9 ------- .../indicador-screening-route.scss | 1 - .../indicadores-kpi-tratamiento.spec.ts | 16 +++---------- .../features/indicadores/indicadores-kpi.ts | 10 -------- .../indicadores/indicadores-page.html | 4 ++-- .../features/indicadores/indicadores-page.ts | 24 +++++++++---------- .../indicadores-screening-route-page.spec.ts | 17 ++++++------- .../features/indicadores/screening-route.ts | 2 ++ 8 files changed, 28 insertions(+), 55 deletions(-) diff --git a/src/app/features/indicadores/indicador-screening-route.html b/src/app/features/indicadores/indicador-screening-route.html index fef2e09..37dffda 100644 --- a/src/app/features/indicadores/indicador-screening-route.html +++ b/src/app/features/indicadores/indicador-screening-route.html @@ -22,15 +22,6 @@ @if (status() === 'empty') {

No hay tiempos publicados para esta ruta.

} @else if (figure(); as figure) { -

- @if (view() === 'cumulative') { - Cada barra es la mediana de días desde la toma de muestra hasta ese evento y el bigote va de Q1 a Q3. Cada fila cuenta solo a quienes llegaron a ese evento. - El diagnóstico incluye a quienes lo recibieron tras el tamizaje, en la colposcopía o tras la biopsia, por eso su barra puede salir antes que la de biopsia. - } @else { - Cada barra es el tramo desde el evento anterior y empieza donde termina el tramo previo; la de color es el tramo más lento. Cada tramo cuenta solo a quienes llegaron a sus dos eventos. - Las medianas de los tramos no tienen que sumar el tiempo acumulado. - } -

}
Valores publicados
diff --git a/src/app/features/indicadores/indicador-screening-route.scss b/src/app/features/indicadores/indicador-screening-route.scss index d4a1da2..fdeeaf6 100644 --- a/src/app/features/indicadores/indicador-screening-route.scss +++ b/src/app/features/indicadores/indicador-screening-route.scss @@ -3,7 +3,6 @@ p, h3, summary { overflow-wrap: anywhere; } h3 { font-size: 1rem; line-height: 1.5; } .controls { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; margin-block: .75rem; } -.note { color: var(--issste-text-secondary); max-width: 70ch; } app-plotly-chart { --plot-height: 360px; } summary { cursor: pointer; padding-block: .75rem; } summary:focus-visible, .table-scroll:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; } diff --git a/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts b/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts index 83a991a..9b6b3f4 100644 --- a/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts +++ b/src/app/features/indicadores/indicadores-kpi-tratamiento.spec.ts @@ -1,22 +1,12 @@ -// 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. +// What this module covers: CaCu's two times to treatment: their ids from the API's measures. 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 16c2f63..b2c40b6 100644 --- a/src/app/features/indicadores/indicadores-kpi.ts +++ b/src/app/features/indicadores/indicadores-kpi.ts @@ -79,16 +79,6 @@ 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..830144b 100644 --- a/src/app/features/indicadores/indicadores-page.html +++ b/src/app/features/indicadores/indicadores-page.html @@ -52,7 +52,7 @@
@if (resumen) { } -
+
@for (card of kpis; track dominio + ':' + card.definition.id) { @if (card.pending) { } } - @if (dominio === 'cacu') { + @if (dominio === 'cacu' && !screeningRouteAvailable) { } @else if (dominio === 'cama') { diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts index daac41c..233cd44 100644 --- a/src/app/features/indicadores/indicadores-page.ts +++ b/src/app/features/indicadores/indicadores-page.ts @@ -17,11 +17,11 @@ 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, KpiCardSlot, cacuPendingKpiCards, camaKpiCards } from './indicadores-kpi'; +import { CACU_RESULTADO_KPI, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KPI_RESUMEN_TEA, KpiCardSlot, camaKpiCards } from './indicadores-kpi'; import { TeaResumenPeriodo } from './tea-resumen-periodo'; import { IndicadorKpiPanel } from './indicador-kpi-panel'; import { IndicadorScreeningRoute } from './indicador-screening-route'; -import { ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route'; +import { CACU_SIN_TARJETA, ROUTE_IDS } from './screening-route'; import { IndicadorKpiCard } from './indicador-kpi-card'; import { figureApplied, independentFigurePeriods } from './indicadores-figure-selection'; import { identityElementId, indicatorIdentity } from './indicadores-identities'; @@ -342,18 +342,18 @@ 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() { - 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)); - } + get availableKpis() { return this.kpisByDomain[this.dominio].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; return this.dominio === 'tea' && selection?.mode === 'explicit' && selection.periodos.length === 1 ? selection.periodos[0] : undefined; } + // With the route chart, CaCu's strip keeps the cytology count: its times are drawn by the chart, so they get no card. get opportunityKpis() { const definitions = this.availableKpis; - if (this.dominio !== 'cacu' || (!definitions.length && !this.catalog().some(item => item.id === CACU_RESULTADO_KPI.id))) return definitions; + if (this.dominio !== 'cacu') return definitions; + if (this.screeningRouteAvailable) return definitions.filter(definition => definition.contrato !== 'C3r'); + if (!definitions.length && !this.catalog().some(item => item.id === CACU_RESULTADO_KPI.id)) return definitions; // Keep the established KPI definitions and initial-period anchor intact. const diagnosis = definitions.findIndex(item => item.id === 'cacu_dias_toma_diagnostico'); return [...definitions.slice(0, diagnosis < 0 ? definitions.length : diagnosis), CACU_RESULTADO_KPI, @@ -362,8 +362,7 @@ 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)); - const cards = this.opportunityKpis.map(definition => ({ definition, pending: false })); - return this.dominio === 'cacu' ? [...cards, ...cacuPendingKpiCards(cards.map(card => card.definition.id))] : cards; + return this.opportunityKpis.map(definition => ({ definition, pending: false })); } private readonly catalogRequests = new Subject(); readonly catalog = signal([]); @@ -374,10 +373,11 @@ export class IndicadoresPage { // Stable presentation order. Pins no longer reorder the summary. readonly catalogOrder = computed(() => { const catalog = this.catalog(); - // The route chart draws its own measures: they get no card of their own once it is there. - const route = this.screeningRouteAvailable ? ROUTE_ONLY_IDS : []; + // CaCu's page draws the cytology result and the confirmation as cards, and the route chart. The times of the route + // get no card of their own once the chart is there; the rest live in the history (they have no figure here). + const hidden = this.screeningRouteAvailable ? [...ROUTE_IDS, ...CACU_SIN_TARJETA] : []; return this.dominio === 'cacu' - ? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7' && !route.includes(item.id))] + ? [...catalog.filter(item => item.id === 'cacu_eu7'), ...catalog.filter(item => item.id !== 'cacu_eu7' && !hidden.includes(item.id))] : this.dominio === 'cama' ? this.cardsDeCama(catalog) : catalog.filter(item => !item.vistas || item.vistas.includes('resumen')); }); diff --git a/src/app/features/indicadores/indicadores-screening-route-page.spec.ts b/src/app/features/indicadores/indicadores-screening-route-page.spec.ts index e80d3a8..2eff58c 100644 --- a/src/app/features/indicadores/indicadores-screening-route-page.spec.ts +++ b/src/app/features/indicadores/indicadores-screening-route-page.spec.ts @@ -10,7 +10,7 @@ import { IndicadorCatalogCard } from './indicador-catalog-card'; import { IndicadoresPage } from './indicadores-page'; import { IndicadoresMemory } from './indicadores-memory'; import { Dominio } from './indicadores.models'; -import { ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route'; +import { CACU_SIN_TARJETA, ROUTE_IDS, ROUTE_ONLY_IDS } from './screening-route'; const item = (id: string, contrato = 'C3r') => ({ id, titulo: id, contrato, figuras: [], tipos_periodo: ['semestre', 'mes'] }); @@ -32,15 +32,16 @@ describe('Ruta del tamizaje: página de CaCu', () => { const ruta = () => fixture.nativeElement.querySelector('app-indicador-screening-route'); const tarjetas = () => fixture.debugElement.queryAll(By.directive(IndicadorCatalogCard)).map(d => (d.componentInstance as IndicadorCatalogCard).indicador.id); - it('con las siete medidas publicadas aparece la gráfica y sus medidas exclusivas no tienen tarjeta', () => { - // Pins down: the chart replaces the cards of the five measures only it draws, while the cytology's and the diagnosis' - // keep theirs. Fails if the chart stops appearing, or a measure it draws also shows as a card. - abrir('cacu', [item('cacu_eu7', 'C2'), ...ROUTE_IDS.map(id => item(id))]); + it('con las siete medidas publicadas aparece la gráfica y CaCu deja solo las tarjetas que la gráfica no dibuja', () => { + // Pins down: the chart replaces the cards of every measure it reads, the proportions without a figure and the times to + // treatment live in the history, and the cytology result and its confirmation keep theirs. Fails if the chart stops + // appearing, or one of those measures also shows as a card. + abrir('cacu', [item('cacu_eu7', 'C2'), item('cacu_confirmacion_citologia', 'C2'), item('ind1', 'C1'), item('cacu_eu13', 'C1'), + item('cacu_riesgo_banda', 'C2'), item('cacu_dias_toma_tratamiento'), item('cacu_dias_diagnostico_tratamiento'), ...ROUTE_IDS.map(id => item(id))]); expect(ruta()).not.toBeNull(); const ids = tarjetas(); - for (const id of ROUTE_ONLY_IDS) expect(ids).not.toContain(id); - expect(ids).toContain('cacu_eu_tiempo_reporte'); - expect(ids).toContain('cacu_eu7'); + for (const id of [...ROUTE_IDS, ...CACU_SIN_TARJETA]) expect(ids).not.toContain(id); + expect(ids).toEqual(['cacu_eu7', 'cacu_confirmacion_citologia']); }); it('si el catálogo no publica alguna de las siete, no hay gráfica y las medidas conservan sus tarjetas', () => { // Fails if the chart appears with a measure missing, or the cards of the others disappear anyway. diff --git a/src/app/features/indicadores/screening-route.ts b/src/app/features/indicadores/screening-route.ts index 0f8f768..0f75d33 100644 --- a/src/app/features/indicadores/screening-route.ts +++ b/src/app/features/indicadores/screening-route.ts @@ -28,6 +28,8 @@ export const ROUTE_STEPS: readonly RouteStep[] = [ export const ROUTE_IDS: readonly string[] = [...new Set(ROUTE_STEPS.flatMap(s => [s.sinceSample, s.sinceStep]))]; /** The measures only this chart draws: the cytology's and the diagnosis' keep their own cards. */ +/** CaCu's measures with no card on the page: the two times to treatment, the proportions without a figure and the risk by band. They are in the history. */ +export const CACU_SIN_TARJETA: readonly string[] = ['cacu_dias_toma_tratamiento', 'cacu_dias_diagnostico_tratamiento', 'ind1', 'cacu_eu13', 'cacu_riesgo_banda']; export const ROUTE_ONLY_IDS: readonly string[] = ROUTE_IDS.filter(id => id !== 'cacu_eu_tiempo_reporte' && id !== 'cacu_dias_toma_diagnostico'); export type RouteView = 'cumulative' | 'steps';