euromod_linking.shock_table

Canonical shock table — the interchange format every external-model shock must be expressed in before it can drive a EUROMOD scenario.

One tidy record per shock:

channel  align|constant|scale|reweight|inject   which EUROMOD lever
metric   e.g. "employment", "$f_cpi", "yem"      channel-specific referent
group    canonical "key=value;..." string        population cell ("" = all)
period   external-model period label (str)
op       set|grow|mult|add                       value semantics
value    number
unit     optional, documentation only
source   optional provenance (file/sheet/row)

A table’s identity is its content: content_id hashes the canonical records into shk_ + 12 hex digits, so the same economic scenario always has the same id whatever file or code path produced it. Nothing is stored — the id is derived on demand, and the table itself is a DataFrame the caller holds.

Attributes

Exceptions

ShockTableError

Inappropriate argument value (of correct type).

Functions

content_id(→ str)

Deterministic id from shock content (unit/source excluded, so identical

describe(→ dict)

The id and summary of a table, as it appears in a scenario result.

normalize(→ pandas.DataFrame)

Validate + canonicalise raw records into the canonical DataFrame,

summarize(→ dict)

Module Contents

exception euromod_linking.shock_table.ShockTableError(problems: list[str])[source]

Inappropriate argument value (of correct type).

problems
euromod_linking.shock_table.content_id(df: pandas.DataFrame) str[source]

Deterministic id from shock content (unit/source excluded, so identical shocks from different files dedupe).

euromod_linking.shock_table.describe(df: pandas.DataFrame, **extra) dict[source]

The id and summary of a table, as it appears in a scenario result.

euromod_linking.shock_table.normalize(records: list[dict]) pandas.DataFrame[source]

Validate + canonicalise raw records into the canonical DataFrame, sorted by (channel, metric, group, period). Raises ShockTableError.

euromod_linking.shock_table.summarize(df: pandas.DataFrame) dict[source]
euromod_linking.shock_table.CHANNELS = ('align', 'constant', 'scale', 'reweight', 'inject')
euromod_linking.shock_table.COLUMNS = ('channel', 'metric', 'group', 'period', 'op', 'value', 'unit', 'source')
euromod_linking.shock_table.OPS = ('set', 'grow', 'mult', 'add')