20261119 CaMa: ayuda en cada dona de BI-RADS
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,25 +1,4 @@
|
||||
<section class="conteos" [attr.aria-label]="indicador.titulo + ', por ' + par.unidades.pacientes.slice(0, -1) + ' y por ' + par.unidades.examenes.slice(0, -1)">
|
||||
<div class="conteos-head">
|
||||
<div class="help" (mouseenter)="showHelp()" (mouseleave)="hideHelp()" (focusin)="showHelp()" (focusout)="onHelpFocusOut($event)">
|
||||
<button type="button" class="help-icon" aria-label="Cómo leer" [attr.aria-expanded]="helpOpen" (click)="toggleHelp()"><span aria-hidden="true">!</span></button>
|
||||
@if (helpOpen) {
|
||||
<div class="methodology" role="tooltip">
|
||||
<section class="reading-guide" aria-label="Cómo leer: dona por categoría">
|
||||
<h3>Dona por categoría</h3>
|
||||
@if (donutGuide; as guide) {
|
||||
@if (guide.descripcion) { <p>{{ guide.descripcion }}</p> }
|
||||
@if (guide.como_leer.length) { <ul>@for (line of guide.como_leer; track $index) { <li>{{ line }}</li> }</ul> }
|
||||
} @else if (!metadata) { <p>Metadatos publicados pendientes. Vuelve a abrir «Cómo leer» para reintentar su consulta.</p> }
|
||||
@else { <p>El servicio no publica instrucciones de lectura para esta figura.</p> }
|
||||
</section>
|
||||
<section class="reading-guide" aria-label="Cómo leer: pacientes y mastografías">
|
||||
<h3>{{ par.unidades.pacientes | titlecase }} y {{ par.unidades.examenes }}</h3>
|
||||
<p>Cada paciente cuenta una vez en el periodo, en la categoría más alta de sus mastografías. Cada mastografía cuenta en su propia categoría. Cada dona muestra uno de esos conteos; no se calcula cuántas mastografías tiene cada paciente, porque no son las mismas poblaciones.</p>
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@switch (status()) {
|
||||
@case ('deferred') { <p role="status">La vista se cargará al acercarse a esta región.</p> }
|
||||
@case ('loading') { <mat-progress-bar mode="indeterminate" [attr.aria-label]="'Cargando ' + indicador.titulo" /><p role="status">Cargando {{ par.unidades.examenes }} y {{ par.unidades.pacientes }} del mismo periodo…</p> }
|
||||
@@ -36,13 +15,45 @@
|
||||
</nav>
|
||||
}
|
||||
<div class="figures">
|
||||
<section class="figure"><h3>{{ par.unidades.examenes | titlecase }} por categoría, {{ m.periodo }}</h3>
|
||||
<section class="figure">
|
||||
<div class="figure-head">
|
||||
<h3>{{ par.unidades.examenes | titlecase }} por categoría, {{ m.periodo }}</h3>
|
||||
<div class="help" (mouseenter)="openHelp('examenes')" (mouseleave)="hideHelp('examenes')" (focusin)="openHelp('examenes')" (focusout)="onHelpFocusOut('examenes', $event)">
|
||||
<button type="button" class="help-icon" aria-label="Cómo leer, mastografías por categoría" [attr.aria-expanded]="helpWhich === 'examenes'" (click)="toggleHelp('examenes')"><span aria-hidden="true">!</span></button>
|
||||
@if (helpWhich === 'examenes') {
|
||||
<div class="methodology" role="tooltip">
|
||||
<section class="reading-guide" aria-label="Cómo leer: dona por categoría">
|
||||
<h3>Dona por categoría</h3>
|
||||
@if (donutGuide; as guide) {
|
||||
@if (guide.descripcion) { <p>{{ guide.descripcion }}</p> }
|
||||
@if (guide.como_leer.length) { <ul>@for (line of guide.como_leer; track $index) { <li>{{ line }}</li> }</ul> }
|
||||
} @else if (!metadata) { <p>Metadatos publicados pendientes. Vuelve a abrir «Cómo leer» para reintentar su consulta.</p> }
|
||||
@else { <p>El servicio no publica instrucciones de lectura para esta figura.</p> }
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (total) {
|
||||
<app-plotly-chart [figure]="donutFigure!" class="donut-chart" (widthChanged)="ajustarAnchoDona($event)" [showNotes]="false" [label]="indicador.titulo + ', dona, ' + m.periodo" />
|
||||
} @else { <p role="status">{{ total === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.examenes + ' en el periodo.' }}</p> }
|
||||
@if (m.sinDato) { <p class="note">Fuera de la dona: {{ texto(m.sinDato) }} {{ par.unidades.examenes }} sin categoría.</p> }
|
||||
</section>
|
||||
<section class="figure"><h3>{{ par.unidades.pacientes | titlecase }} por categoría, {{ m.periodo }}</h3>
|
||||
<section class="figure">
|
||||
<div class="figure-head">
|
||||
<h3>{{ par.unidades.pacientes | titlecase }} por categoría, {{ m.periodo }}</h3>
|
||||
<div class="help" (mouseenter)="openHelp('pacientes')" (mouseleave)="hideHelp('pacientes')" (focusin)="openHelp('pacientes')" (focusout)="onHelpFocusOut('pacientes', $event)">
|
||||
<button type="button" class="help-icon" aria-label="Cómo leer, pacientes por categoría" [attr.aria-expanded]="helpWhich === 'pacientes'" (click)="toggleHelp('pacientes')"><span aria-hidden="true">!</span></button>
|
||||
@if (helpWhich === 'pacientes') {
|
||||
<div class="methodology" role="tooltip">
|
||||
<section class="reading-guide" aria-label="Cómo leer: pacientes y mastografías">
|
||||
<h3>{{ par.unidades.pacientes | titlecase }} y {{ par.unidades.examenes }}</h3>
|
||||
<p>Cada paciente cuenta una vez en el periodo, en la categoría más alta de sus mastografías. Cada mastografía cuenta en su propia categoría. Cada dona muestra uno de esos conteos; no se calcula cuántas mastografías tiene cada paciente, porque no son las mismas poblaciones.</p>
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (totalPacientes) {
|
||||
<app-plotly-chart [figure]="patientsFigure!" class="donut-chart" (widthChanged)="ajustarAnchoPacientes($event)" [showNotes]="false" [label]="indicador.titulo + ', dona de pacientes por categoría BI-RADS, ' + m.periodo" />
|
||||
} @else { <p role="status">{{ !m.pacientesVerificados ? 'Dona de pacientes no disponible hasta verificar la definición publicada.' : totalPacientes === null ? 'Dona no disponible: hay celdas suprimidas o sin dato.' : 'Sin ' + par.unidades.pacientes + ' en el periodo.' }}</p> }
|
||||
|
||||
@@ -7,7 +7,9 @@ p, h3, summary { overflow-wrap: anywhere; }
|
||||
.reading-guide ul { margin: .5rem 0 0; padding-inline-start: 1.25rem; }
|
||||
.reading-guide + .reading-guide { margin-top: 1rem; }
|
||||
.reading-guide li + li { margin-top: .25rem; }
|
||||
.help { position: relative; display: flex; justify-content: flex-end; }
|
||||
.figure-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
|
||||
.figure-head h3 { margin: 0; }
|
||||
.help { position: relative; display: flex; flex: none; justify-content: flex-end; }
|
||||
.help .methodology { position: absolute; z-index: 8; top: calc(100% + .35rem); right: 0; width: min(34rem, calc(100vw - 2rem)); max-height: 18rem; overflow: auto; background: var(--issste-surface); box-shadow: 0 10px 28px rgb(0 0 0 / .14); }
|
||||
h3 { font-size: 1rem; font-weight: 500; line-height: 1.5; }
|
||||
.periods { display: flex; align-items: center; gap: var(--issste-space-3); }
|
||||
@@ -15,7 +17,6 @@ h3 { font-size: 1rem; font-weight: 500; line-height: 1.5; }
|
||||
border: 1px solid var(--issste-border); border-radius: var(--issste-radius); cursor: pointer; }
|
||||
.periods button:disabled { opacity: .5; cursor: default; }
|
||||
// The two figures share the card in equal halves; one above the other on a narrow card.
|
||||
.conteos-head { display: flex; justify-content: flex-end; }
|
||||
.help-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; min-width: 1.75rem; min-height: 1.75rem; padding: 0; border: 0; border-radius: 50%; background: var(--issste-accent); color: var(--issste-on-accent); font: inherit; font-weight: 800; line-height: 1; cursor: pointer; }
|
||||
.help-icon:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 3px; }
|
||||
.figures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
|
||||
|
||||
@@ -48,8 +48,8 @@ export class IndicadorConteosPareados implements OnChanges, OnDestroy {
|
||||
get totalPacientes() { return this.model ? totalPacientes(this.model) : null; }
|
||||
texto(n: number | null) { return n === null ? 'Sin dato' : n.toLocaleString('es-MX'); }
|
||||
textoPacientes(n: number | null) { return n === null && this.model && !this.model.pacientesVerificados ? 'Pendiente' : this.texto(n); }
|
||||
helpOpen = false;
|
||||
private helpPinned = false;
|
||||
helpWhich: 'examenes' | 'pacientes' | null = null;
|
||||
private helpPinned: 'examenes' | 'pacientes' | null = null;
|
||||
// True only while a metadata request is outstanding. A failure leaves metadata empty, so the next
|
||||
// hover may ask again; the catalog card ignores a second ask until that request finishes.
|
||||
private helpAsked = false;
|
||||
@@ -60,23 +60,29 @@ export class IndicadorConteosPareados implements OnChanges, OnDestroy {
|
||||
const como_leer = (detail?.como_leer ?? []).filter(line => line.trim().length > 0);
|
||||
return descripcion || como_leer.length ? { descripcion, como_leer } : undefined;
|
||||
}
|
||||
toggleHelp() {
|
||||
if (this.helpPinned) { this.helpPinned = false; this.helpOpen = false; return; }
|
||||
this.helpPinned = true;
|
||||
toggleHelp(which: 'examenes' | 'pacientes') {
|
||||
if (this.helpPinned === which) { this.helpPinned = null; this.helpWhich = null; return; }
|
||||
this.helpPinned = which;
|
||||
this.openHelp(which);
|
||||
}
|
||||
openHelp(which: 'examenes' | 'pacientes') {
|
||||
this.helpWhich = which;
|
||||
this.showHelp();
|
||||
}
|
||||
showHelp() {
|
||||
this.helpOpen = true;
|
||||
if (this.metadata || this.helpAsked) return;
|
||||
this.helpAsked = true;
|
||||
this.metadataRequested.emit();
|
||||
}
|
||||
hideHelp() { if (!this.helpPinned) this.helpOpen = false; }
|
||||
onHelpFocusOut(event: FocusEvent) {
|
||||
hideHelp(which: 'examenes' | 'pacientes') {
|
||||
if (this.helpPinned === which) return;
|
||||
if (this.helpWhich === which) this.helpWhich = null;
|
||||
}
|
||||
onHelpFocusOut(which: 'examenes' | 'pacientes', event: FocusEvent) {
|
||||
const next = event.relatedTarget;
|
||||
if (next instanceof Node && (event.currentTarget as Node).contains(next)) return;
|
||||
this.helpPinned = false;
|
||||
this.helpOpen = false;
|
||||
if (this.helpPinned === which) this.helpPinned = null;
|
||||
if (this.helpWhich === which) this.helpWhich = null;
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
||||
@@ -220,7 +220,7 @@ describe('Tarjeta pareada de CaMa en la página', () => {
|
||||
expect(filas).toEqual([['BI-RADS 4', '13', '15'], ['BI-RADS 5', '18', '18'], ['BI-RADS 6', '0', '0']]);
|
||||
expect(root().querySelector('.published-values caption')?.textContent).toContain('su categoría más alta');
|
||||
expect(texto('app-indicador-conteos-pareados')).not.toContain('no se calcula la razón de mastografías por paciente');
|
||||
expect(root().querySelector('.help-icon')?.getAttribute('aria-label')).toBe('Cómo leer');
|
||||
expect([...root().querySelectorAll('.help-icon')].map(b => b.getAttribute('aria-label'))).toEqual(['Cómo leer, mastografías por categoría', 'Cómo leer, pacientes por categoría']);
|
||||
expect(texto('app-indicador-conteos-pareados')).not.toContain('Sin dato');
|
||||
});
|
||||
it('sin pacientes verificados dibuja la estructura y deja pendiente solo la cifra de pacientes', () => {
|
||||
@@ -284,7 +284,10 @@ describe('Cómo leer de conteos pareados: reintento tras un fallo', () => {
|
||||
fixture.detectChanges();
|
||||
const segundo = meta();
|
||||
expect(segundo).toHaveLength(1);
|
||||
segundo[0].flush({ descripcion: 'Lectura de la dona' });
|
||||
segundo[0].flush({ descripcion: 'Lectura de la dona', figuras_detalle: [{ figura: 'fig_c2_donas', descripcion: 'Lectura de la dona', como_leer: [] }] });
|
||||
for (const q of http.match(r => r.url.endsWith('/datos'))) q.flush(q.request.url.includes('paciente') ? pacientes(LAB_P) : examenes(LAB_E));
|
||||
fixture.detectChanges();
|
||||
(fixture.nativeElement.querySelectorAll('.help-icon')[1] as HTMLButtonElement).dispatchEvent(new MouseEvent('mouseenter', { bubbles: true }));
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.textContent).toContain('en la categoría más alta de sus mastografías');
|
||||
expect(fixture.nativeElement.textContent).toContain('Cada dona muestra uno de esos conteos');
|
||||
|
||||
Reference in New Issue
Block a user