Skip to content

Conversation

@policyengine
Copy link
Contributor

@policyengine policyengine bot commented Dec 9, 2025

Summary

Fixes #1413 and #1411

Removes redundant formulas from variables where adds/subtracts attributes were being ignored, which could lead to bugs when the two get out of sync.

Changes

Variables refactored (formula removed):

  • household_net_income: Removed formula that only applied np.round() - now relies solely on adds/subtracts
  • household_net_income_ahc: Removed formula that only applied np.round() - now relies solely on adds/subtracts

Variables verified (no changes needed):

These variables correctly reference ClassName.adds in their formulas:

  • household_market_income
  • household_benefits
  • household_tax
  • gov_tax
  • pre_budget_change_household_benefits
  • pre_budget_change_household_tax

Impact

The two refactored variables previously had formulas that:

  1. Hardcoded the list of variables to add/subtract
  2. Applied np.round() to the result
  3. Made the adds/subtracts attributes misleading documentation

By removing the formulas, these variables now:

  • Use OpenFisca's built-in adds/subtracts mechanism
  • Automatically stay in sync (no risk of formula and attributes diverging)
  • Are simpler and easier to maintain

Note: OpenFisca may handle rounding differently when using adds/subtracts directly vs. applying np.round() in a formula, but this appears to be the intended behavior based on the framework design.

Test plan

  • Verify all existing tests pass
  • Confirm household_net_income calculates correctly
  • Confirm household_net_income_ahc calculates correctly

🤖 Generated with Claude Code

PolicyEngine-Bot and others added 2 commits December 9, 2025 08:47
Remove redundant formulas from household_net_income and household_net_income_ahc that only applied np.round() with no conditional logic. These variables now rely solely on their adds/subtracts attributes, eliminating the risk of the two getting out of sync.

Other variables (household_market_income, household_benefits, household_tax, gov_tax, pre_budget_change_household_benefits, pre_budget_change_household_tax) already correctly reference ClassName.adds in their formulas and require no changes.

Fixes #1411
Closes #1413

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@nwoodruff-co nwoodruff-co merged commit 5e7cbba into master Dec 9, 2025
2 checks passed
@nwoodruff-co nwoodruff-co deleted the bot/issue-1413 branch December 9, 2025 16:16
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.

Refactor variables with redundant adds/subtracts and formula definitions

3 participants