From 67cde017fa82cc319f72d1a214b5c47d5de9a7b5 Mon Sep 17 00:00:00 2001 From: rockdrigo Date: Mon, 9 Nov 2026 20:05:23 -0600 Subject: [PATCH] feat(cama): the confirmation donut is the control, without label buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit How: VistaConfirmacion gains `botones`. Without them (cáncer de mama), the donut works like CaCu's interactive one: a click on the inner ring chooses a group, on the outer ring a result, on the centre goes back to the base; the centre names the choice under its count; the donut and the rates animate between choices; a one-line hint says how. The buttons stay in the page for the keyboard, visually hidden until one of them has the focus. CaCu keeps `botones: true` and is unchanged. Implications: on cáncer de mama the choice is made on the chart; a keyboard user tabs into the hidden buttons, which then show. A view whose centre would overflow with long labels needs shorter category names in the catalog. --- .../indicador-confirmacion-citologia.html | 10 +++++++--- .../indicador-confirmacion-citologia.scss | 4 ++++ .../indicador-confirmacion-citologia.ts | 1 + .../indicadores-confirmacion-citologia.spec.ts | 17 ++++++++++++++--- .../indicadores-confirmacion-citologia.ts | 9 ++++++--- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/app/features/indicadores/indicador-confirmacion-citologia.html b/src/app/features/indicadores/indicador-confirmacion-citologia.html index 380007c..6a2bbd1 100644 --- a/src/app/features/indicadores/indicador-confirmacion-citologia.html +++ b/src/app/features/indicadores/indicador-confirmacion-citologia.html @@ -32,7 +32,11 @@

{{ m.periodo }}, selección: {{ selectionLabel }}. {{ reading }}

@if (status() === 'empty') {

{{ vista.textos.vacio }}

} @else { -
+ @if (!vista.botones) { +

Haz clic en un anillo de la dona para elegir un grupo o un resultado; el centro vuelve a «{{ etiquetaBase }}».

+ } + +
@for (g of m.grupos; track g.id; let i = $index) { @@ -48,7 +52,7 @@

{{ vista.textos.filas }}, {{ m.periodo }}

@if (ratesFigure) { - + }
    @for (t of rates; track t.fila.id) { @if (t.k === null) {
  • {{ t.fila.etiqueta }}: {{ estadoTasa(t) }}
  • } } @@ -56,7 +60,7 @@

Resultado de la biopsia, {{ m.periodo }}

@if (m.conBiopsia !== null && m.conBiopsia > 0 && donutFigure) { - + } @else {

{{ m.conBiopsia === null ? 'Dona no disponible: hay celdas suprimidas o datos incompletos. No se calcula un total parcial.' : 'Sin ' + vista.textos.sujetos + ' con biopsia en el periodo.' }}

}
diff --git a/src/app/features/indicadores/indicador-confirmacion-citologia.scss b/src/app/features/indicadores/indicador-confirmacion-citologia.scss index fd6a874..f9c7ebe 100644 --- a/src/app/features/indicadores/indicador-confirmacion-citologia.scss +++ b/src/app/features/indicadores/indicador-confirmacion-citologia.scss @@ -7,6 +7,10 @@ p, h3, summary { overflow-wrap: anywhere; } .legend { display: grid; gap: .6rem; margin-block: 1rem; } .keys { display: flex; flex-wrap: wrap; gap: .5rem; } .legend > button { justify-self: start; } +.hint { color: var(--issste-text-secondary); font: var(--mat-sys-body-medium); } +.legend.solo-teclado:not(:focus-within) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } +// The donut is the control: its slices and centre answer to the pointer. +.donut app-plotly-chart { cursor: pointer; } button { min-height: 44px; max-width: 100%; padding: .5rem .8rem; border: 1px solid var(--issste-border); border-radius: var(--issste-radius); color: var(--issste-text); background: var(--issste-surface); font: inherit; cursor: pointer; } .keys button { display: inline-flex; align-items: center; gap: .4rem; text-align: start; overflow-wrap: anywhere; } diff --git a/src/app/features/indicadores/indicador-confirmacion-citologia.ts b/src/app/features/indicadores/indicador-confirmacion-citologia.ts index ca333dc..dfa2142 100644 --- a/src/app/features/indicadores/indicador-confirmacion-citologia.ts +++ b/src/app/features/indicadores/indicador-confirmacion-citologia.ts @@ -45,6 +45,7 @@ export class IndicadorConfirmacionCitologia implements OnChanges, OnDestroy { get appliedSummary() { return describePeriods(this.applied.tipo, this.applied.selection); } get selectionLabel() { return this.model && this.selection ? seleccionEtiqueta(this.model, this.selection) : ''; } get reading() { return this.model && this.selection ? lectura(this.model, this.selection) : ''; } + get etiquetaBase() { return this.model ? seleccionEtiqueta(this.model, seleccionBase(this.model)) : ''; } get isBase() { return !!this.model && !!this.selection && !this.selection.categoria && this.selection.grupo === this.model.base; } get rates() { return this.model && this.selection ? tasas(this.model, this.selection) : []; } // CaCu's words when the catalog doesn't name this indicator, so the messages still read. diff --git a/src/app/features/indicadores/indicadores-confirmacion-citologia.spec.ts b/src/app/features/indicadores/indicadores-confirmacion-citologia.spec.ts index b58de47..92e8d20 100644 --- a/src/app/features/indicadores/indicadores-confirmacion-citologia.spec.ts +++ b/src/app/features/indicadores/indicadores-confirmacion-citologia.spec.ts @@ -9,11 +9,11 @@ import { IndicadorFigurePanel } from './indicador-figure-panel'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; import { GlobalApplied } from './indicadores-memory'; import { Indicador, IndicadorDatos } from './indicadores.models'; -import { clicConfirmacion, ConfirmacionIncompatible, CONFIRMACION_CAMA, donaConfirmacion, estadoTasa, figuraTasas, lectura, modeloConfirmacion, - periodosConfirmacion, rangoTasas, seleccionBase, tasas, vistaConfirmacion, wilson } from './indicadores-confirmacion-citologia'; +import { clicConfirmacion, ConfirmacionIncompatible, CONFIRMACION_CACU, CONFIRMACION_CAMA, donaConfirmacion, estadoTasa, figuraTasas, lectura, modeloConfirmacion, + periodosConfirmacion, rangoTasas, seleccionBase, seleccionEtiqueta, tasas, vistaConfirmacion, wilson } from './indicadores-confirmacion-citologia'; @Component({ selector: 'app-plotly-chart', template: '' }) -class ChartStub { figure = input(); label = input(); showNotes = input(); plotClick = output(); } +class ChartStub { figure = input(); label = input(); showNotes = input(); animated = input(); plotClick = output(); } const GRADOS = ['NORMAL', 'LIEBG', 'LIEAG', 'CIS', 'CARCINOMA']; // Real kit shape: both apart keys, an off-catalogue grade (CIN2, colour null) and @@ -258,3 +258,14 @@ describe('Confirmación histopatológica de cáncer de mama', () => { expect(estadoTasa(t[0], m.vista.textos.sujetos)).toBe('Sin pacientes con biopsia'); }); }); + +describe('Confirmación sin botones visibles', () => { + it('el centro de la dona nombra la elección solo cuando no hay botones', () => { + // Fails if the donut stops saying what it counts once the buttons are hidden, or CaCu's centre changes. + const cama = { ...CONFIRMACION_CAMA, id: 'cacu_confirmacion_citologia', estrato: 'citologia_alto_grado' as const, filas: CONFIRMACION_CACU.filas, base: 'LIEAG' }; + const m = modeloConfirmacion(respuesta(), '2026-S2', cama); + expect(donaConfirmacion(m, seleccionBase(m), 'claro').data[0]['text']).toEqual(['63
de 108 con biopsia
' + seleccionEtiqueta(m, seleccionBase(m))]); + const c = modeloConfirmacion(respuesta(), '2026-S2'); + expect(donaConfirmacion(c, seleccionBase(c), 'claro').data[0]['text']).toEqual(['63
de 108 con biopsia']); + }); +}); diff --git a/src/app/features/indicadores/indicadores-confirmacion-citologia.ts b/src/app/features/indicadores/indicadores-confirmacion-citologia.ts index d97a389..32624f6 100644 --- a/src/app/features/indicadores/indicadores-confirmacion-citologia.ts +++ b/src/app/features/indicadores/indicadores-confirmacion-citologia.ts @@ -29,17 +29,19 @@ export const Z95 = 1.959963984540054; export interface VistaConfirmacion { id: string; estrato: DimensionEstrato; filas: readonly { id: string; etiqueta: string }[]; base: string; falsoPositivo: string; + // With buttons, the choice is made on them; without, on the donut, whose centre then names it. + botones: boolean; textos: { base: string; falsoPositivo: string; sinConfirmacion: string; filas: string; encabezado: string; sujetos: string; vacio: string }; } export const CONFIRMACION_CACU: VistaConfirmacion = { - id: ID_CONFIRMACION, estrato: ESTRATO_CITOLOGIA, filas: FILAS_CITOLOGIA, base: 'LIEAG', falsoPositivo: 'NORMAL', + id: ID_CONFIRMACION, estrato: ESTRATO_CITOLOGIA, filas: FILAS_CITOLOGIA, base: 'LIEAG', falsoPositivo: 'NORMAL', botones: true, textos: { base: 'Verdaderos positivos (valor predictivo positivo)', falsoPositivo: 'Falsos positivos: la biopsia no confirmó lesión', sinConfirmacion: 'Sin confirmación de alto grado', filas: 'Por resultado de la citología', encabezado: 'Citología', sujetos: 'mujeres', vacio: 'No hay citologías de alto grado publicadas para este periodo.' }, }; // Cáncer de mama: the biopsies by the BI-RADS of the mammogram that led to them; the base is malignancy. export const CONFIRMACION_CAMA: VistaConfirmacion = { - id: 'cama_histopatologia_birads', estrato: 'birads', base: 'INVASOR', falsoPositivo: 'BENIGNO', + id: 'cama_histopatologia_birads', estrato: 'birads', base: 'INVASOR', falsoPositivo: 'BENIGNO', botones: false, filas: [{ id: 'BIRADS_6', etiqueta: 'BI-RADS 6' }, { id: 'BIRADS_5', etiqueta: 'BI-RADS 5' }, { id: 'BIRADS_4C', etiqueta: 'BI-RADS 4C' }, { id: 'BIRADS_4B', etiqueta: 'BI-RADS 4B' }, { id: 'BIRADS_4A', etiqueta: 'BI-RADS 4A' }], textos: { base: 'Detección de cáncer (valor predictivo positivo)', falsoPositivo: 'Falsos positivos: la biopsia resultó benigna', @@ -259,7 +261,8 @@ export function donaConfirmacion(m: ModeloConfirmacion, sel: SeleccionConfirmaci const custom = (values: number[]) => values.map(n => [miles(n), shareText(n, total)]); return { data: [ { ...comun, name: 'centro', values: [1], labels: ['centro'], domain: { x: [.32, .68], y: [.32, .68] }, textinfo: 'text', textposition: 'inside', - text: [`${miles(k)}
de ${miles(total)} con biopsia`], textfont: { size: 16, color: p.text }, + text: [`${miles(k)}
de ${miles(total)} con biopsia` + (m.vista.botones ? '' : '
' + escapar(seleccionEtiqueta(m, sel)))], + textfont: { size: 16, color: p.text }, marker: { colors: [p.background] }, hovertemplate: 'Volver a ' + escapar(m.grupos.find(g => g.id === m.base)!.etiqueta) + '' }, { ...comun, ...hover, name: 'grupos', values: interior, hole: .62, domain: { x: [.16, .84], y: [.16, .84] }, labels: m.grupos.map(g => escapar(g.etiqueta)), customdata: custom(interior),