Skip to content

Introduce Einsatzgemeinschaft (eg) group for SGB XII#1159

Merged
MImmesberger merged 17 commits intogsia-rewritefrom
sg-grouping
Mar 26, 2026
Merged

Introduce Einsatzgemeinschaft (eg) group for SGB XII#1159
MImmesberger merged 17 commits intogsia-rewritefrom
sg-grouping

Conversation

@MImmesberger
Copy link
Copy Markdown
Collaborator

@MImmesberger MImmesberger commented Mar 21, 2026

Summary

  • Adds eg_id (Einsatzgemeinschaft) group for SGB XII, which includes the couple plus their minor unmarried children (< 18) in the same household (§ 27 Abs. 2 SGB XII)
  • Switches Grundsicherung im Alter from _bg to _eg aggregation, fixing incorrect benefit computation for households with minor children
  • Fixes vermögensfreibetrag bug: was using _fg (Familiengemeinschaft) counts instead of the correct group-level counts
  • Moves p_id_lebenspartner (formerly p_id_einstandspartner) from arbeitslosengeld_2/bürgergeld namespaces to familie (shared across SGB II and SGB XII), collapsing date-split fg_id function into single functions
  • Renames EinstandspartnerLebenspartner (p_id_einstandspartnerp_id_lebenspartner)

Test plan

  • pixi run ty and pixi run ty-jax pass
  • pixi run prek run --all-files passes
  • pixi run -e py314-jax tests -n 7 — 1285 passed, 528 skipped
  • Grouping tests verify correct eg_id values for various household compositions
  • skip_hh_id_25.yaml (parent + child) needs expected values recomputed with EG grouping — follow-up needed
  • Additional test cases with minor children should be added

Closes #1147
Supersedes #738
Related to #696

🤖 Generated with Claude Code

The SGB XII benefit unit (§ 27 Abs. 2) includes the couple plus their minor
unmarried children (< 18) in the same household, not just the couple as in
SGB II's Einstandsgemeinschaft. This adds sg_id and switches Grundsicherung
im Alter from _eg to _sg aggregation.

Changes:
- Add sg_id group creation function with sgb_xii_sg_id_formula (age < 18)
- Add SG aggregation functions in familie.py (ist_kind_in_sozialhilfegemeinschaft,
  anzahl_kinder_sg, anzahl_erwachsene_sg, anzahl_personen_sg)
- Rename _eg → _sg throughout grundsicherung/im_alter namespace
- Fix vermögensfreibetrag bug: was using _fg counts, now uses _sg counts
- Move p_id_einstandspartner to familie namespace (shared across SGB II/XII)
- Collapse date-split fg_id/eg_id functions into single functions
- Remove unused EG child/adult functions from familie.py
- Update documentation (hh_concepts.md, AGENTS.md)
- Skip hh_id_25 test (needs recomputation with SG grouping)

Closes #1147
Supersedes #738

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/gettsim/germany/ids.py 89.47% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@MImmesberger MImmesberger marked this pull request as draft March 22, 2026 00:20
@MImmesberger MImmesberger changed the base branch from main to gsia-rewrite March 23, 2026 12:46
@MImmesberger MImmesberger changed the title Introduce Sozialhilfegemeinschaft (sg) group for SGB XII Introduce Einsatzgemeinschaft (eg) group for SGB XII Mar 23, 2026
@MImmesberger MImmesberger marked this pull request as ready for review March 23, 2026 16:07
@MImmesberger
Copy link
Copy Markdown
Collaborator Author

The failing docs build is related to GETTSIM personas. Let's fix this later before merging into main when we have settled on the naming.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community bot commented Mar 24, 2026

Documentation build overview

📚 gettsim | 🛠️ Build #31991218 | 📁 Comparing b506b9b against latest (39f4e01)


🔍 Preview build

Show files changed (6 files in total): 📝 6 modified | ➕ 0 added | ➖ 0 deleted
File Status
changes.html 📝 modified
geps/gep-01.html 📝 modified
geps/gep-08.html 📝 modified
how_to_guides/modifications_of_policy_environments.html 📝 modified
tt_explanations/hh_concepts.html 📝 modified
tutorials/visualizing_the_system.html 📝 modified

Copy link
Copy Markdown
Collaborator

@hmgaudecker hmgaudecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!

p_id_einstandspartner,

# Sort all arrays according to p_id to make the id equal location in array
sorting = xnp.argsort(p_id)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? I thought we guaranteed that via the process of setting our internal p_id, but I might misremember.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, we don't need that anymore. Thanks!

@MImmesberger MImmesberger merged commit c135d82 into gsia-rewrite Mar 26, 2026
14 checks passed
@MImmesberger MImmesberger deleted the sg-grouping branch March 26, 2026 19:51
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.

Einsatzgemeinschaft (eg) group for SGB XII

2 participants