From 0914b8db23d365181547854e8abd9204d417388e Mon Sep 17 00:00:00 2001 From: Angel Capetillo Zavala Date: Thu, 12 Nov 2026 09:26:55 -0600 Subject: [PATCH] feat(indicadores): CaMa summary keeps the paired card and a pending histopathology card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmation, screening-to-diagnosis and exam-to-result cards leave the summary (they stay in Histórico and Datos y definiciones). The histopathological result by BI-RADS keeps its place and structure as a pending card, with no figure or number, until the catalog publishes its indicator. The patients KPI uses the reference's wording. --- .../indicador-histopatologia-pendiente.ts | 48 +++++++++++++++++++ .../indicadores-cama-oportunidad.spec.ts | 5 ++ .../indicadores-cama-resumen-clinico.spec.ts | 34 ++++++++++++- .../indicadores-conteos-pareados.spec.ts | 5 +- .../features/indicadores/indicadores-kpi.ts | 8 +++- .../indicadores/indicadores-page.html | 3 +- .../features/indicadores/indicadores-page.ts | 10 +++- 7 files changed, 104 insertions(+), 9 deletions(-) create mode 100644 src/app/features/indicadores/indicador-histopatologia-pendiente.ts diff --git a/src/app/features/indicadores/indicador-histopatologia-pendiente.ts b/src/app/features/indicadores/indicador-histopatologia-pendiente.ts new file mode 100644 index 0000000..d7b7d9f --- /dev/null +++ b/src/app/features/indicadores/indicador-histopatologia-pendiente.ts @@ -0,0 +1,48 @@ +import { Component, signal } from '@angular/core'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; + +/** + * CaMa's histopathological result by BI-RADS category, while the catalog does not publish its indicator + * (`cama_histopatologia_birads`). It keeps the card's place and structure, with no figure and no number. + */ +@Component({ + selector: 'app-indicador-histopatologia-pendiente', + host: { class: 'dual-card' }, + imports: [MatButtonModule, MatCardModule], + template: ` + +

Resultado histopatológico por categoría BI-RADS

+ + @if (ayuda()) { +
+

Cuando el catálogo publique el indicador, esta tarjeta mostrará, por categoría BI-RADS, el porcentaje de biopsias con resultado maligno y su intervalo de confianza, y la distribución del resultado de la biopsia en una dona que se puede recorrer por grupo y por resultado.

+
+ } +

Integración pendiente. Este indicador aún no está publicado por el catálogo institucional.

+
+

Por categoría BI-RADS

Sin datos publicados
+

Resultado de la biopsia

Sin datos publicados
+
+
+ `, + styles: ` + :host { display: flex; min-width: 0; margin: 0; grid-column: 1 / -1; } + mat-card { flex: 1; min-width: 0; padding: clamp(.75rem, 2vw, 1.5rem); background: var(--issste-surface); color: var(--issste-text); + border: 1px solid var(--issste-border); border-radius: var(--issste-radius); box-shadow: none; } + h2 { margin: 0; font-family: var(--issste-font-heading); font-weight: 500; font-size: 1.125rem; line-height: 1.3; overflow-wrap: anywhere; } + h3 { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.5; } + p { margin: var(--issste-space-3) 0 0; overflow-wrap: anywhere; } + .estado { color: var(--issste-text-secondary); } + .methodology { margin-top: var(--issste-space-3); padding: 1rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); } + .methodology p { margin: 0; } + .figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-6); margin-top: var(--issste-space-3); } + @media (min-width: 1100px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } } + .vacio { display: grid; place-items: center; min-height: 12rem; margin-top: var(--issste-space-3); color: var(--issste-text-secondary); + border: 1px dashed var(--issste-border); border-radius: var(--issste-radius); } + button:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; } + `, +}) +export class IndicadorHistopatologiaPendiente { + readonly ayuda = signal(false); +} diff --git a/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts b/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts index f52f470..7f962db 100644 --- a/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts +++ b/src/app/features/indicadores/indicadores-cama-oportunidad.spec.ts @@ -326,6 +326,11 @@ describe('Filtros generales de CaMa: periodo único', () => { (fixture.nativeElement.querySelector('.apply-button') as HTMLButtonElement).click(); expect(applied).toBe(1); }); + it('el bloque compacto de CaMa lleva la clase de densidad reducida y los demás dominios no', () => { + mount(true); expect((fixture.nativeElement as HTMLElement).classList.contains('compacto')).toBe(true); + fixture.destroy(); TestBed.resetTestingModule(); + mount(false, { mode: 'todos' }, { mode: 'todos' }); expect((fixture.nativeElement as HTMLElement).classList.contains('compacto')).toBe(false); + }); it('Aplicar no se puede pulsar sin cambios pendientes', () => { mount(true); expect((fixture.nativeElement.querySelector('.apply-button') as HTMLButtonElement).disabled).toBe(true); diff --git a/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts b/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts index d14f322..1aa7b23 100644 --- a/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts +++ b/src/app/features/indicadores/indicadores-cama-resumen-clinico.spec.ts @@ -53,8 +53,38 @@ describe('Resumen clínico de CaMa y los demás dominios', () => { expect(titles()).not.toContain('Distribución de resultados de biopsia'); // The patients' counts go on the exams' card, so the partner indicator has no card of its own. expect(titles()).not.toContain('Porcentaje de pacientes con resultados de BI-RADS 4, 5 y 6'); - expect(titles()).toHaveLength(4); - expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe(titles().length + ' indicadores publicados'); + // Only the paired card is a published indicator the summary draws; the other three are in Histórico. + expect(titles()).toEqual(['Porcentaje individual de mastografías']); + expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('1 indicador publicado'); + }); + it('CaMa: las tarjetas que el mockup no tiene en el Resumen se retiran sin quitarlas del catálogo', () => { + // Fails if confirmation, screening-to-diagnosis or exam-to-result come back to the summary, or leave Datos y definiciones. + open('cama', CAMA); + for (const titulo of ['Tasa de confirmación histopatológica', 'Tiempo de tamizaje a diagnóstico', 'Días de la toma de la mastografía a su resultado']) { + expect(section().textContent).not.toContain(titulo); + expect(root().querySelector('#panel-datos')!.textContent).toContain(titulo); + } + }); + it('CaMa: la tarjeta histopatológica ocupa su lugar como pendiente, sin cifras ni figuras', () => { + open('cama', CAMA); + const tarjeta = root().querySelector('app-indicador-histopatologia-pendiente') as HTMLElement; + expect(tarjeta).not.toBeNull(); + expect(tarjeta.querySelector('h2')?.textContent).toBe('Resultado histopatológico por categoría BI-RADS'); + expect(tarjeta.querySelector('[role=status]')?.textContent).toContain('Integración pendiente'); + expect([...tarjeta.querySelectorAll('h3')].map(e => e.textContent)).toEqual(['Por categoría BI-RADS', 'Resultado de la biopsia']); + expect(tarjeta.querySelector('app-plotly-chart, canvas, svg')).toBeNull(); + expect(/[0-9]/.test(tarjeta.textContent!)).toBe(false); + // It comes first, as in the reference, and is not counted as a published indicator. + expect(root().querySelector('.catalog-grid')!.firstElementChild).toBe(tarjeta); + }); + it('CaMa: si el catálogo publica el indicador histopatológico, la tarjeta pendiente deja de dibujarse', () => { + open('cama', [...CAMA, item('cama_histopatologia_birads', 'Resultado histopatológico por categoría BI-RADS', 'C2', ['fig_c2_donas'])]); + expect(root().querySelector('app-indicador-histopatologia-pendiente')).toBeNull(); + expect(titles()).toContain('Resultado histopatológico por categoría BI-RADS'); + }); + it.each(['tea', 'cacu'] as const)('%s no dibuja la tarjeta histopatológica pendiente', domain => { + open(domain, OTRO(domain)); + expect(root().querySelector('app-indicador-histopatologia-pendiente')).toBeNull(); }); it('CaMa: sin buscador, indicadores fijados, navegación flotante, selector de representación ni conteo de figuras', () => { // Fails if any of the controls the mockup does not have comes back to CaMa's summary. diff --git a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts index 410ca73..714f5f2 100644 --- a/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts +++ b/src/app/features/indicadores/indicadores-conteos-pareados.spec.ts @@ -174,8 +174,9 @@ describe('Tarjeta pareada de CaMa en la página', () => { it('el resumen dibuja una sola tarjeta para mastografías y pacientes, y no dibuja el socio ni biopsias', () => { // Fails if the patients' indicator keeps a card of its own beside the pair. const titulos = [...root().querySelectorAll('.catalog-grid app-indicador-catalog-card h2')].map(e => e.textContent?.trim()); - expect(titulos).toEqual(['Porcentaje individual de mastografías', 'Tasa de confirmación histopatológica']); - expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('2 indicadores publicados'); + // Confirmation is in Histórico and in Datos y definiciones, not in CaMa's summary. + expect(titulos).toEqual(['Porcentaje individual de mastografías']); + expect(root().querySelector('.catalog-count')?.textContent?.trim()).toBe('1 indicador publicado'); }); it('al hacerse visible pide los dos conteos del mismo periodo y dibuja dona, barras y tabla con sus valores', () => { abrir(); diff --git a/src/app/features/indicadores/indicadores-kpi.ts b/src/app/features/indicadores/indicadores-kpi.ts index ee52230..7e95a06 100644 --- a/src/app/features/indicadores/indicadores-kpi.ts +++ b/src/app/features/indicadores/indicadores-kpi.ts @@ -67,7 +67,10 @@ export function camaKpiCards(published: (id: string) => boolean): KpiCardSlot[] return cards.some(card => !card.pending) ? cards : []; } // Published CaMa indicators whose card the summary does not draw. -export const CAMA_FUERA_DEL_RESUMEN: readonly string[] = ['cama_biopsias']; +// 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. +export const CAMA_FUERA_DEL_RESUMEN: readonly string[] = ['cama_biopsias', 'cama_confirmacion_birads45', 'cama_dias_toma_diagnostico', 'cama_eu38a']; +export const ID_HISTOPATOLOGIA_CAMA = 'cama_histopatologia_birads'; // C1 rows of CaCu/CaMa carry the linkId `total`; TEA's ficha names its single group `TOTAL`. const C1_GROUP: Record = { tea: 'TOTAL', cacu: 'total', cama: 'total' }; const C1_INFO: Record string> = { @@ -115,7 +118,8 @@ export function kpiResult(data: IndicadorDatos, definition: KpiDefinition, domai if (!rows.every(row => count(row['n']))) return empty; const value = rows.reduce((sum, row) => sum + (row['n'] as number), 0); if (!count(value)) return empty; - return { state: 'Disponible', value, info: domain === 'cacu' ? 'Pacientes con citología tomada en el periodo.' : 'Conteo de pacientes únicos en el periodo.' }; + return { state: 'Disponible', value, info: domain === 'cacu' ? 'Pacientes con citología tomada en el periodo.' + : domain === 'cama' ? 'Pacientes con mastografía BI-RADS 4, 5 o 6 en el periodo.' : 'Conteo de pacientes únicos en el periodo.' }; } if (definition.contrato === 'C1') { if (!finite(row['valor']) || row['valor'] < 0 || row['valor'] > 100) return empty; diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html index fdd3c73..3d771cd 100644 --- a/src/app/features/indicadores/indicadores-page.html +++ b/src/app/features/indicadores/indicadores-page.html @@ -91,7 +91,7 @@

{{ dominio === 'cacu' || dominio === 'cama' ? 'Indicadores clínicos' : 'Indicadores gráficos' }}

@if (!catalogLoading() && !catalogError() && catalog().length) { -

{{ shownIndicators }} indicadores publicados

+

{{ shownIndicators }} {{ shownIndicators === 1 ? 'indicador publicado' : 'indicadores publicados' }}

}
@if (catalogLoading()) { @@ -126,6 +126,7 @@

}
+ @if (histopatologiaPendiente) { } @for (item of searchResults().items; track cardIdentity(item)) { diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts index 7957191..357e9df 100644 --- a/src/app/features/indicadores/indicadores-page.ts +++ b/src/app/features/indicadores/indicadores-page.ts @@ -18,7 +18,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, KPI_BY_DOMAIN, KpiCardSlot, camaKpiCards } from './indicadores-kpi'; +import { CACU_RESULTADO_KPI, CAMA_FUERA_DEL_RESUMEN, ID_HISTOPATOLOGIA_CAMA, KPI_BY_DOMAIN, KpiCardSlot, camaKpiCards } from './indicadores-kpi'; import { IndicadorKpiPanel } from './indicador-kpi-panel'; import { IndicadorKpiCard } from './indicador-kpi-card'; import { figureApplied, independentFigurePeriods } from './indicadores-figure-selection'; @@ -29,6 +29,7 @@ import { IndicadoresInitialPeriod } from './indicadores-initial-period'; import { IndicadoresDefinitions } from './indicadores-definitions'; import { IndicadoresTracking } from './indicadores-tracking'; import { IndicadoresHistorico } from './indicadores-historico'; +import { IndicadorHistopatologiaPendiente } from './indicador-histopatologia-pendiente'; import { IndicadorNavegacionItem, IndicadoresNavegacionPanel } from './indicadores-navegacion-panel'; type DashboardSection = 'resumen' | 'historico' | 'seguimiento' | 'datos'; @@ -42,7 +43,7 @@ const SECCIONES_CON_HISTORICO: readonly { id: DashboardSection; label: string }[ @Component({ selector: 'app-indicadores-page', - imports: [FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, OverlayModule, IndicadorCatalogCard, IndicadorKpiPanel, IndicadorKpiCard, IndicadorPeriodFilters, IndicadoresDefinitions, IndicadoresTracking, IndicadoresNavegacionPanel, IndicadoresHistorico], + imports: [FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, OverlayModule, IndicadorCatalogCard, IndicadorKpiPanel, IndicadorKpiCard, IndicadorHistopatologiaPendiente, IndicadorPeriodFilters, IndicadoresDefinitions, IndicadoresTracking, IndicadoresNavegacionPanel, IndicadoresHistorico], templateUrl: './indicadores-page.html', styleUrl: './indicadores-page.scss', }) @@ -297,6 +298,11 @@ export class IndicadoresPage { const ids = catalog.map(item => item.id); return catalog.filter(item => !CAMA_FUERA_DEL_RESUMEN.includes(item.id) && !esSocioConteos(this.dominio, item.id, ids)); } + // CaMa's histopathology card keeps its place, as pending, while the catalog does not publish its indicator. + get histopatologiaPendiente() { + return this.dominio === 'cama' && !this.catalogLoading() && !this.catalogError() && this.catalog().length > 0 + && !this.catalog().some(item => item.id === ID_HISTOPATOLOGIA_CAMA); + } // How many indicators the graphic section shows: all the catalog, except in CaMa, which draws only some of them. get shownIndicators() { return this.dominio === 'cama' ? this.searchResults().items.length : this.catalog().length; } get availableKpis() { return this.kpisByDomain[this.dominio].filter(definition => this.catalog().some(item => item.id === definition.id)); }