180 lines
5.7 KiB
HTML
180 lines
5.7 KiB
HTML
<section class="page">
|
|
<h1>Gobernanza de modelos</h1>
|
|
<nav class="domains" aria-label="Dominios">
|
|
@for (d of domains.value() ?? []; track d) {
|
|
<a [routerLink]="['/gobernanza', d]" [class.active]="d === domain()">{{ labels[d] ?? d }}</a>
|
|
}
|
|
</nav>
|
|
|
|
<form class="card actions" (submit)="$event.preventDefault()">
|
|
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
|
<mat-label>Datos hasta</mat-label>
|
|
<input
|
|
matInput
|
|
type="date"
|
|
[ngModel]="asOf()"
|
|
(ngModelChange)="asOf.set($event)"
|
|
name="asOf"
|
|
/>
|
|
</mat-form-field>
|
|
<button mat-flat-button type="button" (click)="start('train')">Entrenar</button>
|
|
<button mat-stroked-button type="button" (click)="start('score')">Calcular riesgos</button>
|
|
@if (domain() === 'tea') {
|
|
<button mat-stroked-button type="button" (click)="analyzeEegs()">Analizar EEG</button>
|
|
}
|
|
@if (run(); as r) {
|
|
<span class="muted" role="status">{{ r.kind }}: {{ r.status }}</span>
|
|
}
|
|
</form>
|
|
@if (message()) {
|
|
<p class="muted" role="status">{{ message() }}</p>
|
|
}
|
|
|
|
@if (models.isLoading()) {
|
|
<p class="muted">Cargando modelos…</p>
|
|
} @else if (!models.value()?.length) {
|
|
<p class="muted empty">Este dominio todavía no tiene modelos entrenados.</p>
|
|
}
|
|
@for (m of models.value() ?? []; track m.name) {
|
|
<div class="card model">
|
|
<h2>{{ m.name }}</h2>
|
|
<table class="plain">
|
|
<thead>
|
|
<tr>
|
|
<th>Versión</th>
|
|
<th>Creada</th>
|
|
<th>Entrenamiento / prueba</th>
|
|
<th>Informes</th>
|
|
<th>Validación clínica</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for (v of m.versions; track v.version) {
|
|
<tr>
|
|
<td>
|
|
v{{ v.version }}
|
|
@if (champion(v)) {
|
|
<span class="badge">en producción</span>
|
|
}
|
|
</td>
|
|
<td>{{ v.created | date: 'yyyy-MM-dd HH:mm' }}</td>
|
|
<td class="num">
|
|
{{ v.metrics['n_train'] | number }} / {{ v.metrics['n_test'] | number }}
|
|
</td>
|
|
<td>
|
|
@for (r of v.reports; track r) {
|
|
<a [href]="reportUrl(m.name, v.version, r)" target="_blank" rel="noopener">{{
|
|
reportNames[r] ?? r
|
|
}}</a>
|
|
}
|
|
@if (v.reports.includes('interpretability')) {
|
|
<button
|
|
mat-button
|
|
type="button"
|
|
(click)="chosen.set({ name: m.name, version: v.version })"
|
|
>
|
|
Ver gráficas
|
|
</button>
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (!v.reports.includes('clinical_validation')) {
|
|
<input
|
|
type="file"
|
|
[attr.aria-label]="'Validación clínica de ' + m.name + ' v' + v.version"
|
|
(change)="upload(m.name, v.version, $event)"
|
|
/>
|
|
} @else {
|
|
Agregada
|
|
}
|
|
</td>
|
|
<td>
|
|
@if (!champion(v)) {
|
|
<button mat-stroked-button type="button" (click)="promote(m.name, v.version)">
|
|
Promover
|
|
</button>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
|
|
@if (chosen(); as c) {
|
|
<div class="card">
|
|
<h2>Interpretabilidad · {{ c.name }} v{{ c.version }}</h2>
|
|
@for (f of figures(); track f.title) {
|
|
<h3>{{ f.title }}</h3>
|
|
<app-plot [figure]="f.figure" [height]="360" />
|
|
} @empty {
|
|
<p class="muted">
|
|
{{ report.isLoading() ? 'Cargando…' : 'Este informe no tiene gráficas.' }}
|
|
</p>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
@if (domain() === 'tea') {
|
|
<div class="card model">
|
|
<h2>Electroencefalogramas</h2>
|
|
<table class="plain eegs">
|
|
<thead>
|
|
<tr>
|
|
<th>Fecha</th>
|
|
<th>Registro</th>
|
|
<th>Análisis</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for (e of eegs.value() ?? []; track e.id) {
|
|
<tr>
|
|
<td>
|
|
<button mat-button type="button" (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.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>
|