Files
WebApi/webapi/orchestration/silver/persons.py
ulises 9a62ddcdaf CaMa recurrence: import schemas for the follow-up and the new patient variables, silver mappings and /cama/recurrencia
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>
2026-11-22 08:46:42 -06:00

32 lines
1.2 KiB
Python

"""De una fila de pacientes de staging a `persona` (T-20c)."""
from core.indicadores.comunes import PersonaBase
from webapi.orchestration.silver.values import codigo, texto_limpio
from webapi.orchestration.tables import TablasKit
def a_persona(paciente, *, tablas: TablasKit, **propias) -> PersonaBase:
"""La persona de una fila de pacientes; las columnas propias del proyecto salen de `tablas.persona_propias`."""
return tablas.Persona(
pac_id=paciente.pac_id,
pac_id_hospital=paciente.pac_id_hospital,
fecha_nacimiento=paciente.pac_fecha_nacimiento,
**{**tablas.persona_propias(paciente), **propias},
)
def de_derechohabiente(paciente) -> dict:
"""Lo que la persona de CaCu y CaMa agrega a las comunes: lo que el hospital sabe de la derechohabiente."""
return {
"dependencia": texto_limpio(paciente.pac_dependencia),
"parentesco": texto_limpio(paciente.pac_parentesco),
"codigo_postal": texto_limpio(paciente.pac_codigo_postal),
"fecha_defuncion": paciente.pac_fecha_defuncion,
}
def con_sexo(paciente) -> dict:
"""Lo que la persona de TEA agrega: el sexo, como código."""
return {"sexo": codigo(paciente.pac_sexo)}