feat(indicadores): dashboard interactivo multidominio y seguimiento CaCu

This commit is contained in:
Angel Capetillo Zavala
2026-10-22 17:10:35 -06:00
parent 9cc67c0ef2
commit 1fe88dfb45
62 changed files with 4380 additions and 187 deletions
@@ -0,0 +1,32 @@
import { ChangeDetectorRef, Component, DestroyRef, inject, Input, OnChanges } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { catchError, of, Subject, switchMap } from 'rxjs';
import { Dominio, IndicadorMetadatos } from './indicadores.models';
import { IndicadoresService } from './indicadores.service';
@Component({
selector: 'app-indicador-metadata',
template: `
@if (loading) { <p role="status">Cargando información metodológica…</p> }
@if (metadata?.referencias?.length) {
<h4>Referencias</h4><ul>@for (ref of metadata!.referencias; track $index) { <li>{{ ref.etiqueta }}@if (ref.ref) { · {{ ref.ref }} }</li> }</ul>
}
@if (metadata?.poblaciones?.length) {
<h4>Poblaciones del estudio</h4><ul>@for (p of metadata!.poblaciones; track $index) { <li>{{ p.descripcion }}</li> }</ul>
}
@if (!loading && !metadata?.referencias?.length && !metadata?.poblaciones?.length) { <p>La información metodológica ampliada no está disponible para este indicador.</p> }
`,
})
export class IndicadorMetadata implements OnChanges {
@Input({ required: true }) dominio!: Dominio;
@Input({ required: true }) indicador!: string;
private readonly service = inject(IndicadoresService);
private readonly requests = new Subject<void>();
metadata?: IndicadorMetadatos;
loading = false;
private readonly changeDetector = inject(ChangeDetectorRef);
constructor() {
this.requests.pipe(switchMap(() => this.service.metadatos(this.dominio, this.indicador).pipe(catchError(() => of(undefined)))), takeUntilDestroyed(inject(DestroyRef))).subscribe(value => { this.metadata = value; this.loading = false; this.changeDetector.markForCheck(); });
}
ngOnChanges() { this.metadata = undefined; this.loading = true; this.requests.next(); }
}