From d2eada9385e4dbe775b0f74f23c184cdd0304590 Mon Sep 17 00:00:00 2001 From: edgar Date: Wed, 2 Dec 2026 19:42:38 -0600 Subject: [PATCH] Ficha: titular cada riesgo por su desenlace y llevar el escenario al pie --- src/app/paciente/risk-scales.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/paciente/risk-scales.ts b/src/app/paciente/risk-scales.ts index 340fd6f..a2a91ed 100644 --- a/src/app/paciente/risk-scales.ts +++ b/src/app/paciente/risk-scales.ts @@ -46,6 +46,7 @@ export function horizon(predictions: Prediction[], years: number): Prediction | export interface RiskGroup { /** the model's own title and the day it was scored (none: no model has scored her) */ title?: string; + scenario?: string; index?: string; scales: { label: string; risk?: Prediction }[]; } @@ -55,6 +56,12 @@ const HORIZONS: [number, string][] = [ [5, 'Riesgo a 5 años'], ]; +/** A model's published title, "Riesgo de X en v1", as its outcome and its scenario. */ +export function titleParts(text: string): { title: string; scenario?: string } { + const [, title, scenario] = /^(.*?)(?: en (.+?))?(?: v\d+)?$/.exec(text)!; + return { title, scenario }; +} + /** The scales the page draws: both horizons of every model, or, with no model, both horizons * unavailable. */ export function riskGroups( @@ -63,7 +70,11 @@ export function riskGroups( const scales = (predictions: Prediction[]) => HORIZONS.map(([years, label]) => ({ label, risk: horizon(predictions, years) })); return models.length - ? models.map((m) => ({ title: m.text, index: m.index, scales: scales(m.predictions) })) + ? models.map((m) => ({ + ...titleParts(m.text), + index: m.index, + scales: scales(m.predictions), + })) : [{ scales: scales([]) }]; } @@ -119,7 +130,9 @@ export function riskGroups( } @if (g.index) { -

Fecha índice {{ g.index }}

+

+ {{ g.scenario ? 'Escenario: ' + g.scenario + ' · ' : '' }}Fecha índice {{ g.index }} +

} } `,