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:
@@ -1,18 +1,19 @@
|
||||
"""Import schema for `core.tea.models.RelacionAdos2`: one association of an EEG alteration in a scalp zone with an
|
||||
ADOS-2 item or domain outcome, per fitted model version. `rel_evento` is the outcome event as a threshold on its
|
||||
score, machine-readable (`>=2`); it is shown as written, never parsed."""
|
||||
ADOS-2 outcome, per fitted model version. An item outcome is an item meaning code (`ADOS2_ITEM_MEANINGS`), the same
|
||||
in every module; a domain outcome is the total calibrated severity score (`ADOS2_CSS`). `rel_evento` is the outcome
|
||||
event as a threshold on its score, machine-readable (`>=1`); it is shown as written, never parsed."""
|
||||
from typing import Annotated, Optional
|
||||
|
||||
from pydantic import Field, model_validator
|
||||
|
||||
from core.tea.enums import MetricaEeg, NivelRelacionAdos2
|
||||
from core.tea.models import ADOS2_ITEMS
|
||||
from core.tea.models import ADOS2_CSS, ADOS2_ITEM_MEANINGS
|
||||
from webapi.imports.schemas.base import ImportSchema
|
||||
from webapi.imports.schemas.coercion import Bounded, Catalog, CatalogValue, OptionalStr, ShortKey, SourceId
|
||||
|
||||
_NIVEL_CATALOG = Catalog(NivelRelacionAdos2)
|
||||
_BIOMARCADOR_CATALOG = Catalog(MetricaEeg)
|
||||
_DOMINIOS_ADOS2 = {"SA", "RRB"}
|
||||
_RESULTADOS_DOMINIO = {ADOS2_CSS}
|
||||
|
||||
|
||||
class RelacionAdos2ImportSchema(ImportSchema):
|
||||
@@ -37,7 +38,8 @@ class RelacionAdos2ImportSchema(ImportSchema):
|
||||
if self.rel_ic_inf is not None and self.rel_ic_sup is not None and self.rel_ic_inf > self.rel_ic_sup:
|
||||
raise ValueError("rel_ic_inf no puede ser mayor que rel_ic_sup")
|
||||
if self.rel_tipo is not None and self.rel_resultado is not None:
|
||||
validos = set(ADOS2_ITEMS) if self.rel_tipo == NivelRelacionAdos2.ITEM.value else _DOMINIOS_ADOS2
|
||||
validos = (set(ADOS2_ITEM_MEANINGS) if self.rel_tipo == NivelRelacionAdos2.ITEM.value
|
||||
else _RESULTADOS_DOMINIO)
|
||||
if self.rel_resultado not in validos:
|
||||
raise ValueError(f"'{self.rel_resultado}' no es un código de {self.rel_tipo} del ADOS-2")
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user