From 5d660b7043679f7cca1b1d882d9fb04301fd0bea Mon Sep 17 00:00:00 2001 From: edgar Date: Wed, 2 Dec 2026 23:43:18 -0600 Subject: [PATCH] =?UTF-8?q?Mostrar=20confirmaci=C3=B3n=20con=20intervalo?= =?UTF-8?q?=20en=20barra=20y=20ajustar=20etiquetas=20de=20la=20ficha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/indicadores/bars.ts | 2 +- src/app/indicadores/measures.ts | 35 ++++++++++++++++++++++++++++ src/app/indicadores/pages-cacu.ts | 8 ++----- src/app/indicadores/pages.ts | 2 ++ src/app/indicadores/readings.ts | 5 ++++ src/app/indicadores/section.ts | 15 +++++++++--- src/app/paciente/risk-scales.ts | 6 ----- src/app/paciente/risk-series.spec.ts | 2 +- src/app/paciente/risk-series.ts | 8 ++++++- 9 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/app/indicadores/bars.ts b/src/app/indicadores/bars.ts index 85b9dc8..4d4cb6a 100644 --- a/src/app/indicadores/bars.ts +++ b/src/app/indicadores/bars.ts @@ -70,7 +70,7 @@ export type Mode = { | { kind: 'figure'; measure: string; - figure: 'donut' | 'scenarios'; + figure: 'donut' | 'scenarios' | 'interval'; /** a donut's colour by part (a category, or numerator and rest); none: the page's palette */ colors?: Colors; catalog?: Category[]; diff --git a/src/app/indicadores/measures.ts b/src/app/indicadores/measures.ts index 54793ee..ff20074 100644 --- a/src/app/indicadores/measures.ts +++ b/src/app/indicadores/measures.ts @@ -202,6 +202,41 @@ export function detail(measure: Measure, r: Reading | undefined, unit = 'pacient const pct = (v?: number) => (v === undefined ? '—' : `${(v * 100).toFixed(1)} %`); +/** A proportion as one bar of 0 to 100 % with its published 95 % interval as the error bar. */ +export function intervalBar(r: Reading, color?: string): Figure { + const score = r.score ?? 0; + const known = r.low !== undefined && r.high !== undefined; + return { + data: [ + { + type: 'bar', + orientation: 'h', + x: [score], + y: [''], + width: [0.4], + marker: { color: color ?? PALETTE[0] }, + hovertemplate: `${pct(r.score)}
IC 95 %: ${pct(r.low)}–${pct(r.high)}`, + error_x: known + ? { + type: 'data', + symmetric: false, + array: [r.high! - score], + arrayminus: [score - r.low!], + color: '#17324d', + thickness: 2, + width: 10, + } + : undefined, + }, + ], + layout: { + showlegend: false, + margin: { t: 16, r: 16, b: 32, l: 16 }, + xaxis: { range: [0, 1], tickformat: '.0%' }, + }, + } as Figure; +} + /** A donut of one stratifier's counts (initial population), or of numerator vs the rest. */ export function donut( measure: Measure, diff --git a/src/app/indicadores/pages-cacu.ts b/src/app/indicadores/pages-cacu.ts index be9d931..ba39dff 100644 --- a/src/app/indicadores/pages-cacu.ts +++ b/src/app/indicadores/pages-cacu.ts @@ -116,9 +116,10 @@ const ppv = (measure: string, title: string, note: string, ...more: Mode[]): Rea kind: 'readings', title, headline: measure, + footnote: true, note: `${note} Confirma la histología LIEBG o mayor.`, modes: [ - { kind: 'figure', label: 'Total', measure, figure: 'donut', colors: PPV_DONUT }, + { kind: 'figure', label: 'Total', measure, figure: 'interval', colors: PPV_DONUT }, { kind: 'shares', label: 'Citología previa', @@ -177,11 +178,6 @@ export const CACU: Page = { title: 'Días de toma de citología a resultado', ...CACU_DAYS, }, - { - measure: 'CACU_DIAS_TOMA_DIAGNOSTICO', - title: 'Días de tamizaje a primer diagnóstico', - ...CACU_DAYS, - }, { measure: 'CACU_DIAS_TOMA_DIAGNOSTICO_POST_BIOPSIA', title: 'Días de tamizaje a diagnóstico tras biopsia', diff --git a/src/app/indicadores/pages.ts b/src/app/indicadores/pages.ts index 836f47a..0c104d8 100644 --- a/src/app/indicadores/pages.ts +++ b/src/app/indicadores/pages.ts @@ -26,6 +26,8 @@ export interface ReadingsCard { kind: 'readings'; title: string; headline?: string; + /** say the headline under the figure instead of above it */ + footnote?: boolean; /** what the headline proportion counts, in the plural (default: pacientes) */ unit?: string; note?: string; diff --git a/src/app/indicadores/readings.ts b/src/app/indicadores/readings.ts index 08f3688..1b07184 100644 --- a/src/app/indicadores/readings.ts +++ b/src/app/indicadores/readings.ts @@ -146,6 +146,9 @@ import { Reading } from './measures'; } @else {

Sin datos en el periodo.

} + @if (foot()) { +

{{ foot() }}

+ } `, styles: ` :host { @@ -347,6 +350,8 @@ export class Readings { readonly title = input.required(); readonly headline = input(''); readonly note = input(''); + /** a line under the figure */ + readonly foot = input(''); /** the card around it names it already (tabs inside one card) */ readonly hideTitle = input(false); readonly camaStyle = input(false); diff --git a/src/app/indicadores/section.ts b/src/app/indicadores/section.ts index 37e3b0b..cabf2d7 100644 --- a/src/app/indicadores/section.ts +++ b/src/app/indicadores/section.ts @@ -4,7 +4,7 @@ import { MatCardModule } from '@angular/material/card'; import type { Measure } from 'fhir/r4'; import { Mode } from './bars'; import { scenarioBars } from './figures'; -import { detail, donut, formatScore, name, Reading, scoring } from './measures'; +import { detail, donut, formatScore, intervalBar, name, Reading, scoring } from './measures'; import type { ReadingsCard, Section } from './pages'; import { Readings } from './readings'; @@ -28,7 +28,8 @@ type Shown = Extract; ; [title]="c.section.title" [hideTitle]="true" [camaStyle]="true" - [headline]="headlineOf(c.section)" + [headline]="c.section.footnote ? '' : headlineOf(c.section)" + [foot]="footOf(c.section)" [note]="c.section.note ?? ''" [modes]="c.section.modes" [loading]="of().loading" @@ -162,11 +164,18 @@ export class ReadingsSection { const words = detail(measure, r, s.unit); return scoring(measure) === 'cohort' ? words : `${formatScore(measure, r)} · ${words}`; } + /** The headline of a card that says it under its figure, as one line separated by commas. */ + protected footOf(s: ReadingsCard): string { + return s.footnote + ? this.headlineOf(s).replace(' · ', ', ').replace('. IC 95 %', ', IC 95 %') + : ''; + } protected readonly draw = computed(() => (mode: Mode) => { if (mode.kind !== 'figure') return undefined; const r = this.of().reading(mode.measure); const measure = this.of().measure(mode.measure); if (!measure || !r?.populations['initial-population']) return undefined; + if (mode.figure === 'interval') return intervalBar(r, mode.colors?.['numerator']); if (mode.figure === 'donut') return donut(measure, r, 'category', mode.colors); const categories = (mode.catalog ?? []).map((c) => ({ ...c, group: '' })); return scenarioBars( diff --git a/src/app/paciente/risk-scales.ts b/src/app/paciente/risk-scales.ts index 4c19c86..8a7fe4d 100644 --- a/src/app/paciente/risk-scales.ts +++ b/src/app/paciente/risk-scales.ts @@ -139,9 +139,6 @@ export function riskGroups( selector: 'app-risk-scales', imports: [DecimalPipe], template: ` - @if (groups().length) { -

Divisiones numéricas descriptivas; no representan umbrales clínicos.

- } @for (g of groups(); track $index) { @if (g.title) {

{{ g.title }}

@@ -237,9 +234,6 @@ export function riskGroups( } `, styles: ` - .note { - margin: 0 0 8px; - } .risk-scale { margin: 8px 0 14px; max-width: 740px; diff --git a/src/app/paciente/risk-series.spec.ts b/src/app/paciente/risk-series.spec.ts index 2191002..18d9d58 100644 --- a/src/app/paciente/risk-series.spec.ts +++ b/src/app/paciente/risk-series.spec.ts @@ -24,6 +24,6 @@ describe('risk series', () => { ], }); expect(series.points).toEqual([{ years: 0, p: 0, low: undefined, high: undefined }]); - expect(seriesName(series)).toBe('Institucional · LIEAG+ (CIN2+)'); + expect(seriesName(series)).toBe('ISSSTELEON, LIEAG+'); }); }); diff --git a/src/app/paciente/risk-series.ts b/src/app/paciente/risk-series.ts index f7fc446..fbf3677 100644 --- a/src/app/paciente/risk-series.ts +++ b/src/app/paciente/risk-series.ts @@ -29,7 +29,13 @@ const OUTCOME_TEXT: Record = { cancer: 'Cáncer', }; -export const seriesName = (s: Series) => `${s.source} · ${OUTCOME_TEXT[s.outcome] ?? s.outcome}`; +export const seriesName = (s: Series) => { + const outcome = OUTCOME_TEXT[s.outcome] ?? s.outcome; + // the platform's own models are the hospital's: its name, and the outcome without its synonym + return s.source === 'Institucional' + ? `ISSSTELEON, ${outcome.replace(' (CIN2+)', '')}` + : `${s.source} · ${outcome}`; +}; /** The series of the answer. A value absent from it stays absent. */ export function parseSeries(answer: Parameters): Series[] {