Fix aggregate_microdata to reflect structural hook changes in budget impact#33
Merged
nikhilwoodruff merged 2 commits intomainfrom Apr 10, 2026
Merged
Conversation
When structural post-hooks modify individual benefit/tax columns (e.g. reform_universal_credit on benunits), the pre-computed household-level reform_total_benefits wasn't updated, so the budgetary impact showed £0. Now recomputes reform totals by summing individual program columns from persons (tax) and benunits (benefits), then detects any residual change in reform_net_income not explained by program-level changes (for hooks that modify net income directly without touching individual columns). 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.
When
sim.run()delegates toaggregate_microdatafor structural reforms, the budget impact was always £0 because post-hooks modify individual benefit/tax columns (e.g.reform_universal_credit) but not the pre-computedreform_total_benefitson households.Now recomputes totals by summing individual program columns from persons (tax) and benunits (benefits). Also detects residual net income changes from hooks that modify
reform_net_incomedirectly without touching individual program columns.Tested against 143 policies in 10ds-microsim — 75 now show non-zero budget impacts, up from ~30 before.
Test plan
sim.run()and verify non-zeronet_costwinners_losersstill correct for both types