Files
WebApp/src/app/gobernanza/tea/studies.html
T

141 lines
4.3 KiB
HTML

<section class="card" aria-labelledby="studies-heading">
<h2 #heading id="studies-heading" tabindex="-1">Estudios EEG</h2>
<form class="button-row" (ngSubmit)="analyze()">
<mat-form-field appearance="outline">
<mat-label>Alcance</mat-label>
<mat-select name="scope" [(ngModel)]="mode">
<mat-option value="pending">Pendientes</mat-option>
<mat-option value="first_n">Primeros N</mat-option>
<mat-option value="ids">Por ID</mat-option>
</mat-select>
</mat-form-field>
@if (mode() === 'first_n') {
<mat-form-field appearance="outline">
<mat-label>Número de estudios</mat-label>
<input matInput type="number" name="count" min="1" required [(ngModel)]="count" />
</mat-form-field>
}
@if (mode() === 'ids') {
<mat-form-field appearance="outline">
<mat-label>ID de estudios (uno por línea)</mat-label>
<textarea matInput name="ids" required [(ngModel)]="ids"></textarea>
</mat-form-field>
}
<button mat-flat-button type="submit" [disabled]="busy() || !execution()">Analizar</button>
<button
mat-stroked-button
type="button"
[attr.aria-pressed]="showPreview()"
(click)="showPreview.set(!showPreview())"
>
Evaluar un solo estudio
</button>
</form>
<app-eeg-preview [active]="showPreview()" />
@if (error()) {
<p role="alert">{{ error() }}</p>
}
@if (runId(); as id) {
<app-run-monitor [runId]="id" (finished)="finish()" />
}
<h3>Resumen</h3>
@if (summary.hasValue()) {
<dl>
@for (count of summary.value() | keyvalue; track count.key) {
<dt>{{ labels[count.key] ?? count.key }}</dt>
<dd>{{ count.value }}</dd>
}
</dl>
} @else if (summary.error(); as error) {
<p role="alert">{{ errorText(error) }}</p>
}
@if (history.hasValue()) {
@if (history.value().last; as last) {
<p>
Última ejecución TEA: {{ last.status }}
@if (last.ended != null) {
· {{ last.ended * 1000 | date: 'short' }}
}
</p>
}
<p>
{{
history.value().current
? 'Indicadores al día'
: 'Indicadores pendientes: corre el análisis TEA'
}}
</p>
} @else if (history.error(); as error) {
<p role="alert">{{ errorText(error) }}</p>
}
@if (eegs.error(); as error) {
<p role="alert">{{ errorText(error) }}</p>
}
@if (eegMetrics.error(); as error) {
<p role="alert">{{ errorText(error) }}</p>
}
<div class="model">
<table class="plain eegs">
<thead>
<tr>
<th>Fecha</th>
<th>Registro</th>
<th>Análisis</th>
</tr>
</thead>
<tbody>
@for (e of eegs.hasValue() ? eegs.value() : []; track e.id) {
<tr>
<td>
<button
mat-stroked-button
type="button"
[disabled]="!e.analysed"
(click)="eeg.set(e.id)"
>
{{ e.study_date }}
</button>
</td>
<td>{{ e.lab_record_id ?? '—' }}</td>
<td>
{{ !e.analysed ? 'Sin analizar' : e.valid ? 'Válido' : 'No válido' }}
{{ e.level ? '(' + e.level + ')' : '' }}
</td>
</tr>
} @empty {
<tr>
<td colspan="3" class="muted">Sin EEG cargados.</td>
</tr>
}
</tbody>
</table>
@if (eegMetrics.hasValue() && eegMetrics.value(); as m) {
<h3>EEG {{ m.id }} · {{ m.age_months ?? '—' }} meses</h3>
<table class="plain">
<thead>
<tr>
<th>Métrica</th>
<th>Valor</th>
<th>z</th>
<th>Curva</th>
</tr>
</thead>
<tbody>
@for (x of m.metrics; track x.code) {
<tr>
<td>{{ metricNames[x.code] ?? x.code }}</td>
<td class="num">{{ x.value | number: '1.2-2' }}</td>
<td class="num">{{ x.z === null ? '—' : (x.z | number: '1.2-2') }}</td>
<td>{{ x.model ?? 'sin curva en producción' }}</td>
</tr>
} @empty {
<tr>
<td colspan="4" class="muted">Sin métricas (EEG no válido).</td>
</tr>
}
</tbody>
</table>
}
</div>
</section>