Mostrar escalas de supervivencia publicadas
This commit is contained in:
@@ -48,9 +48,24 @@ export interface RiskGroup {
|
||||
title?: string;
|
||||
scenario?: string;
|
||||
index?: string;
|
||||
survival?: boolean;
|
||||
scales: { label: string; risk?: Prediction }[];
|
||||
}
|
||||
|
||||
/** Stored survival-model probabilities are mortality: complement them to obtain S(t). */
|
||||
export function survivalGroups(models: { index: string; predictions: Prediction[] }[]): RiskGroup[] {
|
||||
return models.map((m) => ({
|
||||
title: 'Supervivencia', index: m.index, survival: true,
|
||||
scales: m.predictions.flatMap((p) => {
|
||||
const v = horizon(m.predictions, p.years);
|
||||
return v ? [{ label: `Supervivencia a ${p.years} ${p.years === 1 ? 'año' : 'años'}`,
|
||||
risk: { years: p.years, p: 1 - v.p,
|
||||
low: v.high === undefined ? undefined : 1 - v.high,
|
||||
high: v.low === undefined ? undefined : 1 - v.low } }] : [];
|
||||
}),
|
||||
})).filter((g) => g.scales.length);
|
||||
}
|
||||
|
||||
const HORIZONS: [number, string][] = [
|
||||
[0, 'Riesgo inmediato (al índice)'],
|
||||
[5, 'Riesgo a 5 años'],
|
||||
@@ -105,7 +120,7 @@ export function riskGroups(
|
||||
· No disponible
|
||||
}
|
||||
</p>
|
||||
<div class="risk-plot" [class.unavailable]="!s.risk">
|
||||
<div class="risk-plot" [class.unavailable]="!s.risk" [class.survival]="g.survival">
|
||||
<div class="risk-line" aria-hidden="true"></div>
|
||||
@if (s.risk; as r) {
|
||||
@if (r.low !== undefined && r.high !== undefined) {
|
||||
@@ -170,6 +185,10 @@ export function riskGroups(
|
||||
#fff 25%
|
||||
);
|
||||
}
|
||||
.survival .risk-line {
|
||||
background: linear-gradient(to right, #c24269 0 25%, #df8640 25% 50%,
|
||||
#a8c243 50% 75%, #42a77e 75% 100%);
|
||||
}
|
||||
.risk-interval {
|
||||
border-left: 2px solid #17324d;
|
||||
border-right: 2px solid #17324d;
|
||||
|
||||
Reference in New Issue
Block a user