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:
Transfers:
kindergeld,kinderzuschlag,wohngeld,arbeitslosengeld,arbeitslosengeld_2,arbeitslosenhilfe,grundsicherung_im_alter,grundsicherung,sozialhilfe,hilfe_zum_lebensunterhalt,bafög,pflegegeld,mutterschaftsgeld,mutterschutz,elternzeit,elterngeld,kriegsopferversorgung,betreuungsgeld,eigenheimzulage,vorruhestandsgeldMaintenance (Unterhalt):
kindesunterhalt,ehegattenunterhalt,unterhalt,unterhaltsvorschuss— the German Unterhalt terms are kept; English “support” / “maintenance” / “alimony” are not interchangeable, so the legal term stays GermanPension pillars / schemes:
gesetzliche_rente,knappschaftliche_rente,riester_rente,betriebliche_altersversorgung,berufsständische_altersvorsorge,private_altersvorsorge,private_rente,beamtenpension,alterssicherung_landwirte,gesetzliche_unfallversicherung,altersteilzeitNamed legal terms / institutions:
werkstatt_für_behinderte(Werkstatt für behinderte Menschen, the SGB IX sheltered-employment institution — no faithful one-word English equivalent)
Everything else is English. Common German scaffolding and its English replacement:
| German | English |
|---|---|
bezieht / bezog | received |
aktuell | current |
anzahl_monate | number_of_months |
im_letzten_monat | last_month |
eingezahlt | paid_in |
nach_steuern / vor_steuern | after_tax / before_tax |
brutto | gross |
hinterbliebene | survivor |
einkommen / einkünfte | income / earnings |
erwerbstätig | employed |
betriebsgröße | firm_size |
gemeldet | registered |
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>.
time:
_m(monthly),_y(annual)aggregation:
_hh(household)source-module disambiguation:
_hl,_pequiv, … when the same concept comes from more than one modulecalendar-month index:
_month_01…_month_12for the twelve slots of apkalactivity calendar (January is01). This is a coordinate identifying which month, not the_mmonthly-frequency suffix; it is zero-padded so the twelve columns sort in calendar order. The year the calendar refers to isprevious_yearand lives in metadata, not in the name (so no_last_yearsuffix — see below).
The reference period is not encoded in the name — see below.
Examples:
kindergeld_currently_received_hharbeitslosengeld_2_number_of_months_hhgesetzliche_rente_survivor_yincome_after_tax_y_hhfull_time_employed_month_03,pension_receipt_or_retirement_month_12
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):
Point-in-time, survey year
t: current-status questions (current employment, satisfaction, current benefit receipt), measured at the interview.Recent past, ≈ the month before the interview (still
t): “current” monthly amounts; e.g.pglabnet(“Current Net Labor Income”) is the previous month’s income.Previous calendar year
t − 1: annual flows (_y), thepkal12-month calendar (“January through December of last year”), and number-of-months counts. This is the SOEP income reference year.
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:
current⇒ryear = survey_yearprevious_year⇒ryear = survey_year − 1previous_month⇒rmonth = interview_month − 1, rolling January back to December ofsurvey_year − 1time_invariant⇒ no reference period (birth year, parents)
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.