Files
WebApp/src/app/features/indicadores/paciente-detalle/paciente-riesgo.models.ts
T
edgar 990cab0e37 Patient risk: probabilities in percent, survival as such, covariates, and one row per model
The table says its probabilities are percentages (0 to 100 %) with their 95 % interval, and its covariates under it.
A model whose estimand asks for its complement (survival from a probability of dying) shows 1 − p with its interval
swapped. "Riesgo acumulado" reads "probabilidad". The models' details are a table of one row per model, without
the version or the batch state.
2026-11-22 15:04:13 -06:00

79 lines
3.2 KiB
TypeScript

import { Observable } from 'rxjs';
export type EstadoEvaluacionCacu = 'preliminary' | 'final';
/** The domain whose patient's risk is read: its FHIR endpoint is `/<dominio>/fhir`. CaCu unless said otherwise. */
export type DominioRiesgo = 'cacu' | 'cama';
export interface HorizonteRiesgoCacu {
/** Years from the risk's index date: the length of the prediction's `whenPeriod`; 0 is the immediate risk. */
horizonte_anios: number;
/** Transport values remain probabilities in [0, 1], never percentages. */
probabilidad: number;
ic_bajo?: number | null;
ic_alto?: number | null;
}
/** What the model's number is (the scenario's `[estimand]`, extension `estimando`); each field may be missing. */
export interface EstimandoRiesgo {
/** e.g. "Probabilidad"; also `method.text`. */
quantity?: string;
description?: string;
outcome?: string;
index_date?: string;
/** The unit the horizons are counted in, e.g. "años". */
horizons_unit?: string;
/** The variables the model uses, in words, as the record writes them under the table. */
covariates?: string;
/** `supervivencia`: the model gives the probability of the outcome (dying) and the record shows its complement. */
complement?: string;
}
/** The results of the cytology sampled on the risk's index date (extension `resultados-indice`), as recorded. */
export interface ResultadosIndice {
escamosas?: string;
glandulares?: string;
/** `POSITIVO`, `NEGATIVO` or `INDETERMINADO`. */
vph?: string;
}
/** The view of one FHIR `RiskAssessment` (`GET /cacu/fhir/RiskAssessment?subject=Patient/<pac_id>`). */
export interface LoteRiesgoCacu {
/** The resource's id, `<lote_id>-<pac_id>`. */
id: string;
modelo_nombre: string;
modelo_version: string;
/** The model's index date for this patient (the predictions' `whenPeriod.start`): the horizons count from it. */
fecha_indice: string;
evaluado_en: string;
estado_lote: EstadoEvaluacionCacu;
/** The prediction's outcome code (e.g. `cin2_mas`) and its display. */
desenlace: string;
desenlace_texto: string | null;
horizontes: HorizonteRiesgoCacu[];
/** `null` for a model whose scenario doesn't say. */
estimando: EstimandoRiesgo | null;
/** `null` when no cytology was sampled on the index date (or the domain doesn't give it). */
resultados_indice: ResultadosIndice | null;
/** Why a current model of this outcome has no risk for her (extension `sin-estimacion`; then `horizontes` is
* empty and `fecha_indice` too); `null` when it scored her. */
sin_estimacion: string | null;
}
/** DEV-only: the patient's current `RiskAssessment` of each outcome, from a `searchset` Bundle tagged `simulado`.
* `riesgos` holds them CIN2+ first, then cancer, then any other; `riesgo` is the first. */
export interface RiesgoPacienteCacu {
simulado: true;
riesgo: LoteRiesgoCacu;
riesgos: LoteRiesgoCacu[];
}
/** The raw FHIR answer (a Bundle), or `null` when the patient has no risk data. */
export interface PacienteRiesgoProvider {
obtener(pacId: string, dominio?: DominioRiesgo): Observable<unknown>;
}
export type PacienteRiesgoEstado =
| { tipo: 'cargando' | 'no-disponible' | 'error' }
| { tipo: 'disponible'; datos: RiesgoPacienteCacu };