euromod_linking.registry

Method registry — the named linkage methodologies.

A method is a reviewed implementation that turns external-model shocks (the canonical shock table) into a transformed EUROMOD input DataFrame plus run parameters. Methodology lives in code; a scenario can only select a method and supply scenario-semantics params validated against the method’s own params_schema.

Methods carry no version number. What guards against an edit to the modelling silently serving results computed by earlier code is code_fingerprint, which hashes a method’s own source into the scenario fingerprint — a content-derived identity that cannot be forgotten the way a hand-maintained version integer can.

Exceptions

MethodLookupError

Mapping key not found.

Classes

MethodSpec

A methodology's published contract: what it consumes, what it needs, and

Functions

available_names(→ list[str])

code_fingerprint(→ str)

Content hash of the methodology's own source.

list_specs(→ list[MethodSpec])

register(→ MethodSpec)

resolve(→ MethodSpec)

The method registered under name.

resolve_for_channels(→ MethodSpec)

Dispatch: the unique registered methodology covering the given shock

Module Contents

exception euromod_linking.registry.MethodLookupError(message: str, available: list[str])[source]

Mapping key not found.

available
class euromod_linking.registry.MethodSpec[source]

A methodology’s published contract: what it consumes, what it needs, and what it does to the input.

name is how a methodology is referred to everywhere else — in dispatch, in a scenario’s methodology pin, and in results.

addon_requirements: tuple
cell_variables: str
channels_consumed: tuple[str, ...]
dataset_requirements: tuple[str, ...]
description: str
factory: Callable = None
injected_columns: tuple[str, ...]
metrics_consumed: tuple[str, ...]
min_model_release: str | None = None
name: str
params_schema: dict
restructures_rows: bool = False
summary: str
euromod_linking.registry.available_names() list[str][source]
euromod_linking.registry.code_fingerprint(spec: MethodSpec) str[source]

Content hash of the methodology’s own source.

Results are cached on the scenario fingerprint, but a scenario document does not change when the methodology does — so without this, editing a method’s modelling silently serves results computed by the earlier code. Hashing the implementation makes any code change invalidate its cached runs, the same content-addressed discipline used for shock tables and scores. Empty string if the source cannot be read, which leaves caching keyed on the methodology name alone.

euromod_linking.registry.list_specs() list[MethodSpec][source]
euromod_linking.registry.register(spec: MethodSpec) MethodSpec[source]
euromod_linking.registry.resolve(name: str) MethodSpec[source]

The method registered under name.

euromod_linking.registry.resolve_for_channels(channels: set[str], metrics: set[str]) MethodSpec[source]

Dispatch: the unique registered methodology covering the given shock channels (and metrics, where the spec constrains them). Users never select a methodology — it is resolved from the shocks and echoed in the response; an explicit scenario pin exists only for reproduction and for the day two methodologies claim the same channel.