Files
WebApp/src/app/features/indicadores/indicadores-tracking.html
T
rockdrigo 710790b98e feat(cama): «Análisis epidemiológico»: epidemiological figures, chosen comparisons, and curves and cells that open their patients
How:
- The tab is now «Análisis epidemiológico». Its first section,
  «Indicadores epidemiológicos», shows the cohort's figures at 24 months
  (GET /<domain>/analisis/indicadores, guarded by analisisIndicadores):
  cumulative incidence of cancer and of recurrence, follow-up adherence and
  survival, each with its interval, counts and assumptions.
- Stages publish a list of variables (two or more) instead of a fixed pair.
  The curves have their own menus: one variable and two or more of its
  values (`grupos`; with all of them the request names none, with one the
  page asks for another and sends nothing). Cox sits beside them, on the
  same groups.
- The heatmap has its own menus for rows and columns, always two distinct
  variables (cruceDeEtapa keeps a pair the stage owns); its answer adds the
  log-rank of each variable, plain and stratified by the other.
- A curve click, its «Ver pacientes» button in the risk table, or a
  coloured cell emits verPacientes with the scenario's population
  (`filtro_seguimiento`) and the values (seleccionDeCurva,
  seleccionDeCelda). The page opens Seguimiento with that selection.
- IndicadoresSeguimientoTabla takes the selection as an input: it asks the
  whole cohort (`meses = 0`, «Toda la cohorte», now in MESES_VENTANA) with
  those filters and says where the list comes from; «Quitar selección»
  goes back to the 3-month window. A new id applies a repeated click.

Implications:
- Seguimiento's contract gains `meses = 0` (no time window); the backend
  must accept it, or answer 400 until it does.
- The list behind a curve is patient-level: the drill-down needs the same
  access rule as Seguimiento, and the figures it comes from stay suppressed.
- Two more endpoints for the backend (/analisis/indicadores, and the new
  parameters grupos, filas and columnas).
2026-11-12 18:38:12 -06:00

118 lines
8.6 KiB
HTML

@if (pacienteDetalle.estado().tipo !== 'cerrado') {
<app-paciente-detalle [estado]="pacienteDetalle.estado()" [categorias]="categories"
[registrosTemporales]="pacienteDetalle.registrosTemporales()"
(registroAgregado)="pacienteDetalle.agregarRegistro($event)" (volver)="volverASeguimiento()" />
}
<div [hidden]="pacienteDetalle.estado().tipo !== 'cerrado'">
<h2>Seguimiento de {{ domainLabel }}</h2>
@if (dominio === 'cama') {
<app-seguimiento-tabla [dominio]="dominio" [active]="active" [seleccion]="seleccion" />
} @else {
<form (ngSubmit)="apply()">
<label>Fecha de corte <input name="corte" type="date" [(ngModel)]="draft.corte" /></label>
<label>Ventana de meses <select name="meses" [(ngModel)]="draft.meses">
@for (m of [1,3,6,12]; track m) { <option [ngValue]="m">{{ m }} {{ m === 1 ? 'mes' : 'meses' }}</option> }
</select></label>
@if (propio) {
<label>{{ dominio === 'tea' ? 'Alteraciones EEG' : 'Estatus de seguimiento' }} <select name="estatus" [(ngModel)]="draft.estatus">
<option [ngValue]="undefined">{{ dominio === 'tea' ? 'Todas' : 'Todos' }}</option>
@for (s of statuses; track s.codigo) { <option [value]="s.codigo">{{ s.etiqueta }}</option> }
</select></label>
}
@if (dominio === 'tea') {
<label>Grupo de edad <select name="grupo_edad" [(ngModel)]="draft.grupo_edad">
<option [ngValue]="undefined">Todos</option>
@for (g of gruposEdad; track g) { <option [value]="g">{{ g }}</option> }
</select></label>
<label>Puntaje M-CHAT <select name="mchat" [(ngModel)]="draft.mchat">
<option [ngValue]="undefined">Todos</option>
@for (r of rangosMchat; track r.codigo) { <option [value]="r.codigo">{{ r.etiqueta }}</option> }
</select></label>
<label>CSS ADOS-2 <select name="css" [(ngModel)]="draft.css">
<option [ngValue]="undefined">Todos</option>
@for (r of rangosCss; track r.codigo) { <option [value]="r.codigo">{{ r.etiqueta }}</option> }
</select></label>
<label>Estado del caso <select name="estado_caso" [(ngModel)]="draft.estado_caso">
<option [ngValue]="undefined">Todos</option>
@for (e of estadosCaso; track e.codigo) { <option [value]="e.codigo">{{ e.etiqueta }}</option> }
</select></label>
<label>Tipo de alteración <select name="alteracion" [(ngModel)]="draft.alteracion">
<option [ngValue]="undefined">Todas</option>
@for (t of tiposAlteracion; track t.codigo) { <option [value]="t.codigo">{{ t.etiqueta }}</option> }
</select></label>
}
<label>Registros por página <input name="size" type="number" min="1" max="200" required [(ngModel)]="draft.page_size" /></label>
<button type="submit" [disabled]="status === 'loading'">Consultar</button>
</form>
@if (status === 'loading') { <p role="status">Cargando seguimiento…</p> }
@if (status === 'pending') { <p role="status">El seguimiento aún no está disponible para esta consulta. Funcionalidad pendiente de publicación.</p> }
@if (message && status !== 'pending') { <p role="alert">{{ message }}</p> }
@if (status === 'error' || status === 'pending') { <button type="button" (click)="retry()">Reintentar seguimiento</button> }
@if (response; as response) {
<p>Ventana consultada: {{ response.ventana.desde }} al {{ response.ventana.hasta }}.</p>
}
@if (teaData; as response) {
<section class="resumen-eeg" aria-labelledby="resumen-eeg-titulo">
<h3 id="resumen-eeg-titulo">EEG de los pacientes filtrados</h3>
<dl>
<div><dt>Normales</dt><dd>{{ response.resumen_eeg.normales }}</dd></div>
<div><dt>Anormales</dt><dd>{{ response.resumen_eeg.anormales }}</dd></div>
<div><dt>Sin EEG</dt><dd>{{ response.resumen_eeg.sin_eeg }}</dd></div>
@for (a of response.resumen_eeg.por_alteracion; track a.codigo) {
<div class="tipo"><dt>{{ a.etiqueta }}</dt><dd>{{ a.n }}</dd></div>
}
</dl>
<p>Un paciente con dos alteraciones cuenta en ambas, así que los tipos pueden sumar más que los anormales.</p>
</section>
<div class="tracking-table" role="region" aria-label="Lista de seguimiento de demostración" tabindex="0">
<table>
<caption>Resultados disponibles por paciente</caption>
<thead><tr><th scope="col">Identificador seudónimo</th><th scope="col">Grupo de edad</th><th scope="col">Estado del caso</th><th scope="col">Último EEG</th><th scope="col">Puntaje M-CHAT</th><th scope="col">CSS ADOS-2</th><th scope="col">Alteraciones EEG</th></tr></thead>
<tbody>
@for (item of response.items; track item.id_seudonimo) {
<tr class="tea-row" [class.abierta]="teaAbierto === item.id_seudonimo" (click)="alternarTea(item.id_seudonimo, $event)">
<td><button class="row-toggle" type="button" [attr.aria-expanded]="teaAbierto === item.id_seudonimo" [attr.aria-controls]="'tea-detalle-' + item.id_seudonimo"
[attr.aria-label]="(teaAbierto === item.id_seudonimo ? 'Ocultar' : 'Ver') + ' resumen del paciente ' + item.id_seudonimo" (click)="alternarTea(item.id_seudonimo, $event)">
<span class="chevron" aria-hidden="true"></span>{{ item.id_seudonimo }}</button></td>
<td>{{ item.grupo_edad }}</td>
<td><span class="estado-caso" [attr.data-estado]="item.estado_caso">{{ etiquetaEstado[item.estado_caso] }}</span>
@if (item.pendientes.length) { <small>Falta: {{ item.pendientes.join(', ') }}</small> }</td>
<td>{{ item.ultimo_eeg ?? 'No disponible' }}</td>
<td>{{ item.mchat ?? 'No disponible' }}</td>
<td>{{ item.css_ados2 ?? 'No disponible' }}@if (item.modulo_ados2) { <small>Módulo {{ item.modulo_ados2 }}</small> }</td>
<td>@if (item.alteraciones_eeg; as eeg) { <span class="eeg" [class.eeg-anormal]="eeg === 'anormal'">{{ eeg === 'anormal' ? 'Anormal' : 'Normal' }}</span> } @else { No disponible }</td></tr>
@if (teaAbierto === item.id_seudonimo) {
<tr class="tea-detalle" [id]="'tea-detalle-' + item.id_seudonimo"><td colspan="7"><app-tea-paciente-resumen [id]="item.id_seudonimo" /></td></tr>
}
} @empty { <tr><td colspan="7">No hay registros para los filtros aplicados.</td></tr> }
</tbody>
</table>
</div>
} @else if (data; as response) {
<div class="tracking-table" role="region" aria-label="Lista de seguimiento de demostración" tabindex="0">
<table>
<caption>Resultados disponibles por paciente</caption>
<thead><tr><th scope="col">Identificador seudónimo</th><th scope="col">Grupo de edad</th><th scope="col">Estatus de seguimiento</th><th scope="col">Última citología</th><th scope="col">Último resultado de VPH</th><th scope="col">Estudio más reciente</th><th scope="col">Días de toma a diagnóstico</th><th scope="col">Prioridad</th></tr></thead>
<tbody>
@for (item of response.items; track item.id_seudonimo) {
<tr tabindex="-1" (click)="abrirPaciente(item, $event)" [attr.data-paciente]="item.id_seudonimo">
<td><button class="patient-link" type="button" [attr.aria-label]="'Ver ficha del paciente ' + item.id_seudonimo" (click)="abrirPaciente(item, $event)">{{ item.id_seudonimo }}</button></td><td>{{ item.grupo_edad === 'sin_dato' ? 'Sin dato' : item.grupo_edad }}</td><td>{{ item.estatus.etiqueta }}</td>
<td>@if (item.ultima_citologia; as c) { {{ cytologyLabel(c) }}<small>Fecha: {{ c.fecha }}</small><small>Calidad: {{ c.calidad ?? '—' }}</small> } @else { No disponible }</td>
<td>@if (item.ultimo_vph; as v) { {{ v.resultado }}<small>Fecha: {{ v.fecha }}</small><small>Genotipo 16/18: {{ v.genotipo_16_18 === null ? 'No disponible' : v.genotipo_16_18 ? 'Presente' : 'No detectado' }}</small> } @else { No disponible }</td>
<td>{{ latestStudy(item) ?? 'No disponible' }}</td><td>{{ item.dias_toma_diagnostico ?? 'No disponible' }}</td><td>{{ item.prioridad?.etiqueta ?? 'No disponible' }}</td>
</tr>
} @empty { <tr><td colspan="8">No hay registros para los filtros aplicados.</td></tr> }
</tbody>
</table>
</div>
}
@if (response; as response) {
<nav aria-label="Paginación de seguimiento">
<button type="button" [disabled]="response.paginacion.page <= 1" (click)="navigate(response.paginacion.page - 1)">Anterior</button>
<span>Página {{ response.paginacion.page }} de {{ response.paginacion.total_pages }}, {{ response.paginacion.total_items }} registros</span>
<button type="button" [disabled]="response.paginacion.page >= response.paginacion.total_pages" (click)="navigate(response.paginacion.page + 1)">Siguiente</button>
</nav>
}
}
</div>