Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Erwerbsminderungsrente #577

Merged
merged 102 commits into from
Dec 6, 2023
Merged

Add Erwerbsminderungsrente #577

merged 102 commits into from
Dec 6, 2023

Conversation

nafetsk
Copy link
Collaborator

@nafetsk nafetsk commented Apr 28, 2023

Implementation of pension for reduced earning capacity (Erwerbsminderungsrente) as addition to the pension system already existing in gettsim.

The special feature of the pension for reduced earning capacity are the additional earning points. Average earning points per year are calculated for every individual and attributed for the time between retirement and an allocation age limit (Zurechnungszeitsgrenze). There are also special rules for (Zugangsfaktor) and (Rentenfaktor) both relevant for the calculation of the total pension claim.

Three new input variables are introduced.

  • voll_erwerbsgemind: Unable to provide more than 3 hours of market labor per day.
  • teilw_erwerbsgemind: Able to provide at least 3 but no more than 6 hours of market labor per day.
  • XXX

@ChristianZimpelmann ChristianZimpelmann requested review from hmgaudecker and removed request for hmgaudecker April 28, 2023 13:48
Copy link
Member

@amageh amageh left a comment

Choose a reason for hiding this comment

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

Nice work, I left some comments that we can discuss later :-).

src/_gettsim/parameters/erwerbsm_rente.yaml Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Show resolved Hide resolved
src/_gettsim/parameters/erwerbsm_rente.yaml Outdated Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Outdated Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Outdated Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Outdated Show resolved Hide resolved
Stefan Klotz added 4 commits May 4, 2023 11:27
Added check for Grundrentenzuschlag
Added erwerbsm_rente_m to default targets
Zugangsfaktor for Erwerbsminderungsrente is now calculated on a monthly basis
Adjusted test for new calculation method
@hmgaudecker
Copy link
Collaborator

hmgaudecker commented May 11, 2023

This will be a very large PR.

It would be helpful to move things that affect other dimensions than Erwerbsminderungsrente to separate PRs.

E.g. if we need to differentiate the stock of points earned by geographic region, we should do so in two stock variables, not one stock, one share. Doing so will affect all pension payments (I suppose) and issues related to that can be discussed without reference to Erwerbsminderungsrente.

@nafetsk
Copy link
Collaborator Author

nafetsk commented May 17, 2023

This will be a very large PR.

It would be helpful to move things that affect other dimensions than Erwerbsminderungsrente to separate PRs.

E.g. if we need to differentiate the stock of points earned by geographic region, we should do so in two stock variables, not one stock, one share. Doing so will affect all pension payments (I suppose) and issues related to that can be discussed without reference to Erwerbsminderungsrente.

Sorry for the late response. You are right, the differentiation between EPs should be discussed on another PR. I removed the last commit

@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c330ab) 91.25% compared to head (2494efe) 91.39%.

❗ Current head 2494efe differs from pull request most recent head aa4a24b. Consider uploading reports for the commit aa4a24b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #577      +/-   ##
==========================================
+ Coverage   91.25%   91.39%   +0.14%     
==========================================
  Files          49       50       +1     
  Lines        3315     3369      +54     
==========================================
+ Hits         3025     3079      +54     
  Misses        290      290              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Stefan_Klotz added 2 commits June 19, 2023 14:32
…OEP-RV data in order to fuel final test and hopefully close PR soon
Copy link
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.

We are getting close!

docs/gettsim_objects/input_variables.md Outdated Show resolved Hide resolved
src/_gettsim/config.py Outdated Show resolved Hide resolved
src/_gettsim/config.py Outdated Show resolved Hide resolved
src/_gettsim/parameters/erwerbsm_rente.yaml Outdated Show resolved Hide resolved
src/_gettsim/parameters/erwerbsm_rente.yaml Outdated Show resolved Hide resolved
return out


def langj_versicherte_wartezeit( # noqa: PLR0913
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def langj_versicherte_wartezeit( # noqa: PLR0913
def _erwerbsm_rente_langj_versicherte_wartezeit( # noqa: PLR0913

For now we'll need to be explicit about this.

src/_gettsim/transfers/rente.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should become five test cases.

Please give them names that check what is being tested. E.g. voll_erwerbsgemindert_birthyear_1940.

(The hh_id-stuff is only there for legacy reasons, i.e. the bulk conversion of csv-files)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah okay good to know. I was always wondering about that "naming convention".
Is there already some kind of script/tool for splitting those yaml files up?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We had one for csv -> yaml, but I am not sure whether it is helpful here. @lars-reimann would know.

Otherwise, I'd just read them into a DataFrame and write out again row-by-row.

Copy link
Collaborator

@lars-reimann lars-reimann Nov 28, 2023

Choose a reason for hiding this comment

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

The conversion script is available here. It was not designed with reusability in mind, but rather to run it once on the old CSV test data.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks a lot. I finally used that script here. Maybe we can add it to the gettsim-code-for-picking repo so people can reuse it.

docs/gettsim_objects/input_variables.md Outdated Show resolved Hide resolved
@nafetsk
Copy link
Collaborator Author

nafetsk commented Dec 1, 2023

I think all suggestions are implemented now @hmgaudecker . The only problem left is that the function name 'erwerbsm_rente_langj_versicherte_wartezeit' is too long but i dont know how to shorten it without losing precision.

@hmgaudecker
Copy link
Collaborator

hmgaudecker commented Dec 1, 2023

I think all suggestions are implemented now @hmgaudecker . The only problem left is that the function name 'erwerbsm_rente_langj_versicherte_wartezeit' is too long but i dont know how to shorten it without losing precision.

Even too long if you add an underscore upfront?

@nafetsk
Copy link
Collaborator Author

nafetsk commented Dec 1, 2023

I think all suggestions are implemented now @hmgaudecker . The only problem left is that the function name 'erwerbsm_rente_langj_versicherte_wartezeit' is too long but i dont know how to shorten it without losing precision.

Even too long if you add an underscore upfront?

I was not aware of that feature. Now it works👍

@hmgaudecker hmgaudecker changed the title erwerbsm_rente Add Erwerbsminderungsrente Dec 2, 2023
Copy link
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.

Just a few quick comments, gotta stop now. Rest looks good at a glance, too, though!

docs/gettsim_objects/input_variables.md Outdated Show resolved Hide resolved
docs/gettsim_objects/input_variables.md Outdated Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Outdated Show resolved Hide resolved
src/_gettsim/transfers/erwerbsm_rente.py Outdated Show resolved Hide resolved
Copy link
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.

Wonderful, thanks a lot! Just a couple of small changes left, nothing substantial.

Stefan Klotz and others added 4 commits December 4, 2023 15:01
updates:
- [github.com/lyz-code/yamlfix: 1.15.0 → 1.16.0](lyz-code/yamlfix@1.15.0...1.16.0)
- [github.com/astral-sh/ruff-pre-commit: v0.1.5 → v0.1.6](astral-sh/ruff-pre-commit@v0.1.5...v0.1.6)
- [github.com/nbQA-dev/nbQA: 1.7.0 → 1.7.1](nbQA-dev/nbQA@1.7.0...1.7.1)
- [github.com/pre-commit/mirrors-mypy: v1.7.0 → v1.7.1](pre-commit/mirrors-mypy@v1.7.0...v1.7.1)
@hmgaudecker hmgaudecker merged commit 933371f into main Dec 6, 2023
5 checks passed
@hmgaudecker hmgaudecker deleted the em_rente branch December 6, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tax-transfer-feature This relates to a feature of the Taxes and Transfers system or reforms thereof
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: piecewise_polynomial ignores intercepts except for the first one
6 participants