Summary
The tax-unit construction engine and its rule helpers have been extracted into the standalone, reusable microunit package. This repository should depend on microunit for tax-unit construction rather than keeping its own in-repo copy, so the rules have a single canonical home and can be shared across PolicyEngine's microdata stack.
Current state
Tax-unit construction currently lives in:
policyengine_us_data/datasets/cps/tax_unit_construction.py — the engine (construct_tax_units, modes, filing-status logic).
policyengine_us_data/datasets/cps/tax_unit_rule_helpers.py — the federal rule helpers (CPS relationship codes, qualifying-child age test, qualifying-relative gross-income limit, etc.).
microunit was extracted from these modules: the engine logic (everything from the HEAD = "HEAD" marker onward) is byte-identical, and microunit exposes the same public API and the same construct_tax_units(person, year, mode="policyengine") -> (person_assignments, tax_unit) signature.
Proposed change
- Add
microunit as a dependency.
- Delete the two in-repo modules.
- Re-point every call site (
census_cps.py, the ACS wrapper, the two validation/ scripts, and the tests) to import from microunit.
- Keep
policyengine_us_data/datasets/acs/acs_to_cps_columns.py and the thin ACS wrapper in this repo, since microunit deliberately excludes ACS column mapping.
This is behavior-preserving: tax-unit output is unchanged.
Summary
The tax-unit construction engine and its rule helpers have been extracted into the standalone, reusable
microunitpackage. This repository should depend onmicrounitfor tax-unit construction rather than keeping its own in-repo copy, so the rules have a single canonical home and can be shared across PolicyEngine's microdata stack.Current state
Tax-unit construction currently lives in:
policyengine_us_data/datasets/cps/tax_unit_construction.py— the engine (construct_tax_units, modes, filing-status logic).policyengine_us_data/datasets/cps/tax_unit_rule_helpers.py— the federal rule helpers (CPS relationship codes, qualifying-child age test, qualifying-relative gross-income limit, etc.).microunitwas extracted from these modules: the engine logic (everything from theHEAD = "HEAD"marker onward) is byte-identical, andmicrounitexposes the same public API and the sameconstruct_tax_units(person, year, mode="policyengine") -> (person_assignments, tax_unit)signature.Proposed change
microunitas a dependency.census_cps.py, the ACS wrapper, the twovalidation/scripts, and the tests) to import frommicrounit.policyengine_us_data/datasets/acs/acs_to_cps_columns.pyand the thin ACS wrapper in this repo, sincemicrounitdeliberately excludes ACS column mapping.This is behavior-preserving: tax-unit output is unchanged.