Skip to main content
Ctrl+K
GETTSIM 1.4.1.dev48 documentation - Home GETTSIM 1.4.1.dev48 documentation - Home
  • GETTSIM on Github
  • Installation
  • Tutorials
  • How-To Guides
  • Explanations
    • GETTSIM Development
    • GETTSIM Enhancement Proposals (GEPs)
    • Changes
    • Glossary
  • GitHub
  • GETTSIM on Github
  • Installation
  • Tutorials
  • How-To Guides
  • Explanations
  • GETTSIM Development
  • GETTSIM Enhancement Proposals (GEPs)
  • Changes
  • Glossary
  • GitHub

Previous topic

GEP 10 — Units and Dimensionality

Next topic

GEP X — Template and Instructions

  • GETTSIM Enhancement Proposals (GEPs)
  • GEP 11 — Legal References

GEP 11 — Legal References#

Author

Marvin Immesberger

Status

Draft

Type

Standards Track

Created

2026-11-26

Resolution

One of Accepted | Rejected | Withdrawn once resolution has been found

Abstract#

This GEP makes references to the law a required and machine-readable part of all policy functions and parameters of the taxes and transfers system that are shipped with GETTSIM. A reference consists of a provision and the act published in the Bundesgesetzblatt (BGBl) by which the provision received the cited wording, e.g.:

§ 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230

For policy functions, references are written in a Reference: section of the docstring. For parameters, they are written in the reference key of each date entry (see GEP 3). Based on this, users can look up the policy functions and parameters that implement a given provision at a given date.

Because public APIs for historical versions of German federal law are still experimental and incomplete, we cannot synchronise federal law and GETTSIM completely. Checking whether a given reference truly exists or whether certain gaps in GETTSIM’s coverage of the law exist remains up to the users. Tools like the legal information portal of the federal government might help in the future.

Motivation and Scope#

So far, the connection between GETTSIM’s policy functions and parameters on the one hand and the law on the other hand has been an implicit one. References are given in docstrings, in the reference key of parameters, or in note keys. They are written as free text and in varying styles; e.g., the same provision may appear as §66 (1) EStG or as § 66 Abs. 1 EStG. Many policy functions do not cite any law at all, and malformed references go unnoticed (e.g., § 32 Art. 2-4 EStG instead of § 32 Abs. 2-4 EStG).

This GEP has two goals.

  1. Reverse lookup. Researchers and developers should be able to find the parts of GETTSIM that implement a provision, e.g., § 66 EStG on 2025-01-01, without searching the code base for “Kindergeld”. Given the date of a policy environment, a reference then serves as a second identifier of a policy function or parameter next to its path.

  2. Correct and uniform references. A single format that is checked automatically makes it easier for reviewers to compare code and law and keeps references consistent across the code base.

Citing the provision alone is not sufficient for these purposes. Laws are amended frequently, and paragraphs or Absätze are renumbered in the process. For example, § 30 SGB II refers to different rules in 2008 and in 2025. The publication in the BGBl, on the other hand, never changes. We therefore always combine the provision with the act that gave it its wording (“in der Fassung”, abbreviated idF). Such a reference remains valid after later renumberings, and its first part still allows for a lookup by paragraph.

The requirements of this GEP only apply to the policy functions and parameters GETTSIM ships with, i.e., those in gettsim.germany. Users who write their own policy functions or parameters do not need to add references.

The following is out of scope:

  • Verifying that a policy function implements the cited provision correctly.

  • Verifying references against the texts of the law. We are not aware of a source that covers historical versions of German federal law in machine-readable form (see Alternatives).

  • A list of provisions that are not implemented in GETTSIM. It would require historical versions of the law at the level of Absätze and is deferred until such data are available.

Usage and Impact#

Writing references#

All policy functions, all date entries of parameters, and all RoundingSpecs shipped with GETTSIM must carry a reference. A reference cites the provision and the act that gave the provision its wording:

§ 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230

The reference should be as precise as possible. The act is cited with its date and its page in the BGBl until 2022 and with its number from 2023 on. Laws are cited by their official abbreviation, e.g., SGB II. If a provision has Absätze, Sätze, or lower levels, they should be included in the reference. However, because we cannot determine the depth of a provision without the text of the law, GETTSIM only enforces that the paragraph and the act are cited automatically.

Some values are set by acts that have no official abbreviation, e.g., the Sozialversicherungs-Rechengrößenverordnungen before 2013. Such a provision is cited by the act itself, without idF:

§ 3 Abs. 1 Nr. 1 V. v. 02.12.2011 BGBl. I S. 2421

In policy functions, references are listed in a Reference: section at the end of the docstring:

def betrag_ohne_staffelung_m(anzahl_ansprüche: int, satz_m: float) -> float:
    """Sum of Kindergeld for eligible children.

    Reference: § 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230
    """
    return satz_m * anzahl_ansprüche

In parameter files, the reference goes into the reference key of each date entry:

2023-01-01:
  value: 250
  reference: § 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230
  note: Inflationsausgleichsgesetz

In a RoundingSpec, it goes into the reference argument.

If there is no provision to cite, the reference is replaced by none (<reason>), e.g., reference: none (technical helper). Several references are given as a list. The format and the remaining rules are specified in Format of a reference and the following sections; the test suite fails if a reference is missing or malformed (see Enforcement).

Looking up policy functions and parameters by provision#

from gettsim import MainTarget, main

main(
    main_target=MainTarget.legal_references.by_query,
    legal_references_query="§ 66 EStG",
    policy_date_str="2025-01-01",
)

The main target returns the paths of all policy functions and parameters in the policy environment at that date whose references match the query. A query matches all references to the provision itself and to its parts, i.e., § 66 EStG matches § 66 Abs. 1 Satz 2 EStG. A more precise query only returns the matching parts: § 66 Abs. 2 EStG matches § 66 Abs. 2 EStG and § 66 Abs. 2 Satz 1 EStG, but not § 66 Abs. 1 EStG. A reference that is less precise than the query, e.g., § 66 EStG, is treated as covering all of its parts and hence also matches § 66 Abs. 2 EStG. The idF part of a reference is only taken into account if it is part of the query. A query that consists of an act only returns everything that cites this act.

legal_references_query also accepts a tuple of queries, e.g., ("§ 66 EStG", "§ 6 BKGG"). In this case, the main target maps each query to its result.

We allow for some flexibility in the query. §66 Estg and § 66 EStG yield the same result, as do § 66 Abs. 1 EStG, § 66 Absatz 1 EStG, and § 66 (1) EStG. If a query cannot be interpreted, the error message lists the closest abbreviations of laws.

The policy date is required because paths only have a meaning within a policy environment.

A second main target, MainTarget.legal_references.by_path, maps each path in the policy environment to its references. Both main targets are part of the interface DAG (see GEP 7).

Documentation#

The documentation contains a page that lists all paths together with their references and can be searched by provision. The page is generated when the documentation is built. Plots of the DAG show the references of each node.

Backward compatibility#

The user interface does not change; the main targets and the legal_references_query argument of main are additions.

For developers, the style of the reference key in the parameter files changes (see Parameters). This requires rewriting all existing reference entries. Docstrings of policy functions gain a Reference: section.

Detailed description#

Format of a reference#

A reference consists of a provision and the act that gave the provision its wording. The provision belongs either to a law with an official abbreviation or to an act without one, which is then identified by its publication:

reference = <provision> <law> idF <act>     (provision of a law)
          | <provision> <act> [idF <act>]   (provision of an act without abbreviation)

provision = § <n>[a-z] [Abs. <n>[a-z]] [Satz <n> | S. <n>] [Halbsatz <n>]
                       [Nr. <n>[a-z]] [Buchst. <x>] [Doppelbuchst. <xx>]
act       = [Art. <n> [Nr. <n>]] G.|V.|B. v. DD.MM.YYYY BGBl. I S. <page>      (until 2022)
          | [Art. <n> [Nr. <n>]] G.|V.|B. v. DD.MM.YYYY BGBl. YYYY I Nr. <n>   (from 2023 on)

The parts of a provision are written in the order in which the law nests them, e.g., § 10 Abs. 1 Nr. 2 Satz 1 EStG.

Abbreviations, idF, and acts without an abbreviation#

  • A law is cited by the abbreviation used on gesetze-im-internet.de, e.g., EStG, RAV 1995, or 3. RAV. Laws that are no longer in force are not listed there; they are cited by the abbreviation that the act itself defines in its title, e.g., “(Beitragssatzverordnung 2019 – BeiSaV 2019)”. We do not invent abbreviations. The books of the Sozialgesetzbuch are the exception: gesetze-im-internet.de writes SGB 2, we write SGB II as in their official titles.

  • A provision of a law with an abbreviation is cited as <provision> <law> idF <act>. The act is the amending act (or the Bekanntmachung) that gave the cited part its wording as of the relevant date. Example: the Kindergeld of 2023 is § 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230, because the Inflationsausgleichsgesetz amended § 66 Abs. 1 EStG. This also holds for a Verordnung with an abbreviation that was never amended; the act is then the Verordnung itself: § 1 Abs. 1 RWBestV 2023 idF V. v. 21.06.2023 BGBl. 2023 I Nr. 164.

  • A provision of an act without an abbreviation is cited by the act that contains it, e.g., the Sozialversicherungs-Rechengrößenverordnung 2012: § 3 Abs. 1 Nr. 1 V. v. 02.12.2011 BGBl. I S. 2421. There is no idF, because the act is the source itself. If the act consists of articles, the article goes into the act.

  • If such an act was amended later, the amending act follows after idF, as for a law: § 1 V. v. 03.12.2015 BGBl. I S. 2188 idF Art. 1 V. v. 28.09.2017 BGBl. I S. 3525 for the Mindestunterhaltsverordnung as amended in 2017.

The following rules apply to both forms:

  • The paragraph (§) is required. Absatz, Satz, and lower levels are optional, but should be given wherever they add precision. Whether a paragraph has Absätze cannot be determined without the text of the law, hence the depth of a reference is not checked.

  • Within the provision, both Satz and S. denote a sentence. Within the act, S. denotes the page of the BGBl. The position relative to the act resolves the ambiguity.

  • A Nummer with a letter, e.g., § 3 Nr. 14a EStG, is a Nummer of its own that was inserted later. It differs from a Buchstabe within a Nummer, e.g., § 3 Nr. 14 Buchst. a EStG, and the two do not match each other in lookups.

  • Articles are abbreviated as Art.. For acts that do not consist of articles, Art. is left out.

  • G., V., and B. stand for Gesetz, Verordnung, and Bekanntmachung, as in GEP 3.

  • For acts published until 2022, the page is the first page of the act, not the page of the provision.

  • The abbreviations we accept are listed in a file called laws.yaml.

Examples:

§ 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230
§ 32a Abs. 1 EStG idF Art. 1 G. v. 23.12.2024 BGBl. 2024 I Nr. 449

Policy functions#

References of policy functions are written in a Reference: section at the end of the docstring. A single reference follows the colon on the same line. Several references are written as indented list items starting with - (see References over time). The rest of the docstring is not affected and should still describe what the function does.

@policy_function(
    start_date="2023-01-01", leaf_name="betrag_m", unit=TTSIMUnit.CURRENCY.PER_MONTH
)
def betrag_ohne_staffelung_m(
    anzahl_ansprüche: int,
    satz_m: float,
) -> float:
    """Sum of Kindergeld for eligible children.

    Kindergeld claim is the same for each child, i.e. increases linearly with the number
    of children.

    Reference: § 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230
    """
    return satz_m * anzahl_ansprüche

A policy function cites the provisions it implements. If it implements several provisions, it lists all of them. Policy functions should not be split up only because the law distributes a rule over several provisions; as before, the boundaries of functions are determined by readability.

Some policy functions do not have a counterpart in the law, e.g., some of the functions in the familie namespace. They state this explicitly:

@policy_function(unit=TTSIMUnit.DIMENSIONLESS)
def ist_kind_bis_2_in_familiengemeinschaft(
    alter: int, ist_kind_in_familiengemeinschaft: bool
) -> bool:
    """Child under the age of 3 in Familiengemeinschaft.

    Reference: none (technical helper)
    """
    return ist_kind_in_familiengemeinschaft and (
        alter <= cast_ttsim_unit(2, unit=TTSIMUnit.YEARS)
    )

The reason in parentheses is required.

References over time#

A reference refers to the version of a provision that is in force at the start_date of the policy function. Because the idF part determines the version, the reference remains valid if the paragraph is renumbered later.

If a provision is changed while the policy function remains the same, both references are listed:

@policy_function(unit=TTSIMUnit.CURRENCY.PER_MONTH)
def anrechnungsfreies_einkommen_m(bruttolohn_m: float) -> float:
    """Freibetrag for income from employment.

    Reference:
        - § 30 SGB II idF Art. 1 G. v. 24.12.2003 BGBl. I S. 2954
        - § 11b Abs. 3 SGB II idF Art. 2 G. v. 24.03.2011 BGBl. I S. 453
    """

A policy function matches a query if any of its references matches. Hence, a query for § 30 SGB II at a date after the renumbering also returns this policy function. Since the result contains the matching reference including its idF part, it is clear which version of the provision was matched.

Rounding rules#

The reference argument of a RoundingSpec (see GEP 5) follows the same rules as the references of policy functions. If a policy function has a rounding_spec, its reference is required, has to follow the format of this GEP, and may be replaced by none (<reason>).

RoundingSpec(
    base=0.01,
    direction="down",
    reference="§ 123 Abs. 1 SGB VI idF Art. 1 G. v. 18.12.1989 BGBl. I S. 2261",
)

Parameters#

For parameters, the reference key of each date entry holds a reference in the format described above. This replaces the style of the reference key specified in GEP 3.

satz_m:
  name:
    de: Kindergeld pro Kind, identisch für alle Kinder.
    en: Child benefit amount, identical for all children.
  description:
    de: >-
      § 66 Abs. 1 EStG. Identische Werte in § 6 Abs. 1 BKGG, diese sind aber nur für
      beschränkt Steuerpflichtige relevant (d.h. Ausländer mit Erwerbstätigkeit in
      Deutschland). Für Werte vor 2002, siehe 'BMF - Datensammlung zur Steuerpolitik'
    en: null
  unit: EUR_PER_MONTH
  type: scalar
  2023-01-01:
    value: 250
    reference: § 66 Abs. 1 EStG idF Art. 2 G. v. 08.12.2022 BGBl. I S. 2230
    note: Inflationsausgleichsgesetz
  2025-01-01:
    value: 255
    reference: § 66 Abs. 1 EStG idF Art. 1 G. v. 23.12.2024 BGBl. 2024 I Nr. 449
    note: Steuerfortentwicklungsgesetz (SteFeG)

Every date entry requires a reference. This includes date entries that mark the end of a parameter. In this case, the reference typically cites the provision that replaces the parameter or its calculation method. If there is nothing to cite, the date entry states the reason:

  2018-01-01:
    note: Irrelevant because last cohort has passed the normal retirement age.
    reference: none (all eligible cohorts have reached the Regelaltersgrenze)

Here, the Altersrente für Frauen (§ 237a SGB VI) is only available to women born before 1952. The provision was not changed, but it no longer applies to anyone.

If the values of a date entry follow from several provisions, the reference key holds a list of references, as in the Reference: section of policy functions.

The note key continues to hold any additional information. The name of an act (e.g., “Steuerfortentwicklungsgesetz”) belongs there and not in the reference.

Scope#

Object

Reference

Policy functions

required, or Reference: none (<reason>)

reference of a RoundingSpec

required, or none (<reason>)

Date entries of parameters, including the end of a period

required, or reference: none (<reason>)

Parameter functions

optional

Aggregation functions, group creation functions, inputs

not required

Policy functions and parameters written by users

not required

TTSIM and GETTSIM#

TTSIM does not contain any country-specific knowledge. Hence, it knows where references are stored, but not how to interpret them.

TTSIM

  • extracts the Reference: section from the docstrings of policy functions and the reference key from the date entries of parameters;

  • stores them as an attribute of each policy object, either as a list of strings or as the reason why there is no reference;

  • accepts a parser for references that is supplied by the country package, in the same way as the unit system. The parser turns a reference or a query into a structured representation and decides whether a reference matches a query;

  • adds the legal_references_query argument to main, which takes a query or a tuple of queries;

  • provides the main targets legal_references.by_path, which maps each path in the policy environment to its parsed references, and legal_references.by_query, which keeps the paths whose references match the query; and

  • shows references in plots of the DAG.

GETTSIM

  • supplies the parser for German references. It implements the grammar of Format of a reference and checks laws against the list in laws.yaml. The parser is lenient for queries (see Looking up policy functions and parameters by provision), but strict for references in the code;

  • passes the parser to TTSIM in gettsim.main; and

  • checks the requirements of this GEP in its test suite.

Enforcement#

A test in GETTSIM loads all policy objects in gettsim.germany for all dates. The test fails if

  • a policy function has neither a Reference: section nor a reason for not having one;

  • a date entry of a parameter has neither a reference nor a reason for not having one;

  • a RoundingSpec has neither a reference nor a reason for not having one;

  • a reference does not follow the format of this GEP; or

  • a reference cites a law that is not listed in laws.yaml.

Related Work#

  • OpenFisca and PolicyEngine store references to the law as optional metadata of variables and parameters.

  • Catala takes a different approach and writes the code alongside the text of the law.

  • bundesrecht parses references to German federal law and resolves them against the current version of the law. We do not use it: it does not parse acts, it accepts much that this GEP rules out (ranges, ff., i.V.m., several paragraphs), and the grammar of this GEP is small enough to parse directly.

  • The legal information portal of the federal government provides an open API. Laws are identified by the European Legislation Identifier (ELI), which is based on the publication in the BGBl (e.g., eli/bund/bgbl-1/2008/s1856 for the WoGG). The act part of a reference in this GEP corresponds to such an identifier.

Implementation#

  1. TTSIM: Extract references from docstrings and parameter files, store them in the policy objects, accept a parser from the country package, and add the legal_references_query argument and the main targets.

  2. GETTSIM: Add laws.yaml, the parser, and the test, and pass the parser to TTSIM in gettsim.main.

  3. GETTSIM: In a single pull request on top of step 2, convert the reference keys in all parameter files and the references of all RoundingSpecs, and add Reference: sections to all policy functions. Steps 2 and 3 are merged together, so that there is no version of GETTSIM in which only some policy objects satisfy this GEP.

  4. GETTSIM: Add the generated page with all references and a how-to guide on finding the code for a provision.

  5. TTSIM: Show references in plots of the DAG.

  6. Update the contributor guide.

Step 2 requires step 1, step 3 requires step 2, and step 5 only requires step 1.

Alternatives#

Regarding renumberings, we considered adding dates to the references of a policy function (e.g., since 2011-01-01: § 11b Abs. 3 SGB II …). This would make the lookup exact for every date, but it would specify the validity of a policy function in a second place next to start_date and end_date.

Regarding checks, we would like to verify references against the texts of the law. bundesrecht only covers the current version of the law and would reject correct references to earlier versions. As of November 2026, the legal information portal of the federal government only contains versions that are currently in force, with historical versions announced for 2028. It contains neither the EStG, SGB IV, SGB V, SGB VI, SGB XI, and AO, nor any amending acts. We will reconsider this question once historical versions are available, together with a list of provisions that do not have a counterpart in GETTSIM.

Discussion#

  • Discussion on Zulip: to be added.

Copyright#

This document has been placed in the public domain.

previous

GEP 10 — Units and Dimensionality

next

GEP X — Template and Instructions

On this page
  • Abstract
  • Motivation and Scope
  • Usage and Impact
    • Writing references
    • Looking up policy functions and parameters by provision
    • Documentation
  • Backward compatibility
  • Detailed description
    • Format of a reference
      • Abbreviations, idF, and acts without an abbreviation
    • Policy functions
    • References over time
    • Rounding rules
    • Parameters
    • Scope
    • TTSIM and GETTSIM
    • Enforcement
  • Related Work
  • Implementation
  • Alternatives
  • Discussion
  • Copyright
Show Source

© Copyright 2019-2026, GETTSIM team.

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.21.0.