9a62ddcdaf
The patient takes the menopausal state, molecular and clinical subtype, integrative cluster, cellularity, mutation load, Ki-67 category and source of the record; a new import entity carries the recurrence and the last contact; hormone and anti-HER2 therapy are treatments. The route serves each cohort's scenarios, a scenario's figure and a patient's scenarios over the live cohort build, computing the models and the bootstrap in the background and caching them per build. Includes the survival import work this builds on. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
"""Import schema for `core.cama.models.Paciente`."""
|
|
from typing import Optional
|
|
|
|
from core.cama.enums import DEPENDENCIA_ALIAS, Dependencia, PARENTESCO_ALIAS, Parentesco, SEXO_BIOLOGICO_ALIAS, SexoBiologico
|
|
from webapi.imports.schemas.base import ImportSchema
|
|
from webapi.imports.schemas.coercion import (
|
|
Catalog,
|
|
CatalogValue,
|
|
FlexDate,
|
|
PostalCode,
|
|
RequiredDate,
|
|
RequiredHospitalId,
|
|
)
|
|
|
|
# Dependencia/Parentesco: Core marks both catalogs as tentative.
|
|
_DEPENDENCIA_CATALOG = Catalog(Dependencia, DEPENDENCIA_ALIAS, strict=False)
|
|
_PARENTESCO_CATALOG = Catalog(Parentesco, PARENTESCO_ALIAS, strict=False)
|
|
_SEXO_BIOLOGICO_CATALOG = Catalog(SexoBiologico, SEXO_BIOLOGICO_ALIAS)
|
|
|
|
|
|
class PacienteImportSchema(ImportSchema):
|
|
# The source's own id, kept so rows that reference it by id (not by a
|
|
# natural key) still point at this record.
|
|
pac_id: Optional[int] = None
|
|
pac_id_hospital: RequiredHospitalId
|
|
pac_sexo: CatalogValue(_SEXO_BIOLOGICO_CATALOG) = None
|
|
# IND-01: required, since age at each event of interest is derived from it.
|
|
pac_fecha_nacimiento: RequiredDate
|
|
pac_fecha_defuncion: FlexDate = None
|
|
pac_codigo_postal: PostalCode = None
|
|
pac_dependencia: CatalogValue(_DEPENDENCIA_CATALOG) = None
|
|
pac_parentesco: CatalogValue(_PARENTESCO_CATALOG) = None
|
|
pac_estado_civil: Optional[str] = None
|
|
pac_raza: Optional[str] = None
|
|
pac_brca1: Optional[str] = None
|
|
pac_brca2: Optional[str] = None
|
|
pac_estado_menopausico: Optional[str] = None
|
|
pac_pam50: Optional[str] = None
|
|
pac_subtipo_clinico: Optional[str] = None
|
|
pac_cluster_integrativo: Optional[str] = None
|
|
pac_celularidad: Optional[str] = None
|
|
pac_carga_mutacional: Optional[float] = None
|
|
pac_ki67_categoria: Optional[str] = None
|
|
pac_fuente: Optional[str] = None
|