feat: Add household axes for MTR and earnings variation#131
Open
SakshiKekre wants to merge 1 commit intomainfrom
Open
feat: Add household axes for MTR and earnings variation#131SakshiKekre wants to merge 1 commit intomainfrom
SakshiKekre wants to merge 1 commit intomainfrom
Conversation
Add axes parameter to /household/calculate endpoint enabling the frontend to sweep a person's input variable (e.g. employment_income) across a range and receive 401-point arrays for all output variables. This powers MTR charts and earnings variation charts, removing the frontend's dependency on the v1 API's calculate-full endpoint. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
axesparameter toPOST /household/calculatefor sweeping a person's input variable across a range (e.g. employment_income from 0 to 200k in 401 steps)calculate-fullendpoint for variation calculationsChanges
src/policyengine_api/utils/axes.py— validate, expand DataFrames, reshape outputtests/test_axes.py— 18 unit tests for axes logicsrc/policyengine_api/api/household.py—AxisSpecmodel,axesfield on request, validation, expansion/reshape threadingsrc/policyengine_api/modal_app.py—axesparam onsimulate_household_ukandsimulate_household_usTest plan
/household/calculatewith axes, poll, verify 401-element arrayshouseholdVariation.tsat v2 endpoint, verify MTR + earnings variation charts render