Add entity variables and convenience functions for V1 economy output parity#234
Merged
anth-volk merged 8 commits intoapp-v2-migrationfrom Feb 20, 2026
Merged
Conversation
Harmonize poverty type tracking between policyengine.py and the API by adding poverty_type directly to the Poverty class. Convenience functions now iterate .items() on the poverty variable dicts to capture both the type enum and variable name, and include poverty_type in DataFrame output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add AGE_GROUPS dict and calculate_uk/us_poverty_by_age() convenience functions that compute poverty rates for child (<18), adult (18-64), and senior (65+) age groups across all poverty types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add is_male to both UK and US entity_variables so it's available in simulation output datasets. Add GENDER_GROUPS dict and calculate_uk/us_poverty_by_gender() convenience functions that compute poverty rates for male and female groups across all poverty types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add race to US entity_variables so it's available in simulation output datasets. Add RACE_GROUPS dict and calculate_us_poverty_by_race() that computes poverty rates for white, black, hispanic, and other racial groups across all US poverty types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Needed for budget summary computation — captures state-level tax revenue impact (matching V1's state_tax_revenue_impact field). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…y_variables Both UK and US models now include these household-level variables, needed for intra-decile income change distribution computation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 tests covering calculate_*_poverty_by_age, calculate_*_poverty_by_gender, and calculate_us_poverty_by_race — verifying delegation, record counts, filter_variable assignment, and correct filter kwargs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #233
Summary
poverty_typefield toPovertyoutput class for demographic breakdown trackingis_maleto UK and US person entity variables (gender poverty)raceto US person entity variables (racial poverty)household_state_income_taxto US tax_unit entity variables (state tax budget line)household_income_decileandhousehold_count_peopleto UK and US household entity variables (intra-decile computation)Test plan
python -m pytestpasses🤖 Generated with Claude Code