Move all stochastic randomness to data package for deterministic country package#7326
Merged
Move all stochastic randomness to data package for deterministic country package#7326
Conversation
…try package Remove all random() calls and seed variables from the country package. Takeup variables (ACA, SNAP, Medicaid) are now formula-less with default True. WIC uses draw variables instead of random(). SSI resource test uses only policy logic. Add state-specific Medicaid rates, Section 1931 deprivation rules, Head Start/Early Head Start takeup variables. Supersedes #6635, #7317. Fixes #7316. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 5, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7326 +/- ##
============================================
- Coverage 100.00% 86.56% -13.44%
============================================
Files 3 12 +9
Lines 54 134 +80
Branches 1 0 -1
============================================
+ Hits 54 116 +62
- Misses 0 18 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MaxGhenis
reviewed
Feb 6, 2026
policyengine_us/variables/gov/usda/wic/wic_nutritional_risk_draw.py
Outdated
Show resolved
Hide resolved
Remove draw variables; would_claim_wic and wic_nutritional_risk_imputed are now simple data-read bools. is_wic_at_nutritional_risk gates imputed risk on having a valid WIC category. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…data-read Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These parameters are now exclusively in policyengine-us-data. No formula in the country package references them anymore since all takeup variables use default_value=True. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MaxGhenis
approved these changes
Feb 7, 2026
Contributor
MaxGhenis
left a comment
There was a problem hiding this comment.
All test suites pass. Codecov failures are non-blocking (Head Start takeup multiplication lines). Takeup parameters cleaned up — now exclusively in us-data.
MaxGhenis
added a commit
that referenced
this pull request
Feb 7, 2026
- Add takes_up_ssi_if_eligible with default_value=True - Apply takeup multiplier in ssi.py for microsimulation - Follows new pattern from PR #7326 (no random() in country package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Feb 7, 2026
- Add takes_up_ssi_if_eligible with default_value=True - Apply takeup multiplier in ssi.py for microsimulation - Follows new pattern from PR #7326 (no random() in country package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Feb 7, 2026
- Add takes_up_ssi_if_eligible with default_value=True - Apply takeup multiplier in ssi.py for microsimulation - Follows new pattern from PR #7326 (no random() in country package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Feb 7, 2026
- Add takes_up_ssi_if_eligible with default_value=True - Apply takeup multiplier in ssi.py for microsimulation - Follows new pattern from PR #7326 (no random() in country package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Feb 7, 2026
* Add liquid asset variables for SSI modeling Adds three input variables imputed from SIPP in policyengine-us-data: - bank_account_assets: checking, savings, money market - stock_assets: stocks and mutual funds - bond_assets: bonds and government securities Updates ssi_countable_resources to calculate from these asset categories, enabling realistic asset-based eligibility testing for SSI. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use adds pattern for ssi_countable_resources Replace formula with adds attribute referencing parameter file that lists the asset sources. This separates policy logic (which assets count) from variable implementation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix references to use POMS sections that explicitly list countable resources The USC only lists exclusions, not what counts. POMS SI 01140.xxx explicitly defines bank accounts, stocks, and bonds as countable. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add spm_unit_cash_assets aggregation from person-level assets spm_unit_cash_assets now sums bank_account_assets, stock_assets, and bond_assets across the SPM unit. This flows through to IL AABD and MA EAEDC which use spm_unit_cash_assets. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Use actual imputed assets for SSI resource test Remove microsimulation bypass that used random pass rate. Now that liquid assets are imputed from SIPP, the resource test can use real calculated values. - Remove pass_rate.yaml parameter (no longer needed) - Update README to reflect new methodology - meets_ssi_resource_test now always uses ssi_countable_resources Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add SSI takeup variable and apply in benefit calculation - Add takes_up_ssi_if_eligible with default_value=True - Apply takeup multiplier in ssi.py for microsimulation - Follows new pattern from PR #7326 (no random() in country package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Trigger CI * Trigger CI * Add POMS references to asset variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <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
Supersedes #6635 and #7317. Fixes #7316.
Files changed
Deleted (3 seed variables)
Simplified (3 takeup variables - formula removed, default True)
Created (6 new files)
Rewritten (3 files - no more random())
Updated (4 files)
Test plan
Merge order
PolicyEngine/policyengine-us-data#451 must be merged FIRST, then this PR.
Related