import { Observable } from 'rxjs'; export type EstadoEvaluacionCacu = 'preliminary' | 'final'; /** The domain whose patient's risk is read: its FHIR endpoint is `//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/`). */ export interface LoteRiesgoCacu { /** The resource's 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; } export type PacienteRiesgoEstado = | { tipo: 'cargando' | 'no-disponible' | 'error' } | { tipo: 'disponible'; datos: RiesgoPacienteCacu };