Distinguir ausencias e insuficiencia en supervivencia CaCu

This commit is contained in:
Angel Capetillo Zavala
2026-12-02 19:26:50 -06:00
parent a4cc80fbe2
commit a43cf4b51b
6 changed files with 512 additions and 225 deletions
+12 -1
View File
@@ -13,6 +13,7 @@ import type {
RiskAssessment,
} from 'fhir/r4';
import { Api } from '../api/api';
import { type Insufficient, insufficientText, sortUndrawn } from './survival-scenarios';
import { cacuEligibility } from '../api/fn/fhir/cacu-eligibility';
import { studies as eegStudies } from '../api/fn/eeg/studies';
import { study as eegStudy } from '../api/fn/eeg/study';
@@ -415,6 +416,8 @@ export class Paciente {
factors: mine(summary?.['filas'] ?? []) as ScenarioFactors[],
scenarios: m.scenarios,
unavailable: [] as string[],
insufficient: [] as Insufficient[],
missing: [] as string[],
methods: [] as string[],
figures: mine(r['escenarios'] ?? []).map((e) =>
scenarioFigure(
@@ -435,12 +438,19 @@ export class Paciente {
'Supervivencia S(t)',
),
);
const undrawn = m.scenarios.filter((s) => !drawn.some((e) => e.escenario === s));
// CaCu: the report says which scenarios lack deaths (`escenarios_sin_curvas`); one it does not
// mention is not "insufficient", it is absent from the report. Other domains keep one list.
const { insufficient, missing } =
domain === 'cacu' ? sortUndrawn(report, undrawn) : { insufficient: [], missing: [] };
return {
factors: mine((report?.['factores_escenarios'] ?? []) as any[]) as ScenarioFactors[],
scenarios: m.scenarios,
figures,
// her scenarios the report draws no curve for
unavailable: m.scenarios.filter((s) => !drawn.some((e) => e.escenario === s)),
unavailable: domain === 'cacu' ? [] : undrawn,
insufficient,
missing,
methods: methods(figures),
};
},
@@ -563,6 +573,7 @@ export class Paciente {
...this.riskModels().flatMap((m) => m.predictions.map((p) => p.high ?? p.p)),
);
}
protected readonly insufficientText = insufficientText;
protected readonly name = name;
protected readonly levelNames = LEVEL_NAMES;
protected readonly identity = computed(() => {