Files
WebApp/src/app/governance/components/model-version-dialog/model-version-dialog.html
T
edgar 60c71bfc3d Governance: a version lists only the routines its run recorded
Not every model has each of the five routines, and the registry doesn't require them; the dialog showed the missing
ones as failures. It now lists the recorded ones and says so when there are none.

(cherry picked from commit b5bff7e0c6)
2026-11-22 09:47:11 -06:00

171 lines
6.5 KiB
HTML

<h2 mat-dialog-title class="title">
{{ title }}
@if (lineage(); as l) {
<app-model-status [status]="l.model_version.status"></app-model-status>
}
</h2>
<mat-dialog-content class="content">
@if (busy()) {
<mat-progress-bar mode="indeterminate" aria-label="Cargando"></mat-progress-bar>
}
@if (error(); as message) {
<p class="alert" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ message }}</p>
}
@if (lineage(); as l) {
@let v = l.model_version;
<section class="summary">
<dl>
<dt>Dominio · escenario</dt>
<dd>{{ v.tags.domain }} · {{ v.tags.scenario }}</dd>
<dt>Entorno</dt>
<dd>{{ v.tags.environment }}</dd>
<dt>Creada</dt>
<dd>{{ v.created_at | date: 'medium' }}</dd>
@if (v.tags.promovida_en) {
<dt>Promovida</dt>
<dd>{{ v.tags.promovida_en | date: 'medium' }}</dd>
}
<dt>Predicciones registradas</dt>
<dd>{{ l.predictions | number }}</dd>
</dl>
@if (metrics(v).length) {
<dl class="metrics">
@for (metric of metrics(v); track metric[0]) {
<dt>{{ metric[0] }}</dt>
<dd>{{ metric[1] }}</dd>
}
</dl>
}
</section>
<section aria-labelledby="checks-title">
<h3 id="checks-title">Requisitos para producción</h3>
<ul class="checks">
@for (check of l.checks; track $index) {
<li [class.checks__fail]="!check.passed">
<mat-icon aria-hidden="true">{{ check.passed ? 'check_circle' : 'cancel' }}</mat-icon>
<span class="checks__code">{{ check.code }}</span>
<span>{{ check.requirement }}</span>
@if (check.detail) {
<span class="checks__detail">{{ check.detail }}</span>
}
</li>
}
</ul>
</section>
<section aria-labelledby="cohort-title">
<h3 id="cohort-title">Cohorte de entrenamiento</h3>
@if (l.cohorte_armado; as armado) {
<p>
{{ armado.url }} · versión {{ armado.version }} · {{ armado.n_miembros | number }} miembros ·
datos al {{ armado.datos_as_of | date: 'mediumDate' }}
</p>
<p class="hash" [matTooltip]="armado.huella">huella {{ armado.huella.slice(0, 12) }}… · armado {{ armado.armado_id }}</p>
@if (l.cohorte_exclusiones.length) {
<table class="exclusions">
<thead>
<tr><th>#</th><th>Paso</th><th>Quedan</th></tr>
</thead>
<tbody>
@for (paso of l.cohorte_exclusiones; track paso.orden) {
<tr><td>{{ paso.orden }}</td><td>{{ paso.paso }}</td><td>{{ paso.n | number }}</td></tr>
}
</tbody>
</table>
}
} @else {
<p class="muted">Sin cohorte enlazada.</p>
}
</section>
<section aria-labelledby="routines-title">
<h3 id="routines-title">Rutinas del entrenamiento</h3>
<p class="muted">Lo que cada rutina hizo, registrado por la corrida mientras entrenaba. No todos los modelos
tienen cada rutina; no se piden para promover (ML-01a lo cumple la corrida misma).</p>
@let recorded = recordedRoutines(l.routines);
@if (recorded.length) {
<ul class="artifacts">
@for (routine of recorded; track routine.kind) {
<li>
<mat-icon aria-hidden="true">check_circle</mat-icon>
<span class="artifacts__kind">{{ routine.label }}</span>
<details class="routine">
<summary>{{ routine.record['method'] ?? 'Ver registro' }}</summary>
<pre>{{ routine.record | json }}</pre>
</details>
</li>
}
</ul>
} @else {
<p class="muted">La corrida no guardó registros de rutina.</p>
}
</section>
<section aria-labelledby="artifacts-title">
<h3 id="artifacts-title">Archivos de la corrida</h3>
<ul class="artifacts">
@for (file of files(l.artifacts); track file.path) {
<li>
<mat-icon aria-hidden="true">description</mat-icon>
<a class="artifacts__name" [href]="artifactUrl(file.path)" download>{{ file.label }}</a>
@if (file.size !== null) {
<span class="muted">{{ file.size | number }} B</span>
}
</li>
} @empty {
<li class="muted">Sin archivos.</li>
}
</ul>
<div class="upload">
<button mat-stroked-button type="button" (click)="tryInNotebook()">
<mat-icon aria-hidden="true">science</mat-icon>Probar en un notebook
</button>
<span class="muted">Corre un notebook propio sobre una cohorte, con esta versión cargada.</span>
</div>
</section>
<section aria-labelledby="reports-title">
<h3 id="reports-title">Reportes de validación</h3>
<form [formGroup]="reports" class="reports" (ngSubmit)="saveReports()">
<mat-form-field appearance="outline">
<mat-label>Pruebas técnicas (MLD-01)</mat-label>
<input matInput formControlName="technical_validation_report_uri" placeholder="Ruta o URL del reporte" />
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Validación clínica (MLD-01b)</mat-label>
<input matInput formControlName="clinical_validation_report_uri" placeholder="Ruta o URL del reporte" />
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Interpretabilidad (MLD-03)</mat-label>
<input matInput formControlName="interpretability_report_uri" placeholder="Ruta o URL del reporte" />
</mat-form-field>
<button mat-stroked-button type="submit" [disabled]="busy() || reports.pristine">Guardar reportes</button>
</form>
</section>
}
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button type="button" (click)="close()">Cerrar</button>
@if (lineage(); as l) {
@if (l.model_version.status === 'produccion') {
<button mat-stroked-button type="button" [disabled]="busy()" (click)="retire()">
<mat-icon aria-hidden="true">pause_circle</mat-icon>Retirar de producción
</button>
} @else {
<button
mat-flat-button
type="button"
[disabled]="busy() || !ready(l.checks)"
[matTooltip]="ready(l.checks) ? '' : 'Faltan requisitos para producción'"
(click)="promote()"
>
<mat-icon aria-hidden="true">rocket_launch</mat-icon>Promover a producción
</button>
}
}
</mat-dialog-actions>