euromod_linking.ingest

Universal shock ingest: (external model output file, mapping spec) -> canonical shock-table records.

Mapping specs are declarative, repo-versioned YAML files in euromod_linking/mappings/, validated against mapping.v1.schema.json. Anything a spec cannot express becomes a new named transform here — mappings stay data, code stays reviewed.

Exceptions

IngestError

Inappropriate argument value (of correct type).

Functions

ingest(→ tuple[list[dict], list[str]])

Read an external model output file through a mapping spec.

list_mappings(→ list[dict])

Available mapping specs: [{name, description, file}].

load_mapping(→ dict)

Load + schema-validate a mapping spec by name (mappings/{name}.yaml)

Module Contents

exception euromod_linking.ingest.IngestError[source]

Inappropriate argument value (of correct type).

euromod_linking.ingest.ingest(file_path: str, mapping, country: str | None = None) tuple[list[dict], list[str]][source]

Read an external model output file through a mapping spec.

Returns (records, warnings). country filters rows to one country when a group derivation uses the nuts_code transform, for files covering several. Raises IngestError on structural problems.

euromod_linking.ingest.list_mappings() list[dict][source]

Available mapping specs: [{name, description, file}].

euromod_linking.ingest.load_mapping(name_or_spec) dict[source]

Load + schema-validate a mapping spec by name (mappings/{name}.yaml) or as an already-parsed dict.