feat(cama): the confirmation donut is the control, without label buttons
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.
This commit is contained in:
@@ -32,7 +32,11 @@
|
||||
<p class="selection-status" role="status" aria-live="polite">{{ m.periodo }}, selección: {{ selectionLabel }}. {{ reading }}</p>
|
||||
@if (status() === 'empty') { <p role="status">{{ vista.textos.vacio }}</p> }
|
||||
@else {
|
||||
<div class="legend" role="group" aria-label="Seleccionar resultado de biopsia">
|
||||
@if (!vista.botones) {
|
||||
<p class="hint">Haz clic en un anillo de la dona para elegir un grupo o un resultado; el centro vuelve a «{{ etiquetaBase }}».</p>
|
||||
}
|
||||
<!-- Without visible buttons they stay for the keyboard, shown while one has the focus. -->
|
||||
<div class="legend" [class.solo-teclado]="!vista.botones" role="group" aria-label="Seleccionar resultado de biopsia">
|
||||
<button type="button" (click)="select('centro')" [disabled]="isBase" aria-label="Volver a la vista base de la confirmación">Volver</button>
|
||||
<div class="keys" role="group" aria-label="Grupos del anillo interior">
|
||||
@for (g of m.grupos; track g.id; let i = $index) {
|
||||
@@ -48,7 +52,7 @@
|
||||
<div class="figures">
|
||||
<section class="figure rates"><h3>{{ vista.textos.filas }}, {{ m.periodo }}</h3>
|
||||
@if (ratesFigure) {
|
||||
<app-plotly-chart [figure]="ratesFigure" [showNotes]="false" [label]="'Confirmación, tasas ' + vista.textos.filas.toLowerCase() + ', ' + m.periodo + ', ' + selectionLabel" />
|
||||
<app-plotly-chart [figure]="ratesFigure" [animated]="!vista.botones" [showNotes]="false" [label]="'Confirmación, tasas ' + vista.textos.filas.toLowerCase() + ', ' + m.periodo + ', ' + selectionLabel" />
|
||||
}
|
||||
<ul class="rate-states">
|
||||
@for (t of rates; track t.fila.id) { @if (t.k === null) { <li>{{ t.fila.etiqueta }}: {{ estadoTasa(t) }}</li> } }
|
||||
@@ -56,7 +60,7 @@
|
||||
</section>
|
||||
<section class="figure donut"><h3>Resultado de la biopsia, {{ m.periodo }}</h3>
|
||||
@if (m.conBiopsia !== null && m.conBiopsia > 0 && donutFigure) {
|
||||
<app-plotly-chart [figure]="donutFigure" [showNotes]="false" [label]="'Confirmación, dona de grados de biopsia, ' + m.periodo + ', ' + selectionLabel" (plotClick)="plotClicked($event)" />
|
||||
<app-plotly-chart [figure]="donutFigure" [animated]="!vista.botones" [showNotes]="false" [label]="'Confirmación, dona de grados de biopsia, ' + m.periodo + ', ' + selectionLabel" (plotClick)="plotClicked($event)" />
|
||||
} @else { <p role="status">{{ 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.' }}</p> }
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<unknown>(); label = input<string>(); showNotes = input<boolean>(); plotClick = output<unknown>(); }
|
||||
class ChartStub { figure = input<unknown>(); label = input<string>(); showNotes = input<boolean>(); animated = input<boolean>(); plotClick = output<unknown>(); }
|
||||
|
||||
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(['<b>63</b><br>de 108 con biopsia<br>' + seleccionEtiqueta(m, seleccionBase(m))]);
|
||||
const c = modeloConfirmacion(respuesta(), '2026-S2');
|
||||
expect(donaConfirmacion(c, seleccionBase(c), 'claro').data[0]['text']).toEqual(['<b>63</b><br>de 108 con biopsia']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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: [`<b>${miles(k)}</b><br>de ${miles(total)} con biopsia`], textfont: { size: 16, color: p.text },
|
||||
text: [`<b>${miles(k)}</b><br>de ${miles(total)} con biopsia` + (m.vista.botones ? '' : '<br>' + 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) + '<extra></extra>' },
|
||||
{ ...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),
|
||||
|
||||
Reference in New Issue
Block a user