Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Naming conventions

Final variable names follow one rule, with one explicit exception list.

The rule: English by default, German for named programmes

A final variable name is English by default. A token stays German only when it is the proper noun of a German statutory programme, benefit, or pension pillar whose English translation would be ambiguous or would drift over time. German stems match GETTSIM’s spelling (so the GETTSIM-input variables are drop-in) but stay flat single-underscore — soep-preparation does not use GETTSIM’s __ qualified names.

German allow-list

The only tokens allowed to remain German:

Everything else is English. Common German scaffolding and its English replacement:

GermanEnglish
bezieht / bezogreceived
aktuellcurrent
anzahl_monatenumber_of_months
im_letzten_monatlast_month
eingezahltpaid_in
nach_steuern / vor_steuernafter_tax / before_tax
bruttogross
hinterbliebenesurvivor
einkommen / einkünfteincome / earnings
erwerbstätigemployed
betriebsgrößefirm_size
gemeldetregistered

PEP 8

Names are snake_case and must not start with a digit (1989_place_of_residence → place_of_residence_1989). Umlauts and ß are allowed, consistent with GETTSIM (which uses e.g. bürgergeld).

Suffix convention

Order: <german_stem>_<english_modifiers>_<time>_<aggregation>_<source>.

The reference period is not encoded in the name — see below.

Examples:

Reference period: it lives in metadata, not the name

A value’s reference period — does it describe the survey year, the previous calendar year, or the month before the interview? — is a property of each variable, not of the row: one (p_id, survey_year) row holds current-status variables, previous-month amounts, and previous-calendar-year income at once. So it is recorded as per-variable metadata, and you turn it into ryear / rmonth columns yourself when you need them.

The SOEP measurement modes (per the SOEP companion and paneldata.org):

The cleaning pipeline stores every variable under survey_year = syear (the interview wave t) with no year arithmetic, so the reference period is recoverable only from the metadata reference field:

Recipe: build ryear / rmonth

The add_reference_columns helper turns survey_year into the reference year and month, with the January→December rollover for previous_month:

from soep_preparation.utilities.reference_period import add_reference_columns

# `reference` for a variable comes from variable_to_metadata_mapping.yaml.
periods = add_reference_columns(
    survey_year=df["survey_year"],
    reference="previous_year",  # or "current" / "previous_month" / "time_invariant"
    interview_month=df["month_interview"],  # only needed for "previous_month"
)
df["ryear"] = periods["ryear"]
df["rmonth"] = periods["rmonth"]
# Then merge on `ryear` (e.g. to align income to its calendar year for GETTSIM) or keep
# `survey_year` — your choice.

How reference periods are decided

Most assignments follow deterministic rules: annual _y flows and the pkal 12-month calendar are previous_year, point-in-time status is current, and biographical facts are time_invariant. Where a variable’s mode is ambiguous, the soep_preparation.survey_year_audit task cross-checks it against the data — for every variable carrying survey_year it writes a low-cell-count-screened, per-survey-year value distribution to bld/survey_year_audit/alignment_report.json. Comparing a variable’s year-over-year movement against the questionnaire and external benchmarks reveals whether it aligns to the survey year or the previous year, which fixes its reference entry in create_metadata/reference_assignment.py. Regenerate the report with pixi run pytask.

Enforcement

A test fails any final variable name (checked against the generated metadata inventory and the out["…"] assignments via AST) that contains a German-scaffolding token outside the allow-list, starts with a digit, or is not Unicode-aware snake_case. The allow-list is matched on exact phrase spans, not substrings, so bezieht_kindergeld_aktuell still fails on bezieht/aktuell.