Dibujar todos los ajustes de supervivencia en la ficha
This commit is contained in:
@@ -612,7 +612,8 @@
|
||||
} @else if (combination.value(); as c) {
|
||||
@if (c.figure) {
|
||||
<p class="muted">
|
||||
Kaplan-Meier de pacientes con sus mismos valores (IC 95 % Greenwood log-log; n =
|
||||
Ajustes sobre las pacientes con sus mismos valores (Kaplan-Meier con IC 95 %
|
||||
Greenwood; n =
|
||||
{{ c.n }}, fallecidos = {{ c.fallecidos }}).
|
||||
</p>
|
||||
<app-plot [figure]="c.figure" [height]="340" [toolbar]="false" />
|
||||
|
||||
@@ -33,7 +33,7 @@ import { ineligibility } from './ineligibility';
|
||||
import { parseSeries, RiskSeries, Series } from './risk-series';
|
||||
import { curveFigure } from './risk-curve';
|
||||
import { riskGroups, riskScales, RiskScales, survivalGroups } from './risk-scales';
|
||||
import { combinationFigure, combinationOf, noCurveText } from './survival-combination';
|
||||
import { combinationOf, noCurveText, survivalFigure } from './survival-combination';
|
||||
import { route, Stages } from './stages';
|
||||
import { ageAt, ageGroup, CAMA_AGE_GROUPS, camaRows, CURP } from '../indicadores/follow-up';
|
||||
import { LABELS, name, PRIORITY } from '../indicadores/measures';
|
||||
@@ -235,7 +235,7 @@ export class Paciente {
|
||||
});
|
||||
const found = combinationOf(report as Record<string, unknown>, inputs);
|
||||
return found?.km
|
||||
? { n: found.n, fallecidos: found.fallecidos, figure: combinationFigure(found.km) }
|
||||
? { n: found.n, fallecidos: found.fallecidos, figure: survivalFigure(found) }
|
||||
: { missing: noCurveText(report as Record<string, unknown>, found) };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { combinationOf, noCurveText } from './survival-combination';
|
||||
import { combinationOf, noCurveText, survivalFigure } from './survival-combination';
|
||||
|
||||
describe('combinationOf', () => {
|
||||
const values = { age_group: '<30', cytology: 'NA', hpv: 'positive' };
|
||||
@@ -22,4 +22,28 @@ describe('combinationOf', () => {
|
||||
),
|
||||
).toContain('n = 9, fallecidos = 2; mínimo requerido: 5');
|
||||
});
|
||||
|
||||
it('draws every fit the report has, and the Kaplan-Meier alone in an older report', () => {
|
||||
const km = { months: [0, 1], S: [1, 0.9], low: [1, 0.8], high: [1, 0.95] };
|
||||
const old = { valores: values, n: 9, fallecidos: 6, km };
|
||||
expect(survivalFigure(old).data.map((t) => (t as { name?: string }).name)).toContain(
|
||||
'Kaplan-Meier',
|
||||
);
|
||||
const fit = { t: [0, 1], S: [1, 0.9] };
|
||||
const full = {
|
||||
...old,
|
||||
weibull: fit,
|
||||
weibull_fractional: fit,
|
||||
points: { COMB: { S: [0.9] } },
|
||||
horizons_months: [12],
|
||||
};
|
||||
const names = survivalFigure(full).data.map((t) => (t as { name?: string }).name);
|
||||
expect(names).toEqual(
|
||||
expect.arrayContaining([
|
||||
'Weibull',
|
||||
'Weibull fraccional',
|
||||
'LR + HBN combinado (IC 95 % bootstrap)',
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
import { scenarioFigure } from '../gobernanza/figures';
|
||||
import { Figure, PALETTE } from '../plot';
|
||||
|
||||
/** All the fits the report has for her values, drawn as a clinical scenario's are. */
|
||||
export function survivalFigure(c: Combination): Figure {
|
||||
return c.weibull && c.weibull_fractional && c.points && c.horizons_months
|
||||
? scenarioFigure('', c, c.horizons_months, 'Supervivencia S(t)').figure
|
||||
: combinationFigure(c.km!);
|
||||
}
|
||||
|
||||
/** One entry of the survival report's `km_combinaciones`: the patients who share every value. */
|
||||
export interface Combination {
|
||||
valores: Record<string, string>;
|
||||
n: number;
|
||||
fallecidos: number;
|
||||
km?: { months: number[]; S: number[]; low: number[]; high: number[] };
|
||||
/** the other fits; a report from before they were published has the Kaplan-Meier only */
|
||||
weibull?: { t: number[]; S: number[] };
|
||||
weibull_fractional?: { t: number[]; S: number[] };
|
||||
points?: { COMB: { S: number[]; low?: number[]; high?: number[] } };
|
||||
horizons_months?: number[];
|
||||
}
|
||||
|
||||
/** The entry with exactly her values (a missing one is the report's "NA"); never a partial match. */
|
||||
|
||||
Reference in New Issue
Block a user