feat: support multiple households in calculation endpoints#73
Merged
nwoodruff-co merged 3 commits intomainfrom Jan 13, 2026
Merged
feat: support multiple households in calculation endpoints#73nwoodruff-co merged 3 commits intomainfrom
nwoodruff-co merged 3 commits intomainfrom
Conversation
Changed entity inputs from single dicts to lists of dicts, enabling
callers to submit multiple households with entity relational dataframes.
The caller specifies {entity}_id fields in each entity and
person_{entity}_id fields in people to link them together.
For simple single-household requests, IDs can be omitted and all people
will default to entity 0.
Co-Authored-By: Claude <noreply@anthropic.com>
nwoodruff-co
approved these changes
Jan 13, 2026
- Changed route paths from "/" to "" to avoid trailing slash mismatch - Added simulation_id fixture to create test dependencies - Updated tests to use the fixture instead of random UUIDs Co-Authored-By: Claude <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
Changed entity inputs from single dicts to lists of dicts, enabling callers to submit multiple households with entity relational dataframes. The caller specifies
{entity}_idfields in each entity andperson_{entity}_idfields in people to link them together.Changes
HouseholdCalculateRequestandHouseholdImpactRequestschemas: entity fields (benunit,marital_unit,family,spm_unit,tax_unit,household) changed fromdict[str, Any]tolist[dict[str, Any]]HouseholdCalculateResponseto returnhouseholdas a list_calculate_household_uk,_calculate_household_us) to build entity dataframes directly with proper ID relationshipssimulate_household_uk,simulate_household_us) with the same logicMicroDataFrameandUKYearData/USYearDataExample
{ "tax_benefit_model_name": "policyengine_us", "people": [ {"person_id": 0, "person_household_id": 0, "person_tax_unit_id": 0, "age": 40, "employment_income": 70000}, {"person_id": 1, "person_household_id": 1, "person_tax_unit_id": 1, "age": 30, "employment_income": 50000} ], "tax_unit": [ {"tax_unit_id": 0, "state_code": "CA"}, {"tax_unit_id": 1, "state_code": "NY"} ], "household": [ {"household_id": 0, "state_fips": 6}, {"household_id": 1, "state_fips": 36} ], "year": 2024 }Testing
All 10 household tests pass, including 2 new multi-household tests.