Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4d2a3e85f |
+2
-5
@@ -1,10 +1,7 @@
|
|||||||
# Production image: build the Angular app, serve the static bundle with
|
# Production image: the Angular build served by nginx, which proxies the API paths to `webapi`.
|
||||||
# nginx, and reverse-proxy the API paths to the `webapi` compose service —
|
|
||||||
# the same routing `proxy.conf.json` gives `ng serve` in development, so the
|
|
||||||
# app's relative `/imports`, `/data`, ... calls work unchanged.
|
|
||||||
FROM node:22-slim AS build
|
FROM node:22-slim AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npx ng build --configuration production
|
RUN npx ng build --configuration production
|
||||||
|
|||||||
@@ -1,59 +1,16 @@
|
|||||||
# WebApp
|
# WebApp
|
||||||
|
|
||||||
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 22.1.8.
|
Interfaz de ISSSTELEON en Angular y Angular Material: conexión e importación de
|
||||||
|
datos (`/conectar`), bitácora de cargas (`/bitacora`), gobernanza y tablero de
|
||||||
## Development server
|
indicadores (`/indicadores`).
|
||||||
|
|
||||||
To start a local development server, run:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ng serve
|
npm ci
|
||||||
|
npx ng serve # http://localhost:4200
|
||||||
|
npx ng test --watch=false # pruebas unitarias (Vitest)
|
||||||
|
npx ng build # compilación de producción en dist/WebApp
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
`ng serve` envía las rutas de la API a WebApi en `localhost:5050`
|
||||||
|
(`proxy.conf.json`). La imagen de Docker (`Dockerfile`) sirve la compilación con
|
||||||
## Code scaffolding
|
nginx (`nginx.conf`), que reenvía esas mismas rutas al servicio `webapi`.
|
||||||
|
|
||||||
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng generate component component-name
|
|
||||||
```
|
|
||||||
|
|
||||||
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng generate --help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
To build the project run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng build
|
|
||||||
```
|
|
||||||
|
|
||||||
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
|
||||||
|
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
For end-to-end (e2e) testing, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng e2e
|
|
||||||
```
|
|
||||||
|
|
||||||
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
||||||
|
|
||||||
## Additional Resources
|
|
||||||
|
|
||||||
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ server {
|
|||||||
# the ~33% base64 overhead.
|
# the ~33% base64 overhead.
|
||||||
client_max_body_size 270m;
|
client_max_body_size 270m;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/css application/javascript application/json image/svg+xml;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
|
||||||
location ~ ^/(api|imports|data|cacu|cama|tea|governance|reportes|health)(/|$) {
|
location ~ ^/(api|imports|data|cacu|cama|tea|governance|reportes|health)(/|$) {
|
||||||
proxy_pass http://webapi:5000;
|
proxy_pass http://webapi:5000;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'bitacora',
|
path: 'bitacora',
|
||||||
title: 'Bitácora de cargas | ISSSTELEON',
|
title: 'Bitácora de cargas | ISSSTELEON',
|
||||||
loadComponent: () => import('./reportes/reportes-page').then((m) => m.ReportesPage),
|
loadComponent: () => import('./reportes/reportes-page').then((m) => m.ReportsPage),
|
||||||
data: { workspace: true, breadcrumb: 'Bitácora de cargas' },
|
data: { workspace: true, breadcrumb: 'Bitácora de cargas' },
|
||||||
},
|
},
|
||||||
{ path: 'indicadores', pathMatch: 'full', redirectTo: 'indicadores/tea' },
|
{ path: 'indicadores', pathMatch: 'full', redirectTo: 'indicadores/tea' },
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export interface ImportSourcePayload extends SourceLocator {
|
|||||||
defaults?: Record<string, unknown>;
|
defaults?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- documents -----------------------------------------------------------------
|
// Clinical documents
|
||||||
|
|
||||||
export type OcrMode = 'auto' | 'always' | 'never';
|
export type OcrMode = 'auto' | 'always' | 'never';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
/** Base64 of a File's bytes, for JSON endpoints that carry a file. */
|
/** Base64 of a File's bytes, for JSON endpoints that carry a file. */
|
||||||
export async function fileToBase64(file: Blob): Promise<string> {
|
export function fileToBase64(file: Blob): Promise<string> {
|
||||||
const bytes = new Uint8Array(await file.arrayBuffer());
|
return new Promise((resolve, reject) => {
|
||||||
const chunk = 0x8000;
|
const reader = new FileReader();
|
||||||
let binary = '';
|
reader.onload = () => {
|
||||||
for (let i = 0; i < bytes.length; i += chunk) {
|
const dataUrl = reader.result as string;
|
||||||
binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
|
resolve(dataUrl.slice(dataUrl.indexOf(',') + 1));
|
||||||
}
|
};
|
||||||
return btoa(binary);
|
reader.onerror = () => reject(reader.error);
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
@if (store.connections().length === 0) {
|
@if (store.connections().length === 0) {
|
||||||
<div class="pane__empty">
|
<div class="pane__empty">
|
||||||
<app-file-dropzone [accept]="store.acceptedExtensions()" [multiple]="true" (filesChange)="onFilesDropped($event)"></app-file-dropzone>
|
<app-file-dropzone [accept]="store.acceptedExtensions()" [keepSelection]="false" (filesChange)="onFilesDropped($event)"></app-file-dropzone>
|
||||||
<button mat-stroked-button type="button" class="pane__db-button" (click)="addConnection.emit()">
|
<button mat-stroked-button type="button" class="pane__db-button" (click)="addConnection.emit()">
|
||||||
<mat-icon aria-hidden="true">storage</mat-icon>Conectar una base de datos
|
<mat-icon aria-hidden="true">storage</mat-icon>Conectar una base de datos
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
<app-file-dropzone [accept]="entry()?.connector?.extensions ?? []" [multiple]="true" (filesChange)="files.set($event)"></app-file-dropzone>
|
<app-file-dropzone [accept]="entry()?.connector?.extensions ?? []" (filesChange)="files.set($event)"></app-file-dropzone>
|
||||||
}
|
}
|
||||||
|
|
||||||
@case ('database') {
|
@case ('database') {
|
||||||
|
|||||||
@@ -83,10 +83,8 @@ export class ConnectorGalleryDialog {
|
|||||||
this.categories.filter((c) => c.id === 'all' || this.entries().some((entry) => entry.category === c.id)),
|
this.categories.filter((c) => c.id === 'all' || this.entries().some((entry) => entry.category === c.id)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// -- files --
|
|
||||||
readonly files = signal<File[]>([]);
|
readonly files = signal<File[]>([]);
|
||||||
|
|
||||||
// -- database --
|
|
||||||
readonly serverForm = this.formBuilder.nonNullable.group({
|
readonly serverForm = this.formBuilder.nonNullable.group({
|
||||||
host: ['', Validators.required],
|
host: ['', Validators.required],
|
||||||
port: [null as number | null],
|
port: [null as number | null],
|
||||||
|
|||||||
@@ -101,8 +101,6 @@ export class DocumentReviewDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- settings ------------------------------------------------------------
|
|
||||||
|
|
||||||
updateSettings(patch: Partial<DocumentSettings>): void {
|
updateSettings(patch: Partial<DocumentSettings>): void {
|
||||||
this.settings.update((settings) => ({ ...settings, ...patch }));
|
this.settings.update((settings) => ({ ...settings, ...patch }));
|
||||||
}
|
}
|
||||||
@@ -128,8 +126,6 @@ export class DocumentReviewDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- records and values ------------------------------------------------------
|
|
||||||
|
|
||||||
select(index: number): void {
|
select(index: number): void {
|
||||||
this.selectedIndex.set(index);
|
this.selectedIndex.set(index);
|
||||||
this.page.set(null);
|
this.page.set(null);
|
||||||
@@ -171,8 +167,6 @@ export class DocumentReviewDialog {
|
|||||||
return record.conflicts.find((conflict) => conflict.field === field) ?? null;
|
return record.conflicts.find((conflict) => conflict.field === field) ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- pages and images ----------------------------------------------------------
|
|
||||||
|
|
||||||
thumbnailKey(image: DocumentImage): string {
|
thumbnailKey(image: DocumentImage): string {
|
||||||
return `${image.document}|${image.page_number}|${image.bbox.join(',')}`;
|
return `${image.document}|${image.page_number}|${image.bbox.join(',')}`;
|
||||||
}
|
}
|
||||||
@@ -199,8 +193,6 @@ export class DocumentReviewDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- close -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
apply(): void {
|
apply(): void {
|
||||||
this.table.configure(this.settings(), { [this.target.key]: this.overrides() });
|
this.table.configure(this.settings(), { [this.target.key]: this.overrides() });
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<mat-icon class="dropzone__icon" aria-hidden="true">cloud_upload</mat-icon>
|
<mat-icon class="dropzone__icon" aria-hidden="true">cloud_upload</mat-icon>
|
||||||
<p class="dropzone__title">Arrastra tus archivos aquí</p>
|
<p class="dropzone__title">Arrastra tus archivos aquí</p>
|
||||||
<p class="dropzone__formats">{{ formatsLabel }}</p>
|
<p class="dropzone__formats">{{ formatsLabel }}</p>
|
||||||
<input #fileInput class="visually-hidden" type="file" [multiple]="multiple" [attr.accept]="acceptAttribute" aria-label="Seleccionar archivos" (change)="onFileSelection($event)" />
|
<input #fileInput class="visually-hidden" type="file" [multiple]="multiple()" [attr.accept]="acceptAttribute" aria-label="Seleccionar archivos" (change)="onFileSelection($event)" />
|
||||||
<button class="upload-action upload-action--outlined select-files-button" mat-stroked-button type="button" (click)="fileInput.click()">
|
<button class="upload-action upload-action--outlined select-files-button" mat-stroked-button type="button" (click)="fileInput.click()">
|
||||||
<mat-icon aria-hidden="true">upload_file</mat-icon>
|
<mat-icon aria-hidden="true">upload_file</mat-icon>
|
||||||
<span>Seleccionar archivos</span>
|
<span>Seleccionar archivos</span>
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { FileDropzone } from './file-dropzone';
|
import { FileDropzone } from './file-dropzone';
|
||||||
|
|
||||||
describe('FileDropzone', () => {
|
describe('FileDropzone', () => {
|
||||||
function createFixture() {
|
function createFixture(keepSelection = true) {
|
||||||
const fixture = TestBed.createComponent(FileDropzone);
|
const fixture = TestBed.createComponent(FileDropzone);
|
||||||
|
fixture.componentRef.setInput('accept', ['xlsx', 'csv', 'json', 'pdf']);
|
||||||
|
fixture.componentRef.setInput('keepSelection', keepSelection);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
return fixture;
|
return fixture;
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,27 @@ describe('FileDropzone', () => {
|
|||||||
expect(emitted.at(-1)).toEqual([]);
|
expect(emitted.at(-1)).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('honors a custom accept input, keeping pdf available by default', () => {
|
it('without keepSelection emits only each new batch and lists nothing', () => {
|
||||||
|
const fixture = createFixture(false);
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
const component = fixture.componentInstance;
|
||||||
|
const emitted: File[][] = [];
|
||||||
|
component.filesChange.subscribe((files) => emitted.push(files));
|
||||||
|
const drop = (files: File[]) =>
|
||||||
|
component.onDrop({ preventDefault: () => undefined, dataTransfer: { files } } as unknown as DragEvent);
|
||||||
|
|
||||||
|
const first = new File(['a'], 'uno.csv');
|
||||||
|
const second = new File(['b'], 'dos.csv');
|
||||||
|
drop([first]);
|
||||||
|
drop([second]);
|
||||||
|
drop([new File(['x'], 'malo.docx')]);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(emitted).toEqual([[first], [second]]);
|
||||||
|
expect(compiled.querySelectorAll('.file-row')).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('honors a custom accept input', () => {
|
||||||
const fixture = createFixture();
|
const fixture = createFixture();
|
||||||
expect(fixture.componentInstance.allowedExtensions.has('pdf')).toBe(true);
|
expect(fixture.componentInstance.allowedExtensions.has('pdf')).toBe(true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import { Component, EventEmitter, Input, Output, signal } from '@angular/core';
|
import { Component, input, output, signal } from '@angular/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
|
||||||
/** Drag-and-drop and file-picker area that collects a validated list of files. */
|
/**
|
||||||
|
* Drag-and-drop and file-picker area that validates files by extension and size.
|
||||||
|
* With `keepSelection` it keeps and emits the whole selected list; without it,
|
||||||
|
* it emits only each batch of newly accepted files and keeps nothing.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
imports: [MatButtonModule, MatIconModule],
|
imports: [MatButtonModule, MatIconModule],
|
||||||
selector: 'app-file-dropzone',
|
selector: 'app-file-dropzone',
|
||||||
@@ -10,9 +14,10 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
templateUrl: './file-dropzone.html',
|
templateUrl: './file-dropzone.html',
|
||||||
})
|
})
|
||||||
export class FileDropzone {
|
export class FileDropzone {
|
||||||
@Input() accept: string[] = ['xlsx', 'csv', 'json', 'pdf'];
|
readonly accept = input.required<string[]>();
|
||||||
@Input() multiple = true;
|
readonly multiple = input(true);
|
||||||
@Output() readonly filesChange = new EventEmitter<File[]>();
|
readonly keepSelection = input(true);
|
||||||
|
readonly filesChange = output<File[]>();
|
||||||
|
|
||||||
readonly files = signal<File[]>([]);
|
readonly files = signal<File[]>([]);
|
||||||
readonly fileMessages = signal<string[]>([]);
|
readonly fileMessages = signal<string[]>([]);
|
||||||
@@ -21,15 +26,15 @@ export class FileDropzone {
|
|||||||
private dragDepth = 0;
|
private dragDepth = 0;
|
||||||
|
|
||||||
get allowedExtensions(): Set<string> {
|
get allowedExtensions(): Set<string> {
|
||||||
return new Set(this.accept.map((extension) => extension.toLowerCase()));
|
return new Set(this.accept().map((extension) => extension.toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
get acceptAttribute(): string {
|
get acceptAttribute(): string {
|
||||||
return this.accept.map((extension) => `.${extension}`).join(',');
|
return this.accept().map((extension) => `.${extension}`).join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
get formatsLabel(): string {
|
get formatsLabel(): string {
|
||||||
return this.accept.map((extension) => extension.toUpperCase()).join(' · ');
|
return this.accept().map((extension) => extension.toUpperCase()).join(' · ');
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileSelection(event: Event): void {
|
onFileSelection(event: Event): void {
|
||||||
@@ -88,7 +93,8 @@ export class FileDropzone {
|
|||||||
|
|
||||||
private addFiles(incomingFiles: File[]): void {
|
private addFiles(incomingFiles: File[]): void {
|
||||||
const messages: string[] = [];
|
const messages: string[] = [];
|
||||||
const accepted = this.multiple ? [...this.files()] : [];
|
const kept = this.keepSelection() && this.multiple() ? [...this.files()] : [];
|
||||||
|
const accepted = [...kept];
|
||||||
|
|
||||||
for (const file of incomingFiles) {
|
for (const file of incomingFiles) {
|
||||||
const extension = this.extensionOf(file.name);
|
const extension = this.extensionOf(file.name);
|
||||||
@@ -104,16 +110,20 @@ export class FileDropzone {
|
|||||||
messages.push(`${file.name} ya se encuentra seleccionado.`);
|
messages.push(`${file.name} ya se encuentra seleccionado.`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!this.multiple) {
|
if (!this.multiple()) {
|
||||||
accepted.length = 0;
|
accepted.length = 0;
|
||||||
}
|
}
|
||||||
accepted.push(file);
|
accepted.push(file);
|
||||||
if (!this.multiple) break;
|
if (!this.multiple()) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.files.set(accepted);
|
|
||||||
this.fileMessages.set(messages);
|
this.fileMessages.set(messages);
|
||||||
this.filesChange.emit(accepted);
|
if (this.keepSelection()) {
|
||||||
|
this.files.set(accepted);
|
||||||
|
this.filesChange.emit(accepted);
|
||||||
|
} else if (accepted.length > kept.length) {
|
||||||
|
this.filesChange.emit(accepted.slice(kept.length));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extensionOf(fileName: string): string {
|
private extensionOf(fileName: string): string {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<ng-container matColumnDef="outcome">
|
<ng-container matColumnDef="outcome">
|
||||||
<th mat-header-cell *matHeaderCellDef>Resultado</th>
|
<th mat-header-cell *matHeaderCellDef>Resultado</th>
|
||||||
<td mat-cell *matCellDef="let flow">
|
<td mat-cell *matCellDef="let flow">
|
||||||
@if (resultOf(flow); as result) {
|
@if (flow.result(); as result) {
|
||||||
+{{ result.created }} · ↻{{ result.updated }} · ✕{{ result.rejected }}@if (result.merged) { · ⧉{{ result.merged }} }
|
+{{ result.created }} · ↻{{ result.updated }} · ✕{{ result.rejected }}@if (result.merged) { · ⧉{{ result.merged }} }
|
||||||
} @else {
|
} @else {
|
||||||
—
|
—
|
||||||
|
|||||||
@@ -37,12 +37,7 @@ export class LoadDialog implements OnInit {
|
|||||||
/** With merging, rows incomplete on their own may be completed by another source. */
|
/** With merging, rows incomplete on their own may be completed by another source. */
|
||||||
readonly canLoad = computed(() => this.totals().valid > 0 || (this.store.mergeDuplicates() && this.totals().rows > 0));
|
readonly canLoad = computed(() => this.totals().valid > 0 || (this.store.mergeDuplicates() && this.totals().rows > 0));
|
||||||
|
|
||||||
/**
|
/** The flows the next batch writes; frozen once it starts so the results match what was sent. */
|
||||||
* The flows the next batch would write. Reactive to the merge checkbox
|
|
||||||
* while nothing has loaded yet, so ticking it reveals the flow it
|
|
||||||
* completes; frozen the moment a batch starts, so the results table
|
|
||||||
* keeps listing exactly what was sent.
|
|
||||||
*/
|
|
||||||
private readonly _frozenFlows = signal<ImportFlow[] | null>(null);
|
private readonly _frozenFlows = signal<ImportFlow[] | null>(null);
|
||||||
readonly flows = computed(() => this._frozenFlows() ?? this.store.submittableFlows());
|
readonly flows = computed(() => this._frozenFlows() ?? this.store.submittableFlows());
|
||||||
readonly skipped = computed(() => this.store.flows().filter((flow) => !this.flows().includes(flow) && !flow.canSubmit));
|
readonly skipped = computed(() => this.store.flows().filter((flow) => !this.flows().includes(flow) && !flow.canSubmit));
|
||||||
@@ -85,7 +80,7 @@ export class LoadDialog implements OnInit {
|
|||||||
this.store.setOnConflict(strategy);
|
this.store.setOnConflict(strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Toggling may bring an until-now-skipped flow into `flows()`; preview its rows too. */
|
/** Merging can add flows to the batch; validate them so their rows show up in the preview. */
|
||||||
toggleMerge(merge: boolean): void {
|
toggleMerge(merge: boolean): void {
|
||||||
this.store.setMergeDuplicates(merge);
|
this.store.setMergeDuplicates(merge);
|
||||||
Promise.all(this.flows().filter((flow) => !flow.validation()).map((flow) => this.store.validate(flow)));
|
Promise.all(this.flows().filter((flow) => !flow.validation()).map((flow) => this.store.validate(flow)));
|
||||||
@@ -99,8 +94,4 @@ export class LoadDialog implements OnInit {
|
|||||||
explore(): void {
|
explore(): void {
|
||||||
this.dialogRef.close('explore');
|
this.dialogRef.close('explore');
|
||||||
}
|
}
|
||||||
|
|
||||||
resultOf(flow: ImportFlow) {
|
|
||||||
return flow.result();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import { FileConnection } from './file-source';
|
|||||||
import { PdfConnection } from './pdf-source';
|
import { PdfConnection } from './pdf-source';
|
||||||
|
|
||||||
/** Turns the files chosen for one source kind into workspace connections. */
|
/** Turns the files chosen for one source kind into workspace connections. */
|
||||||
export type ConnectionFactory = (files: File[]) => DataConnection[];
|
type ConnectionFactory = (files: File[]) => DataConnection[];
|
||||||
|
|
||||||
|
// Adding a file source on the client is one `DataConnection` subclass and one entry here.
|
||||||
const FACTORIES = new Map<SourceType, ConnectionFactory>([
|
const FACTORIES = new Map<SourceType, ConnectionFactory>([
|
||||||
['csv', (files) => files.map((file) => new FileConnection(file, 'csv'))],
|
['csv', (files) => files.map((file) => new FileConnection(file, 'csv'))],
|
||||||
['excel', (files) => files.map((file) => new FileConnection(file, 'excel'))],
|
['excel', (files) => files.map((file) => new FileConnection(file, 'excel'))],
|
||||||
@@ -18,11 +19,6 @@ const FACTORIES = new Map<SourceType, ConnectionFactory>([
|
|||||||
['document', (files) => [new DocumentConnection(files)]],
|
['document', (files) => [new DocumentConnection(files)]],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** Adding a file source on the client is one `DataConnection` subclass and one call here. */
|
|
||||||
export function registerConnectionFactory(kind: SourceType, factory: ConnectionFactory): void {
|
|
||||||
FACTORIES.set(kind, factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function connectionsFor(kind: SourceType, files: File[]): DataConnection[] {
|
export function connectionsFor(kind: SourceType, files: File[]): DataConnection[] {
|
||||||
const factory = FACTORIES.get(kind);
|
const factory = FACTORIES.get(kind);
|
||||||
return factory && files.length ? factory(files) : [];
|
return factory && files.length ? factory(files) : [];
|
||||||
|
|||||||
@@ -134,12 +134,7 @@ export class ImportFlow {
|
|||||||
return !['loading', 'error', 'incomplete'].includes(this.status());
|
return !['loading', 'error', 'incomplete'].includes(this.status());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Complete and not yet written; editing a loaded flow clears its result and makes it pending again. */
|
||||||
* Belongs in the next load: complete and not already written. A loaded
|
|
||||||
* flow stays out of later batches (re-sending it would duplicate rows in
|
|
||||||
* tables without a natural key) until it's edited, since any edit clears
|
|
||||||
* its result.
|
|
||||||
*/
|
|
||||||
get pendingLoad(): boolean {
|
get pendingLoad(): boolean {
|
||||||
return this.canSubmit && this.status() !== 'loaded';
|
return this.canSubmit && this.status() !== 'loaded';
|
||||||
}
|
}
|
||||||
@@ -162,7 +157,7 @@ export class ImportFlow {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- mapping edits (every one invalidates the last validation) -----------
|
// Every mapping edit invalidates the last validation.
|
||||||
|
|
||||||
map(source: string, field: string): void {
|
map(source: string, field: string): void {
|
||||||
this.mapping.assign(source, field);
|
this.mapping.assign(source, field);
|
||||||
@@ -210,7 +205,6 @@ export class ImportFlow {
|
|||||||
return Object.fromEntries(Object.entries(this._defaults()).filter(([, value]) => value.trim() !== ''));
|
return Object.fromEntries(Object.entries(this._defaults()).filter(([, value]) => value.trim() !== ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- backend round trips ---------------------------------------------------
|
|
||||||
|
|
||||||
async toPayload(): Promise<ImportSourcePayload> {
|
async toPayload(): Promise<ImportSourcePayload> {
|
||||||
const locator = await this.table.locator(this.target.key);
|
const locator = await this.table.locator(this.target.key);
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ const SQL_DIALECT_LABELS: Record<string, string> = {
|
|||||||
mariadb: 'MariaDB',
|
mariadb: 'MariaDB',
|
||||||
postgresql: 'PostgreSQL',
|
postgresql: 'PostgreSQL',
|
||||||
mssql: 'SQL Server',
|
mssql: 'SQL Server',
|
||||||
oracle: 'Oracle',
|
|
||||||
sqlite: 'SQLite',
|
sqlite: 'SQLite',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -75,12 +75,7 @@ export class ConnectWorkspaceStore {
|
|||||||
/** A batch writes to one domain's database, so the domain can only change while there are no flows. */
|
/** A batch writes to one domain's database, so the domain can only change while there are no flows. */
|
||||||
readonly domainLocked = computed(() => this._flows().length > 0);
|
readonly domainLocked = computed(() => this._flows().length > 0);
|
||||||
|
|
||||||
/**
|
/** Unwritten flows into a keyed target: what `mergeDuplicates` may combine, complete or not. */
|
||||||
* Flows with a known target and a natural key, not still loading/erroring
|
|
||||||
* and not already written — candidates to combine by `mergeDuplicates`,
|
|
||||||
* complete or not (a source missing a required field may still supply
|
|
||||||
* others a sibling source lacks).
|
|
||||||
*/
|
|
||||||
private readonly mergeCandidateFlows = computed(() =>
|
private readonly mergeCandidateFlows = computed(() =>
|
||||||
this._flows().filter((flow) => !!flow.target.conflict_fields && !['loading', 'error', 'loaded'].includes(flow.status())),
|
this._flows().filter((flow) => !!flow.target.conflict_fields && !['loading', 'error', 'loaded'].includes(flow.status())),
|
||||||
);
|
);
|
||||||
@@ -97,13 +92,7 @@ export class ConnectWorkspaceStore {
|
|||||||
return new Set([...counts].filter(([, count]) => count > 1).map(([key]) => key));
|
return new Set([...counts].filter(([, count]) => count > 1).map(([key]) => key));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/** Flows the next batch writes: the complete ones, plus incomplete ones another flow may complete when merging. */
|
||||||
* Flows the next batch will write. Normally just the complete ones; with
|
|
||||||
* `mergeDuplicates` on, a flow missing a required field joins them too
|
|
||||||
* when another flow targets the same keyed entity — the gap may be
|
|
||||||
* exactly what that other source supplies, so the batch combines them
|
|
||||||
* before validating instead of dropping the incomplete one silently.
|
|
||||||
*/
|
|
||||||
readonly submittableFlows = computed(() => {
|
readonly submittableFlows = computed(() => {
|
||||||
const complete = this._flows().filter((flow) => flow.pendingLoad);
|
const complete = this._flows().filter((flow) => flow.pendingLoad);
|
||||||
if (!this._mergeDuplicates()) return complete;
|
if (!this._mergeDuplicates()) return complete;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
|||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
CohortExclusionsResponse,
|
|
||||||
CohortScenario,
|
|
||||||
CohortVersion,
|
|
||||||
ModelLineage,
|
ModelLineage,
|
||||||
ModelVersion,
|
ModelVersion,
|
||||||
PromotionCheck,
|
PromotionCheck,
|
||||||
@@ -15,7 +12,7 @@ import {
|
|||||||
OcrRunSummary,
|
OcrRunSummary,
|
||||||
} from './governance.types';
|
} from './governance.types';
|
||||||
|
|
||||||
/** `/governance/*`: model and cohort versions, artifacts, and the OCR review queue. */
|
/** `/governance/*`: model versions, artifacts, and the OCR review queue. */
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class GovernanceApi {
|
export class GovernanceApi {
|
||||||
private readonly http = inject(HttpClient);
|
private readonly http = inject(HttpClient);
|
||||||
@@ -56,22 +53,6 @@ export class GovernanceApi {
|
|||||||
return this.http.post<ModelVersion>(`/governance/model-versions/${domain}/${scenario}/${version}/artifacts`, form);
|
return this.http.post<ModelVersion>(`/governance/model-versions/${domain}/${scenario}/${version}/artifacts`, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
listCohortScenarios(): Observable<{ scenarios: CohortScenario[] }> {
|
|
||||||
return this.http.get<{ scenarios: CohortScenario[] }>('/governance/cohort-scenarios');
|
|
||||||
}
|
|
||||||
|
|
||||||
buildCohortVersion(domain: string, scenario: string, description?: string): Observable<CohortVersion> {
|
|
||||||
return this.http.post<CohortVersion>('/governance/cohort-versions', { domain, scenario, ...(description ? { description } : {}) });
|
|
||||||
}
|
|
||||||
|
|
||||||
listCohortVersions(filters: { domain?: string; scenario?: string } = {}): Observable<{ cohort_versions: CohortVersion[] }> {
|
|
||||||
return this.http.get<{ cohort_versions: CohortVersion[] }>('/governance/cohort-versions', { params: toParams(filters) });
|
|
||||||
}
|
|
||||||
|
|
||||||
getCohortExclusions(cohortVersionId: number): Observable<CohortExclusionsResponse> {
|
|
||||||
return this.http.get<CohortExclusionsResponse>(`/governance/cohort-versions/${cohortVersionId}/exclusions`);
|
|
||||||
}
|
|
||||||
|
|
||||||
listOcrJobs(): Observable<{ jobs: OcrJob[] }> {
|
listOcrJobs(): Observable<{ jobs: OcrJob[] }> {
|
||||||
return this.http.get<{ jobs: OcrJob[] }>('/governance/ocr/jobs');
|
return this.http.get<{ jobs: OcrJob[] }>('/governance/ocr/jobs');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
/** Shapes of the `/governance/*` JSON contract. */
|
/** Shapes of the `/governance/*` JSON contract. */
|
||||||
import { Domain } from '../../connect/api/api.types';
|
import { Domain } from '../../connect/api/api.types';
|
||||||
|
|
||||||
export type Environment = 'DEV' | 'PROD';
|
|
||||||
|
|
||||||
/** Derived from MLflow on every call, never stored. */
|
/** Derived from MLflow on every call, never stored. */
|
||||||
export type ModelStatus = 'desarrollo' | 'candidata' | 'produccion' | 'retirada';
|
export type ModelStatus = 'desarrollo' | 'candidata' | 'produccion' | 'retirada';
|
||||||
|
|
||||||
/** Training, versioning and artifact storage live in MLflow; `name` is
|
/** Training, versioning and artifact storage live in MLflow; `name` is
|
||||||
* `<domain>-<scenario>` and `tags` carries our own promotion-relevant
|
* `<domain>-<scenario>` and `tags` carries our own promotion-relevant
|
||||||
* metadata (domain, scenario, environment, cohort_version_id, the three
|
* metadata (domain, scenario, environment, kit.armado_id, the three
|
||||||
* report URIs) — MLflow has no native columns for any of that. */
|
* report URIs) — MLflow has no native columns for any of that. */
|
||||||
export interface ModelVersion {
|
export interface ModelVersion {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
run_id: string;
|
run_id: string;
|
||||||
tags: Partial<Record<ReportField | 'domain' | 'scenario' | 'environment' | 'cohort_version_id' | 'retirada_en' | 'promovida_en', string>>;
|
tags: Partial<Record<ReportField | 'domain' | 'scenario' | 'environment' | 'kit.armado_id' | 'retirada_en' | 'promovida_en', string>>;
|
||||||
metrics: Record<string, number>;
|
metrics: Record<string, number>;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
status: ModelStatus;
|
status: ModelStatus;
|
||||||
@@ -35,55 +33,29 @@ export type ArtifactPath = string;
|
|||||||
|
|
||||||
export interface ModelLineage {
|
export interface ModelLineage {
|
||||||
model_version: ModelVersion;
|
model_version: ModelVersion;
|
||||||
cohort_version: CohortVersion | null;
|
cohorte_armado: CohorteArmado | null;
|
||||||
cohort_exclusions: CohortExclusionCount[];
|
cohorte_exclusiones: CohorteExclusion[];
|
||||||
artifacts: ArtifactPath[];
|
artifacts: ArtifactPath[];
|
||||||
predictions: number;
|
predictions: number;
|
||||||
checks: PromotionCheck[];
|
checks: PromotionCheck[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CohortScenario {
|
/** The indicator kit's cohort build the version was trained on. */
|
||||||
domain: string;
|
export interface CohorteArmado {
|
||||||
scenario: string;
|
armado_id: number;
|
||||||
criteria_version: string;
|
url: string;
|
||||||
criteria: { code: string; reason_code: string; applicable_in_production: boolean }[];
|
version: string;
|
||||||
|
huella: string;
|
||||||
|
n_miembros: number;
|
||||||
|
datos_as_of: string;
|
||||||
|
armado_en: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CohortVersion {
|
/** One attrition step of a cohort build. */
|
||||||
cohort_version_id: number;
|
export interface CohorteExclusion {
|
||||||
domain: string;
|
orden: number;
|
||||||
scenario: string;
|
paso: string;
|
||||||
criteria_version: string;
|
n: number;
|
||||||
version_hash: string;
|
|
||||||
source_table: string;
|
|
||||||
description: string | null;
|
|
||||||
n_source: number;
|
|
||||||
n_included: number;
|
|
||||||
created_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CohortExclusionCount {
|
|
||||||
cohort_exclusion_count_id: number;
|
|
||||||
cohort_version_id: number;
|
|
||||||
criterion_code: string;
|
|
||||||
reason_code: string;
|
|
||||||
count: number;
|
|
||||||
created_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CohortExclusionDetail {
|
|
||||||
cohort_exclusion_id: number;
|
|
||||||
cohort_version_id: number;
|
|
||||||
pac_id_hospital: string;
|
|
||||||
episodio_id: number | null;
|
|
||||||
criterion_code: string;
|
|
||||||
reason_code: string;
|
|
||||||
excluded_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CohortExclusionsResponse {
|
|
||||||
counts: CohortExclusionCount[];
|
|
||||||
detail: CohortExclusionDetail[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OcrJob {
|
export interface OcrJob {
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
<h2 mat-dialog-title>Exclusiones · {{ data.cohort.scenario }} ({{ data.cohort.version_hash.slice(0, 12) }}…)</h2>
|
|
||||||
<mat-dialog-content class="exclusions">
|
|
||||||
@if (loading()) {
|
|
||||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
|
||||||
}
|
|
||||||
@if (error(); as message) {
|
|
||||||
<p class="exclusions__alert" role="alert">{{ message }}</p>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (!loading() && !error()) {
|
|
||||||
<h3>Conteo por criterio</h3>
|
|
||||||
<table mat-table [dataSource]="counts()" class="exclusions__table">
|
|
||||||
<ng-container matColumnDef="criterion_code">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Criterio</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.criterion_code }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="reason_code">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Razón</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.reason_code }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="count">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Conteo</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.count }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<tr mat-header-row *matHeaderRowDef="countColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: countColumns"></tr>
|
|
||||||
</table>
|
|
||||||
@if (counts().length === 0) {
|
|
||||||
<p class="exclusions__empty">Ningún episodio fue excluido al construir esta cohorte.</p>
|
|
||||||
}
|
|
||||||
|
|
||||||
<h3>Bitácora por episodio</h3>
|
|
||||||
<table mat-table [dataSource]="detail()" class="exclusions__table">
|
|
||||||
<ng-container matColumnDef="pac_id_hospital">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Paciente</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.pac_id_hospital }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="episodio_id">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Episodio</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.episodio_id ?? '—' }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="criterion_code">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Criterio</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.criterion_code }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="reason_code">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Razón</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.reason_code }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container matColumnDef="excluded_at">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Fecha</th>
|
|
||||||
<td mat-cell *matCellDef="let row">{{ row.excluded_at | date: 'short' }}</td>
|
|
||||||
</ng-container>
|
|
||||||
<tr mat-header-row *matHeaderRowDef="detailColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: detailColumns"></tr>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
</mat-dialog-content>
|
|
||||||
<mat-dialog-actions align="end">
|
|
||||||
<button mat-button type="button" mat-dialog-close>Cerrar</button>
|
|
||||||
</mat-dialog-actions>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
.exclusions {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--space-2);
|
|
||||||
max-height: 70vh;
|
|
||||||
min-width: 560px;
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font: var(--mat-sys-title-small);
|
|
||||||
margin: var(--space-3) 0 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.exclusions__table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.exclusions__alert {
|
|
||||||
color: var(--mat-sys-error);
|
|
||||||
}
|
|
||||||
|
|
||||||
.exclusions__empty {
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
font: var(--mat-sys-body-small);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 720px) {
|
|
||||||
.exclusions {
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, OnInit, inject, signal } from '@angular/core';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
|
||||||
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
||||||
import { MatTableModule } from '@angular/material/table';
|
|
||||||
import { apiErrorMessage } from '../../../connect/api/api.types';
|
|
||||||
import { GovernanceApi } from '../../api/governance.api';
|
|
||||||
import { CohortExclusionCount, CohortExclusionDetail, CohortVersion } from '../../api/governance.types';
|
|
||||||
|
|
||||||
export interface CohortExclusionsDialogData {
|
|
||||||
cohort: CohortVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exclusion counts per criterion for a cohort version, plus the
|
|
||||||
* per-episode log behind them. Both are written when the cohort is built;
|
|
||||||
* this dialog only displays them.
|
|
||||||
*/
|
|
||||||
@Component({
|
|
||||||
selector: 'app-cohort-exclusions-dialog',
|
|
||||||
imports: [DatePipe, MatButtonModule, MatDialogModule, MatProgressBarModule, MatTableModule],
|
|
||||||
templateUrl: './cohort-exclusions-dialog.html',
|
|
||||||
styleUrl: './cohort-exclusions-dialog.scss',
|
|
||||||
})
|
|
||||||
export class CohortExclusionsDialog implements OnInit {
|
|
||||||
readonly data = inject<CohortExclusionsDialogData>(MAT_DIALOG_DATA);
|
|
||||||
private readonly api = inject(GovernanceApi);
|
|
||||||
|
|
||||||
readonly loading = signal(true);
|
|
||||||
readonly error = signal<string | null>(null);
|
|
||||||
readonly counts = signal<CohortExclusionCount[]>([]);
|
|
||||||
readonly detail = signal<CohortExclusionDetail[]>([]);
|
|
||||||
|
|
||||||
readonly countColumns = ['criterion_code', 'reason_code', 'count'];
|
|
||||||
readonly detailColumns = ['pac_id_hospital', 'episodio_id', 'criterion_code', 'reason_code', 'excluded_at'];
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.api.getCohortExclusions(this.data.cohort.cohort_version_id).subscribe({
|
|
||||||
next: ({ counts, detail }) => {
|
|
||||||
this.loading.set(false);
|
|
||||||
this.counts.set(counts);
|
|
||||||
this.detail.set(detail);
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
this.loading.set(false);
|
|
||||||
this.error.set(apiErrorMessage(error, 'No se pudieron cargar las exclusiones.'));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
<div class="cohorts">
|
|
||||||
<div class="cohorts__toolbar">
|
|
||||||
<mat-button-toggle-group hideSingleSelectionIndicator [value]="domain()" (change)="setDomain($event.value)" aria-label="Dominio">
|
|
||||||
@for (option of domains; track option.id) {
|
|
||||||
<mat-button-toggle [value]="option.id">{{ option.label }}</mat-button-toggle>
|
|
||||||
}
|
|
||||||
</mat-button-toggle-group>
|
|
||||||
<span class="cohorts__spacer"></span>
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
type="button"
|
|
||||||
[matMenuTriggerFor]="scenarioMenu"
|
|
||||||
[disabled]="building() || scenarios().length === 0"
|
|
||||||
[matTooltip]="scenarios().length ? '' : 'No hay escenarios con un constructor de cohorte registrado (models.cohort)'"
|
|
||||||
>
|
|
||||||
<mat-icon aria-hidden="true">add</mat-icon>Construir versión
|
|
||||||
</button>
|
|
||||||
<mat-menu #scenarioMenu="matMenu">
|
|
||||||
@for (scenario of scenarios(); track scenario.domain + scenario.scenario) {
|
|
||||||
<button mat-menu-item type="button" (click)="build(scenario)">
|
|
||||||
{{ scenario.domain }} · {{ scenario.scenario }} ({{ scenario.criteria_version }}, {{ scenario.criteria.length }} criterio(s))
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</mat-menu>
|
|
||||||
<button mat-icon-button type="button" (click)="reload()" aria-label="Recargar" matTooltip="Recargar">
|
|
||||||
<mat-icon aria-hidden="true">refresh</mat-icon>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (loading() || building()) {
|
|
||||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
|
||||||
}
|
|
||||||
@if (loadError(); as error) {
|
|
||||||
<p class="cohorts__alert" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ error }}</p>
|
|
||||||
}
|
|
||||||
|
|
||||||
<table mat-table [dataSource]="cohorts()" class="cohorts__table">
|
|
||||||
<ng-container matColumnDef="scenario">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Dominio · escenario</th>
|
|
||||||
<td mat-cell *matCellDef="let c">{{ c.domain }} · {{ c.scenario }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="version_hash">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Hash de versión</th>
|
|
||||||
<td mat-cell *matCellDef="let c"><code class="cohorts__hash" [matTooltip]="c.version_hash">{{ c.version_hash.slice(0, 16) }}…</code></td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="criteria_version">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Criterio</th>
|
|
||||||
<td mat-cell *matCellDef="let c">{{ c.criteria_version }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="counts">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Participantes</th>
|
|
||||||
<td mat-cell *matCellDef="let c">{{ c.n_included }} incluido(s) · {{ excludedCount(c) }} excluido(s) de {{ c.n_source }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="created_at">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Creada</th>
|
|
||||||
<td mat-cell *matCellDef="let c">{{ c.created_at | date: 'short' }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="acciones">
|
|
||||||
<th mat-header-cell *matHeaderCellDef></th>
|
|
||||||
<td mat-cell *matCellDef="let c">
|
|
||||||
<button mat-button type="button" (click)="openExclusions(c)">
|
|
||||||
<mat-icon aria-hidden="true">rule</mat-icon>Exclusiones
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
@if (!loading() && cohorts().length === 0) {
|
|
||||||
<p class="cohorts__empty"><mat-icon aria-hidden="true">dataset</mat-icon>Aún no hay cohortes construidas para este filtro.</p>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
.cohorts {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--space-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__toolbar {
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
gap: var(--space-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__spacer {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__alert {
|
|
||||||
align-items: center;
|
|
||||||
background: var(--mat-sys-error-container);
|
|
||||||
color: var(--mat-sys-on-error-container);
|
|
||||||
display: flex;
|
|
||||||
gap: var(--space-2);
|
|
||||||
margin: 0;
|
|
||||||
padding: var(--space-2) var(--space-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__hash {
|
|
||||||
background: var(--mat-sys-surface-variant);
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 2px 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cohorts__empty {
|
|
||||||
align-items: center;
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
display: flex;
|
|
||||||
font: var(--mat-sys-body-small);
|
|
||||||
gap: var(--space-2);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
import { DatePipe } from '@angular/common';
|
|
||||||
import { Component, DestroyRef, OnInit, inject, signal } from '@angular/core';
|
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
|
||||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
|
||||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
||||||
import { MatTableModule } from '@angular/material/table';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { DOMAINS } from '../../../connect/state/connect-workspace.store';
|
|
||||||
import { apiErrorMessage } from '../../../connect/api/api.types';
|
|
||||||
import { GovernanceApi } from '../../api/governance.api';
|
|
||||||
import { CohortScenario, CohortVersion } from '../../api/governance.types';
|
|
||||||
import { CohortExclusionsDialog, CohortExclusionsDialogData } from '../cohort-exclusions-dialog/cohort-exclusions-dialog';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frozen, hashed cohort versions with their exclusion counts and log.
|
|
||||||
* Scenarios with a registered builder can produce a
|
|
||||||
* new version from here.
|
|
||||||
*/
|
|
||||||
@Component({
|
|
||||||
selector: 'app-cohort-versions-panel',
|
|
||||||
imports: [
|
|
||||||
DatePipe,
|
|
||||||
MatButtonModule,
|
|
||||||
MatButtonToggleModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatMenuModule,
|
|
||||||
MatProgressBarModule,
|
|
||||||
MatSnackBarModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatTooltipModule,
|
|
||||||
],
|
|
||||||
templateUrl: './cohort-versions-panel.html',
|
|
||||||
styleUrl: './cohort-versions-panel.scss',
|
|
||||||
})
|
|
||||||
export class CohortVersionsPanel implements OnInit {
|
|
||||||
private readonly api = inject(GovernanceApi);
|
|
||||||
private readonly dialog = inject(MatDialog);
|
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
|
||||||
private readonly snackBar = inject(MatSnackBar);
|
|
||||||
|
|
||||||
readonly domains = [{ id: null, label: 'Todos' }, ...DOMAINS.map((d) => ({ id: d.id as string | null, label: d.label }))];
|
|
||||||
readonly domain = signal<string | null>(null);
|
|
||||||
readonly cohorts = signal<CohortVersion[]>([]);
|
|
||||||
readonly loading = signal(false);
|
|
||||||
readonly loadError = signal<string | null>(null);
|
|
||||||
readonly scenarios = signal<CohortScenario[]>([]);
|
|
||||||
readonly building = signal(false);
|
|
||||||
|
|
||||||
readonly displayedColumns = ['scenario', 'version_hash', 'criteria_version', 'counts', 'created_at', 'acciones'];
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.reload();
|
|
||||||
this.api.listCohortScenarios().subscribe({ next: ({ scenarios }) => this.scenarios.set(scenarios), error: () => this.scenarios.set([]) });
|
|
||||||
}
|
|
||||||
|
|
||||||
build(scenario: CohortScenario): void {
|
|
||||||
this.building.set(true);
|
|
||||||
this.api.buildCohortVersion(scenario.domain, scenario.scenario).subscribe({
|
|
||||||
next: (cohort) => {
|
|
||||||
this.building.set(false);
|
|
||||||
this.snackBar.open(`Cohorte ${cohort.scenario} construida: ${cohort.n_included} de ${cohort.n_source} episodios.`, 'OK', { duration: 5000 });
|
|
||||||
this.reload();
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
this.building.set(false);
|
|
||||||
this.snackBar.open(apiErrorMessage(error, 'No se pudo construir la cohorte.'), 'OK', { duration: 6000 });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setDomain(domain: string | null): void {
|
|
||||||
this.domain.set(domain);
|
|
||||||
this.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
reload(): void {
|
|
||||||
this.loading.set(true);
|
|
||||||
this.loadError.set(null);
|
|
||||||
this.api
|
|
||||||
.listCohortVersions(this.domain() ? { domain: this.domain()! } : {})
|
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
||||||
.subscribe({
|
|
||||||
next: ({ cohort_versions }) => {
|
|
||||||
this.loading.set(false);
|
|
||||||
this.cohorts.set(cohort_versions);
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
this.loading.set(false);
|
|
||||||
this.loadError.set(apiErrorMessage(error, 'No se pudieron cargar las versiones de cohorte.'));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openExclusions(cohort: CohortVersion): void {
|
|
||||||
this.dialog.open<CohortExclusionsDialog, CohortExclusionsDialogData>(CohortExclusionsDialog, {
|
|
||||||
width: '720px',
|
|
||||||
maxWidth: '96vw',
|
|
||||||
data: { cohort },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
excludedCount(cohort: CohortVersion): number {
|
|
||||||
return cohort.n_source - cohort.n_included;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,11 +12,6 @@
|
|||||||
<app-model-versions-panel></app-model-versions-panel>
|
<app-model-versions-panel></app-model-versions-panel>
|
||||||
</div>
|
</div>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Cohortes">
|
|
||||||
<div class="governance__panel">
|
|
||||||
<app-cohort-versions-panel></app-cohort-versions-panel>
|
|
||||||
</div>
|
|
||||||
</mat-tab>
|
|
||||||
<mat-tab label="Revisión de OCR">
|
<mat-tab label="Revisión de OCR">
|
||||||
<div class="governance__panel">
|
<div class="governance__panel">
|
||||||
<app-ocr-review-panel></app-ocr-review-panel>
|
<app-ocr-review-panel></app-ocr-review-panel>
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
import { CohortVersionsPanel } from '../cohort-versions-panel/cohort-versions-panel';
|
|
||||||
import { ModelVersionsPanel } from '../model-versions-panel/model-versions-panel';
|
import { ModelVersionsPanel } from '../model-versions-panel/model-versions-panel';
|
||||||
import { OcrReviewPanel } from '../ocr-review-panel/ocr-review-panel';
|
import { OcrReviewPanel } from '../ocr-review-panel/ocr-review-panel';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "Gobernanza de modelos" page (route `/gobernanza`): model versions,
|
* The "Gobernanza de modelos" page (route `/gobernanza`): model versions
|
||||||
* cohorts and the OCR review queue, one tab each. Every tab is a
|
* and the OCR review queue, one tab each. Every tab is a
|
||||||
* self-contained panel that loads its own data.
|
* self-contained panel that loads its own data.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-governance-page',
|
selector: 'app-governance-page',
|
||||||
imports: [CohortVersionsPanel, MatTabsModule, MatToolbarModule, ModelVersionsPanel, OcrReviewPanel],
|
imports: [MatTabsModule, MatToolbarModule, ModelVersionsPanel, OcrReviewPanel],
|
||||||
templateUrl: './governance-page.html',
|
templateUrl: './governance-page.html',
|
||||||
styleUrl: './governance-page.scss',
|
styleUrl: './governance-page.scss',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -58,18 +58,23 @@
|
|||||||
|
|
||||||
<section aria-labelledby="cohort-title">
|
<section aria-labelledby="cohort-title">
|
||||||
<h3 id="cohort-title">Cohorte de entrenamiento</h3>
|
<h3 id="cohort-title">Cohorte de entrenamiento</h3>
|
||||||
@if (l.cohort_version; as cohort) {
|
@if (l.cohorte_armado; as armado) {
|
||||||
<p>
|
<p>
|
||||||
{{ cohort.domain }} · {{ cohort.scenario }} · criterio {{ cohort.criteria_version }} ·
|
{{ armado.url }} · versión {{ armado.version }} · {{ armado.n_miembros | number }} miembros ·
|
||||||
{{ cohort.n_included | number }} de {{ cohort.n_source | number }} episodios
|
datos al {{ armado.datos_as_of | date: 'mediumDate' }}
|
||||||
</p>
|
</p>
|
||||||
<p class="hash" [matTooltip]="cohort.version_hash">hash {{ cohort.version_hash.slice(0, 16) }}…</p>
|
<p class="hash" [matTooltip]="armado.huella">huella {{ armado.huella.slice(0, 12) }}… · armado {{ armado.armado_id }}</p>
|
||||||
@if (l.cohort_exclusions.length) {
|
@if (l.cohorte_exclusiones.length) {
|
||||||
<ul class="exclusions">
|
<table class="exclusions">
|
||||||
@for (count of l.cohort_exclusions; track count.cohort_exclusion_count_id) {
|
<thead>
|
||||||
<li>{{ count.criterion_code }} ({{ count.reason_code }}): {{ count.count | number }} excluidos</li>
|
<tr><th>#</th><th>Paso</th><th>Quedan</th></tr>
|
||||||
}
|
</thead>
|
||||||
</ul>
|
<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 {
|
} @else {
|
||||||
<p class="muted">Sin cohorte enlazada.</p>
|
<p class="muted">Sin cohorte enlazada.</p>
|
||||||
|
|||||||
@@ -49,8 +49,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.checks,
|
.checks,
|
||||||
.artifacts,
|
.artifacts {
|
||||||
.exclusions {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--space-1);
|
gap: var(--space-1);
|
||||||
@@ -111,3 +110,19 @@
|
|||||||
justify-self: start;
|
justify-self: start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.exclusions {
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
padding: var(--space-1) var(--space-2);
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
td:last-child,
|
||||||
|
th:last-child {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const ARTIFACT_KINDS: { id: string; label: string }[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One model version: what it was trained on (cohort hash and exclusions),
|
* One model version: what it was trained on (the kit's cohort build and its attrition),
|
||||||
* its artifacts and their integrity, its validation reports, and the
|
* its artifacts and their integrity, its validation reports, and the
|
||||||
* checklist that must pass before it can serve predictions. Closes with
|
* checklist that must pass before it can serve predictions. Closes with
|
||||||
* `true` when the version changed.
|
* `true` when the version changed.
|
||||||
|
|||||||
@@ -45,9 +45,9 @@
|
|||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="cohort_version_id">
|
<ng-container matColumnDef="armado">
|
||||||
<th mat-header-cell *matHeaderCellDef>Cohorte</th>
|
<th mat-header-cell *matHeaderCellDef>Armado de cohorte</th>
|
||||||
<td mat-cell *matCellDef="let v">{{ v.tags.cohort_version_id ?? '— (sin enlazar)' }}</td>
|
<td mat-cell *matCellDef="let v">{{ v.tags['kit.armado_id'] ?? 'Sin enlazar' }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="status">
|
<ng-container matColumnDef="status">
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export class ModelVersionsPanel implements OnInit {
|
|||||||
readonly loading = signal(false);
|
readonly loading = signal(false);
|
||||||
readonly loadError = signal<string | null>(null);
|
readonly loadError = signal<string | null>(null);
|
||||||
|
|
||||||
readonly displayedColumns = ['version', 'scenario', 'environment', 'cohort_version_id', 'status', 'created_at', 'acciones'];
|
readonly displayedColumns = ['version', 'scenario', 'environment', 'armado', 'status', 'created_at', 'acciones'];
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.reload();
|
this.reload();
|
||||||
|
|||||||
@@ -10,26 +10,26 @@
|
|||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
|
|
||||||
<div class="reportes__body">
|
<div class="reportes__body">
|
||||||
@if (error(); as mensaje) {
|
@if (error(); as message) {
|
||||||
<p class="reportes__error" role="alert">{{ mensaje }}</p>
|
<p class="reportes__error" role="alert">{{ message }}</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<section aria-labelledby="estado-title">
|
<section aria-labelledby="estado-title">
|
||||||
<h2 id="estado-title">Indicadores</h2>
|
<h2 id="estado-title">Indicadores</h2>
|
||||||
<p class="reportes__hint">Los indicadores se recalculan automáticamente después de cada carga de información.</p>
|
<p class="reportes__hint">Los indicadores se recalculan automáticamente después de cada carga de información.</p>
|
||||||
<div class="estado-grid">
|
<div class="estado-grid">
|
||||||
@for (dominio of dominios; track dominio.id) {
|
@for (domain of domains; track domain.id) {
|
||||||
@if (estados()?.[dominio.id]; as estado) {
|
@if (statuses()?.[domain.id]; as status) {
|
||||||
<article class="estado" [attr.data-estado]="estado.estado">
|
<article class="estado" [attr.data-estado]="status.estado">
|
||||||
<h3>{{ dominio.nombre }}</h3>
|
<h3>{{ domain.description }}</h3>
|
||||||
<p class="estado__valor">{{ estadoTexto(estado) }}</p>
|
<p class="estado__valor">{{ statusLabel(status) }}</p>
|
||||||
@if (estado.fin) {
|
@if (status.fin) {
|
||||||
<p>Último cálculo: {{ estado.fin | date: 'dd/MM/yyyy HH:mm' }} ({{ estado.duracion_s | number: '1.0-1' }} s)</p>
|
<p>Último cálculo: {{ status.fin | date: 'dd/MM/yyyy HH:mm' }} ({{ status.duracion_s | number: '1.0-1' }} s)</p>
|
||||||
}
|
}
|
||||||
@if (estado.error) {
|
@if (status.error) {
|
||||||
<p class="estado__error">{{ estado.error.tipo }}: {{ estado.error.mensaje }}</p>
|
<p class="estado__error">{{ status.error.tipo }}: {{ status.error.mensaje }}</p>
|
||||||
}
|
}
|
||||||
<button mat-button type="button" (click)="recalcular(dominio.id)" [disabled]="estado.pendiente || estado.estado === 'en_curso'">
|
<button mat-button type="button" (click)="recompute(domain.id)" [disabled]="status.pendiente || status.estado === 'en_curso'">
|
||||||
<mat-icon aria-hidden="true">refresh</mat-icon>Recalcular
|
<mat-icon aria-hidden="true">refresh</mat-icon>Recalcular
|
||||||
</button>
|
</button>
|
||||||
</article>
|
</article>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
<section aria-labelledby="intentos-title">
|
<section aria-labelledby="intentos-title">
|
||||||
<h2 id="intentos-title">Intentos de carga y validación</h2>
|
<h2 id="intentos-title">Intentos de carga y validación</h2>
|
||||||
<p class="reportes__hint">La bitácora registra únicamente conteos y formatos agregados; no almacena valores de los registros.</p>
|
<p class="reportes__hint">La bitácora registra únicamente conteos y formatos agregados; no almacena valores de los registros.</p>
|
||||||
@if (intentos().length === 0) {
|
@if (attempts().length === 0) {
|
||||||
<p>No se han registrado intentos de carga o validación.</p>
|
<p>No se han registrado intentos de carga o validación.</p>
|
||||||
} @else {
|
} @else {
|
||||||
<table class="intentos">
|
<table class="intentos">
|
||||||
@@ -52,33 +52,33 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (intento of intentos(); track intento.id) {
|
@for (attempt of attempts(); track attempt.id) {
|
||||||
<tr [attr.data-resultado]="intento.resultado">
|
<tr [attr.data-resultado]="attempt.resultado">
|
||||||
<td>{{ intento.fecha | date: 'dd/MM/yyyy HH:mm' }}</td>
|
<td>{{ attempt.fecha | date: 'dd/MM/yyyy HH:mm' }}</td>
|
||||||
<td>{{ intento.operacion === 'carga' ? 'Carga' : 'Validación' }}</td>
|
<td>{{ attempt.operacion === 'carga' ? 'Carga' : 'Validación' }}</td>
|
||||||
<td>{{ intento.fuentes.length ? intento.fuentes[0].destino : (intento.dominio ?? '—') }}@if (intento.fuentes.length > 1) { <span> +{{ intento.fuentes.length - 1 }}</span> }</td>
|
<td>{{ attempt.fuentes.length ? attempt.fuentes[0].destino : (attempt.dominio ?? '—') }}@if (attempt.fuentes.length > 1) { <span> +{{ attempt.fuentes.length - 1 }}</span> }</td>
|
||||||
<td>{{ resultadoTexto(intento.resultado) }}</td>
|
<td>{{ outcomeLabel(attempt.resultado) }}</td>
|
||||||
<td>{{ intento.totales['leidas'] ?? 0 }}</td>
|
<td>{{ attempt.totales['leidas'] ?? 0 }}</td>
|
||||||
<td>{{ intento.totales['validas'] ?? 0 }}</td>
|
<td>{{ attempt.totales['validas'] ?? 0 }}</td>
|
||||||
<td>{{ (intento.totales['insertadas'] ?? 0) + (intento.totales['actualizadas'] ?? 0) }}</td>
|
<td>{{ (attempt.totales['insertadas'] ?? 0) + (attempt.totales['actualizadas'] ?? 0) }}</td>
|
||||||
<td>{{ (intento.totales['rechazadas_en_validacion'] ?? 0) + (intento.totales['rechazadas_por_conflicto'] ?? 0) }}</td>
|
<td>{{ (attempt.totales['rechazadas_en_validacion'] ?? 0) + (attempt.totales['rechazadas_por_conflicto'] ?? 0) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<button mat-icon-button type="button" (click)="alternar(intento.id)" [attr.aria-expanded]="abierto() === intento.id" aria-label="Ver detalle">
|
<button mat-icon-button type="button" (click)="toggle(attempt.id)" [attr.aria-expanded]="expanded() === attempt.id" aria-label="Ver detalle">
|
||||||
<mat-icon>{{ abierto() === intento.id ? 'expand_less' : 'expand_more' }}</mat-icon>
|
<mat-icon>{{ expanded() === attempt.id ? 'expand_less' : 'expand_more' }}</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if (abierto() === intento.id) {
|
@if (expanded() === attempt.id) {
|
||||||
<tr class="detalle">
|
<tr class="detalle">
|
||||||
<td colspan="9">
|
<td colspan="9">
|
||||||
@if (intento.error) {
|
@if (attempt.error) {
|
||||||
<p class="estado__error">{{ intento.error.tipo }}: {{ intento.error.mensaje }}</p>
|
<p class="estado__error">{{ attempt.error.tipo }}: {{ attempt.error.mensaje }}</p>
|
||||||
}
|
}
|
||||||
@for (fuente of intento.fuentes; track $index) {
|
@for (source of attempt.fuentes; track $index) {
|
||||||
<p>
|
<p>
|
||||||
<strong>{{ fuente.destino }}</strong> desde {{ fuente.origen.tipo }}
|
<strong>{{ source.destino }}</strong> desde {{ source.origen.tipo }}
|
||||||
@if (fuente.mapeo.requeridos_sin_mapear.length) {
|
@if (source.mapeo.requeridos_sin_mapear.length) {
|
||||||
· requeridos sin mapear: {{ fuente.mapeo.requeridos_sin_mapear.join(', ') }}
|
· requeridos sin mapear: {{ source.mapeo.requeridos_sin_mapear.join(', ') }}
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
@@ -87,16 +87,16 @@
|
|||||||
<tr><th scope="col">Campo</th><th scope="col">Con valor</th><th scope="col">Vacíos</th><th scope="col">Errores</th><th scope="col">Formatos o valores rechazados</th></tr>
|
<tr><th scope="col">Campo</th><th scope="col">Con valor</th><th scope="col">Vacíos</th><th scope="col">Errores</th><th scope="col">Formatos o valores rechazados</th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@for (fila of camposConProblemas(intento); track fila.destino + fila.nombre) {
|
@for (row of fieldsWithProblems(attempt); track row.target + row.name) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ fila.nombre }}</td>
|
<td>{{ row.name }}</td>
|
||||||
<td>{{ fila.campo.con_valor }}</td>
|
<td>{{ row.field.con_valor }}</td>
|
||||||
<td>{{ fila.campo.vacios }}</td>
|
<td>{{ row.field.vacios }}</td>
|
||||||
<td>@for (e of fila.campo.errores | keyvalue; track e.key) { <span class="chip">{{ e.key }}: {{ e.value }}</span> }</td>
|
<td>@for (e of row.field.errores | keyvalue; track e.key) { <span class="chip">{{ e.key }}: {{ e.value }}</span> }</td>
|
||||||
<td>
|
<td>
|
||||||
@for (f of fila.campo.formatos_rechazados | keyvalue; track f.key) { <span class="chip"><code>{{ f.key }}</code> ×{{ f.value }}</span> }
|
@for (f of row.field.formatos_rechazados | keyvalue; track f.key) { <span class="chip"><code>{{ f.key }}</code> ×{{ f.value }}</span> }
|
||||||
@for (v of fila.campo.valores_fuera_de_catalogo | keyvalue; track v.key) { <span class="chip">{{ v.key }} ×{{ v.value }}</span> }
|
@for (v of row.field.valores_fuera_de_catalogo | keyvalue; track v.key) { <span class="chip">{{ v.key }} ×{{ v.value }}</span> }
|
||||||
@if (fila.campo.valores_fuera_de_catalogo_poco_frecuentes) { <span class="chip">otros ×{{ fila.campo.valores_fuera_de_catalogo_poco_frecuentes }}</span> }
|
@if (row.field.valores_fuera_de_catalogo_poco_frecuentes) { <span class="chip">otros ×{{ row.field.valores_fuera_de_catalogo_poco_frecuentes }}</span> }
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
} @empty {
|
} @empty {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { provideHttpClient } from '@angular/common/http';
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ReportesPage } from './reportes-page';
|
import { ReportsPage } from './reportes-page';
|
||||||
|
|
||||||
describe('ReportesPage', () => {
|
describe('ReportsPage', () => {
|
||||||
let http: HttpTestingController;
|
let http: HttpTestingController;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ReportesPage],
|
imports: [ReportsPage],
|
||||||
providers: [provideHttpClient(), provideHttpClientTesting()],
|
providers: [provideHttpClient(), provideHttpClientTesting()],
|
||||||
});
|
});
|
||||||
http = TestBed.inject(HttpTestingController);
|
http = TestBed.inject(HttpTestingController);
|
||||||
@@ -17,7 +17,7 @@ describe('ReportesPage', () => {
|
|||||||
afterEach(() => http.verify());
|
afterEach(() => http.verify());
|
||||||
|
|
||||||
it('shows the indicator status and the aggregate attempts', () => {
|
it('shows the indicator status and the aggregate attempts', () => {
|
||||||
const fixture = TestBed.createComponent(ReportesPage);
|
const fixture = TestBed.createComponent(ReportsPage);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
http.expectOne('/reportes/indicadores').flush({
|
http.expectOne('/reportes/indicadores').flush({
|
||||||
cacu: { estado: 'ok', pendiente: false, fin: '2026-10-29T10:00:00+00:00', duracion_s: 12 },
|
cacu: { estado: 'ok', pendiente: false, fin: '2026-10-29T10:00:00+00:00', duracion_s: 12 },
|
||||||
@@ -48,9 +48,29 @@ describe('ReportesPage', () => {
|
|||||||
expect(fixture.nativeElement.querySelector('.campos').textContent).toContain('out_of_catalog: 2');
|
expect(fixture.nativeElement.querySelector('.campos').textContent).toContain('out_of_catalog: 2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps polling after a failed request', () => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
try {
|
||||||
|
const fixture = TestBed.createComponent(ReportsPage);
|
||||||
|
fixture.detectChanges();
|
||||||
|
http.expectOne('/reportes/indicadores').flush('caída', { status: 502, statusText: 'Bad Gateway' });
|
||||||
|
http.expectOne((r) => r.url === '/reportes/importaciones');
|
||||||
|
expect(fixture.componentInstance.error()).toBeTruthy();
|
||||||
|
|
||||||
|
vi.advanceTimersByTime(15000);
|
||||||
|
http.expectOne('/reportes/indicadores').flush({ cacu: { estado: 'ok', pendiente: false } });
|
||||||
|
http.expectOne((r) => r.url === '/reportes/importaciones').flush({ resumen: { intentos: {}, ultimo: null }, intentos: [] });
|
||||||
|
expect(fixture.componentInstance.error()).toBeNull();
|
||||||
|
expect(fixture.componentInstance.statuses()?.cacu.estado).toBe('ok');
|
||||||
|
fixture.destroy();
|
||||||
|
} finally {
|
||||||
|
vi.useRealTimers();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it('asks for a recomputation', () => {
|
it('asks for a recomputation', () => {
|
||||||
const fixture = TestBed.createComponent(ReportesPage);
|
const fixture = TestBed.createComponent(ReportsPage);
|
||||||
fixture.componentInstance.recalcular('tea');
|
fixture.componentInstance.recompute('tea');
|
||||||
http.expectOne('/reportes/indicadores/tea/recalcular').flush({ pendiente: true });
|
http.expectOne('/reportes/indicadores/tea/recalcular').flush({ pendiente: true });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,87 +4,83 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
import { forkJoin, interval, startWith, switchMap } from 'rxjs';
|
import { EMPTY, catchError, forkJoin, interval, startWith, switchMap } from 'rxjs';
|
||||||
import { apiErrorMessage } from '../connect/api/api.types';
|
import { Domain, apiErrorMessage } from '../connect/api/api.types';
|
||||||
import { Dominio, EstadoRecalculo, IntentoImportacion, ReportesApi } from './reportes.api';
|
import { DOMAINS } from '../connect/state/connect-workspace.store';
|
||||||
|
import { ImportAttempt, RecomputeStatus, ReportsApi } from './reportes.api';
|
||||||
|
|
||||||
const DOMINIOS: { id: Dominio; nombre: string }[] = [
|
const STATUS_LABELS: Record<string, string> = {
|
||||||
{ id: 'cacu', nombre: 'Cáncer cervicouterino' },
|
|
||||||
{ id: 'cama', nombre: 'Cáncer de mama' },
|
|
||||||
{ id: 'tea', nombre: 'Trastorno del espectro autista' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const ESTADOS: Record<string, string> = {
|
|
||||||
sin_correr: 'Pendiente de cálculo', en_curso: 'En proceso de cálculo', ok: 'Actualizado', error: 'Error en el cálculo',
|
sin_correr: 'Pendiente de cálculo', en_curso: 'En proceso de cálculo', ok: 'Actualizado', error: 'Error en el cálculo',
|
||||||
};
|
};
|
||||||
|
|
||||||
const RESULTADOS: Record<string, string> = {
|
const OUTCOME_LABELS: Record<string, string> = {
|
||||||
completada: 'Completada', solicitud_invalida: 'Solicitud inválida',
|
completada: 'Completada', solicitud_invalida: 'Solicitud inválida',
|
||||||
rechazada_por_la_base: 'Rechazada por la base', fallida: 'Fallida',
|
rechazada_por_la_base: 'Rechazada por la base', fallida: 'Fallida',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** The import log page (`/bitacora`): import attempts in aggregate and the indicator status per domain. */
|
||||||
* The "Bitácora" page (route `/bitacora`): what happened to every import
|
|
||||||
* attempt, in aggregates only, and whether each domain's indicators are up
|
|
||||||
* to date with what was loaded. Refreshes itself every 15 seconds.
|
|
||||||
*/
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reportes-page',
|
selector: 'app-reportes-page',
|
||||||
imports: [DatePipe, DecimalPipe, KeyValuePipe, MatButtonModule, MatIconModule, MatToolbarModule],
|
imports: [DatePipe, DecimalPipe, KeyValuePipe, MatButtonModule, MatIconModule, MatToolbarModule],
|
||||||
templateUrl: './reportes-page.html',
|
templateUrl: './reportes-page.html',
|
||||||
styleUrl: './reportes-page.scss',
|
styleUrl: './reportes-page.scss',
|
||||||
})
|
})
|
||||||
export class ReportesPage implements OnInit {
|
export class ReportsPage implements OnInit {
|
||||||
private readonly api = inject(ReportesApi);
|
private readonly api = inject(ReportsApi);
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
readonly dominios = DOMINIOS;
|
readonly domains = DOMAINS;
|
||||||
readonly estados = signal<Record<Dominio, EstadoRecalculo> | null>(null);
|
readonly statuses = signal<Record<Domain, RecomputeStatus> | null>(null);
|
||||||
readonly intentos = signal<IntentoImportacion[]>([]);
|
readonly attempts = signal<ImportAttempt[]>([]);
|
||||||
readonly abierto = signal<string | null>(null);
|
readonly expanded = signal<string | null>(null);
|
||||||
readonly error = signal<string | null>(null);
|
readonly error = signal<string | null>(null);
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
interval(15000)
|
interval(15000)
|
||||||
.pipe(
|
.pipe(
|
||||||
startWith(0),
|
startWith(0),
|
||||||
switchMap(() => forkJoin({ estados: this.api.indicadores(), log: this.api.importaciones() })),
|
// Errors are handled per poll so one failed request doesn't stop the refresh.
|
||||||
|
switchMap(() =>
|
||||||
|
forkJoin({ statuses: this.api.indicatorStatus(), log: this.api.importLog() }).pipe(
|
||||||
|
catchError((err) => {
|
||||||
|
this.error.set(apiErrorMessage(err, 'No se pudo leer la bitácora.'));
|
||||||
|
return EMPTY;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
)
|
)
|
||||||
.subscribe({
|
.subscribe(({ statuses, log }) => {
|
||||||
next: ({ estados, log }) => {
|
this.statuses.set(statuses);
|
||||||
this.estados.set(estados);
|
this.attempts.set(log.intentos);
|
||||||
this.intentos.set(log.intentos);
|
this.error.set(null);
|
||||||
this.error.set(null);
|
|
||||||
},
|
|
||||||
error: (err) => this.error.set(apiErrorMessage(err, 'No se pudo leer la bitácora.')),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
estadoTexto(estado: EstadoRecalculo): string {
|
statusLabel(status: RecomputeStatus): string {
|
||||||
return estado.pendiente && estado.estado !== 'en_curso' ? 'En espera de cálculo' : ESTADOS[estado.estado] ?? estado.estado;
|
return status.pendiente && status.estado !== 'en_curso' ? 'En espera de cálculo' : STATUS_LABELS[status.estado] ?? status.estado;
|
||||||
}
|
}
|
||||||
|
|
||||||
resultadoTexto(resultado: string): string {
|
outcomeLabel(outcome: string): string {
|
||||||
return RESULTADOS[resultado] ?? resultado;
|
return OUTCOME_LABELS[outcome] ?? outcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
recalcular(dominio: Dominio): void {
|
recompute(domain: Domain): void {
|
||||||
this.api.recalcular(dominio).subscribe({
|
this.api.recompute(domain).subscribe({
|
||||||
next: () => this.estados.update((e) => (e ? { ...e, [dominio]: { ...e[dominio], pendiente: true } } : e)),
|
next: () => this.statuses.update((s) => (s ? { ...s, [domain]: { ...s[domain], pendiente: true } } : s)),
|
||||||
error: (err) => this.error.set(apiErrorMessage(err, 'No se pudo solicitar el recálculo.')),
|
error: (err) => this.error.set(apiErrorMessage(err, 'No se pudo solicitar el recálculo.')),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
alternar(id: string): void {
|
toggle(id: string): void {
|
||||||
this.abierto.update((actual) => (actual === id ? null : id));
|
this.expanded.update((current) => (current === id ? null : id));
|
||||||
}
|
}
|
||||||
|
|
||||||
camposConProblemas(intento: IntentoImportacion) {
|
fieldsWithProblems(attempt: ImportAttempt) {
|
||||||
return intento.fuentes.flatMap((fuente) =>
|
return attempt.fuentes.flatMap((source) =>
|
||||||
Object.entries(fuente.campos)
|
Object.entries(source.campos)
|
||||||
.filter(([, campo]) => campo.errores || campo.vacios)
|
.filter(([, field]) => field.errores || field.vacios)
|
||||||
.map(([nombre, campo]) => ({ destino: fuente.destino, nombre, campo })),
|
.map(([name, field]) => ({ target: source.destino, name, field })),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { Domain } from '../connect/api/api.types';
|
||||||
|
|
||||||
export type Dominio = 'cacu' | 'cama' | 'tea';
|
// Field names follow the JSON the API writes to the log.
|
||||||
|
|
||||||
export interface CampoReporte {
|
export interface FieldReport {
|
||||||
con_valor: number;
|
con_valor: number;
|
||||||
vacios: number;
|
vacios: number;
|
||||||
errores?: Record<string, number>;
|
errores?: Record<string, number>;
|
||||||
@@ -13,33 +14,33 @@ export interface CampoReporte {
|
|||||||
valores_fuera_de_catalogo_poco_frecuentes?: number;
|
valores_fuera_de_catalogo_poco_frecuentes?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FuenteReporte {
|
export interface SourceReport {
|
||||||
destino: string;
|
destino: string;
|
||||||
origen: { tipo: string; extensiones?: string[]; archivos?: number; motor?: string | null };
|
origen: { tipo: string; extensiones?: string[]; archivos?: number; motor?: string | null };
|
||||||
mapeo: { requeridos_sin_mapear: string[]; campos_sin_mapear: string[]; columnas_origen: string[] };
|
mapeo: { requeridos_sin_mapear: string[]; campos_sin_mapear: string[]; columnas_origen: string[] };
|
||||||
filas: Record<string, number>;
|
filas: Record<string, number>;
|
||||||
campos: Record<string, CampoReporte>;
|
campos: Record<string, FieldReport>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One line of the aggregate import log (`/reportes/importaciones`). */
|
/** One line of the aggregate import log. */
|
||||||
export interface IntentoImportacion {
|
export interface ImportAttempt {
|
||||||
id: string;
|
id: string;
|
||||||
fecha: string;
|
fecha: string;
|
||||||
operacion: 'validacion' | 'carga';
|
operacion: 'validacion' | 'carga';
|
||||||
dominio: Dominio | null;
|
dominio: Domain | null;
|
||||||
resultado: string;
|
resultado: string;
|
||||||
duracion_s: number;
|
duracion_s: number;
|
||||||
totales: Record<string, number>;
|
totales: Record<string, number>;
|
||||||
fuentes: FuenteReporte[];
|
fuentes: SourceReport[];
|
||||||
error?: { tipo: string; mensaje: string };
|
error?: { tipo: string; mensaje: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReporteImportaciones {
|
export interface ImportLog {
|
||||||
resumen: { intentos: Record<string, number>; ultimo: string | null };
|
resumen: { intentos: Record<string, number>; ultimo: string | null };
|
||||||
intentos: IntentoImportacion[];
|
intentos: ImportAttempt[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EstadoRecalculo {
|
export interface RecomputeStatus {
|
||||||
estado: 'sin_correr' | 'en_curso' | 'ok' | 'error';
|
estado: 'sin_correr' | 'en_curso' | 'ok' | 'error';
|
||||||
pendiente: boolean;
|
pendiente: boolean;
|
||||||
inicio?: string;
|
inicio?: string;
|
||||||
@@ -49,20 +50,20 @@ export interface EstadoRecalculo {
|
|||||||
error?: { tipo: string; mensaje: string };
|
error?: { tipo: string; mensaje: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** `/reportes/*`: the aggregate import log and the live indicator recomputation. */
|
/** `/reportes/*`: the aggregate import log and the indicator recomputation. */
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ReportesApi {
|
export class ReportsApi {
|
||||||
private readonly http = inject(HttpClient);
|
private readonly http = inject(HttpClient);
|
||||||
|
|
||||||
importaciones(limite = 100): Observable<ReporteImportaciones> {
|
importLog(limit = 100): Observable<ImportLog> {
|
||||||
return this.http.get<ReporteImportaciones>('/reportes/importaciones', { params: new HttpParams().set('limite', limite) });
|
return this.http.get<ImportLog>('/reportes/importaciones', { params: new HttpParams().set('limite', limit) });
|
||||||
}
|
}
|
||||||
|
|
||||||
indicadores(): Observable<Record<Dominio, EstadoRecalculo>> {
|
indicatorStatus(): Observable<Record<Domain, RecomputeStatus>> {
|
||||||
return this.http.get<Record<Dominio, EstadoRecalculo>>('/reportes/indicadores');
|
return this.http.get<Record<Domain, RecomputeStatus>>('/reportes/indicadores');
|
||||||
}
|
}
|
||||||
|
|
||||||
recalcular(dominio: Dominio): Observable<{ pendiente: boolean }> {
|
recompute(domain: Domain): Observable<{ pendiente: boolean }> {
|
||||||
return this.http.post<{ pendiente: boolean }>(`/reportes/indicadores/${dominio}/recalcular`, {});
|
return this.http.post<{ pendiente: boolean }>(`/reportes/indicadores/${domain}/recalcular`, {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -25,9 +25,7 @@
|
|||||||
--space-8: 48px;
|
--space-8: 48px;
|
||||||
--space-9: 64px;
|
--space-9: 64px;
|
||||||
|
|
||||||
/* Aliases for the `--issste-*` tokens the vendored `features/indicadores`
|
/* Aliases for the tokens used by `features/indicadores`. */
|
||||||
module (fork `dev`) is written against, so it can be pulled in byte-
|
|
||||||
identical rather than rewritten against our own naming. */
|
|
||||||
--issste-text: var(--color-text);
|
--issste-text: var(--color-text);
|
||||||
--issste-text-secondary: var(--color-text-secondary);
|
--issste-text-secondary: var(--color-text-secondary);
|
||||||
--issste-background: var(--color-background);
|
--issste-background: var(--color-background);
|
||||||
@@ -111,9 +109,8 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Global rules of the vendored indicators dashboard (fork `dev`): the
|
/* Global rules of the indicators dashboard: its floating navigation trigger
|
||||||
floating "navegación gráfica" trigger and its overlay live outside the
|
and overlay live outside the component's own styles. */
|
||||||
component's own styles. */
|
|
||||||
:root {
|
:root {
|
||||||
--issste-header-clearance: 7rem;
|
--issste-header-clearance: 7rem;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user