Skip to content

Parser for references to German law and GEP 11 enforcement - #1265

Draft
MImmesberger wants to merge 13 commits into
gep-11from
claude/project-thread-y388yx
Draft

MImmesberger wants to merge 13 commits into
gep-11from
claude/project-thread-y388yx

Conversation

@MImmesberger

@MImmesberger MImmesberger commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What problem do you want to solve?

Step 2 of the implementation of GEP 11 (#1264). Stacked on the GEP branch; requires ttsim-dev/ttsim#167. The conversion of all references follows in a single PR on top of this one (#1266), and both are merged together. Until then, the enforcement tests fail by design.

  • gettsim.legal_references: GermanLegalReferenceParser, which implements TTSIM's LegalReferenceParser protocol. It parses the grammar of GEP 11 itself; no external parser is used.
    • Provision: § n[a-z] followed by Abs., Satz (or S.), Halbsatz, Nr., Buchst., Doppelbuchst. in the order in which the law nests them. Nr. 14a is a Nummer of its own and differs from Nr. 14 Buchst. a.
    • A provision belongs either to a law listed in laws.yaml (§ 66 Abs. 1 EStG idF <act>) or to an act without an official abbreviation, which is cited by its publication (§ 3 Abs. 1 Nr. 1 V. v. 02.12.2011 BGBl. I S. 2421, or ... idF <amending act> if it was amended).
    • Act: [Art. n [Nr. n]] G.|V.|B. v. DD.MM.YYYY BGBl. I S. n until 2022, BGBl. YYYY I Nr. n from 2023 on.
    • References in the code are parsed strictly: canonical form, a single paragraph (no ranges, ff., und, i.V.m.), and a known law.
    • Queries are parsed leniently (§66 Estg, § 66 (1) EStG, Absatz, Nummer, lit., Hs., SGB 2, i.d.F., a bare act). An unknown law lists the closest abbreviations.
    • matches: a query matches the provision and its parts, and a less precise reference covers its parts. The act only counts if it is in the query, and an act without an article matches all of its articles.
  • laws.yaml lists the laws GETTSIM cites today by their abbreviation on gesetze-im-internet.de. The conversion PR extends it.
  • gettsim.main passes the parser by default and gains legal_references_parser and legal_references_query.
  • tests_germany/test_legal_references.py:
    • Enforcement tests for all policy functions, RoundingSpecs, parameter functions and parameter date entries. Each test reports all violations at once.
    • Tests of the parser.
  • GEP 11: describes the parser and explains which abbreviation to use, when to cite idF, and when to cite the act itself.
  • ttsim-backend points to the TTSIM branch for now.

Todo

MImmesberger and others added 7 commits November 27, 2026 10:57
Add laws.yaml, a parser that wraps bundesrecht for the provision and parses the act
itself, pass it to TTSIM in gettsim.main, and test that all policy functions,
RoundingSpecs and date entries of parameters carry valid references.
@read-the-docs-community

read-the-docs-community Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 gettsim | 🛠️ Build #36217446 | 📁 Comparing e57d0b1 against latest (ff93042)

  🔍 Preview build  

7 files changed · + 1 added · ± 6 modified

+ Added

± Modified

MImmesberger and others added 4 commits November 27, 2026 18:01
Provisions follow the small grammar of GEP 11, so we parse them directly.
This also allows citing a provision of an act without an official
abbreviation, e.g. § 1 Abs. 1 V. v. 05.06.1992 BGBl. I S. 1017, and keeps
Nr. 14a apart from Nr. 14 Buchst. a.
GEP 11 now explains which abbreviation to use, when to cite idF and when to
cite the act that contains the provision, also for amended acts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant