Mostrar confirmación con intervalo en barra y ajustar etiquetas de la ficha
This commit is contained in:
@@ -70,7 +70,7 @@ export type Mode = {
|
|||||||
| {
|
| {
|
||||||
kind: 'figure';
|
kind: 'figure';
|
||||||
measure: string;
|
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 */
|
/** a donut's colour by part (a category, or numerator and rest); none: the page's palette */
|
||||||
colors?: Colors;
|
colors?: Colors;
|
||||||
catalog?: Category[];
|
catalog?: Category[];
|
||||||
|
|||||||
@@ -202,6 +202,41 @@ export function detail(measure: Measure, r: Reading | undefined, unit = 'pacient
|
|||||||
|
|
||||||
const pct = (v?: number) => (v === undefined ? '—' : `${(v * 100).toFixed(1)} %`);
|
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)}<br>IC 95 %: ${pct(r.low)}–${pct(r.high)}<extra></extra>`,
|
||||||
|
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. */
|
/** A donut of one stratifier's counts (initial population), or of numerator vs the rest. */
|
||||||
export function donut(
|
export function donut(
|
||||||
measure: Measure,
|
measure: Measure,
|
||||||
|
|||||||
@@ -116,9 +116,10 @@ const ppv = (measure: string, title: string, note: string, ...more: Mode[]): Rea
|
|||||||
kind: 'readings',
|
kind: 'readings',
|
||||||
title,
|
title,
|
||||||
headline: measure,
|
headline: measure,
|
||||||
|
footnote: true,
|
||||||
note: `${note} Confirma la histología LIEBG o mayor.`,
|
note: `${note} Confirma la histología LIEBG o mayor.`,
|
||||||
modes: [
|
modes: [
|
||||||
{ kind: 'figure', label: 'Total', measure, figure: 'donut', colors: PPV_DONUT },
|
{ kind: 'figure', label: 'Total', measure, figure: 'interval', colors: PPV_DONUT },
|
||||||
{
|
{
|
||||||
kind: 'shares',
|
kind: 'shares',
|
||||||
label: 'Citología previa',
|
label: 'Citología previa',
|
||||||
@@ -177,11 +178,6 @@ export const CACU: Page = {
|
|||||||
title: 'Días de toma de citología a resultado',
|
title: 'Días de toma de citología a resultado',
|
||||||
...CACU_DAYS,
|
...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',
|
measure: 'CACU_DIAS_TOMA_DIAGNOSTICO_POST_BIOPSIA',
|
||||||
title: 'Días de tamizaje a diagnóstico tras biopsia',
|
title: 'Días de tamizaje a diagnóstico tras biopsia',
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export interface ReadingsCard {
|
|||||||
kind: 'readings';
|
kind: 'readings';
|
||||||
title: string;
|
title: string;
|
||||||
headline?: 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) */
|
/** what the headline proportion counts, in the plural (default: pacientes) */
|
||||||
unit?: string;
|
unit?: string;
|
||||||
note?: string;
|
note?: string;
|
||||||
|
|||||||
@@ -146,6 +146,9 @@ import { Reading } from './measures';
|
|||||||
} @else {
|
} @else {
|
||||||
<p class="state">Sin datos en el periodo.</p>
|
<p class="state">Sin datos en el periodo.</p>
|
||||||
}
|
}
|
||||||
|
@if (foot()) {
|
||||||
|
<p class="state">{{ foot() }}</p>
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
styles: `
|
styles: `
|
||||||
:host {
|
:host {
|
||||||
@@ -347,6 +350,8 @@ export class Readings {
|
|||||||
readonly title = input.required<string>();
|
readonly title = input.required<string>();
|
||||||
readonly headline = input('');
|
readonly headline = input('');
|
||||||
readonly note = input('');
|
readonly note = input('');
|
||||||
|
/** a line under the figure */
|
||||||
|
readonly foot = input('');
|
||||||
/** the card around it names it already (tabs inside one card) */
|
/** the card around it names it already (tabs inside one card) */
|
||||||
readonly hideTitle = input(false);
|
readonly hideTitle = input(false);
|
||||||
readonly camaStyle = input(false);
|
readonly camaStyle = input(false);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MatCardModule } from '@angular/material/card';
|
|||||||
import type { Measure } from 'fhir/r4';
|
import type { Measure } from 'fhir/r4';
|
||||||
import { Mode } from './bars';
|
import { Mode } from './bars';
|
||||||
import { scenarioBars } from './figures';
|
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 type { ReadingsCard, Section } from './pages';
|
||||||
import { Readings } from './readings';
|
import { Readings } from './readings';
|
||||||
|
|
||||||
@@ -28,7 +28,8 @@ type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
|||||||
<app-readings
|
<app-readings
|
||||||
[title]="s.title"
|
[title]="s.title"
|
||||||
[camaStyle]="hasCamaHeading(s)"
|
[camaStyle]="hasCamaHeading(s)"
|
||||||
[headline]="headlineOf(s)"
|
[headline]="s.footnote ? '' : headlineOf(s)"
|
||||||
|
[foot]="footOf(s)"
|
||||||
[note]="s.note ?? ''"
|
[note]="s.note ?? ''"
|
||||||
[modes]="s.modes"
|
[modes]="s.modes"
|
||||||
[view]="view()"
|
[view]="view()"
|
||||||
@@ -58,7 +59,8 @@ type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
|||||||
[title]="c.section.title"
|
[title]="c.section.title"
|
||||||
[hideTitle]="true"
|
[hideTitle]="true"
|
||||||
[camaStyle]="true"
|
[camaStyle]="true"
|
||||||
[headline]="headlineOf(c.section)"
|
[headline]="c.section.footnote ? '' : headlineOf(c.section)"
|
||||||
|
[foot]="footOf(c.section)"
|
||||||
[note]="c.section.note ?? ''"
|
[note]="c.section.note ?? ''"
|
||||||
[modes]="c.section.modes"
|
[modes]="c.section.modes"
|
||||||
[loading]="of().loading"
|
[loading]="of().loading"
|
||||||
@@ -162,11 +164,18 @@ export class ReadingsSection {
|
|||||||
const words = detail(measure, r, s.unit);
|
const words = detail(measure, r, s.unit);
|
||||||
return scoring(measure) === 'cohort' ? words : `${formatScore(measure, r)} · ${words}`;
|
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) => {
|
protected readonly draw = computed(() => (mode: Mode) => {
|
||||||
if (mode.kind !== 'figure') return undefined;
|
if (mode.kind !== 'figure') return undefined;
|
||||||
const r = this.of().reading(mode.measure);
|
const r = this.of().reading(mode.measure);
|
||||||
const measure = this.of().measure(mode.measure);
|
const measure = this.of().measure(mode.measure);
|
||||||
if (!measure || !r?.populations['initial-population']) return undefined;
|
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);
|
if (mode.figure === 'donut') return donut(measure, r, 'category', mode.colors);
|
||||||
const categories = (mode.catalog ?? []).map((c) => ({ ...c, group: '' }));
|
const categories = (mode.catalog ?? []).map((c) => ({ ...c, group: '' }));
|
||||||
return scenarioBars(
|
return scenarioBars(
|
||||||
|
|||||||
@@ -139,9 +139,6 @@ export function riskGroups(
|
|||||||
selector: 'app-risk-scales',
|
selector: 'app-risk-scales',
|
||||||
imports: [DecimalPipe],
|
imports: [DecimalPipe],
|
||||||
template: `
|
template: `
|
||||||
@if (groups().length) {
|
|
||||||
<p class="muted note">Divisiones numéricas descriptivas; no representan umbrales clínicos.</p>
|
|
||||||
}
|
|
||||||
@for (g of groups(); track $index) {
|
@for (g of groups(); track $index) {
|
||||||
@if (g.title) {
|
@if (g.title) {
|
||||||
<h3>{{ g.title }}</h3>
|
<h3>{{ g.title }}</h3>
|
||||||
@@ -237,9 +234,6 @@ export function riskGroups(
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
styles: `
|
styles: `
|
||||||
.note {
|
|
||||||
margin: 0 0 8px;
|
|
||||||
}
|
|
||||||
.risk-scale {
|
.risk-scale {
|
||||||
margin: 8px 0 14px;
|
margin: 8px 0 14px;
|
||||||
max-width: 740px;
|
max-width: 740px;
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ describe('risk series', () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
expect(series.points).toEqual([{ years: 0, p: 0, low: undefined, high: undefined }]);
|
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+');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,13 @@ const OUTCOME_TEXT: Record<string, string> = {
|
|||||||
cancer: 'Cáncer',
|
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. */
|
/** The series of the answer. A value absent from it stays absent. */
|
||||||
export function parseSeries(answer: Parameters): Series[] {
|
export function parseSeries(answer: Parameters): Series[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user