Governance figures spec: scenarios are drawn by the record

This commit is contained in:
Roberto Treviño
2026-11-28 17:16:25 -06:00
parent fd19fdaefa
commit cbec0d431e
+6 -6
View File
@@ -1,4 +1,4 @@
import { interpretabilityFigures } from './figures';
import { interpretabilityFigures, scenarioFigure } from './figures';
describe('governance figures', () => {
it('draws a survival report as curves with bands and the model points', () => {
@@ -13,7 +13,7 @@ describe('governance figures', () => {
expect((found.figure.data[2] as any).error_y.array[0]).toBeCloseTo(0.05);
});
it("draws each survival scenario after the cohort's curves, titled with its deaths", () => {
it('leaves the survival scenarios to the patient record, which draws them whole', () => {
const scenario = {
escenario: 'HER2+ · ≥60 años · estadio III–IV (Alto)',
n: 1142,
@@ -30,10 +30,10 @@ describe('governance figures', () => {
predicted: { name: 'Modelo', months: [6], survival: [0.9], low: [0.8], high: [0.95] },
escenarios: [scenario],
});
expect(found.length).toBe(2);
expect(found[1].title).toContain('fallecidos = 308');
expect(found[1].figure.data.length).toBe(5); // band, KM, Weibull, fractional, points
expect((found[1].figure.data[4] as any).x).toEqual([6, 12, 18]);
expect(found.length).toBe(1); // the cohort's curves only
const drawn = scenarioFigure(scenario.escenario, scenario, scenario.horizons_months, 'S(t)');
expect(drawn.figure.data.length).toBe(5); // band, KM, Weibull, fractional, points
expect((drawn.figure.data[4] as any).x).toEqual([6, 12, 18]);
});
it('draws a recurrence scenario: KM band, both Weibulls and the model points', () => {