|
|
|
@@ -6,6 +6,7 @@ import { MatButtonModule } from '@angular/material/button';
|
|
|
|
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
|
|
|
import { catchError, map, Observable, of, startWith, Subject, switchMap } from 'rxjs';
|
|
|
|
|
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
|
|
|
|
|
import { IndicadorKpiCard } from './indicador-kpi-card';
|
|
|
|
|
import { isoDate } from './cacu-seguimiento.models';
|
|
|
|
|
import { grupoDelClic, gruposFigura } from './indicadores-analisis-figuras';
|
|
|
|
|
import { etiquetaBirads } from './etiquetas-cohorte';
|
|
|
|
@@ -53,62 +54,80 @@ function contenedorDeScroll(el: HTMLElement): HTMLElement {
|
|
|
|
|
// a suppressed one says why it does not. Nothing is requested until the tab is first opened.
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-indicadores-analisis',
|
|
|
|
|
imports: [FormsModule, MatButtonModule, MatProgressBarModule, PlotlyChart],
|
|
|
|
|
imports: [FormsModule, MatButtonModule, MatProgressBarModule, PlotlyChart, IndicadorKpiCard],
|
|
|
|
|
template: `
|
|
|
|
|
<section class="panel" aria-labelledby="analisis-titulo">
|
|
|
|
|
<h2 id="analisis-titulo">Pacientes por categoría BI-RADS</h2>
|
|
|
|
|
<p class="nota">Conteo descriptivo de las pacientes de la cohorte en cada categoría BI-RADS a la fecha de corte. No estima incidencia, recurrencia ni supervivencia.</p>
|
|
|
|
|
<section class="analisis" aria-labelledby="analisis-titulo">
|
|
|
|
|
<h2 id="analisis-titulo">Análisis epidemiológico</h2>
|
|
|
|
|
<p class="nota">Conteo de pacientes de la cohorte por categoría BI-RADS a la fecha de corte. No estima incidencia, recurrencia ni supervivencia.</p>
|
|
|
|
|
@if (datos(); as d) {
|
|
|
|
|
<p class="contexto">Fecha de corte: {{ d.corte }}. Denominador: {{ d.denominador }}.</p>
|
|
|
|
|
<div class="tarjetas">
|
|
|
|
|
<app-indicador-kpi-card title="Categorías publicadas" [value]="publicadas()" state="Disponible" [quietWhenAvailable]="true"
|
|
|
|
|
[additionalInfo]="'de ' + d.grupos.length + ' categorías BI-RADS.'" />
|
|
|
|
|
<app-indicador-kpi-card title="Categorías no publicadas" [value]="d.grupos.length - publicadas()" state="Disponible" [quietWhenAvailable]="true"
|
|
|
|
|
[additionalInfo]="'Con menos de ' + d.umbral_supresion + ' pacientes: su conteo y su lista no se publican.'" />
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<form class="controles" (ngSubmit)="consultar()">
|
|
|
|
|
<label>Fecha de corte <input name="corte" type="date" required [(ngModel)]="corte" [max]="hoy" /></label>
|
|
|
|
|
<button type="submit" mat-stroked-button [disabled]="carga().estado === 'cargando'">Consultar</button>
|
|
|
|
|
</form>
|
|
|
|
|
@switch (carga().estado) {
|
|
|
|
|
@case ('cargando') { <mat-progress-bar mode="indeterminate" aria-label="Consultando el análisis" /> }
|
|
|
|
|
@case ('pendiente') { <p role="status">Funcionalidad pendiente de publicación.</p> }
|
|
|
|
|
@case ('no-disponible') {
|
|
|
|
|
<p role="status">La cohorte no está disponible en este momento.</p>
|
|
|
|
|
<button type="button" mat-stroked-button (click)="reintentar()">Reintentar consulta</button>
|
|
|
|
|
<article class="panel" aria-labelledby="birads-titulo">
|
|
|
|
|
<h3 id="birads-titulo">Pacientes por categoría BI-RADS</h3>
|
|
|
|
|
@switch (carga().estado) {
|
|
|
|
|
@case ('cargando') { <mat-progress-bar mode="indeterminate" aria-label="Consultando el análisis" /> }
|
|
|
|
|
@case ('pendiente') { <p role="status">Funcionalidad pendiente de publicación.</p> }
|
|
|
|
|
@case ('no-disponible') {
|
|
|
|
|
<p role="status">La cohorte no está disponible en este momento.</p>
|
|
|
|
|
<button type="button" mat-stroked-button (click)="reintentar()">Reintentar consulta</button>
|
|
|
|
|
}
|
|
|
|
|
@case ('error') {
|
|
|
|
|
<div role="alert"><p>{{ $any(carga()).mensaje }}</p><button type="button" mat-stroked-button (click)="reintentar()">Reintentar consulta</button></div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@case ('error') {
|
|
|
|
|
<div role="alert"><p>{{ $any(carga()).mensaje }}</p><button type="button" mat-stroked-button (click)="reintentar()">Reintentar consulta</button></div>
|
|
|
|
|
@if (datos(); as d) {
|
|
|
|
|
@if (todasSuprimidas()) {
|
|
|
|
|
<p class="nota">Ninguna categoría alcanza el mínimo de {{ d.umbral_supresion }} pacientes para publicarse a esta fecha de corte.</p>
|
|
|
|
|
}
|
|
|
|
|
<p class="aviso" role="status">{{ aviso() }}</p>
|
|
|
|
|
<app-plotly-chart [style.--plot-height]="'360px'" [style.--plot-min-width]="'480px'" [showNotes]="false" [figure]="figura()" (plotClick)="clicGrupo($event)"
|
|
|
|
|
label="Pacientes por categoría BI-RADS" />
|
|
|
|
|
<p class="nota">Haga clic en una barra o use «Ver pacientes» para abrir la lista en Seguimiento. Una categoría con menos de {{ d.umbral_supresion }} pacientes no se publica.</p>
|
|
|
|
|
<div class="tabla-scroll" role="region" tabindex="0" aria-label="Pacientes por categoría BI-RADS, tabla">
|
|
|
|
|
<table>
|
|
|
|
|
<caption>Pacientes por categoría BI-RADS a la fecha de corte {{ d.corte }}</caption>
|
|
|
|
|
<thead><tr><th scope="col">Categoría</th><th scope="col">Pacientes</th><th scope="col"><span class="visually-hidden">Seguimiento</span></th></tr></thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
@for (g of d.grupos; track g.codigo) {
|
|
|
|
|
<tr [attr.data-grupo]="g.codigo">
|
|
|
|
|
<th scope="row">{{ etiqueta(g.codigo) }}</th>
|
|
|
|
|
<td>{{ g.suprimido ? 'No publicado' : miles(g.n!) }}</td>
|
|
|
|
|
<td>@if (g.suprimido) { <span class="sin-lista">{{ motivo }}</span> }
|
|
|
|
|
@else { <button type="button" class="ver" (click)="verGrupo(g.codigo, $event.currentTarget)" [attr.aria-label]="'Ver pacientes de ' + etiqueta(g.codigo) + ' en Seguimiento'">Ver pacientes</button> }</td>
|
|
|
|
|
</tr>
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@if (datos(); as d) {
|
|
|
|
|
<p class="contexto">Fecha de corte: {{ d.corte }}. Denominador: {{ d.denominador }}.</p>
|
|
|
|
|
@if (todasSuprimidas()) {
|
|
|
|
|
<p class="nota">Ninguna categoría alcanza el mínimo de {{ d.umbral_supresion }} pacientes para publicarse a esta fecha de corte.</p>
|
|
|
|
|
}
|
|
|
|
|
<p class="aviso" role="status">{{ aviso() }}</p>
|
|
|
|
|
<app-plotly-chart [style.--plot-height]="'360px'" [style.--plot-min-width]="'480px'" [showNotes]="false" [figure]="figura()" (plotClick)="clicGrupo($event)"
|
|
|
|
|
label="Pacientes por categoría BI-RADS" />
|
|
|
|
|
<p class="nota">Haga clic en una barra publicada para ver sus pacientes en Seguimiento. Una categoría con menos de {{ d.umbral_supresion }} pacientes no se publica.</p>
|
|
|
|
|
<div class="tabla-scroll" role="region" tabindex="0" aria-label="Pacientes por categoría BI-RADS, tabla">
|
|
|
|
|
<table>
|
|
|
|
|
<caption>Pacientes por categoría BI-RADS a la fecha de corte {{ d.corte }}</caption>
|
|
|
|
|
<thead><tr><th scope="col">Categoría</th><th scope="col">Pacientes</th><th scope="col"><span class="visually-hidden">Seguimiento</span></th></tr></thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
@for (g of d.grupos; track g.codigo) {
|
|
|
|
|
<tr [attr.data-grupo]="g.codigo">
|
|
|
|
|
<th scope="row">{{ etiqueta(g.codigo) }}</th>
|
|
|
|
|
<td>{{ g.suprimido ? 'No publicado' : miles(g.n!) }}</td>
|
|
|
|
|
<td>@if (g.suprimido) { <span class="sin-lista">{{ motivo }}</span> }
|
|
|
|
|
@else { <button type="button" class="ver" (click)="verGrupo(g.codigo, $event.currentTarget)" [attr.aria-label]="'Ver pacientes de ' + etiqueta(g.codigo) + ' en Seguimiento'">Ver pacientes</button> }</td>
|
|
|
|
|
</tr>
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</article>
|
|
|
|
|
</section>
|
|
|
|
|
`,
|
|
|
|
|
styles: `
|
|
|
|
|
:host { display: block; min-width: 0; }
|
|
|
|
|
.analisis { display: flex; flex-direction: column; gap: var(--issste-space-4); min-width: 0; }
|
|
|
|
|
.analisis > * { margin: 0; }
|
|
|
|
|
/* The dark theme paints the panel's own surfaces, not the page: the loose heading and notes get the dark background so their light text stays legible. */
|
|
|
|
|
:host-context(.dark-theme) .analisis { padding: var(--issste-space-4); background: var(--issste-background); color: var(--issste-text); border-radius: var(--issste-radius); }
|
|
|
|
|
.tarjetas { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--issste-space-4); }
|
|
|
|
|
@media (min-width: 700px) { .tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
|
|
|
.panel { box-sizing: border-box; min-width: 0; padding: var(--issste-space-6); background: var(--issste-surface); color: var(--issste-text);
|
|
|
|
|
border: 1px solid var(--issste-border); border-radius: var(--issste-radius); }
|
|
|
|
|
h2 { margin: 0; font-family: var(--issste-font-heading); font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
|
|
|
|
|
h2, h3 { margin: 0; font-family: var(--issste-font-heading); font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
|
|
|
|
|
p { margin: var(--issste-space-3) 0 0; overflow-wrap: anywhere; }
|
|
|
|
|
.nota, .contexto, .sin-lista { color: var(--issste-text-secondary); font: var(--mat-sys-body-medium); }
|
|
|
|
|
.controles { display: flex; flex-wrap: wrap; align-items: end; gap: var(--issste-space-3); margin-top: var(--issste-space-4); }
|
|
|
|
|
.controles { display: flex; flex-wrap: wrap; align-items: end; gap: var(--issste-space-3); padding: var(--issste-space-3) var(--issste-space-4); background: var(--issste-surface);
|
|
|
|
|
border: 1px solid var(--issste-border); border-radius: var(--issste-radius); }
|
|
|
|
|
label { display: flex; flex-direction: column; gap: .5rem; max-width: 100%; }
|
|
|
|
|
input { color: inherit; background: var(--issste-surface); border: 1px solid var(--issste-border); border-radius: 4px; padding: .6rem; min-height: 44px; box-sizing: border-box; font: inherit; max-width: 100%; }
|
|
|
|
|
input:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
|
|
|
|
@@ -150,6 +169,8 @@ export class IndicadoresAnalisis {
|
|
|
|
|
// Why the last click on a bar opened nothing.
|
|
|
|
|
readonly aviso = signal('');
|
|
|
|
|
readonly datos = computed(() => { const c = this.carga(); return c.estado === 'listo' ? c.datos : undefined; });
|
|
|
|
|
// How many categories the answer publishes; the rest are suppressed. Counts categories only, never patients.
|
|
|
|
|
readonly publicadas = computed(() => this.datos()?.grupos.filter(g => !g.suprimido).length ?? 0);
|
|
|
|
|
// The answer cannot tell an empty cohort from categories that are all under the threshold: it only says none is published.
|
|
|
|
|
readonly todasSuprimidas = computed(() => !!this.datos()?.grupos.every(g => g.suprimido));
|
|
|
|
|
readonly figura = computed(() => { const d = this.datos(); return d ? gruposFigura(d, this.tema()) : { data: [], layout: {} }; });
|
|
|
|
|