feat(tea): EEG analysis before the silver load, and its verdict, quality checks and baselines through silver and FHIR

This commit is contained in:
AlbertoPMDM
2026-11-19 15:43:27 -06:00
parent b1bbbc25b4
commit d35e8bbae9
26 changed files with 1486 additions and 312 deletions
+12 -2
View File
@@ -11,6 +11,7 @@ Bronce lo escribe la ingesta, fuera del ciclo.
"""
import logging
from dataclasses import asdict
from datetime import date, datetime
from functools import partial
from importlib import import_module
@@ -81,8 +82,17 @@ def catalogs(migrate: str, ctx: Context) -> dict[str, int]:
return counts
def load(catalogs: dict[str, int], ctx: Context) -> SQLModel:
"""`carga`, `persona`, `procedimiento` y `observacion_clinica` desde staging (T-20c).
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`.
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.
Incremental por la llave lógica de cada procedimiento (`save_load_in`): repetir no cambia nada.
"""