Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions packages/populace-build/src/populace/build/us/fiscal_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,114 @@
"PolicyEngine-US; this STC residual collection row cannot be estimated "
"from the current state_income_tax variable."
),
"hhs_acf_tanf.fy2024.cash_assistance.ar.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Arkansas under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.az.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Arizona under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.co.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Colorado under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.ct.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Connecticut under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.de.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Delaware under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.ga.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Georgia under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.id.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Idaho under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.in.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Indiana under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.ks.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Kansas under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.ky.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Kentucky under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.me.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Maine under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.mi.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Michigan under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.mt.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Montana under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.nm.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in New Mexico under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.nv.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Nevada under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.ok.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Oklahoma under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.or.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Oregon under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.pa.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Pennsylvania under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.sd.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in South Dakota under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.tx.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Texas under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.vt.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in Vermont under PolicyEngine-US state TANF formulas."
),
"hhs_acf_tanf.fy2024.cash_assistance.wv.basic_assistance_excluding_relative_foster_care_and_adoption_guardianship.all_funds": (
"Current 2024 base microdata have zero positive TANF benefit support "
"in West Virginia under PolicyEngine-US state TANF formulas."
),
"irs_soi.ty2022.historic_table_2.state_agi.ak.under_1.return_count": (
"Current 2024 base microdata have zero Alaska return-count support in "
"the SOI under-$1 AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.under_1.income_tax_before_credits_returns": (
"Current 2024 base microdata have zero positive income-tax-before-"
"credits support in the SOI under-$1 AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.under_1.income_tax_before_credits_amount": (
"Current 2024 base microdata have zero income-tax-before-credits "
"amount support in the SOI under-$1 AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.under_1.income_tax_liability_returns": (
"Current 2024 base microdata have zero positive income-tax-liability "
"support in the SOI under-$1 AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.under_1.income_tax_liability_amount": (
"Current 2024 base microdata have zero income-tax-liability amount "
"support in the SOI under-$1 AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.under_1.qbi_claims": (
"Current 2024 base microdata have zero positive qualified business "
"income deduction support in this SOI AGI bin."
Expand Down Expand Up @@ -326,6 +434,14 @@
"Current-law PolicyEngine-US refundable CTC amount support is zero in "
"this high-income SOI AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.500k_to_1m.medical_dental_expense_returns": (
"Current 2024 base microdata have zero positive medical-expense "
"deduction support in this SOI AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.500k_to_1m.medical_dental_expense_amount": (
"Current 2024 base microdata have zero medical-expense deduction "
"amount support in this SOI AGI bin."
),
"irs_soi.ty2022.historic_table_2.us.1m_plus.medical_dental_expense_returns": (
"Current 2024 base microdata have zero positive medical-expense "
"deduction support in this SOI AGI bin."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def test_aca_source_runtime_refreshes_degenerate_release_inputs(monkeypatch) ->
{
"tax_unit_id": np.asarray([10, 20], dtype="int64"),
"stable_tax_unit_draw": [0.1, 0.2],
"takes_up_aca_if_eligible": [True, True],
"takes_up_aca_if_eligible": [False, False],
"selected_marketplace_plan_benchmark_ratio": [1.0, 1.0],
}
),
Expand All @@ -395,7 +395,7 @@ def test_aca_source_runtime_refreshes_degenerate_release_inputs(monkeypatch) ->
name="cms_aca.oep2024.state_marketplace.al.aptc_recipients",
entity="household",
measure="takes_up_aca_if_eligible",
value=2.0,
value=3.0,
source="CMS Marketplace OEP",
family="cms_aca",
metadata={"target_role": "aca_ptc_recipients", "state_fips": "01"},
Expand All @@ -407,7 +407,8 @@ def test_aca_source_runtime_refreshes_degenerate_release_inputs(monkeypatch) ->
"health_insurance_premiums_without_medicare_part_b": np.asarray(
[400.0, 1200.0]
),
"assigned_aca_ptc": np.asarray([100.0, 0.0]),
"assigned_aca_ptc": np.asarray([0.0, 0.0]),
"aca_ptc": np.asarray([100.0, 0.0]),
"slcsp": np.asarray([1000.0, 1000.0]),
}

Expand Down
54 changes: 43 additions & 11 deletions packages/populace-build/tests/test_us_fiscal_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,61 @@ def test_us_fiscal_reference_selectors_are_unique_on_synthetic_fact_surface() ->


def test_zero_support_ledger_facts_are_reviewed_exclusions() -> None:
assert len(US_FISCAL_TARGET_SUPPORT_EXCLUSIONS) == 11
assert len(US_FISCAL_TARGET_SUPPORT_EXCLUSIONS) == 40
assert all(
source_record_id.startswith(("census_stc.", "irs_soi."))
source_record_id.startswith(("census_stc.", "hhs_acf_tanf.", "irs_soi."))
for source_record_id in US_FISCAL_TARGET_SUPPORT_EXCLUSIONS
)
assert all(US_FISCAL_TARGET_SUPPORT_EXCLUSIONS.values())


def test_reviewed_zero_support_facts_are_not_active_targets() -> None:
excluded_source_record_id = (
"hhs_acf_tanf.fy2024.cash_assistance.ar."
"basic_assistance_excluding_relative_foster_care_and_adoption_guardianship."
"all_funds"
)
control_source_record_id = (
"hhs_acf_tanf.fy2024.cash_assistance.ca."
"basic_assistance_excluding_relative_foster_care_and_adoption_guardianship."
"all_funds"
)
facts = [
{"lineage": {"source_record_id": source_record_id}}
for source_record_id in US_FISCAL_TARGET_SUPPORT_EXCLUSIONS
*packaged_reference_facts(),
_dynamic_ledger_fact(
source_record_id=excluded_source_record_id,
source_name="hhs_acf_tanf",
measure_id="all_funds",
value=123_000_000,
geography_level="state",
geography_id="0400000US05",
groupby_value_id="ar",
),
_dynamic_ledger_fact(
source_record_id=control_source_record_id,
source_name="hhs_acf_tanf",
measure_id="all_funds",
value=456_000_000,
geography_level="state",
geography_id="0400000US06",
groupby_value_id="ca",
),
]
facts.extend(
_ledger_fact_for_reference(reference, value=index + 1)
for index, reference in enumerate(US_FISCAL_TARGET_REFERENCES)
)

registry = compile_us_fiscal_target_registry(facts)

names = {spec.name for spec in registry.specs}
assert len(registry) == len(US_FISCAL_TARGET_REFERENCES)
assert names.isdisjoint(US_FISCAL_TARGET_SUPPORT_EXCLUSIONS)
by_source_record_id = {
spec.metadata["ledger_source_record_id"]: spec for spec in registry.specs
}
assert excluded_source_record_id in US_FISCAL_TARGET_SUPPORT_EXCLUSIONS
assert excluded_source_record_id not in by_source_record_id
assert control_source_record_id in by_source_record_id
control = by_source_record_id[control_source_record_id]
assert control.family == "hhs_acf_tanf"
assert control.metadata["target_role"] == "tanf_total"
assert control.metadata["base_variable"] == "tanf"
assert control.metadata["state_fips"] == "06"
assert control.value == 456_000_000


def test_jct_tax_expenditure_references_are_simple_income_tax_reforms() -> None:
Expand Down
20 changes: 13 additions & 7 deletions tools/build_us_fiscal_refresh_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ def _aca_source_tax_unit_table(
)
> 0
)
# Source-runtime support must ignore pre-refresh take-up flags:
# assigned_aca_ptc is aca_ptc multiplied by takes_up_aca_if_eligible.
potential_aca_ptc = _calculate_array(
simulation,
"aca_ptc",
map_to="tax_unit",
)
has_potential_ptc = potential_aca_ptc > 0
if has_person_count_targets:
eligible_people = (
_calculate_array(
Expand All @@ -503,20 +511,18 @@ def _aca_source_tax_unit_table(
frame,
person_filter=eligible_people,
)
tax_unit["is_aca_ptc_eligible"] = tax_unit["tax_unit_weight"] > 0
tax_unit["is_aca_ptc_eligible"] = (
tax_unit["tax_unit_weight"] > 0
) & has_potential_ptc
else:
tax_unit["tax_unit_weight"] = frame.weights_for("household").values[positions]
tax_unit["is_aca_ptc_eligible"] = is_aca_ptc_eligible
tax_unit["is_aca_ptc_eligible"] = is_aca_ptc_eligible & has_potential_ptc
tax_unit["health_insurance_premiums_without_medicare_part_b"] = _calculate_array(
simulation,
"health_insurance_premiums_without_medicare_part_b",
map_to="tax_unit",
)
tax_unit["assigned_aca_ptc"] = _calculate_array(
simulation,
"assigned_aca_ptc",
map_to="tax_unit",
)
tax_unit["assigned_aca_ptc"] = potential_aca_ptc
tax_unit["slcsp"] = _calculate_array(simulation, "slcsp", map_to="tax_unit")
return _with_state_take_up_rates(tax_unit, target_tables)

Expand Down
Loading