Files
models/models/tea/ados2/settings.py
T

21 lines
651 B
Python

"""The ADOS-2 association's settings (`model.toml`): the library module, its implementation and level, and the
stored EEG metric each of its biomarkers reads."""
import tomllib
from dataclasses import dataclass
from functools import cache
from pathlib import Path
@dataclass(frozen=True)
class Settings:
association: str
impl: str
level: str
biomarkers: dict[str, str] # library biomarker -> `MetricaEeg` code
@cache
def settings(path: Path = Path(__file__).with_name("model.toml")) -> Settings:
raw = tomllib.loads(path.read_text())
return Settings(raw["association"], raw["impl"], raw["level"], dict(raw["biomarkers"]))