nudb_config.pydantic package

nudb_config.pydantic.datasets module

class Dataset(**data)

Bases: BaseModel, DotMap

Dataset configuration entry under [datasets].

Parameters:
  • variables (list[str])

  • thresholds_empty (dict[str, float] | None)

  • min_values (dict[str, str] | None)

  • max_values (dict[str, str] | None)

  • dataset_specific_renames (dict[str, str] | None)

variables

Ordered list of variable names included in the dataset.

thresholds_empty

Allowable proportions of emptiness per variable.

min_values

Minimum inclusive filter values per variable.

max_values

Maximum inclusive filter values per variable.

dataset_specific_renames: dict[str, str] | None
max_values: dict[str, str] | None
min_values: dict[str, str] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

thresholds_empty: dict[str, float] | None
variables: list[str]
class DatasetsFile(**data)

Bases: BaseModel, DotMap

Root schema of datasets.toml.

Parameters:

datasets (dict[str, Dataset])

datasets

Mapping of dataset name to its configuration.

datasets: dict[str, Dataset]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nudb_config.pydantic.load module

class NudbConfig(**data)

Bases: BaseModel, DotMap

Unified configuration built from the TOML files.

This model aggregates values from settings.toml, variables.toml, variables_outdated.toml (if present), datasets.toml, and paths.toml. It mirrors the top-level structure exposed by the Dynaconf-based loader to preserve compatibility. Any codelist augmentations performed by the Dynaconf variant are also applied during loading so that downstream behavior matches.

Parameters:
  • dapla_team (str)

  • short_name (str)

  • utd_nacekoder (list[str])

  • variables_sort_unit (list[str] | None)

  • variables (Any)

  • datasets (DotMap)

  • paths (DotMap)

dapla_team

Team identifier from settings.toml.

short_name

Short project name from settings.toml.

utd_nacekoder

NACE codes from settings.toml.

variables_sort_unit

Unit sort order from variables.toml.

variables

Mapping of variable name to definition.

datasets

Mapping of dataset name to configuration.

paths

Mapping of environment name to paths configuration.

dapla_team: str
datasets: DotMap
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

paths: DotMap
short_name: str
utd_nacekoder: list[str]
variables: Any
variables_sort_unit: list[str] | None
load_pydantic_settings()

Load and assemble configuration using Pydantic models.

Reads the package-embedded TOML files under nudb_config/config_tomls (settings.toml, variables.toml, optional variables_outdated.toml, datasets.toml, paths.toml), parses them into their respective Pydantic models, applies the same codelist augmentations as the Dynaconf-based loader, and returns a unified NudbConfig object mirroring the Dynaconf structure.

Returns:

Aggregated configuration ready for downstream use.

Return type:

NudbConfig

nudb_config.pydantic.paths module

class PathEntry(**data)

Bases: BaseModel, DotMap

Path configuration for a named environment under [paths].

Parameters:
  • katalog (str)

  • delt_utdanning (str)

katalog

Base catalog path for configuration artifacts.

delt_utdanning

Location of shared education data.

delt_utdanning: str
katalog: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class PathsFile(**data)

Bases: BaseModel, DotMap

Root schema of paths.toml.

Parameters:

paths (dict[str, PathEntry])

paths

Mapping of environment name to its paths configuration.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

paths: dict[str, PathEntry]

nudb_config.pydantic.settings module

class SettingsFile(**data)

Bases: BaseModel, DotMap

Root schema of settings.toml.

Parameters:
  • dapla_team (str)

  • short_name (str)

  • utd_nacekoder (list[str])

dapla_team

Name of the Dapla team that owns the data.

short_name

Short identifier for the project or dataset.

utd_nacekoder

List of NACE codes relevant for education data.

dapla_team: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

short_name: str
utd_nacekoder: list[str]

nudb_config.pydantic.variables module

class Variable(**data)

Bases: BaseModel, DotMap

Definition of a single variable from variables.toml.

Parameters:
  • unit (str)

  • dtype (str)

  • description_short (str | None)

  • length (list[int] | None)

  • klass_codelist (int | None)

  • klass_codelist_from_date (str | None)

  • klass_variant (int | None)

  • renamed_from (list[str] | None)

  • derived_from (list[str] | None)

  • codelist_extras (dict[str, str] | None)

  • outdated_comment (str | None)

unit

Logical grouping the variable belongs to.

dtype

Storage or semantic type of the variable.

length

Allowed lengths for string fields, if constrained.

klass_codelist

KLASS codelist identifier, if applicable.

klass_variant

KLASS variant identifier, if applicable.

renamed_from

Previous column name(s) that map to this variable.

codelist_extras

Additional code mappings injected at load time.

codelist_extras: dict[str, str] | None
derived_from: list[str] | None
description_short: str | None
dtype: str
klass_codelist: int | None
klass_codelist_from_date: str | None
klass_variant: int | None
length: list[int] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

outdated_comment: str | None
renamed_from: list[str] | None
unit: str
class VariablesFile(**data)

Bases: BaseModel, DotMap

Root schema of variables.toml.

Parameters:
  • variables_sort_unit (list[str] | None)

  • variables (dict[str, Variable])

variables_sort_unit

Preferred order of variable units.

variables

Mapping of variable name to its definition.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

variables: dict[str, Variable]
variables_sort_unit: list[str] | None