Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def höchstbetrag_m(...) -> float: ...
- `_hh` (Haushalt - household)
- `_fg` (Familiengemeinschaft)
- `_bg` (Bedarfsgemeinschaft)
- `_eg` (Einstandsgemeinschaft)
- `_eg` (Einsatzgemeinschaft)
- `_ehe` (Ehegemeinschaft)

Example: `arbeitslosengeld_2__betrag_m_bg` = monthly ALG2 amount at Bedarfsgemeinschaft
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ All releases are available on [Anaconda.org](https://anaconda.org/conda-forge/ge

## Unreleased

- {gh}`1159` Add Einsatzgemeinschaft (SGB XII); remove Einstandsgemeinschaft.
({ghuser}`MImmesberger`)
- {gh}`1154` Fix Freibetrag for pension income from all pillars for Grundsicherung im
Alter. ({ghuser}`MImmesberger`)
- {gh}`1155` Fix Vermögensfreibetrag for Grundsicherung im Alter.
Expand Down
20 changes: 10 additions & 10 deletions docs/geps/gep-01.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ GETTSIM knows about the following units:
unit is based on the priority check via
`vorrangprüfungen__wohngeld_vorrang_vor_arbeitslosengeld_2_bg` and
`vorrangprüfungen__wohngeld_und_kinderzuschlag_vorrang_vor_arbeitslosengeld_2_bg`.
- `arbeitslosengeld_2__fg_id`: Familiengemeinschaft. Maximum of two generations, the
relevant unit for Bürgergeld / Arbeitslosengeld 2. Another way to think about this is
the potential Bedarfsgemeinschaft before making checks for whether children have
enough income fend for themselves. Subset of `hh`.
- `arbeitslosengeld_2__bg_id`: Bedarfsgemeinschaft, i.e., Familiengemeinschaft excluding
children who have enough income to fend for themselves (they will form separate
`bg`s). Subset of `arbeitslosengeld_2__fg_id`.
- `arbeitslosengeld_2__eg_id`: Einstandsgemeinschaft, a couple whose members are deemed
to be responsible for each other. This includes couples that live together and may or
may not be married or in a civil union.
- `arbeitslosengeld_2__fg_id` and `bürgergeld__fg_id`: Familiengemeinschaft. Maximum of
two generations, the relevant unit for Bürgergeld / Arbeitslosengeld 2. Another way to
think about this is the potential Bedarfsgemeinschaft before making checks for whether
children have enough income fend for themselves. Subset of `hh`.
- `arbeitslosengeld_2__bg_id` and `bürgergeld__bg_id`: Bedarfsgemeinschaft, i.e.,
Familiengemeinschaft excluding children who have enough income to fend for themselves
(they will form separate `bg`s). Subset of `arbeitslosengeld_2__fg_id` /
`bürgergeld__fg_id`.
- `grundsicherung__eg_id`: Einsatzgemeinschaft according to § 27 Abs. 2 SGB XII. Maximum
of two generations, the relevant unit for Grundsicherung im Alter / Sozialhilfe.
- `familie__ehe_id`: Ehegemeinschaft, i.e. couples that are married or in a civil union.
- `einkommensteuer__sn_id`: Steuernummer (same for spouses filing taxes jointly, not the
same as the Germany-wide Steuer-ID)
Expand Down
35 changes: 7 additions & 28 deletions docs/tt_explanations/hh_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The units are:
| Bedarfsgemeinschaft | arbeitslosengeld_2\_\_bg_id | Familiengemeinschaft except for children who have enough income to fend for themselves. Relevant unit for Bürgergeld / Arbeitslosengeld 2. | yes |
| Steuernummer | einkommensteuer\_\_sn_id | Spouses filing taxes jointly or individuals. | yes |
| Ehepartner | familie\_\_ehe_id | Couples that are either married or in a civil union. | yes |
| Einstandsgemeinschaft | arbeitslosengeld_2\_\_eg_id | A couple whose members are deemed to be responsible for each other. | yes |
| Einsatzgemeinschaft | grundsicherung\_\_eg_id | Einsatzgemeinschaft according to § 27 Abs. 2 SGB XII. Maximum of two generations, the relevant base unit for Grundsicherung im Alter / Sozialhilfe. | yes |

Note that GETTSIM handles only simple cases (`hh_id` = `fg_id` = `bg_id` = `wthh_id`)
out of the box. If you need to handle more complex cases, you will need to pass all of
Expand Down Expand Up @@ -167,7 +167,8 @@ the [dedicated repository](https://github.com/ttsim-dev/gettsim-crazy-grouping-r
#### Description

- Bedarfsgemeinschaft comprised of:
- Einstandsgemeinschaft (SGB II - max 2 adults, marriage-like relationships)
- A single or a couple (Einstandspartner) whose members are deemed to be responsible
for each other
- Children under 18/25 whose income does not exceed their own needs. - The
"Kinderwohngeld" allows children to leave the Bedarfsgemeinschaft if Wohngeld (and
other sourced of income) is sufficient to cover their needs. Not implemented yet.
Expand All @@ -192,7 +193,7 @@ the [dedicated repository](https://github.com/ttsim-dev/gettsim-crazy-grouping-r

Government expenditures: 1.5 Mrd €

- Entitled to benefits: Einstandsgemeinschaft (SGB XII) - §27 SGB XII
- Entitled to benefits: Einsatzgemeinschaft (SGB XII) - §27 SGB XII
- max 2 adults, marriage-like relationships
- Their children under 18 living in the same household whose income does not exceed
their own needs
Expand All @@ -214,8 +215,7 @@ Regarding the household definition:

#### Aggregation unit

- Not implemented yet. The current `arbeitslosengeld_2__eg_id`/`bürgergeld__eg_id` is
not sufficient as it doesn't include children (it follows the SGB II definition).
- `grundsicherung__eg_id` (Einsatzgemeinschaft)

#### Pointers

Expand All @@ -230,7 +230,7 @@ Regarding the household definition:

Government expenditures: 7 Mrd €

- Entitled to benefits: Einstandsgemeinschaft (SGB XII) - §27 SGB XII
- Entitled to benefits: Einsatzgemeinschaft (SGB XII) - §27 SGB XII
- max 2 adults, marriage-like relationships
- Their children under 18 living in the same household whose income does not exceed
their own needs
Expand All @@ -240,10 +240,7 @@ Government expenditures: 7 Mrd €

#### Aggregation unit

- Currently: `arbeitslosengeld_2__eg_id` until 2022; `bürgergeld__eg_id` since 2023
(endogenous)
- The current implementation of `arbeitslosengeld_2__eg_id`/`bürgergeld__eg_id` is not
sufficient as it doesn't include children (it follows the SGB II definition).
- `grundsicherung__eg_id` (Einsatzgemeinschaft, endogenous)

#### Pointers

Expand Down Expand Up @@ -327,24 +324,6 @@ Government expenditures: 4 Mrd €
- Does not happen automatically, but upon request by the parents
- Not implemented yet.

## Limitations

- Within a Wohngeldhaushalt, no distinction can be made between persons without
Einstandsverpflichtung according to SGB II or SGB XII and those with
Einstandsverpflichtung

- Can only show the two extreme cases

1. all non-vertical or partner relationships not a candidate for Haushaltsgemeinschaft
according to SGB II / SGB XII
1. all non-vertical or partner relationships are candidates for Haushaltsgemeinschaft
according to SGB II / SGB XII

Typically, 1. will be the solution (hurdles for joint economic activity are high).

- An alternative would be another ID variable that specifies Einstandsgemeinschaft
according to SGB II and SGB XII.

### Parts of the data not available

- Adult children exist, but not in the dataset
Expand Down
59 changes: 33 additions & 26 deletions src/gettsim/germany/familie/familie.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,43 +236,50 @@ def alleinerziehend_sn(familie__alleinerziehend: bool, sn_id: int) -> bool:
pass


@policy_function()
def ist_kind_in_einstandsgemeinschaft(alter: int) -> bool:
"""Determines whether the given person is a child in a Einstandsgemeinschaft.

The 'child' definition follows §27 SGB XII.
"""
# TODO(@MImmesberger): This assumes that parents are part of the minor's (SGB XII)
# Einstandsgemeinschaft. This is not necessarily true. Rewrite once we refactor SGB
# XII.
# https://github.com/ttsim-dev/gettsim/issues/738
return alter <= 17
@policy_function(start_date="2005-01-01", vectorization_strategy="not_required")
def ist_kind_in_einsatzgemeinschaft(
p_id_elternteil_1: IntColumn,
p_id_elternteil_2: IntColumn,
p_id: IntColumn,
eg_id: IntColumn,
xnp: ModuleType,
) -> BoolColumn:
"""Child in an Einsatzgemeinschaft (§ 27 Abs. 2 SGB XII)."""
eg_id_elternteil_1 = join(
foreign_key=p_id_elternteil_1,
primary_key=p_id,
target=eg_id,
value_if_foreign_key_is_missing=-1,
xnp=xnp,
)
eg_id_elternteil_2 = join(
foreign_key=p_id_elternteil_2,
primary_key=p_id,
target=eg_id,
value_if_foreign_key_is_missing=-1,
xnp=xnp,
)
in_gleicher_eg_wie_elternteil_1 = eg_id_elternteil_1 == eg_id
in_gleicher_eg_wie_elternteil_2 = eg_id_elternteil_2 == eg_id
return in_gleicher_eg_wie_elternteil_1 | in_gleicher_eg_wie_elternteil_2


@policy_function()
def ist_erwachsener_in_einstandsgemeinschaft(
ist_kind_in_einstandsgemeinschaft: bool,
@policy_function(start_date="2005-01-01")
def ist_erwachsener_in_einsatzgemeinschaft(
ist_kind_in_einsatzgemeinschaft: bool,
) -> bool:
"""
Determines whether the given person is an adult in a Einstandsgemeinschaft.

The 'adult' definition follows §27 SGB XII.
"""
# TODO(@MImmesberger): This assumes that parents are part of the minor's
# Einstandsgemeinschaft. This is not necessarily true. Rewrite once we refactor SGB
# XII.
# https://github.com/ttsim-dev/gettsim/issues/738
return not ist_kind_in_einstandsgemeinschaft
"""Adult in an Einsatzgemeinschaft (§ 27 Abs. 2 SGB XII)."""
return not ist_kind_in_einsatzgemeinschaft


@agg_by_group_function(start_date="2005-01-01", agg_type=AggType.SUM)
def anzahl_kinder_eg(ist_kind_in_einstandsgemeinschaft: bool, eg_id: int) -> int:
def anzahl_kinder_eg(ist_kind_in_einsatzgemeinschaft: bool, eg_id: int) -> int:
pass


@agg_by_group_function(start_date="2005-01-01", agg_type=AggType.SUM)
def anzahl_erwachsene_eg(
ist_erwachsener_in_einstandsgemeinschaft: bool, eg_id: int
ist_erwachsener_in_einsatzgemeinschaft: bool, eg_id: int
) -> int:
pass

Expand Down
18 changes: 8 additions & 10 deletions src/gettsim/germany/grundsicherung/im_alter/im_alter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def betrag_m_eg_bis_2022(
familie__anzahl_kinder_eg: int,
familie__anzahl_personen_eg: int,
) -> float:
"""Calculate Grundsicherung im Alter on household level.
"""Grundsicherung im Alter.

# ToDo: There is no check for Wohngeld included as Wohngeld is
# ToDo: currently not implemented for retirees.
Expand Down Expand Up @@ -82,7 +82,7 @@ def betrag_m_eg_ab_2023(
familie__anzahl_kinder_eg: int,
familie__anzahl_personen_eg: int,
) -> float:
"""Calculate Grundsicherung im Alter on household level.
"""Grundsicherung im Alter.

# ToDo: There is no check for Wohngeld included as Wohngeld is
# ToDo: currently not implemented for retirees.
Expand Down Expand Up @@ -131,7 +131,7 @@ def mehrbedarf_schwerbehinderung_g_m(
mehrbedarf_bei_schwerbehinderungsgrad_g: float,
grundsicherung__regelbedarfsstufen: Regelbedarfsstufen,
) -> float:
"""Calculate additional allowance for individuals with disabled person's pass G."""
"""Additional allowance for individuals with disabled person's pass G."""
mehrbedarf_single = (
grundsicherung__regelbedarfsstufen.rbs_1
) * mehrbedarf_bei_schwerbehinderungsgrad_g
Expand All @@ -151,14 +151,12 @@ def mehrbedarf_schwerbehinderung_g_m(

@policy_function(start_date="2005-01-01")
def vermögensfreibetrag_eg(
familie__anzahl_kinder_fg: int,
familie__anzahl_erwachsene_fg: int,
familie__anzahl_kinder_eg: int,
familie__anzahl_erwachsene_eg: int,
parameter_vermögensfreibetrag: dict[str, float],
) -> float:
"""Calculate wealth not considered for Grundsicherung im Alter on household
level.
"""
"""Wealth not considered for Grundsicherung im Alter."""
return (
parameter_vermögensfreibetrag["erwachsene"] * familie__anzahl_erwachsene_fg
+ parameter_vermögensfreibetrag["kinder"] * familie__anzahl_kinder_fg
parameter_vermögensfreibetrag["erwachsene"] * familie__anzahl_erwachsene_eg
+ parameter_vermögensfreibetrag["kinder"] * familie__anzahl_kinder_eg
)
Loading
Loading