CaMa Indicadores as the old page: its cards, timeliness boxes with pending ones, BI-RADS 4–6 donuts, malignancy by BI-RADS and the biopsy donut, the confirmation card; page definitions apart from figure builders
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Component, computed, effect, inject, input, resource, signal } from '@angular/core';
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
@@ -9,14 +10,15 @@ import { Fhir, resources } from '../fhir';
|
||||
import { Figure, Plot } from '../plot';
|
||||
import { LAYOUTS } from './layout';
|
||||
import {
|
||||
FigureSpec,
|
||||
boxFigure,
|
||||
fill,
|
||||
nestedDonut,
|
||||
PAGES,
|
||||
rateDots,
|
||||
routeFigure,
|
||||
scenarioBars,
|
||||
Section,
|
||||
} from './pages';
|
||||
shareDonut,
|
||||
} from './figures';
|
||||
import { FigureSpec, Kpi, PAGES, Section } from './pages';
|
||||
import {
|
||||
detail,
|
||||
donut,
|
||||
@@ -41,6 +43,7 @@ import { Loading } from '../loading';
|
||||
imports: [
|
||||
Loading,
|
||||
FormsModule,
|
||||
NgTemplateOutlet,
|
||||
MatButtonModule,
|
||||
MatButtonToggleModule,
|
||||
MatCardModule,
|
||||
@@ -65,6 +68,8 @@ export class TabIndicadores {
|
||||
protected readonly layout = computed(
|
||||
() => LAYOUTS[this.domain()] ?? { kpis: [], route: [], anchor: '' },
|
||||
);
|
||||
protected readonly pending =
|
||||
'Este indicador aún no está publicado por el catálogo institucional.';
|
||||
/** The old app's page for this domain, when it is rebuilt as it was (else today's). */
|
||||
protected readonly page = computed(() => PAGES[this.domain()]);
|
||||
private readonly byName = computed(() => new Map(this.measures().map((m) => [m.name!, m])));
|
||||
@@ -189,25 +194,29 @@ export class TabIndicadores {
|
||||
protected kpi(code: string): Measure | undefined {
|
||||
return this.byName().get(code);
|
||||
}
|
||||
/** A KPI card's value as the old cards wrote it. */
|
||||
protected kpiValue(code: string): string {
|
||||
const m = this.kpi(code);
|
||||
const r = this.rd(code);
|
||||
if (!m || !r || r.score === undefined) return '';
|
||||
if (scoring(m) === 'continuous-variable') return `${Math.round(r.score)} días (mediana)`;
|
||||
if (scoring(m) === 'proportion') return `${(r.score * 100).toFixed(1)} %`;
|
||||
const n = r.populations['initial-population'] ?? 0;
|
||||
return `${n.toLocaleString('es-MX')} pacientes`;
|
||||
/** A card's value and note, from its templates (a card with no measure: its words). */
|
||||
protected kpiValue(k: Kpi): string {
|
||||
if (!k.measure) return k.value ?? '';
|
||||
const r = this.rd(k.measure);
|
||||
return r && r.score !== undefined && k.value ? fill(k.value, r) : '';
|
||||
}
|
||||
protected kpiNote(code: string, note?: string): string {
|
||||
const m = this.kpi(code);
|
||||
const r = this.rd(code);
|
||||
if (!m || !r || r.score === undefined) return 'Sin valor disponible';
|
||||
if (scoring(m) === 'continuous-variable') {
|
||||
const n = (r.populations['measure-observation'] ?? 0).toLocaleString('es-MX');
|
||||
return `${n} citologías; primer cuartil: ${Math.round(r.low ?? r.score)} días; tercer cuartil: ${Math.round(r.high ?? r.score)} días.`;
|
||||
}
|
||||
return note ?? detail(m, r);
|
||||
protected kpiNote(k: Kpi): string {
|
||||
if (!k.measure) return k.note ?? '';
|
||||
const r = this.rd(k.measure);
|
||||
if (!r || r.score === undefined) return 'Sin valor disponible';
|
||||
return k.note ? fill(k.note, r) : '';
|
||||
}
|
||||
/** A figure's title, with the applied period in it. */
|
||||
protected titled(title: string): string {
|
||||
return title.replace('{p}', this.applied() ?? '');
|
||||
}
|
||||
/** A duration's box, or nothing to draw. */
|
||||
protected boxOf(measure: string | undefined): Figure | undefined {
|
||||
const r = measure ? this.rd(measure) : undefined;
|
||||
return r && r.score !== undefined ? boxFigure(r, this.applied() ?? '') : undefined;
|
||||
}
|
||||
protected measureTitle(code: string | undefined): string {
|
||||
return (code && this.byName().get(code)?.title) || '';
|
||||
}
|
||||
/** A clinical section's route or figures, drawn from the applied period's reports. */
|
||||
protected routeOf(section: Section): Figure | undefined {
|
||||
@@ -221,6 +230,8 @@ export class TabIndicadores {
|
||||
switch (spec.kind) {
|
||||
case 'donut':
|
||||
return nestedDonut(r, spec.catalog, spec.center);
|
||||
case 'share-donut':
|
||||
return shareDonut(r, spec.catalog, spec.center);
|
||||
case 'scenario-bars':
|
||||
return scenarioBars(r, spec.catalog, spec.stratum, name);
|
||||
case 'rates':
|
||||
|
||||
Reference in New Issue
Block a user