Agregar elegibilidad CaCu por escenario clínico

This commit is contained in:
Angel Capetillo Zavala
2026-12-02 18:47:09 -06:00
parent f7fdab950a
commit 370da43695
18 changed files with 1128 additions and 9 deletions
+31
View File
@@ -13,6 +13,7 @@ import type {
RiskAssessment,
} from 'fhir/r4';
import { Api } from '../api/api';
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';
import { readReport$Json } from '../api/fn/models/read-report-json';
@@ -26,6 +27,12 @@ import type { Parameters as FhirParameters } from 'fhir/r4';
import { firstValueFrom } from 'rxjs';
import { ApiConfiguration } from '../api/api-configuration';
import { ANTECEDENTS, Fact, group, split } from './record-groups';
import {
Eligibility,
eligibilityFailure,
eligibilityView,
type EligibilityState,
} from './eligibility';
import { referenceView, ReferenceRisk, ReferenceView } from './reference-risk';
import { parseSeries, RiskSeries, Series } from './risk-series';
import { curveFigure, curveText } from './risk-curve';
@@ -89,6 +96,7 @@ function methods(figures: { figure: { data: unknown[] } }[]): string[] {
Plot,
RiskScales,
ReferenceRisk,
Eligibility,
RiskSeries,
Stages,
],
@@ -212,6 +220,29 @@ export class Paciente {
});
/** CaCu, experimental: the NCI reference comparison of the cytology she was opened at. The API
* answers 404 while the feature is off: then nothing is shown. */
/** CaCu: the eligibility the backend publishes for each indexed visit (`$eligibility`). A failure is a
* state of the section, never an eligibility; a new patient starts from nothing (no earlier answer). */
private readonly eligibilityData = resource({
params: () =>
this.domain() === 'cacu' ? { id: this.id(), cutoff: this.corte() } : undefined,
loader: async ({ params }): Promise<EligibilityState> => {
try {
const answer = await this.api.invoke(cacuEligibility, {
domain: 'cacu' as Domain,
id: params.id,
cutoff: params.cutoff,
});
return eligibilityView(answer as FhirParameters);
} catch (error) {
return eligibilityFailure(error);
}
},
});
protected readonly eligibility = computed<EligibilityState>(() =>
this.eligibilityData.isLoading()
? { kind: 'loading' }
: (this.eligibilityData.value() ?? { kind: 'loading' }),
);
protected readonly reference = resource({
params: () =>
this.domain() === 'cacu'