import { DecimalPipe } from '@angular/common'; import { Component, input } from '@angular/core'; interface Prediction { years: number; p: number; low?: number; high?: number; } export interface RiskScale { label: string; risk?: Prediction; } /** Each model's risk at its index visit and at five years; none where it gives no such horizon. */ export function riskScales(models: { text: string; predictions: Prediction[] }[]): RiskScale[] { return models.flatMap((m) => [0, 5].map((years) => ({ label: `${m.text}, riesgo ${years ? 'a 5 años' : 'inmediato'}`, risk: m.predictions.find((p) => p.years === years), })), ); } @Component({ selector: 'app-risk-scales', imports: [DecimalPipe], template: ` @for (s of scales(); track s.label) {