Governance charts for recurrence scenarios and age curves

This commit is contained in:
Roberto Treviño
2026-11-26 14:25:53 -06:00
parent 471ed3a18c
commit d1f9dcbea8
2 changed files with 141 additions and 0 deletions
+35
View File
@@ -13,6 +13,41 @@ describe('governance figures', () => {
expect((found.figure.data[2] as any).error_y.array[0]).toBeCloseTo(0.05);
});
it('draws a recurrence scenario: KM band, both Weibulls and the model points', () => {
const [found] = interpretabilityFigures({
kind: 'scenarios',
recurrencia: {
horizons_months: [12, 36],
escenarios: [
{
cohorte_nombre: 'METABRIC',
escenario: 'RE+',
n: 10,
recaidas: 3,
km: { months: [0, 12], S: [1, 0.9], low: [1, 0.8], high: [1, 1] },
weibull: { t: [0, 12], S: [1, 0.9] },
weibull_fractional: { t: [0, 12], S: [1, 0.91] },
points: { COMB: { S: [0.95, 0.8], low: [0.9, 0.7], high: [0.99, 0.9] } },
},
],
},
});
expect(found.figure.data.length).toBe(5); // band, KM, Weibull, fractional, points
});
it('draws an age curve with its centile band', () => {
const [found] = interpretabilityFigures({
kind: 'age_curves',
curves: {
value: {
kind: 'curves',
curve: { age_months: [16, 36], p5: [1, 2], median: [2, 3], p95: [3, 4] },
},
},
});
expect(found.figure.data.length).toBe(2);
});
it('draws nothing for a report it does not know', () => {
expect(interpretabilityFigures({ kind: 'other' })).toEqual([]);
});