iza-institute-of-labor-economics / gettsim

The GErman Taxes and Transfers SIMulator
https://gettsim.readthedocs.io/
GNU Affero General Public License v3.0
54 stars 32 forks source link

Join columns to make target columns available at source level #722

Closed lars-reimann closed 5 months ago

lars-reimann commented 5 months ago

What problem do you want to solve?

Closes #708

Add a join_numpy function to make target columns available at the source level.

The function gets

It then maps each foreign key to the associated target. Primary keys must be unique and foreign keys must point to some primary key.

Todo

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 89.41%. Comparing base (284bfb3) to head (add6232).

Files Patch % Lines
src/_gettsim/shared.py 70.58% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #722 +/- ## ========================================== - Coverage 89.49% 89.41% -0.09% ========================================== Files 51 51 Lines 3627 3646 +19 ========================================== + Hits 3246 3260 +14 - Misses 381 386 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MImmesberger commented 5 months ago

I think the most straightforward application is in function _unterhaltsvors_anspruch_pro_kind_m. There, we need to replace _unterhaltsvorschuss_eink_above_income_threshold_fg. Instead, we should have a bool based on the parent's (linked via p_id_kindergeld_empf) return value of _unterhaltsvorschuss_eink_above_income_threshold.

In Lars' terminology:

lars-reimann commented 5 months ago

I think the most straightforward application is in function _unterhaltsvors_anspruch_pro_kind_m. There, we need to replace _unterhaltsvorschuss_eink_above_income_threshold_fg. Instead, we should have a bool based on the parent's (linked via p_id_kindergeld_empf) return value of _unterhaltsvorschuss_eink_above_income_threshold.

Thanks, the demo is now included.

lars-reimann commented 5 months ago

I'll look into updating the type hint check later.

MImmesberger commented 5 months ago

Thanks, the demo is now included.

Thanks! I just adjusted the column name and removed the obsolete aggregation dict at the top of the file.

I'm happy with the implementation but I'll let @hmgaudecker approve.