PolicyEngine / PolicyEngine/policyengine.py
Household results return numeric indices for enum variables (state_code -> 4.0, filing_status -> 0.0)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7
- Forks
- 9
- Avg merge
- 15h 51m
- Merged PRs (30d)
- 9
Description
Found during the PR #363 review, but pre-existing and identical in the non-axes path: _safe_convert in us/household.py (and the UK counterpart) floats EnumArray int16 indices, so result.household.state_code returns 4.0 instead of "CA" and result.tax_unit.filing_status returns 0.0 instead of "SINGLE". The default person column race already ships this way. EnumArray.decode_to_str() is the proper decode. Fix belongs in the shared result-building path; needs a small sweep of existing tests that may assert the numeric form.
🤖 Generated with Claude Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with _safe_convert in us/household.py and its UK counterpart, then inspect the shared result-building path and EnumArray.decode_to_str(). Update the conversion so enum results return their string values rather than numeric indices, and sweep existing tests for assertions of the numeric form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100