Skip to content

Add country situation preprocessing and supplied membership provenance - #600

Draft
hua7450 wants to merge 1 commit into
masterfrom
marital-unit-construction-hook
Draft

hua7450 wants to merge 1 commit into
masterfrom
marital-unit-construction-hook

Conversation

@hua7450

@hua7450 hua7450 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Country models cannot currently supply missing entity groups consistently across the household API and YAML runner. Add an opt-in TaxBenefitSystem.preprocess_situation hook before entity construction, and record Simulation.input_group_entities so formulas can distinguish supplied memberships from generated defaults. The default hook leaves other countries' behavior unchanged; datasets bypass it and retain their supplied membership provenance.

Prerequisite for PolicyEngine/policyengine-us#9999; consumer implementation: PolicyEngine/policyengine-us#10000. Keep in draft while the US consumer and integration are reviewed.

Validation: 49 focused builder, simulation/clone, and dataset-loading tests pass; make format passes. Tests cover caller-copy isolation, singular aliases, explicit empty groups, direct Simulation construction, clone provenance, variable-only reset, and suffixed flat-file membership columns. No country package or real microdata is required. The full core suite was not run; verification is focused on the construction and loading paths changed here.

Documentation review: added the hook/provenance contract to the simulation API reference and source docstrings. Impact: medium (public extension point, opt-in default). Confidence: high for the focused paths; downstream US integration is being tested in the companion draft.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant