TEA: the cycle's relate_ados2 step between the EEG analysis and the load, and the ADOS-2 relation in FHIR

This commit is contained in:
ulises
2026-11-21 23:18:39 -06:00
parent 71557ecbd3
commit 74303aa1b9
15 changed files with 235 additions and 71 deletions
+14 -3
View File
@@ -84,15 +84,26 @@ def catalogs(migrate: str, ctx: Context) -> dict[str, int]:
def analyze_eeg(migrate: str, ctx: Context) -> dict[str, int]:
"""The EEG analysis of each stored EDF that needs one (`ctx.eeg_analysis`), written to bronze before `load` reads
it: the verdict, quality checks and metrics in `eeg`, `eeg_criterio`, `eeg_metrica` and `eeg_metrica_electrodo`.
it: the verdict, quality checks and metrics in `eeg`, `eeg_criterio`, `eeg_metrica`, `eeg_metrica_electrodo`
and `eeg_metrica_zona`.
Returns how many EEGs were pending and how each ended; nothing without an analysis (every domain but TEA)."""
if ctx.eeg_analysis is None:
return {}
return asdict(ctx.eeg_analysis())
def load(catalogs: dict[str, int], analyze_eeg: dict[str, int], ctx: Context) -> SQLModel:
"""`carga`, `persona`, `procedimiento` y `observacion_clinica` desde staging (T-20c), after the EEG analysis.
def relate_ados2(analyze_eeg: dict[str, int], ctx: Context) -> dict:
"""The ADOS-2 association fitted on the EEGs the analysis left (`ctx.ados2_relation`), written to
`relacion_ados2` and `relacion_ados2_paciente` before `load`, so the same cycle's gold views show it. Returns
the version and its counts; nothing without an association (every domain but TEA)."""
if ctx.ados2_relation is None:
return {}
return asdict(ctx.ados2_relation())
def load(catalogs: dict[str, int], analyze_eeg: dict[str, int], relate_ados2: dict, ctx: Context) -> SQLModel:
"""`carga`, `persona`, `procedimiento` y `observacion_clinica` desde staging (T-20c), after the EEG analysis and
the ADOS-2 association.
Incremental por la llave lógica de cada procedimiento (`save_load_in`): repetir no cambia nada.
"""