Gobernanza: execution, models (training, run monitor, checks, lineage, bundles, interpretability), EEG studies
Share one execution selection across training and analysis. Use the first configured scheduler for a remote default and let the API validate typed addresses. Suspend health polling when the document is hidden. Poll each run serially, retry status reads on transient errors, and compute ETA from completed items and elapsed seconds. Reuse the Conectar Formly types with nullable fields and inlined references. Omit the optional cohort when its name is blank, and offer the declared input sets in a datalist with filename validation before upload. Identify the versions created by a training run from its version log lines, then check each exact version before promotion. Use native dialogs for checks, lineage, bulk confirmation and preview. Recheck promotion eligibility before submitting changes, and list results per version. Verify bundle hashes using SubtleCrypto before upload. Use blob downloads for bundles and reports. Read age centiles from the curve endpoint and keep the count-rate reference line from the report. Join study metrics by code and regional values by feature, skipping absent ages and values. Use one Plotly trace per association pair and scale the forest plot height by row count. Preflight the TEA pipeline before staging EDFs, then start the pipeline once for the batch. Refresh studies, their overlays and summary on completed runs. Page through analyze history to compare its end times against the latest tea_eeg result. The branch base lacks export/pdf.ts, so the preview uses the specified TODO and omits the PDF action. Added Vitest coverage for execution and run polling, ETA and cancellation, training schema, version actions, bundle digest verification, study overlays and the association forest. Ruff check, Ruff format --check, Prettier, strict Angular and TypeScript diagnostics for Gobernanza and git diff --check passed. npm ci, ng build and vitest run are assigned to the test machines.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
<section class="card model">
|
||||
<h2>Estudios EEG</h2>
|
||||
<form (ngSubmit)="analyze()">
|
||||
<label
|
||||
>Alcance
|
||||
<select name="scope" [(ngModel)]="mode">
|
||||
<option value="pending">Pendientes</option>
|
||||
<option value="first_n">Primeros N</option>
|
||||
<option value="ids">Por ID</option>
|
||||
</select>
|
||||
</label>
|
||||
@if (mode() === 'first_n') {
|
||||
<label
|
||||
>Número de estudios <input type="number" name="count" min="1" required [(ngModel)]="count"
|
||||
/></label>
|
||||
}
|
||||
@if (mode() === 'ids') {
|
||||
<label
|
||||
>ID de estudios (uno por línea) <textarea name="ids" required [(ngModel)]="ids"></textarea>
|
||||
</label>
|
||||
}
|
||||
<button mat-flat-button type="submit" [disabled]="busy() || !execution()">Analizar</button>
|
||||
</form>
|
||||
<form (ngSubmit)="upload(files)">
|
||||
<label>Archivos EDF <input #files type="file" accept=".edf" multiple required /></label>
|
||||
<button mat-stroked-button type="submit" [disabled]="busy()">Subir EDF</button>
|
||||
</form>
|
||||
@if (error()) {
|
||||
<p role="alert">{{ error() }}</p>
|
||||
}
|
||||
@if (runId(); as id) {
|
||||
<app-run-monitor [runId]="id" (finished)="finish()" />
|
||||
}
|
||||
<app-eeg-preview />
|
||||
<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-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>
|
||||
Reference in New Issue
Block a user