98 lines
3.2 KiB
TypeScript
98 lines
3.2 KiB
TypeScript
import { Component, computed, inject, input, resource } from '@angular/core';
|
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
import type { Measure } from 'fhir/r4';
|
|
import { DOMAINS } from '../app';
|
|
import { Fhir, resources } from '../fhir';
|
|
import { TabDefiniciones } from './tab-definiciones';
|
|
import { TabIndicadores } from './tab-indicadores';
|
|
import { TabRiesgos } from './tab-riesgos';
|
|
import { TabSeguimiento } from './tab-seguimiento';
|
|
import { TabTrazabilidad } from './tab-trazabilidad';
|
|
|
|
/** A domain's indicator page: four tabs over its FHIR measures and patients. */
|
|
@Component({
|
|
selector: 'app-indicadores',
|
|
imports: [
|
|
MatTabsModule,
|
|
TabIndicadores,
|
|
TabTrazabilidad,
|
|
TabRiesgos,
|
|
TabSeguimiento,
|
|
TabDefiniciones,
|
|
],
|
|
template: `
|
|
<section class="page">
|
|
<h1>{{ title() }}</h1>
|
|
<p class="subtitle">
|
|
Indicadores de calidad y oportunidad del tamizaje, a partir de los datos cargados.
|
|
</p>
|
|
@if (measures.isLoading()) {
|
|
<p class="muted">Cargando indicadores…</p>
|
|
} @else if (measures.error()) {
|
|
<p class="muted" role="alert">No se pudieron leer los indicadores.</p>
|
|
} @else if (!measures.value()?.length) {
|
|
<p class="muted empty">Este dominio todavía no tiene indicadores publicados.</p>
|
|
} @else {
|
|
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="center" animationDuration="0ms">
|
|
<mat-tab label="Indicadores">
|
|
<app-tab-indicadores [domain]="domain()" [measures]="measures.value()!" />
|
|
</mat-tab>
|
|
<mat-tab label="Trazabilidad">
|
|
<ng-template matTabContent>
|
|
<app-tab-trazabilidad [domain]="domain()" [measures]="measures.value()!" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
@if (domain() === 'cacu') {
|
|
<mat-tab label="Análisis de riesgos">
|
|
<ng-template matTabContent>
|
|
<app-tab-riesgos [domain]="domain()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
} @else if (domain() === 'cama') {
|
|
<mat-tab label="Seguimiento">
|
|
<ng-template matTabContent>
|
|
<app-tab-seguimiento [domain]="domain()" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
}
|
|
<mat-tab label="Datos y definiciones">
|
|
<ng-template matTabContent>
|
|
<app-tab-definiciones [measures]="measures.value()!" />
|
|
</ng-template>
|
|
</mat-tab>
|
|
</mat-tab-group>
|
|
}
|
|
</section>
|
|
`,
|
|
styles: `
|
|
:host {
|
|
display: block;
|
|
}
|
|
h1 {
|
|
text-align: center;
|
|
}
|
|
.subtitle {
|
|
text-align: center;
|
|
}
|
|
.empty {
|
|
padding: 48px 0;
|
|
text-align: center;
|
|
}
|
|
::ng-deep .mdc-tab-indicator__content--underline {
|
|
border-color: var(--color-primary) !important;
|
|
}
|
|
`,
|
|
})
|
|
export class Indicadores {
|
|
private readonly fhir = inject(Fhir);
|
|
readonly domain = input.required<string>();
|
|
protected readonly title = computed(
|
|
() => DOMAINS[this.domain() as keyof typeof DOMAINS] ?? this.domain(),
|
|
);
|
|
protected readonly measures = resource({
|
|
params: () => this.domain(),
|
|
loader: async ({ params }) =>
|
|
resources<Measure>(await this.fhir.all(params, 'Measure'), 'Measure'),
|
|
});
|
|
}
|