Indicadores TEA: Resumen, Trazabilidad, Seguimiento, Análisis de riesgo, periodicities

This commit is contained in:
2026-11-30 14:19:03 -06:00
parent 56d1ef2e8a
commit adff5bac5c
16 changed files with 1876 additions and 361 deletions
+296
View File
@@ -0,0 +1,296 @@
@if (focused(); as id) {
<button type="button" (click)="cleared.set(id)">Ver todos los pacientes</button>
} @else {
<div class="filters card">
<label>
Expediente o nombre
<input type="search" [ngModel]="query()" (ngModelChange)="setQuery($event)" />
</label>
@for (filter of tokenFilters; track filter.key) {
<label>
{{ filter.label }}
<select [ngModel]="filters()[filter.key]" (ngModelChange)="setFilter(filter.key, $event)">
<option [ngValue]="undefined">Todos</option>
@for (option of filter.options; track option.code) {
<option [ngValue]="option.code">{{ option.label }}</option>
}
</select>
</label>
}
<label>
M-CHAT mínimo
<input
type="number"
step="any"
[ngModel]="filters().mchatMin"
(ngModelChange)="setFilter('mchatMin', $event)"
/>
</label>
<label>
M-CHAT máximo
<input
type="number"
step="any"
[ngModel]="filters().mchatMax"
(ngModelChange)="setFilter('mchatMax', $event)"
/>
</label>
<label>
CSS mínimo
<input
type="number"
step="any"
[ngModel]="filters().cssMin"
(ngModelChange)="setFilter('cssMin', $event)"
/>
</label>
<label>
CSS máximo
<input
type="number"
step="any"
[ngModel]="filters().cssMax"
(ngModelChange)="setFilter('cssMax', $event)"
/>
</label>
<label>
Ventana de seguimiento
<select [ngModel]="filters().window" (ngModelChange)="setFilter('window', $event)">
@for (months of windows; track months) {
<option [ngValue]="months">{{ months }} {{ months === 1 ? 'mes' : 'meses' }}</option>
}
</select>
</label>
<label>
Inicio
<input type="date" [ngModel]="filters().start" (ngModelChange)="setFilter('start', $event)" />
</label>
<label>
Corte
<input
type="date"
[ngModel]="filters().cutoff"
(ngModelChange)="setFilter('cutoff', $event)"
/>
</label>
@if (risk()) {
<label>
Modelo de asociación
<select [ngModel]="association()" (ngModelChange)="setAssociation($event)">
<option value="with">{{ associationLabels.with }}</option>
<option value="without">{{ associationLabels.without }}</option>
<option value="all">{{ associationLabels.all }}</option>
</select>
</label>
}
</div>
}
<div class="actions">
<button
type="button"
(click)="export()"
[disabled]="loading() || exporting() || !!error() || !rows().length"
>
{{ exporting() ? 'Exportando…' : 'Exportar a Excel' }}
</button>
</div>
@if (actionError()) {
<p role="alert">{{ actionError() }}</p>
}
@if (loading() || moving()) {
<p role="status">Cargando pacientes…</p>
}
@if (error()) {
<p role="alert">No se pudieron leer los pacientes.</p>
} @else if (rows().length) {
<div class="table-wrap">
<table class="plain card">
<thead>
<tr>
<th>Expediente</th>
<th>Nombre</th>
@if (!risk()) {
<th>Proceso diagnóstico</th>
<th>Concordancia con el ADOS-2</th>
} @else {
<th>Pares</th>
}
<th>Acciones</th>
</tr>
</thead>
<tbody>
@for (row of rows(); track row.patient.id) {
@let id = row.patient.id!;
<tr [class.highlighted]="id === focused()">
<td>{{ row.recordNumbers.join(', ') || '—' }}</td>
<td>{{ row.name || '—' }}</td>
@if (!risk()) {
<td>
<ol class="stepper" aria-label="Proceso diagnóstico">
@for (step of row.steps; track step.code) {
<li
[class.reached]="step.reached"
[attr.title]="step.label + ': ' + (step.date || '—')"
[attr.aria-label]="step.label + ': ' + (step.date || '—')"
></li>
}
</ol>
</td>
<td>
@if (row.headline; as headline) {
{{ headline.pair || '—' }} · OR {{ (headline.or | number: '1.0-3') ?? '—' }} · q
{{ (headline.q | number: '1.0-4') ?? '—' }} · {{ row.concordance }}
} @else {
—
}
</td>
} @else {
<td>{{ row.pairs.length }}</td>
}
<td class="actions">
<button type="button" (click)="toggle(id)" [attr.aria-expanded]="isExpanded(id)">
{{ isExpanded(id) ? 'Ocultar' : 'Ver detalles' }}
</button>
<a [routerLink]="['/indicadores', 'tea', 'pacientes', id]">Expediente</a>
<a [routerLink]="['/indicadores', 'tea', 'pacientes', id, 'riesgo']">Riesgo</a>
</td>
</tr>
@if (isExpanded(id)) {
<tr [class.highlighted]="id === focused()">
<td [attr.colspan]="risk() ? 4 : 5">
@if (risk()) {
@if (row.pairs.length) {
<table class="plain pairs">
<thead>
<tr>
<th>Par</th>
<th>OR (IC)</th>
<th>q</th>
<th>Probabilidad</th>
<th>Referencia</th>
<th>Mismo sentido</th>
</tr>
</thead>
<tbody>
@for (pair of row.pairs; track pair.pair) {
<tr>
<td>{{ pair.pair || '—' }}</td>
<td>
{{ (pair.or | number: '1.0-3') ?? '—' }} ({{
(pair.low | number: '1.0-3') ?? '—'
}}–{{ (pair.high | number: '1.0-3') ?? '—' }})
</td>
<td>{{ (pair.q | number: '1.0-4') ?? '—' }}</td>
<td>{{ (pair.probability | number: '1.0-4') ?? '—' }}</td>
<td>{{ (pair.reference | number: '1.0-4') ?? '—' }}</td>
<td>
{{
pair.sameDirection == null ? '—' : pair.sameDirection ? 'Sí' : 'No'
}}
</td>
</tr>
}
</tbody>
</table>
} @else {
<p>Sin resultados de asociación.</p>
}
} @else {
<div class="cards">
<section class="card">
<h3>Datos</h3>
<dl>
<dt>Nombre</dt>
<dd>{{ row.name || '—' }}</dd>
<dt>Expediente</dt>
<dd>{{ row.recordNumbers.join(', ') || '—' }}</dd>
<dt>Sexo</dt>
<dd>{{ row.patient.gender ? name(row.patient.gender) : '—' }}</dd>
<dt>Nacimiento</dt>
<dd>{{ row.patient.birthDate || '—' }}</dd>
<dt>M-CHAT</dt>
<dd>{{ row.mchatScore ?? '—' }}</dd>
</dl>
</section>
<section class="card">
<h3>ADOS-2</h3>
@if (row.ados; as ados) {
<dl>
<dt>Fecha</dt>
<dd>{{ ados.date || '—' }}</dd>
<dt>Módulo</dt>
<dd>{{ ados.module || '—' }}</dd>
<dt>CSS</dt>
<dd>{{ ados.css ?? '—' }}</dd>
<dt>Clasificación</dt>
<dd>{{ ados.classification || '—' }}</dd>
</dl>
} @else {
<p>—</p>
}
</section>
<section class="card">
<h3>EEG</h3>
@for (eeg of row.eegs; track eeg.id) {
<dl>
<dt>Fecha</dt>
<dd>{{ eeg.date || '—' }}</dd>
<dt>Calidad</dt>
<dd>{{ eeg.quality || '—' }}</dd>
<dt>Validez</dt>
<dd>{{ eeg.validity || '—' }}</dd>
<dt>Duración (min)</dt>
<dd>{{ eeg.duration ?? '—' }}</dd>
<dt>Canales</dt>
<dd>{{ eeg.channels ?? '—' }}</dd>
</dl>
} @empty {
<p>—</p>
}
</section>
<section class="card">
<h3>Asociación</h3>
@if (row.headline; as headline) {
<dl>
<dt>Par</dt>
<dd>{{ headline.pair || '—' }}</dd>
<dt>OR</dt>
<dd>{{ (headline.or | number: '1.0-3') ?? '—' }}</dd>
<dt>q</dt>
<dd>{{ (headline.q | number: '1.0-4') ?? '—' }}</dd>
<dt>Concordancia con el ADOS-2</dt>
<dd>{{ row.concordance }}</dd>
</dl>
} @else {
<p>—</p>
}
</section>
</div>
}
</td>
</tr>
}
}
</tbody>
</table>
</div>
} @else if (!loading()) {
<p>Sin pacientes para los filtros seleccionados.</p>
}
@if (has('previous') || has('next')) {
<nav class="actions" aria-label="Páginas de pacientes">
<button
type="button"
(click)="go('previous')"
[disabled]="!has('previous') || loading() || moving()"
>
Anterior
</button>
<button type="button" (click)="go('next')" [disabled]="!has('next') || loading() || moving()">
Siguiente
</button>
</nav>
}