Merge parity/F1h
This commit is contained in:
+24
-19
@@ -149,16 +149,11 @@ test('tea gobernanza: every section in sync mode, and the preview saved as PDF',
|
|||||||
'Ejecución',
|
'Ejecución',
|
||||||
'Modelos',
|
'Modelos',
|
||||||
'Entrenamiento',
|
'Entrenamiento',
|
||||||
'Subir archivos',
|
|
||||||
'Bundles',
|
'Bundles',
|
||||||
'Estudios EEG',
|
'Estudios EEG',
|
||||||
]);
|
]);
|
||||||
await expect(page.locator('app-eeg-preview')).toHaveCount(0);
|
await expect(page.getByRole('heading', { name: 'Subir archivos', exact: true })).toHaveCount(0);
|
||||||
await expect(page.getByText('Archivos de entrenamiento', { exact: true })).toHaveCount(0);
|
await expect(page.getByText('Archivos de entrenamiento', { exact: true })).toHaveCount(0);
|
||||||
const uploads = page.getByRole('region', { name: 'Subir archivos' });
|
|
||||||
await expect(uploads.getByLabel('Conjunto')).toBeVisible();
|
|
||||||
await expect(uploads.getByRole('button', { name: 'Archivos', exact: true })).toBeVisible();
|
|
||||||
await expect(uploads.getByRole('button', { name: 'Subir archivos' })).toBeDisabled();
|
|
||||||
await page.getByRole('combobox', { name: 'Modo' }).click();
|
await page.getByRole('combobox', { name: 'Modo' }).click();
|
||||||
await page.getByRole('option', { name: 'Sync' }).click();
|
await page.getByRole('option', { name: 'Sync' }).click();
|
||||||
await expect(page.getByRole('status').filter({ hasText: 'Disponible' })).toBeVisible();
|
await expect(page.getByRole('status').filter({ hasText: 'Disponible' })).toBeVisible();
|
||||||
@@ -205,14 +200,28 @@ test('tea gobernanza: every section in sync mode, and the preview saved as PDF',
|
|||||||
{ timeout: 10 * 60_000 },
|
{ timeout: 10 * 60_000 },
|
||||||
);
|
);
|
||||||
|
|
||||||
await page
|
const models = page.getByRole('region', { name: 'Modelos' });
|
||||||
.locator('app-governance-models')
|
const toggle = models.getByRole('button', { name: 'Evaluar un solo estudio' });
|
||||||
.getByRole('button', {
|
const preview = models.locator('.button-row + app-eeg-preview');
|
||||||
name: 'Evaluar un solo estudio',
|
const edf = preview.getByRole('button', { name: 'EDF', exact: true });
|
||||||
})
|
const ados = preview.getByRole('button', { name: 'ADOS-2 (PDF)', exact: true });
|
||||||
.click();
|
const birth = preview.getByLabel('Fecha de nacimiento');
|
||||||
const preview = page.locator('app-eeg-preview');
|
await expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||||||
await expect(preview.getByRole('heading', { name: 'Vista previa' })).toBeVisible();
|
await expect(edf).toBeHidden();
|
||||||
|
await expect(ados).toBeHidden();
|
||||||
|
await expect(birth).toBeHidden();
|
||||||
|
await toggle.click();
|
||||||
|
await expect(toggle).toHaveAttribute('aria-pressed', 'true');
|
||||||
|
await expect(page.getByRole('heading', { name: 'Vista previa', exact: true })).toHaveCount(0);
|
||||||
|
await expect(edf).toBeVisible();
|
||||||
|
await expect(ados).toBeVisible();
|
||||||
|
await expect(birth).toBeVisible();
|
||||||
|
await toggle.click();
|
||||||
|
await expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||||||
|
await expect(edf).toBeHidden();
|
||||||
|
await expect(ados).toBeHidden();
|
||||||
|
await expect(birth).toBeHidden();
|
||||||
|
await toggle.click();
|
||||||
await preview.getByLabel('EDF').setInputFiles(process.env['TEA_EDF']!);
|
await preview.getByLabel('EDF').setInputFiles(process.env['TEA_EDF']!);
|
||||||
await preview.getByLabel('ADOS-2 (PDF)').setInputFiles(process.env['TEA_ADOS2']!);
|
await preview.getByLabel('ADOS-2 (PDF)').setInputFiles(process.env['TEA_ADOS2']!);
|
||||||
await preview.getByLabel('Fecha de nacimiento').fill(process.env['TEA_BIRTH']!);
|
await preview.getByLabel('Fecha de nacimiento').fill(process.env['TEA_BIRTH']!);
|
||||||
@@ -306,9 +315,5 @@ test('cacu gobernanza: the shared sections only, none of the TEA ones', async ({
|
|||||||
const nav = page.getByRole('navigation', { name: 'Dominios' });
|
const nav = page.getByRole('navigation', { name: 'Dominios' });
|
||||||
await expect(nav.getByRole('link', { name: 'Cáncer de mama' })).toBeVisible();
|
await expect(nav.getByRole('link', { name: 'Cáncer de mama' })).toBeVisible();
|
||||||
await expect(nav.getByRole('link', { name: 'Trastorno del espectro autista' })).toBeVisible();
|
await expect(nav.getByRole('link', { name: 'Trastorno del espectro autista' })).toBeVisible();
|
||||||
expect(
|
expect(problems.filter((p) => !p.startsWith('console: Failed to load'))).toEqual([]);
|
||||||
problems.filter(
|
|
||||||
(p) => !p.endsWith('/models/cacu/all/inputs') && !p.startsWith('console: Failed to load'),
|
|
||||||
),
|
|
||||||
).toEqual([]);
|
|
||||||
});
|
});
|
||||||
|
|||||||
-146
@@ -255,24 +255,6 @@
|
|||||||
"title": "Body_upload",
|
"title": "Body_upload",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"Body_upload_training_inputs": {
|
|
||||||
"properties": {
|
|
||||||
"files": {
|
|
||||||
"items": {
|
|
||||||
"format": "binary",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"minItems": 1,
|
|
||||||
"title": "Files",
|
|
||||||
"type": "array"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"files"
|
|
||||||
],
|
|
||||||
"title": "Body_upload_training_inputs",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"Browsed": {
|
"Browsed": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"entries": {
|
"entries": {
|
||||||
@@ -5121,134 +5103,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/models/{domain}/{name}/inputs": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "training_inputs",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "domain",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/Domain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "name",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"title": "Name",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"additionalProperties": {
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"title": "Response Training Inputs",
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": "Successful Response"
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/HTTPValidationError"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": "Validation Error"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"summary": "Training Inputs",
|
|
||||||
"tags": [
|
|
||||||
"models"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/models/{domain}/{name}/inputs/{set}/files": {
|
|
||||||
"post": {
|
|
||||||
"operationId": "upload_training_inputs",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "domain",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/Domain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "name",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"title": "Name",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "set",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"title": "Set",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
|
||||||
"content": {
|
|
||||||
"multipart/form-data": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/Body_upload_training_inputs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"additionalProperties": true,
|
|
||||||
"title": "Response Upload Training Inputs",
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": "Successful Response"
|
|
||||||
},
|
|
||||||
"422": {
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/components/schemas/HTTPValidationError"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": "Validation Error"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"summary": "Upload Training Inputs",
|
|
||||||
"tags": [
|
|
||||||
"models"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/models/{domain}/{name}/training-config": {
|
"/models/{domain}/{name}/training-config": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "training_config",
|
"operationId": "training_config",
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
|
||||||
|
|
||||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { filter, map } from 'rxjs/operators';
|
|
||||||
import { StrictHttpResponse } from '../../strict-http-response';
|
|
||||||
import { RequestBuilder } from '../../request-builder';
|
|
||||||
|
|
||||||
import { Domain } from '../../models/domain';
|
|
||||||
|
|
||||||
export interface TrainingInputs$Params {
|
|
||||||
domain: Domain;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function trainingInputs(http: HttpClient, rootUrl: string, params: TrainingInputs$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
|
||||||
[key: string]: Array<string>;
|
|
||||||
}>> {
|
|
||||||
const rb = new RequestBuilder(rootUrl, trainingInputs.PATH, 'get');
|
|
||||||
if (params) {
|
|
||||||
rb.path('domain', params.domain, {});
|
|
||||||
rb.path('name', params.name, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
return http.request(
|
|
||||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
|
||||||
).pipe(
|
|
||||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
|
||||||
map((r: HttpResponse<any>) => {
|
|
||||||
return r as StrictHttpResponse<{
|
|
||||||
[key: string]: Array<string>;
|
|
||||||
}>;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
trainingInputs.PATH = '/models/{domain}/{name}/inputs';
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
|
||||||
|
|
||||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { filter, map } from 'rxjs/operators';
|
|
||||||
import { StrictHttpResponse } from '../../strict-http-response';
|
|
||||||
import { RequestBuilder } from '../../request-builder';
|
|
||||||
|
|
||||||
import { BodyUploadTrainingInputs } from '../../models/body-upload-training-inputs';
|
|
||||||
import { Domain } from '../../models/domain';
|
|
||||||
|
|
||||||
export interface UploadTrainingInputs$Params {
|
|
||||||
domain: Domain;
|
|
||||||
name: string;
|
|
||||||
set: string;
|
|
||||||
body: BodyUploadTrainingInputs
|
|
||||||
}
|
|
||||||
|
|
||||||
export function uploadTrainingInputs(http: HttpClient, rootUrl: string, params: UploadTrainingInputs$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
|
||||||
[key: string]: any;
|
|
||||||
}>> {
|
|
||||||
const rb = new RequestBuilder(rootUrl, uploadTrainingInputs.PATH, 'post');
|
|
||||||
if (params) {
|
|
||||||
rb.path('domain', params.domain, {});
|
|
||||||
rb.path('name', params.name, {});
|
|
||||||
rb.path('set', params.set, {});
|
|
||||||
rb.body(params.body, 'multipart/form-data');
|
|
||||||
}
|
|
||||||
|
|
||||||
return http.request(
|
|
||||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
|
||||||
).pipe(
|
|
||||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
|
||||||
map((r: HttpResponse<any>) => {
|
|
||||||
return r as StrictHttpResponse<{
|
|
||||||
[key: string]: any;
|
|
||||||
}>;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uploadTrainingInputs.PATH = '/models/{domain}/{name}/inputs/{set}/files';
|
|
||||||
@@ -53,10 +53,6 @@ export type { Score$Params as Score$Params } from './fn/models/score';
|
|||||||
export { score as score } from './fn/models/score';
|
export { score as score } from './fn/models/score';
|
||||||
export type { Train$Params as Train$Params } from './fn/models/train';
|
export type { Train$Params as Train$Params } from './fn/models/train';
|
||||||
export { train as train } from './fn/models/train';
|
export { train as train } from './fn/models/train';
|
||||||
export type { TrainingInputs$Params as TrainingInputs$Params } from './fn/models/training-inputs';
|
|
||||||
export { trainingInputs as trainingInputs } from './fn/models/training-inputs';
|
|
||||||
export type { UploadTrainingInputs$Params as UploadTrainingInputs$Params } from './fn/models/upload-training-inputs';
|
|
||||||
export { uploadTrainingInputs as uploadTrainingInputs } from './fn/models/upload-training-inputs';
|
|
||||||
export type { TrainingConfig$Params as TrainingConfig$Params } from './fn/models/training-config';
|
export type { TrainingConfig$Params as TrainingConfig$Params } from './fn/models/training-config';
|
||||||
export { trainingConfig as trainingConfig } from './fn/models/training-config';
|
export { trainingConfig as trainingConfig } from './fn/models/training-config';
|
||||||
export type { Versions$Params as Versions$Params } from './fn/models/versions';
|
export type { Versions$Params as Versions$Params } from './fn/models/versions';
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export type { BodyAddClinicalValidation } from './models/body-add-clinical-valid
|
|||||||
export type { BodyImportModels } from './models/body-import-models';
|
export type { BodyImportModels } from './models/body-import-models';
|
||||||
export type { BodyStartPreview } from './models/body-start-preview';
|
export type { BodyStartPreview } from './models/body-start-preview';
|
||||||
export type { BodyUpload } from './models/body-upload';
|
export type { BodyUpload } from './models/body-upload';
|
||||||
export type { BodyUploadTrainingInputs } from './models/body-upload-training-inputs';
|
|
||||||
export type { Browsed } from './models/browsed';
|
export type { Browsed } from './models/browsed';
|
||||||
export type { Cancel } from './models/cancel';
|
export type { Cancel } from './models/cancel';
|
||||||
export type { Catalog } from './models/catalog';
|
export type { Catalog } from './models/catalog';
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
/* eslint-disable */
|
|
||||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
|
||||||
|
|
||||||
export interface BodyUploadTrainingInputs {
|
|
||||||
files: Array<Blob>;
|
|
||||||
}
|
|
||||||
@@ -44,7 +44,7 @@ export async function exportErrorText(error: unknown): Promise<string> {
|
|||||||
template: `
|
template: `
|
||||||
<section class="card" aria-labelledby="bundles-heading">
|
<section class="card" aria-labelledby="bundles-heading">
|
||||||
<h2 id="bundles-heading">Bundles</h2>
|
<h2 id="bundles-heading">Bundles</h2>
|
||||||
<form (ngSubmit)="export()">
|
<form class="button-row" (ngSubmit)="export()">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Versiones</mat-label>
|
<mat-label>Versiones</mat-label>
|
||||||
<mat-select name="versions" [(ngModel)]="selection">
|
<mat-select name="versions" [(ngModel)]="selection">
|
||||||
@@ -60,7 +60,7 @@ export async function exportErrorText(error: unknown): Promise<string> {
|
|||||||
SHA-256 <code>{{ exportedHash() }}</code>
|
SHA-256 <code>{{ exportedHash() }}</code>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
<form (ngSubmit)="import(file)">
|
<form class="button-row" (ngSubmit)="import(file)">
|
||||||
<input
|
<input
|
||||||
#file
|
#file
|
||||||
type="file"
|
type="file"
|
||||||
|
|||||||
@@ -58,9 +58,11 @@ import type { Health } from '../api/models/health';
|
|||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
@if (h.dashboard_url && h.dashboard_ok !== false) {
|
@if (h.dashboard_url && h.dashboard_ok !== false) {
|
||||||
<a mat-stroked-button [href]="h.dashboard_url" target="_blank" rel="noopener"
|
<div class="button-row">
|
||||||
>Panel de Dask</a
|
<a mat-stroked-button [href]="h.dashboard_url" target="_blank" rel="noopener"
|
||||||
>
|
>Panel de Dask</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
} @else if (health.error() || options.error()) {
|
} @else if (health.error() || options.error()) {
|
||||||
<p role="alert">No se pudo consultar la ejecución.</p>
|
<p role="alert">No se pudo consultar la ejecución.</p>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<section class="page">
|
<section class="page">
|
||||||
<h1>Gobernanza de modelos</h1>
|
<h1>Gobernanza de modelos</h1>
|
||||||
<p class="subtitle">Administra la ejecución, las versiones y el entrenamiento por dominio.</p>
|
<p class="subtitle">Administra la ejecución, las versiones y el entrenamiento por dominio.</p>
|
||||||
<nav class="domains" aria-label="Dominios">
|
<nav class="domains button-row" aria-label="Dominios">
|
||||||
@for (d of domains.hasValue() ? domains.value() : []; track d) {
|
@for (d of domains.hasValue() ? domains.value() : []; track d) {
|
||||||
<a mat-stroked-button [routerLink]="['/gobernanza', d]" [class.active]="d === domain()">
|
<a mat-stroked-button [routerLink]="['/gobernanza', d]" [class.active]="d === domain()">
|
||||||
{{ labels[d] ?? d }}
|
{{ labels[d] ?? d }}
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
[domain]="domainKey()"
|
[domain]="domainKey()"
|
||||||
[execution]="execution.execution()"
|
[execution]="execution.execution()"
|
||||||
(trainingRequested)="training.focus()"
|
(trainingRequested)="training.focus()"
|
||||||
(previewRequested)="showPreview.set(true)"
|
|
||||||
/>
|
/>
|
||||||
<app-governance-training
|
<app-governance-training
|
||||||
#training
|
#training
|
||||||
@@ -39,9 +38,6 @@
|
|||||||
[refresh]="models.refreshed()"
|
[refresh]="models.refreshed()"
|
||||||
(changed)="models.refresh()"
|
(changed)="models.refresh()"
|
||||||
/>
|
/>
|
||||||
@if (showPreview()) {
|
|
||||||
<app-eeg-preview />
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.domains {
|
.domains {
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: var(--space-3);
|
|
||||||
margin-bottom: var(--space-4);
|
margin-bottom: var(--space-4);
|
||||||
}
|
}
|
||||||
.domains a.active {
|
.domains a.active {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, computed, inject, input, linkedSignal, resource } from '@angular/core';
|
import { Component, computed, inject, input, resource } from '@angular/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { Api } from '../api/api';
|
import { Api } from '../api/api';
|
||||||
@@ -8,29 +8,18 @@ import { DOMAINS } from '../app';
|
|||||||
import { Bundles } from './bundles';
|
import { Bundles } from './bundles';
|
||||||
import { Execution } from './execution';
|
import { Execution } from './execution';
|
||||||
import { Models } from './models';
|
import { Models } from './models';
|
||||||
import { EegPreview } from './tea/preview';
|
|
||||||
import { EegStudies } from './tea/studies';
|
import { EegStudies } from './tea/studies';
|
||||||
import { Training } from './training';
|
import { Training } from './training';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gobernanza',
|
selector: 'app-gobernanza',
|
||||||
imports: [
|
imports: [MatButtonModule, RouterLink, Execution, Models, Training, Bundles, EegStudies],
|
||||||
MatButtonModule,
|
|
||||||
RouterLink,
|
|
||||||
Execution,
|
|
||||||
Models,
|
|
||||||
Training,
|
|
||||||
Bundles,
|
|
||||||
EegStudies,
|
|
||||||
EegPreview,
|
|
||||||
],
|
|
||||||
templateUrl: './gobernanza.html',
|
templateUrl: './gobernanza.html',
|
||||||
styleUrl: './gobernanza.scss',
|
styleUrl: './gobernanza.scss',
|
||||||
})
|
})
|
||||||
export class Gobernanza {
|
export class Gobernanza {
|
||||||
private readonly api = inject(Api);
|
private readonly api = inject(Api);
|
||||||
readonly domain = input.required<string>();
|
readonly domain = input.required<string>();
|
||||||
protected readonly showPreview = linkedSignal({ source: this.domain, computation: () => false });
|
|
||||||
protected readonly domainKey = computed(() => this.domain() as Domain);
|
protected readonly domainKey = computed(() => this.domain() as Domain);
|
||||||
protected readonly labels = DOMAINS as Record<string, string>;
|
protected readonly labels = DOMAINS as Record<string, string>;
|
||||||
protected readonly domains = resource({ loader: () => this.api.invoke(domains) });
|
protected readonly domains = resource({ loader: () => this.api.invoke(domains) });
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<section class="card" aria-labelledby="models-heading">
|
<section class="card" aria-labelledby="models-heading">
|
||||||
<h2 id="models-heading">Modelos</h2>
|
<h2 id="models-heading">Modelos</h2>
|
||||||
<div class="actions">
|
<div class="button-row">
|
||||||
<button mat-flat-button type="button" (click)="selectTraining('all')">Entrenar modelos</button>
|
<button mat-flat-button type="button" (click)="selectTraining('all')">Entrenar modelos</button>
|
||||||
<button
|
<button
|
||||||
mat-stroked-button
|
mat-stroked-button
|
||||||
@@ -19,7 +19,12 @@
|
|||||||
>
|
>
|
||||||
Analizar EEG
|
Analizar EEG
|
||||||
</button>
|
</button>
|
||||||
<button mat-stroked-button type="button" (click)="previewRequested.emit()">
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
type="button"
|
||||||
|
[attr.aria-pressed]="showPreview()"
|
||||||
|
(click)="showPreview.set(!showPreview())"
|
||||||
|
>
|
||||||
Evaluar un solo estudio
|
Evaluar un solo estudio
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
@@ -32,6 +37,9 @@
|
|||||||
Promover candidatas
|
Promover candidatas
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@if (domain() === 'tea') {
|
||||||
|
<app-eeg-preview [active]="showPreview()" />
|
||||||
|
}
|
||||||
@if (run(); as current) {
|
@if (run(); as current) {
|
||||||
<section>
|
<section>
|
||||||
<h3>{{ current.label }}</h3>
|
<h3>{{ current.label }}</h3>
|
||||||
@@ -52,7 +60,11 @@
|
|||||||
@for (m of models.hasValue() ? models.value() : []; track m.name) {
|
@for (m of models.hasValue() ? models.value() : []; track m.name) {
|
||||||
<section class="model">
|
<section class="model">
|
||||||
<h3>{{ m.title }}</h3>
|
<h3>{{ m.title }}</h3>
|
||||||
<button mat-stroked-button type="button" (click)="selectTraining(m.name)">Reentrenar</button>
|
<div class="button-row">
|
||||||
|
<button mat-stroked-button type="button" (click)="selectTraining(m.name)">
|
||||||
|
Reentrenar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<table class="plain">
|
<table class="plain">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -75,24 +87,26 @@
|
|||||||
{{ v.metrics['n_train'] | number }} / {{ v.metrics['n_test'] | number }}
|
{{ v.metrics['n_train'] | number }} / {{ v.metrics['n_test'] | number }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@for (report of v.reports; track report) {
|
<div class="button-row">
|
||||||
<button
|
@for (report of v.reports; track report) {
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
(click)="reportDownload(m.name, v.version, report)"
|
type="button"
|
||||||
>
|
(click)="reportDownload(m.name, v.version, report)"
|
||||||
{{ reportNames[report] ?? report }}
|
>
|
||||||
</button>
|
{{ reportNames[report] ?? report }}
|
||||||
}
|
</button>
|
||||||
@if (v.reports.includes('interpretability')) {
|
}
|
||||||
<button
|
@if (v.reports.includes('interpretability')) {
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
(click)="chooseReport({ name: m.name, version: v.version })"
|
type="button"
|
||||||
>
|
(click)="chooseReport({ name: m.name, version: v.version })"
|
||||||
Ver gráficas
|
>
|
||||||
</button>
|
Ver gráficas
|
||||||
}
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if (!v.reports.includes('clinical_validation')) {
|
@if (!v.reports.includes('clinical_validation')) {
|
||||||
@@ -111,24 +125,26 @@
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<div class="button-row">
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
(click)="
|
type="button"
|
||||||
showVersion('checks', { name: m.name, version: v.version }, checksDialog)
|
(click)="
|
||||||
"
|
showVersion('checks', { name: m.name, version: v.version }, checksDialog)
|
||||||
>
|
"
|
||||||
Comprobaciones
|
>
|
||||||
</button>
|
Comprobaciones
|
||||||
<button
|
</button>
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
(click)="
|
type="button"
|
||||||
showVersion('lineage', { name: m.name, version: v.version }, lineageDialog)
|
(click)="
|
||||||
"
|
showVersion('lineage', { name: m.name, version: v.version }, lineageDialog)
|
||||||
>
|
"
|
||||||
Linaje
|
>
|
||||||
</button>
|
Linaje
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@@ -190,22 +206,24 @@
|
|||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<button
|
<div class="button-row">
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
[disabled]="editing() || !actions.promote"
|
type="button"
|
||||||
(click)="changeVersion(key, 'promote')"
|
[disabled]="editing() || !actions.promote"
|
||||||
>
|
(click)="changeVersion(key, 'promote')"
|
||||||
Promover
|
>
|
||||||
</button>
|
Promover
|
||||||
<button
|
</button>
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
[disabled]="editing() || !actions.retire"
|
type="button"
|
||||||
(click)="changeVersion(key, 'retire')"
|
[disabled]="editing() || !actions.retire"
|
||||||
>
|
(click)="changeVersion(key, 'retire')"
|
||||||
Retirar
|
>
|
||||||
</button>
|
Retirar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
} @else if (checks.error(); as error) {
|
} @else if (checks.error(); as error) {
|
||||||
<p role="alert">{{ errorText(error) }}</p>
|
<p role="alert">{{ errorText(error) }}</p>
|
||||||
} @else {
|
} @else {
|
||||||
@@ -215,7 +233,7 @@
|
|||||||
<p role="status">{{ message() }}</p>
|
<p role="status">{{ message() }}</p>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<form method="dialog"><button mat-stroked-button>Cerrar</button></form>
|
<form class="button-row" method="dialog"><button mat-stroked-button>Cerrar</button></form>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog #lineageDialog aria-label="Linaje" (close)="lineageFor.set(undefined)">
|
<dialog #lineageDialog aria-label="Linaje" (close)="lineageFor.set(undefined)">
|
||||||
@@ -259,7 +277,7 @@
|
|||||||
<p>Cargando…</p>
|
<p>Cargando…</p>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<form method="dialog"><button mat-stroked-button>Cerrar</button></form>
|
<form class="button-row" method="dialog"><button mat-stroked-button>Cerrar</button></form>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog #bulkDialog aria-label="Promover candidatas">
|
<dialog #bulkDialog aria-label="Promover candidatas">
|
||||||
@@ -269,14 +287,16 @@
|
|||||||
<li>{{ candidate.name }} v{{ candidate.version }}</li>
|
<li>{{ candidate.name }} v{{ candidate.version }}</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<button
|
<div class="button-row">
|
||||||
mat-flat-button
|
<button
|
||||||
type="button"
|
mat-flat-button
|
||||||
[disabled]="editing()"
|
type="button"
|
||||||
(click)="promoteCandidates(bulkDialog)"
|
[disabled]="editing()"
|
||||||
>
|
(click)="promoteCandidates(bulkDialog)"
|
||||||
Promover
|
>
|
||||||
</button>
|
Promover
|
||||||
<form method="dialog"><button mat-stroked-button>Cancelar</button></form>
|
</button>
|
||||||
|
<form method="dialog"><button mat-stroked-button>Cancelar</button></form>
|
||||||
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--space-3);
|
|
||||||
margin-bottom: var(--space-4);
|
|
||||||
}
|
|
||||||
.model {
|
.model {
|
||||||
margin-bottom: var(--space-4);
|
margin-bottom: var(--space-4);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -31,6 +24,3 @@
|
|||||||
dialog {
|
dialog {
|
||||||
max-width: min(90vw, 64rem);
|
max-width: min(90vw, 64rem);
|
||||||
}
|
}
|
||||||
dialog form {
|
|
||||||
margin-top: var(--space-3);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { checkActions } from './models';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { Api } from '../api/api';
|
||||||
|
import { checkActions, Models } from './models';
|
||||||
|
|
||||||
describe('version checks', () => {
|
describe('version checks', () => {
|
||||||
it('enables promotion only when the API says the version is promotable', () => {
|
it('enables promotion only when the API says the version is promotable', () => {
|
||||||
@@ -14,3 +16,30 @@ describe('version checks', () => {
|
|||||||
expect(checkActions({ status: 'candidate', promotable: true, checks: [] }).retire).toBe(true);
|
expect(checkActions({ status: 'candidate', promotable: true, checks: [] }).retire).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('single study evaluation', () => {
|
||||||
|
it('toggles the preview form below the Modelos button row', async () => {
|
||||||
|
TestBed.overrideProvider(Api, { useValue: { invoke: vi.fn().mockResolvedValue([]) } });
|
||||||
|
const fixture = TestBed.createComponent(Models);
|
||||||
|
fixture.componentRef.setInput('domain', 'tea');
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
const host: HTMLElement = fixture.nativeElement;
|
||||||
|
const toggle = host.querySelector<HTMLButtonElement>('button[aria-pressed]')!;
|
||||||
|
const form = host.querySelector<HTMLFormElement>('.button-row + app-eeg-preview > form')!;
|
||||||
|
expect(toggle.getAttribute('aria-pressed')).toBe('false');
|
||||||
|
expect(form.hidden).toBe(true);
|
||||||
|
|
||||||
|
toggle.click();
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(toggle.getAttribute('aria-pressed')).toBe('true');
|
||||||
|
expect(form.hidden).toBe(false);
|
||||||
|
expect(form.querySelectorAll('input')).toHaveLength(3);
|
||||||
|
|
||||||
|
toggle.click();
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(toggle.getAttribute('aria-pressed')).toBe('false');
|
||||||
|
expect(form.hidden).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
effect,
|
effect,
|
||||||
inject,
|
inject,
|
||||||
input,
|
input,
|
||||||
|
linkedSignal,
|
||||||
output,
|
output,
|
||||||
resource,
|
resource,
|
||||||
signal,
|
signal,
|
||||||
@@ -36,6 +37,7 @@ import { Plot } from '../plot';
|
|||||||
import { download } from '../export';
|
import { download } from '../export';
|
||||||
import { interpretabilityFigures, studyPoints, type Centile } from './figures';
|
import { interpretabilityFigures, studyPoints, type Centile } from './figures';
|
||||||
import { errorText, RunMonitor } from './run-monitor';
|
import { errorText, RunMonitor } from './run-monitor';
|
||||||
|
import { EegPreview } from './tea/preview';
|
||||||
|
|
||||||
const REPORTS: Record<string, string> = {
|
const REPORTS: Record<string, string> = {
|
||||||
technical_validation: 'Validación técnica',
|
technical_validation: 'Validación técnica',
|
||||||
@@ -78,6 +80,7 @@ export function checkActions(checks: Checks) {
|
|||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
Plot,
|
Plot,
|
||||||
RunMonitor,
|
RunMonitor,
|
||||||
|
EegPreview,
|
||||||
],
|
],
|
||||||
templateUrl: './models.html',
|
templateUrl: './models.html',
|
||||||
styleUrl: './models.scss',
|
styleUrl: './models.scss',
|
||||||
@@ -87,7 +90,7 @@ export class Models {
|
|||||||
readonly domain = input.required<Domain>();
|
readonly domain = input.required<Domain>();
|
||||||
readonly execution = input<Choice>();
|
readonly execution = input<Choice>();
|
||||||
readonly trainingRequested = output<void>();
|
readonly trainingRequested = output<void>();
|
||||||
readonly previewRequested = output<void>();
|
protected readonly showPreview = linkedSignal({ source: this.domain, computation: () => false });
|
||||||
protected readonly reportNames = REPORTS;
|
protected readonly reportNames = REPORTS;
|
||||||
protected readonly errorText = errorText;
|
protected readonly errorText = errorText;
|
||||||
readonly refreshed = signal(0);
|
readonly refreshed = signal(0);
|
||||||
|
|||||||
@@ -77,14 +77,16 @@ export function eta(progress: Progress): number | null {
|
|||||||
<p role="alert">{{ r.error }}</p>
|
<p role="alert">{{ r.error }}</p>
|
||||||
}
|
}
|
||||||
@if (!terminal.has(r.state)) {
|
@if (!terminal.has(r.state)) {
|
||||||
<button
|
<div class="button-row">
|
||||||
mat-stroked-button
|
<button
|
||||||
type="button"
|
mat-stroked-button
|
||||||
[disabled]="cancelling() || r.state === 'cancelling'"
|
type="button"
|
||||||
(click)="cancel()"
|
[disabled]="cancelling() || r.state === 'cancelling'"
|
||||||
>
|
(click)="cancel()"
|
||||||
Cancelar
|
>
|
||||||
</button>
|
Cancelar
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
<p role="status">Consultando ejecución…</p>
|
<p role="status">Consultando ejecución…</p>
|
||||||
|
|||||||
+158
-158
@@ -1,5 +1,5 @@
|
|||||||
import { KeyValuePipe } from '@angular/common';
|
import { KeyValuePipe } from '@angular/common';
|
||||||
import { Component, inject, signal } from '@angular/core';
|
import { Component, inject, input, signal } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
@@ -23,170 +23,170 @@ import { downloadPreviewPdf } from './preview-pdf';
|
|||||||
RunMonitor,
|
RunMonitor,
|
||||||
],
|
],
|
||||||
template: `
|
template: `
|
||||||
<section class="card" aria-labelledby="preview-heading">
|
<form
|
||||||
<h2 id="preview-heading">Vista previa</h2>
|
class="button-row"
|
||||||
<form (ngSubmit)="start(edf.files?.[0], ados.files?.[0], birth.value)">
|
[hidden]="!active()"
|
||||||
<input
|
(ngSubmit)="start(edf.files?.[0], ados.files?.[0], birth.value)"
|
||||||
#edf
|
>
|
||||||
type="file"
|
<input
|
||||||
accept=".edf"
|
#edf
|
||||||
required
|
type="file"
|
||||||
hidden
|
accept=".edf"
|
||||||
aria-label="EDF"
|
required
|
||||||
(change)="edfFiles.set(edf.files)"
|
hidden
|
||||||
/>
|
aria-label="EDF"
|
||||||
<button mat-stroked-button type="button" (click)="edf.click()">EDF</button>
|
(change)="edfFiles.set(edf.files)"
|
||||||
@for (file of edfFiles(); track $index) {
|
/>
|
||||||
<span>{{ file.name }}</span>
|
<button mat-stroked-button type="button" (click)="edf.click()">EDF</button>
|
||||||
}
|
@for (file of edfFiles(); track $index) {
|
||||||
<input
|
<span>{{ file.name }}</span>
|
||||||
#ados
|
|
||||||
type="file"
|
|
||||||
accept=".pdf"
|
|
||||||
hidden
|
|
||||||
aria-label="ADOS-2 (PDF)"
|
|
||||||
(change)="adosFiles.set(ados.files)"
|
|
||||||
/>
|
|
||||||
<button mat-stroked-button type="button" (click)="ados.click()">ADOS-2 (PDF)</button>
|
|
||||||
@for (file of adosFiles(); track $index) {
|
|
||||||
<span>{{ file.name }}</span>
|
|
||||||
}
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Fecha de nacimiento</mat-label>
|
|
||||||
<input matInput #birth type="date" />
|
|
||||||
</mat-form-field>
|
|
||||||
<button mat-stroked-button type="submit" [disabled]="busy() || !edfFiles()?.length">
|
|
||||||
Vista previa
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
@if (error()) {
|
|
||||||
<p role="alert">{{ error() }}</p>
|
|
||||||
}
|
}
|
||||||
@if (runId(); as id) {
|
<input
|
||||||
<app-run-monitor [runId]="id" (finished)="finish($event, dialog)" />
|
#ados
|
||||||
|
type="file"
|
||||||
|
accept=".pdf"
|
||||||
|
hidden
|
||||||
|
aria-label="ADOS-2 (PDF)"
|
||||||
|
(change)="adosFiles.set(ados.files)"
|
||||||
|
/>
|
||||||
|
<button mat-stroked-button type="button" (click)="ados.click()">ADOS-2 (PDF)</button>
|
||||||
|
@for (file of adosFiles(); track $index) {
|
||||||
|
<span>{{ file.name }}</span>
|
||||||
}
|
}
|
||||||
<dialog #dialog aria-label="Vista previa del estudio">
|
<mat-form-field appearance="outline">
|
||||||
|
<mat-label>Fecha de nacimiento</mat-label>
|
||||||
|
<input matInput #birth type="date" />
|
||||||
|
</mat-form-field>
|
||||||
|
<button mat-stroked-button type="submit" [disabled]="busy() || !edfFiles()?.length">
|
||||||
|
Vista previa
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@if (error()) {
|
||||||
|
<p role="alert">{{ error() }}</p>
|
||||||
|
}
|
||||||
|
@if (runId(); as id) {
|
||||||
|
<app-run-monitor [runId]="id" (finished)="finish($event, dialog)" />
|
||||||
|
}
|
||||||
|
<dialog #dialog aria-label="Vista previa del estudio">
|
||||||
|
@if (result(); as r) {
|
||||||
|
<h3>Resultado de la vista previa</h3>
|
||||||
|
<p>
|
||||||
|
{{ r.eeg.level }} ·
|
||||||
|
{{ r.eeg.valid === true ? 'Válido' : r.eeg.valid === false ? 'No válido' : '—' }}
|
||||||
|
</p>
|
||||||
|
@if (r.eeg.error) {
|
||||||
|
<p role="alert">{{ r.eeg.error }}</p>
|
||||||
|
}
|
||||||
|
<h4>Comprobaciones</h4>
|
||||||
|
<table class="plain">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Comprobación</th>
|
||||||
|
<th>Electrodo</th>
|
||||||
|
<th>Resultado</th>
|
||||||
|
<th>Rango</th>
|
||||||
|
<th>Anormal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (check of r.eeg.checks; track $index) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ check['code'] }}</td>
|
||||||
|
<td>{{ check['electrode'] ?? '—' }}</td>
|
||||||
|
<td>{{ check['value'] ?? check['text'] ?? '—' }} {{ check['unit'] }}</td>
|
||||||
|
<td>{{ check['low'] ?? '—' }} / {{ check['high'] ?? '—' }}</td>
|
||||||
|
<td>
|
||||||
|
{{ check['abnormal'] === true ? 'Sí' : check['abnormal'] === false ? 'No' : '—' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h4>Métricas</h4>
|
||||||
|
<table class="plain">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Métrica</th>
|
||||||
|
<th>Valor</th>
|
||||||
|
<th>z</th>
|
||||||
|
<th>p5 / mediana / p95</th>
|
||||||
|
<th>Fuera de rango</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (metric of r.eeg.metrics; track metric.code) {
|
||||||
|
<tr>
|
||||||
|
<th>{{ metric.code }}</th>
|
||||||
|
<td>{{ metric.value ?? '—' }}</td>
|
||||||
|
<td>{{ metric.score?.z ?? '—' }}</td>
|
||||||
|
<td>
|
||||||
|
{{ metric.score?.p5 ?? '—' }} / {{ metric.score?.median ?? '—' }} /
|
||||||
|
{{ metric.score?.p95 ?? '—' }}
|
||||||
|
</td>
|
||||||
|
<td>{{ metric.score?.outside ?? '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
@for (site of metric.electrodes | keyvalue; track site.key) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ site.key }}</td>
|
||||||
|
<td>{{ site.value.value ?? '—' }}</td>
|
||||||
|
<td>{{ site.value.score?.z ?? '—' }}</td>
|
||||||
|
<td>
|
||||||
|
{{ site.value.score?.p5 ?? '—' }} / {{ site.value.score?.median ?? '—' }} /
|
||||||
|
{{ site.value.score?.p95 ?? '—' }}
|
||||||
|
</td>
|
||||||
|
<td>{{ site.value.score?.outside ?? '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
@for (site of metric.zones | keyvalue; track site.key) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ site.key }}</td>
|
||||||
|
<td>{{ site.value.value ?? '—' }}</td>
|
||||||
|
<td>{{ site.value.score?.z ?? '—' }}</td>
|
||||||
|
<td>
|
||||||
|
{{ site.value.score?.p5 ?? '—' }} / {{ site.value.score?.median ?? '—' }} /
|
||||||
|
{{ site.value.score?.p95 ?? '—' }}
|
||||||
|
</td>
|
||||||
|
<td>{{ site.value.score?.outside ?? '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@if (r.ados2; as ados2) {
|
||||||
|
<h4>ADOS-2</h4>
|
||||||
|
<p>{{ ados2.classification }} · CSS {{ ados2.css ?? '—' }}</p>
|
||||||
|
<dl>
|
||||||
|
@for (item of ados2.items | keyvalue: unsorted; track item.key) {
|
||||||
|
<dt>{{ ados2.titles[item.key] ?? item.key }}</dt>
|
||||||
|
<dd>{{ item.value ?? '—' }}</dd>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
}
|
||||||
|
@if (r.warnings.length) {
|
||||||
|
<h4>Advertencias</h4>
|
||||||
|
<ul>
|
||||||
|
@for (warning of r.warnings; track $index) {
|
||||||
|
<li>{{ warning }}</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if (pdfError()) {
|
||||||
|
<p role="alert">{{ pdfError() }}</p>
|
||||||
|
}
|
||||||
|
<form class="button-row" method="dialog">
|
||||||
@if (result(); as r) {
|
@if (result(); as r) {
|
||||||
<h3>Resultado de la vista previa</h3>
|
<button mat-stroked-button type="button" [disabled]="exporting()" (click)="pdf(r)">
|
||||||
<p>
|
Guardar como PDF
|
||||||
{{ r.eeg.level }} ·
|
</button>
|
||||||
{{ r.eeg.valid === true ? 'Válido' : r.eeg.valid === false ? 'No válido' : '—' }}
|
|
||||||
</p>
|
|
||||||
@if (r.eeg.error) {
|
|
||||||
<p role="alert">{{ r.eeg.error }}</p>
|
|
||||||
}
|
|
||||||
<h4>Comprobaciones</h4>
|
|
||||||
<table class="plain">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Comprobación</th>
|
|
||||||
<th>Electrodo</th>
|
|
||||||
<th>Resultado</th>
|
|
||||||
<th>Rango</th>
|
|
||||||
<th>Anormal</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@for (check of r.eeg.checks; track $index) {
|
|
||||||
<tr>
|
|
||||||
<td>{{ check['code'] }}</td>
|
|
||||||
<td>{{ check['electrode'] ?? '—' }}</td>
|
|
||||||
<td>{{ check['value'] ?? check['text'] ?? '—' }} {{ check['unit'] }}</td>
|
|
||||||
<td>{{ check['low'] ?? '—' }} / {{ check['high'] ?? '—' }}</td>
|
|
||||||
<td>
|
|
||||||
{{
|
|
||||||
check['abnormal'] === true ? 'Sí' : check['abnormal'] === false ? 'No' : '—'
|
|
||||||
}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<h4>Métricas</h4>
|
|
||||||
<table class="plain">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Métrica</th>
|
|
||||||
<th>Valor</th>
|
|
||||||
<th>z</th>
|
|
||||||
<th>p5 / mediana / p95</th>
|
|
||||||
<th>Fuera de rango</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@for (metric of r.eeg.metrics; track metric.code) {
|
|
||||||
<tr>
|
|
||||||
<th>{{ metric.code }}</th>
|
|
||||||
<td>{{ metric.value ?? '—' }}</td>
|
|
||||||
<td>{{ metric.score?.z ?? '—' }}</td>
|
|
||||||
<td>
|
|
||||||
{{ metric.score?.p5 ?? '—' }} / {{ metric.score?.median ?? '—' }} /
|
|
||||||
{{ metric.score?.p95 ?? '—' }}
|
|
||||||
</td>
|
|
||||||
<td>{{ metric.score?.outside ?? '—' }}</td>
|
|
||||||
</tr>
|
|
||||||
@for (site of metric.electrodes | keyvalue; track site.key) {
|
|
||||||
<tr>
|
|
||||||
<td>{{ site.key }}</td>
|
|
||||||
<td>{{ site.value.value ?? '—' }}</td>
|
|
||||||
<td>{{ site.value.score?.z ?? '—' }}</td>
|
|
||||||
<td>
|
|
||||||
{{ site.value.score?.p5 ?? '—' }} / {{ site.value.score?.median ?? '—' }} /
|
|
||||||
{{ site.value.score?.p95 ?? '—' }}
|
|
||||||
</td>
|
|
||||||
<td>{{ site.value.score?.outside ?? '—' }}</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
@for (site of metric.zones | keyvalue; track site.key) {
|
|
||||||
<tr>
|
|
||||||
<td>{{ site.key }}</td>
|
|
||||||
<td>{{ site.value.value ?? '—' }}</td>
|
|
||||||
<td>{{ site.value.score?.z ?? '—' }}</td>
|
|
||||||
<td>
|
|
||||||
{{ site.value.score?.p5 ?? '—' }} / {{ site.value.score?.median ?? '—' }} /
|
|
||||||
{{ site.value.score?.p95 ?? '—' }}
|
|
||||||
</td>
|
|
||||||
<td>{{ site.value.score?.outside ?? '—' }}</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
@if (r.ados2; as ados2) {
|
|
||||||
<h4>ADOS-2</h4>
|
|
||||||
<p>{{ ados2.classification }} · CSS {{ ados2.css ?? '—' }}</p>
|
|
||||||
<dl>
|
|
||||||
@for (item of ados2.items | keyvalue: unsorted; track item.key) {
|
|
||||||
<dt>{{ ados2.titles[item.key] ?? item.key }}</dt>
|
|
||||||
<dd>{{ item.value ?? '—' }}</dd>
|
|
||||||
}
|
|
||||||
</dl>
|
|
||||||
}
|
|
||||||
@if (r.warnings.length) {
|
|
||||||
<h4>Advertencias</h4>
|
|
||||||
<ul>
|
|
||||||
@for (warning of r.warnings; track $index) {
|
|
||||||
<li>{{ warning }}</li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@if (pdfError()) {
|
<button mat-stroked-button>Cerrar</button>
|
||||||
<p role="alert">{{ pdfError() }}</p>
|
</form>
|
||||||
}
|
</dialog>
|
||||||
<form method="dialog">
|
|
||||||
@if (result(); as r) {
|
|
||||||
<button mat-stroked-button type="button" [disabled]="exporting()" (click)="pdf(r)">
|
|
||||||
Guardar como PDF
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
<button mat-stroked-button>Cerrar</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
</section>
|
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class EegPreview {
|
export class EegPreview {
|
||||||
|
readonly active = input.required<boolean>();
|
||||||
private readonly api = inject(Api);
|
private readonly api = inject(Api);
|
||||||
protected readonly edfFiles = signal<FileList | null>(null);
|
protected readonly edfFiles = signal<FileList | null>(null);
|
||||||
protected readonly adosFiles = signal<FileList | null>(null);
|
protected readonly adosFiles = signal<FileList | null>(null);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<section class="card" aria-labelledby="studies-heading">
|
<section class="card" aria-labelledby="studies-heading">
|
||||||
<h2 id="studies-heading">Estudios EEG</h2>
|
<h2 id="studies-heading">Estudios EEG</h2>
|
||||||
<form (ngSubmit)="analyze()">
|
<form class="button-row" (ngSubmit)="analyze()">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Alcance</mat-label>
|
<mat-label>Alcance</mat-label>
|
||||||
<mat-select name="scope" [(ngModel)]="mode">
|
<mat-select name="scope" [(ngModel)]="mode">
|
||||||
|
|||||||
+14
-120
@@ -1,4 +1,3 @@
|
|||||||
import { HttpErrorResponse } from '@angular/common/http';
|
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
@@ -14,8 +13,6 @@ import {
|
|||||||
import { FormsModule, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
||||||
import { MatInputModule } from '@angular/material/input';
|
|
||||||
import { FormlyForm, provideFormlyCore } from '@ngx-formly/core';
|
import { FormlyForm, provideFormlyCore } from '@ngx-formly/core';
|
||||||
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
|
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
|
||||||
import { withFormlyMaterial } from '@ngx-formly/material';
|
import { withFormlyMaterial } from '@ngx-formly/material';
|
||||||
@@ -23,8 +20,6 @@ import type { JSONSchema7, JSONSchema7TypeName } from 'json-schema';
|
|||||||
import { Api } from '../api/api';
|
import { Api } from '../api/api';
|
||||||
import { train } from '../api/fn/models/train';
|
import { train } from '../api/fn/models/train';
|
||||||
import { trainingConfig } from '../api/fn/models/training-config';
|
import { trainingConfig } from '../api/fn/models/training-config';
|
||||||
import { trainingInputs } from '../api/fn/models/training-inputs';
|
|
||||||
import { uploadTrainingInputs } from '../api/fn/models/upload-training-inputs';
|
|
||||||
import type { Domain } from '../api/models/domain';
|
import type { Domain } from '../api/models/domain';
|
||||||
import type { Execution } from '../api/models/execution';
|
import type { Execution } from '../api/models/execution';
|
||||||
import type { TrainingConfig } from '../api/models/training-config';
|
import type { TrainingConfig } from '../api/models/training-config';
|
||||||
@@ -112,26 +107,10 @@ export function sourcePayload<T extends object>(source: T, variants: Variants):
|
|||||||
) as T;
|
) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowedFile(file: File, allowed: string[]): boolean {
|
|
||||||
return allowed.some((pattern) => {
|
|
||||||
if (pattern === '*.edf') return file.name.toLowerCase().endsWith('.edf');
|
|
||||||
return file.name === pattern;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-governance-training',
|
selector: 'app-governance-training',
|
||||||
imports: [
|
imports: [FormsModule, ReactiveFormsModule, FormlyForm, MatButtonModule, MatCheckboxModule],
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
FormlyForm,
|
|
||||||
MatButtonModule,
|
|
||||||
MatCheckboxModule,
|
|
||||||
MatFormFieldModule,
|
|
||||||
MatInputModule,
|
|
||||||
],
|
|
||||||
providers: [provideFormlyCore([...withFormlyMaterial(), FORMLY_TYPES])],
|
providers: [provideFormlyCore([...withFormlyMaterial(), FORMLY_TYPES])],
|
||||||
styles: ':host { display: grid; gap: var(--space-4); }',
|
|
||||||
template: `
|
template: `
|
||||||
<section class="card" aria-labelledby="training-heading">
|
<section class="card" aria-labelledby="training-heading">
|
||||||
<h2 #heading id="training-heading" tabindex="-1">Entrenamiento</h2>
|
<h2 #heading id="training-heading" tabindex="-1">Entrenamiento</h2>
|
||||||
@@ -142,18 +121,20 @@ function allowedFile(file: File, allowed: string[]): boolean {
|
|||||||
@let form = config.value();
|
@let form = config.value();
|
||||||
<form (ngSubmit)="start(form.model)">
|
<form (ngSubmit)="start(form.model)">
|
||||||
<formly-form [form]="form.form" [fields]="form.fields" [model]="form.model" />
|
<formly-form [form]="form.form" [fields]="form.fields" [model]="form.model" />
|
||||||
@if (domain() === 'tea') {
|
<div class="button-row">
|
||||||
<mat-checkbox name="promote" [(ngModel)]="autoPromote"
|
@if (domain() === 'tea') {
|
||||||
>Promover al terminar</mat-checkbox
|
<mat-checkbox name="promote" [(ngModel)]="autoPromote"
|
||||||
|
>Promover al terminar</mat-checkbox
|
||||||
|
>
|
||||||
|
}
|
||||||
|
<button
|
||||||
|
mat-flat-button
|
||||||
|
type="submit"
|
||||||
|
[disabled]="busy() || disabled() || form.form.invalid"
|
||||||
>
|
>
|
||||||
}
|
Entrenar
|
||||||
<button
|
</button>
|
||||||
mat-flat-button
|
</div>
|
||||||
type="submit"
|
|
||||||
[disabled]="busy() || disabled() || form.form.invalid"
|
|
||||||
>
|
|
||||||
Entrenar
|
|
||||||
</button>
|
|
||||||
</form>
|
</form>
|
||||||
} @else if (config.error(); as error) {
|
} @else if (config.error(); as error) {
|
||||||
<p role="alert">{{ errorText(error) }}</p>
|
<p role="alert">{{ errorText(error) }}</p>
|
||||||
@@ -162,43 +143,6 @@ function allowedFile(file: File, allowed: string[]): boolean {
|
|||||||
<p role="status">{{ message() }}</p>
|
<p role="status">{{ message() }}</p>
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
@if (inputs.hasValue() && inputs.value(); as metadata) {
|
|
||||||
<section class="card" aria-labelledby="training-upload-heading">
|
|
||||||
<h2 id="training-upload-heading">Subir archivos</h2>
|
|
||||||
<form (ngSubmit)="upload(setName.value, files)">
|
|
||||||
<mat-form-field appearance="outline">
|
|
||||||
<mat-label>Conjunto</mat-label>
|
|
||||||
<input matInput #setName required />
|
|
||||||
</mat-form-field>
|
|
||||||
<input
|
|
||||||
#files
|
|
||||||
type="file"
|
|
||||||
multiple
|
|
||||||
required
|
|
||||||
[accept]="accept(metadata['allowed'])"
|
|
||||||
hidden
|
|
||||||
aria-label="Archivos"
|
|
||||||
(change)="selectedFiles.set(files.files)"
|
|
||||||
/>
|
|
||||||
<button mat-stroked-button type="button" (click)="files.click()">Archivos</button>
|
|
||||||
@for (file of selectedFiles(); track $index) {
|
|
||||||
<span>{{ file.name }}</span>
|
|
||||||
}
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
type="submit"
|
|
||||||
[disabled]="uploading() || !selectedFiles()?.length"
|
|
||||||
>
|
|
||||||
Subir archivos
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
@if (uploadMessage()) {
|
|
||||||
<p role="status">{{ uploadMessage() }}</p>
|
|
||||||
}
|
|
||||||
</section>
|
|
||||||
} @else if (inputs.error(); as error) {
|
|
||||||
<p role="alert">{{ errorText(error) }}</p>
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class Training {
|
export class Training {
|
||||||
@@ -237,25 +181,8 @@ export class Training {
|
|||||||
return { fields, model, variants, form: new UntypedFormGroup({}) };
|
return { fields, model, variants, form: new UntypedFormGroup({}) };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
protected readonly inputs = resource({
|
|
||||||
params: () => ({ domain: this.domain(), name: this.name() }),
|
|
||||||
loader: async ({ params }) => {
|
|
||||||
try {
|
|
||||||
return await this.api.invoke(trainingInputs, params);
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof HttpErrorResponse && error.status === 404) return undefined;
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
readonly busy = model(false);
|
readonly busy = model(false);
|
||||||
protected readonly selectedFiles = linkedSignal({
|
|
||||||
source: () => (this.inputs.hasValue() ? this.inputs.value() : undefined),
|
|
||||||
computation: (): FileList | null => null,
|
|
||||||
});
|
|
||||||
protected readonly uploading = signal(false);
|
|
||||||
protected readonly message = signal('');
|
protected readonly message = signal('');
|
||||||
protected readonly uploadMessage = signal('');
|
|
||||||
protected readonly autoPromote = linkedSignal({ source: this.domain, computation: () => false });
|
protected readonly autoPromote = linkedSignal({ source: this.domain, computation: () => false });
|
||||||
protected readonly errorText = errorText;
|
protected readonly errorText = errorText;
|
||||||
|
|
||||||
@@ -289,37 +216,4 @@ export class Training {
|
|||||||
if (domain === this.domain()) this.busy.set(false);
|
if (domain === this.domain()) this.busy.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected accept(allowed: string[]): string {
|
|
||||||
return allowed
|
|
||||||
.map((pattern) =>
|
|
||||||
pattern.startsWith('*.') ? pattern.slice(1) : '.' + pattern.split('.').pop(),
|
|
||||||
)
|
|
||||||
.join(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async upload(set: string, input: HTMLInputElement): Promise<void> {
|
|
||||||
const files = Array.from(input.files ?? []);
|
|
||||||
const allowed = this.inputs.hasValue() ? (this.inputs.value()?.['allowed'] ?? []) : [];
|
|
||||||
if (!files.length || files.some((file) => !allowedFile(file, allowed))) {
|
|
||||||
this.uploadMessage.set('Archivos permitidos: ' + allowed.join(', '));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.uploading.set(true);
|
|
||||||
this.uploadMessage.set('');
|
|
||||||
try {
|
|
||||||
await this.api.invoke(uploadTrainingInputs, {
|
|
||||||
domain: this.domain(),
|
|
||||||
name: this.name(),
|
|
||||||
set: set.trim(),
|
|
||||||
body: { files },
|
|
||||||
});
|
|
||||||
input.value = '';
|
|
||||||
this.selectedFiles.set(null);
|
|
||||||
} catch (error) {
|
|
||||||
this.uploadMessage.set(errorText(error));
|
|
||||||
} finally {
|
|
||||||
this.uploading.set(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { Loading } from '../loading';
|
|||||||
<section class="page">
|
<section class="page">
|
||||||
<h1>{{ title() }}</h1>
|
<h1>{{ title() }}</h1>
|
||||||
<p class="subtitle">Explora los indicadores de {{ title().toLowerCase() }}.</p>
|
<p class="subtitle">Explora los indicadores de {{ title().toLowerCase() }}.</p>
|
||||||
<app-report-button />
|
<app-report-button class="button-row" />
|
||||||
@if (measures.isLoading()) {
|
@if (measures.isLoading()) {
|
||||||
<app-loading what="los indicadores" />
|
<app-loading what="los indicadores" />
|
||||||
} @else if (measures.error()) {
|
} @else if (measures.error()) {
|
||||||
|
|||||||
@@ -123,6 +123,17 @@ html {
|
|||||||
@include meta.load-css('print');
|
@include meta.load-css('print');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-row:not([hidden]) {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-row:not(td > *):not([hidden]) {
|
||||||
|
margin-block: var(--space-3);
|
||||||
|
}
|
||||||
|
|
||||||
.filters {
|
.filters {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user