Ajustar indicadores, fecha de corte y ficha de CaMa y CaCu

This commit is contained in:
2026-12-03 19:33:13 -06:00
parent 0fe772ed6f
commit cbcb524902
18 changed files with 333 additions and 120 deletions
+14 -2
View File
@@ -31,6 +31,10 @@ interface Drawn {
<mat-button-toggle value="month">Mensual</mat-button-toggle>
<mat-button-toggle value="semester">Semestral</mat-button-toggle>
</mat-button-toggle-group>
@if (domain() === 'cama' || domain() === 'cacu') {
<label>Fecha de corte <input type="date" [value]="chosenCutoff()" (input)="chosenCutoff.set($any($event.target).value)" /></label>
<button type="button" (click)="cutoff.set(chosenCutoff())">Aplicar</button>
}
</section>
@if (series.isLoading()) {
<app-loading what="el histórico" text="Cargando histórico…" />
@@ -95,13 +99,16 @@ export class TabTrazabilidad {
readonly domain = input.required<string>();
readonly measures = input.required<Measure[]>();
protected readonly type = signal<PeriodType>('month');
protected readonly chosenCutoff = signal('');
protected readonly cutoff = signal('');
protected readonly series = resource({
params: () => ({ domain: this.domain(), type: this.type(), measures: this.measures() }),
params: () => ({ domain: this.domain(), type: this.type(), measures: this.measures(), cutoff: this.cutoff() }),
loader: async ({ params }) => {
const history = HISTORY[params.domain];
if (!history) return [];
const asked = periods(params.type).reverse();
const day = params.cutoff ? new Date(`${params.cutoff}T12:00:00`) : new Date();
const asked = periods(params.type, 6, day).reverse();
return Promise.all(
history.panels.map(async (panel) => {
const measure = params.measures.find((m) => m.name === panel.measure);
@@ -109,6 +116,11 @@ export class TabTrazabilidad {
const pages = await this.fhir.all(params.domain, 'MeasureReport', {
measure: measure.id!,
'reporting-period': asked.join(','),
...(params.cutoff ? {
'as-of': `${params.cutoff}T23:59:59.999999Z`,
'event-cutoff': params.cutoff,
'period-cutoff': params.cutoff,
} : {}),
});
// One report per period asked, in the order asked.
const found = resources<MeasureReport>(pages, 'MeasureReport');