Files
WebApp/src/app/indicadores/tab-riesgos-tea.html
T
alberto 4929def121 F1g: whole-number axes, risk list link, dotted timeline, head map
Share the integer tick rule between Trazabilidad and TEA record figures.
Use the plotted extent, including stacked totals or interval bounds, to
target four divisions. Round spacing up to a 1/2/5 step with a minimum of
one, anchor ticks at zero, ignore nonfinite values, and include integer
bounds when a fractional extent contains no integer.

Point the existing patient link at the TEA risk route and remove the
details accordion and separate risk action. Exercise the link from the
risk list in the existing patient page case. Connect completed diamonds
in step order on the existing marker trace, using its color for the
dotted line and retaining the duration bars and annotations.

The scalp figure used the ear electrodes as markers outside the circle,
omitted the ears, and masked sample centers without clipping Plotly's
rendered contour cells at the scalp boundary. Its interpolation also
colored distant areas with no adjacent sample. Use the reference's 19
scalp positions, nose and ear paths, and reverse-wound mask painted in
the card's white surface color beneath the outline. Derive the mask and
the existing 41-point grid in headMapGeometry. Use the reference's 0.45
interpolation reach with inverse squared distance, taking a coincident
sample directly and preserving the existing zone inputs and z color
scale. Test mirror positions, scalp bounds, and plotted contour values.

Prettier, Ruff check, Ruff format check, and git diff --check passed.
Angular and Playwright execution are reserved for the test machines.
2026-12-01 13:42:54 -06:00

195 lines
6.4 KiB
HTML

<div class="filters worklist-filters card">
<app-patient-search [(value)]="search" (searched)="index.set(0)" />
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Fecha de corte</mat-label>
<input
matInput
type="date"
[ngModel]="filters().cutoff || cutoff()"
(ngModelChange)="setFilter('cutoff', $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Ventana de meses</mat-label>
<mat-select [value]="filters().window" (selectionChange)="setFilter('window', $event.value)">
@for (months of [1, 3, 6, 12]; track months) {
<mat-option [value]="months">{{ months }} {{ months === 1 ? 'mes' : 'meses' }}</mat-option>
}
</mat-select>
</mat-form-field>
@for (filter of tokenFilters; track filter.key) {
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }}</mat-label>
<mat-select
[value]="filters()[filter.key] || ''"
(selectionChange)="setFilter(filter.key, $event.value)"
>
<mat-option value="">Todos</mat-option>
@for (option of filter.options; track option.code) {
<mat-option [value]="option.code">{{ option.label }}</mat-option>
}
</mat-select>
</mat-form-field>
}
@for (filter of scoreFilters; track filter.label) {
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }} mínimo</mat-label>
<input
matInput
type="number"
step="any"
[ngModel]="filters()[filter.min]"
(ngModelChange)="setFilter(filter.min, $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>{{ filter.label }} máximo</mat-label>
<input
matInput
type="number"
step="any"
[ngModel]="filters()[filter.max]"
(ngModelChange)="setFilter(filter.max, $event)"
/>
</mat-form-field>
}
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Inicio</mat-label>
<input
matInput
type="date"
[ngModel]="filters().start"
(ngModelChange)="setFilter('start', $event)"
/>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Modelo de asociación</mat-label>
<mat-select
[value]="association()"
(selectionChange)="association.set($event.value); index.set(0)"
>
@for (option of associationOptions; track option) {
<mat-option [value]="option">{{ associationLabels[option] }}</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" subscriptSizing="dynamic">
<mat-label>Registros por página</mat-label>
<mat-select [value]="size()" (selectionChange)="size.set($event.value); index.set(0)">
@for (n of [20, 50, 100]; track n) {
<mat-option [value]="n">{{ n }}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
@if (cutoff()) {
<p class="muted window">Ventana consultada: {{ start() }} al {{ cutoff() }}.</p>
}
@if (summary(); as eeg) {
<section class="card eeg-summary" aria-labelledby="tea-eeg-summary">
<h3 id="tea-eeg-summary">EEG de los pacientes del periodo</h3>
<div class="counts">
<span
><strong>{{ eeg.normal }}</strong> Normales</span
>
<span
><strong>{{ eeg.abnormal }}</strong> Anormales</span
>
<span
><strong>{{ eeg.notValid }}</strong> Sin EEG válido</span
>
</div>
@if (eeg.alterations.length) {
<ul class="by-alteration">
@for (alteration of eeg.alterations; track alteration.code) {
<li>
{{ name(alteration.code) }}: <strong>{{ alteration.patients }}</strong>
</li>
}
</ul>
}
</section>
} @else if (summaryError()) {
<p role="alert">No se pudo leer el resumen de EEG.</p>
}
<div class="actions">
<button
mat-stroked-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 (error()) {
<p role="alert">No se pudieron leer los pacientes.</p>
} @else if (loading()) {
<app-loading what="pacientes" />
}
@if (!loading() && !error()) {
<div class="table-wrap card">
<table class="plain worklist">
<caption>
Resultados de asociación por paciente
</caption>
<thead>
<tr>
<th scope="col">Expediente</th>
<th scope="col">Nombre</th>
<th scope="col">Sexo</th>
<th scope="col">Edad (meses)</th>
<th scope="col">Asociación principal</th>
<th scope="col">Razón de momios</th>
<th scope="col">IC 95 %</th>
<th scope="col">q</th>
<th scope="col">Probabilidad</th>
<th scope="col">Probabilidad de referencia</th>
</tr>
</thead>
<tbody>
@for (row of rows(); track row.patient.id) {
@let id = row.patient.id!;
<tr>
<td>{{ row.recordNumbers.join(', ') || '—' }}</td>
<td>
<a [routerLink]="['/indicadores', 'tea', 'pacientes', id, 'riesgo']">
{{ row.name || '—' }}
</a>
</td>
<td>{{ row.patient.gender ? name(row.patient.gender) : '—' }}</td>
<td>{{ ageMonths(row.patient.birthDate, cutoff()) ?? '—' }}</td>
<td>{{ row.headline?.title ?? '—' }}</td>
<td>{{ formatOr(row.headline?.or) }}</td>
<td>{{ formatIc(row.headline?.low, row.headline?.high) }}</td>
<td>{{ formatQ(row.headline?.q) }}</td>
<td>{{ formatProbability(row.headline?.probability) }}</td>
<td>{{ formatProbability(row.headline?.reference) }}</td>
</tr>
} @empty {
<tr>
<td colspan="10" class="muted">No hay registros para los filtros aplicados.</td>
</tr>
}
</tbody>
</table>
</div>
<app-pager
[previousDisabled]="index() === 0"
[nextDisabled]="index() + 1 >= pageCount()"
(previous)="index.set(index() - 1)"
(next)="index.set(index() + 1)"
>
Página {{ index() + 1 }} de {{ pageCount() }} · {{ filtered().length }} registros
</app-pager>
}