Skip to content

Comments

Add entity variables and convenience functions for V1 economy output parity#234

Merged
anth-volk merged 8 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-2
Feb 20, 2026
Merged

Add entity variables and convenience functions for V1 economy output parity#234
anth-volk merged 8 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-2

Conversation

@anth-volk
Copy link
Contributor

Fixes #233

Summary

  • Add poverty_type field to Poverty output class for demographic breakdown tracking
  • Add is_male to UK and US person entity variables (gender poverty)
  • Add race to US person entity variables (racial poverty)
  • Add household_state_income_tax to US tax_unit entity variables (state tax budget line)
  • Add household_income_decile and household_count_people to UK and US household entity variables (intra-decile computation)
  • Create convenience functions for poverty by age, gender, and race

Test plan

  • python -m pytest passes
  • New convenience functions return correct OutputCollection structures
  • All added entity variables are present in simulation output datasets

🤖 Generated with Claude Code

anth-volk and others added 8 commits February 19, 2026 23:01
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>
@anth-volk anth-volk marked this pull request as ready for review February 20, 2026 18:52
@anth-volk anth-volk merged commit 0b9ed0d into app-v2-migration Feb 20, 2026
2 checks passed
@anth-volk anth-volk deleted the feat/sim-report-migration/phase-2 branch February 20, 2026 18:52
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.

1 participant