Patient risk: what the model's number is, and its curve with the interval

The record reads the RiskAssessment's `estimando` extension and shows the quantity, the outcome, the index date and
the interval's method, and names the table's columns with the quantity and the horizons' unit. Below the table, a
collapsible curve of the risk at each horizon, with its interval as a band (or as error bars when a horizon lacks
one); Plotly is loaded only when it's opened.

(cherry picked from commit 6039e6b741)
This commit is contained in:
2026-11-22 07:48:42 -06:00
parent 1af0c21291
commit ad4edbe2a1
8 changed files with 206 additions and 9 deletions
@@ -2,6 +2,7 @@ import { RiesgoPacienteCacu } from './paciente-riesgo.models';
const CS = 'https://isssteleon.org/fhir/CodeSystem';
export const INTERVALO = 'https://isssteleon.org/fhir/StructureDefinition/intervalo-confianza';
export const ESTIMANDO = 'https://isssteleon.org/fhir/StructureDefinition/estimando';
/** A FHIR prediction: probability `p` from `inicio` to `fin`, with its interval when given. */
export function prediccion(p: number, inicio: string, fin: string, ic?: [number, number]): any {
@@ -47,6 +48,23 @@ export function riesgoCacuVista(): RiesgoPacienteCacu {
{ horizonte_anios: 3, probabilidad: 0.21, ic_bajo: 0.15, ic_alto: 0.28 },
{ horizonte_anios: 5, probabilidad: 0.34, ic_bajo: 0.26, ic_alto: 0.44 },
],
estimando: null,
},
};
}
/** TEST ONLY. `riesgoCacuEjemplo()` from a model whose scenario says what its number is (extension `estimando`). */
export function riesgoCacuConEstimando(): any {
const data = riesgoCacuEjemplo();
const resource = data.entry[0].resource;
resource.method.text = 'Riesgo acumulado';
resource.extension = [{ url: ESTIMANDO, extension: [
{ url: 'quantity', valueString: 'Riesgo acumulado' },
{ url: 'description', valueString: 'Probabilidad de CIN2+ antes de cada horizonte.' },
{ url: 'outcome', valueString: 'CIN2+: biopsia LIEAG, CIS o carcinoma' },
{ url: 'horizons_unit', valueString: 'años' },
{ url: 'interval', valueString: 'IC 95 % por método delta' },
{ url: 'otra', valueString: 'se ignora' },
] }];
return data;
}