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
1 change: 1 addition & 0 deletions changelog.d/fix-reform-build-failures.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set the default calculation and input year of `Simulation` to 2026, keep `Microsimulation` on its dataset's base year, and check structural reforms from 2024 through 2033 by default.
1 change: 1 addition & 0 deletions changelog.d/fix-reform-build-failures.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix state EITC and Utah HB210 Substitute 2 structural reforms that failed to build in a Simulation.
2 changes: 1 addition & 1 deletion docs/usage/microsimulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Known limitations, which callers avoid by supplying `marital_units`:
formulas run again in any year without a role input. So a calculation for
another year can give roles the units don't match. For example, a
grandchild's undated `is_tax_unit_spouse: false` lands in the default input
year (2024), so the grandparents get their own units, while a 2026
year (2026), so the grandparents get their own units, while a 2025
calculation still makes them head and spouse.

These rules apply to Python household simulations and entity-form YAML tests,
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/structural_reform_dating.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"\"Structural\" reforms are those reforms that modify not only set values in the tax-benefit system, but also the formulas used to calculate taxes and benefits. These are typcially larger, more involved reforms that require custom coding.\n",
"\n",
"Due to the current limitations of the `Microsimulation` class, a code patch is required when running structural reforms with parameters that begin at any date other than January 1st of the current year. \n",
"Most structural reforms are found by checking their parameters on January 1 of ten consecutive years from `start_instant`, which defaults to January 1, 2024. Some reforms check only `start_instant` itself. A code patch is required when a reform's parameters begin outside the dates it checks. \n",
"\n",
"For example, the code cell below illustrates a standard way to instantiating a structural reform, without the patch, when simulating in 2024:"
]
Expand Down Expand Up @@ -69,7 +69,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The cell below shows a series of reforms that begin in 2026, later than the current year. To effectively handle this case, we need to add an argument to the `Microsimulation` classes that we call. \n",
"The cell below shows a series of reforms that begin in 2026. To start the check on that date, which reforms that check a single date require, we add an argument to the `Microsimulation` classes that we call. \n",
"\n",
"This argument, called `start_instant`, should be set to the same date as the start of the reforms, in ISO date format. In the case of the example below, this is `2026-01-01`, so our altered call to `Microsimulation` looks like:\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/data/dataset_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# spm_unit, family, marital_unit are optional and default to empty.
_REQUIRED_ENTITIES = ("person", "household", "tax_unit")

# Sync with CURRENT_YEAR in system.py
# The default dataset's base year, which does not follow CURRENT_YEAR.
_DEFAULT_TIME_PERIOD = 2024


Expand Down
1 change: 1 addition & 0 deletions policyengine_us/model_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from policyengine_core.model_api import *
from policyengine_us.entities import *
from policyengine_us.tools.general import *
from policyengine_us.tools.parameters import STRUCTURAL_REFORM_CHECK_YEARS
from pathlib import Path
from policyengine_us.typing import *
import warnings
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/aca/aca_ptc_700_fpl_cliff.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def create_aca_ptc_700_fpl_cliff_reform(parameters, period, bypass: bool = False
p = parameters.gov.contrib.aca.ptc_700_fpl_cliff
current_period = period_(period)

# Check if reform is active within a 5-year lookahead window
# Check if reform is active within the lookahead window
reform_active = False
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/aca/aca_ptc_additional_bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def create_aca_ptc_additional_bracket_reform(parameters, period, bypass: bool =
p = parameters.gov.contrib.aca.ptc_additional_bracket
current_period = period_(period)

# Check if reform is active within a 5-year lookahead window
# Check if reform is active within the lookahead window
# This allows the reform to be selected in the web app interface
# even if it's scheduled to start in a future year
reform_active = False
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/aca/aca_ptc_minimum_premium.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def create_aca_ptc_minimum_premium_reform(parameters, period, bypass: bool = Fal
p = parameters.gov.contrib.aca.minimum_premium
current_period = period_(period)

# Check if reform is active within a 5-year lookahead window
# Check if reform is active within the lookahead window
reform_active = False
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/aca/aca_ptc_simplified_bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def create_aca_ptc_simplified_bracket_reform(parameters, period, bypass: bool =
p = parameters.gov.contrib.aca.ptc_simplified_bracket
current_period = period_(period)

# Check if reform is active within a 5-year lookahead window
# Check if reform is active within the lookahead window
# This allows the reform to be selected in the web app interface
# even if it's scheduled to start in a future year
reform_active = False
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def create_additional_tax_bracket_reform(parameters, period, bypass: bool = Fals
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def create_cdcc_single_parent_work_requirement_reform(

p = parameters.gov.contrib.cdcc.single_parent_work_requirement

# Check if reform is active in current period or next 5 years
# Check if reform is active in the lookahead window
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def create_afa_other_dependent_credit_reform(parameters, period, bypass: bool =
reform_active = False
current_period = period_(period)

for i in range(10):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p.in_effect(current_period):
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def create_american_family_act_with_baby_bonus_reform(
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).baby_bonus > 0:
reform_active = True
break
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/congress/golden/fisc_act.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def create_fisc_act_reform(parameters, period, bypass: bool = False):
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_american_worker_rebate_act_reform(parameters, period, bypass: bool =
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def create_working_parents_tax_relief_act_reform(
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def create_remove_head_of_household_reform(parameters, period, bypass: bool = Fa
if bypass:
return create_remove_head_of_household()

# Look ahead for the next five years
# Check each year of the lookahead window
p = parameters.gov.contrib.congress.romney.family_security_act
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).remove_head_of_household:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ def create_family_security_act_2024_ctc_reform(
if bypass:
return create_family_security_act_2024_ctc()

# Look ahead for the next five years
# Check each year of the lookahead window
p = parameters.gov.contrib.congress.romney.family_security_act_2_0.ctc
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).apply_ctc_structure:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def create_family_security_act_2024_eitc_reform(
if bypass:
return create_family_security_act_2024_eitc()

# Look ahead for the next five years
# Check each year of the lookahead window
p = parameters.gov.contrib.congress.romney.family_security_act_2_0.eitc
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).apply_eitc_structure:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def create_end_child_poverty_act_reform(parameters, period, bypass: bool = False
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).end_child_poverty_act.in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def create_watca_reform(parameters, period, bypass: bool = False):
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/congress/wyden_smith/ctc_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def create_ctc_expansion_reform(parameters, period, bypass: bool = False):
if bypass:
return create_ctc_expansion()

# Look ahead for the next five years
# Check each year of the lookahead window

p = parameters.gov.contrib.congress.wyden_smith

reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).actc_lookback or p(current_period).per_child_actc_phase_in:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/crfb/agi_surtax.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def create_agi_surtax_reform(parameters, period, bypass: bool = False):
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
# If in any of the next five years, the boolean is true,
# If in any year of the lookahead window, the boolean is true,
# set the boolean reform_active to true, and stop the check,
# i.e., assume the reform is active in all subsequent years.
reform_active = True
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/crfb/non_refundable_ss_credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ def create_non_refundable_ss_credit_reform(parameters, period, bypass: bool = Fa
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
# If in any of the next five years, the boolean is true,
# If in any year of the lookahead window, the boolean is true,
# set the boolean reform_active to true, and stop the check,
# i.e., assume the reform is active in all subsequent years.
reform_active = True
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/crfb/senior_deduction_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_senior_deduction_extension_reform(parameters, period, bypass: bool =
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).applies:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/crfb/tax_employer_medicare_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def create_tax_employer_medicare_tax_reform(parameters, period, bypass: bool = F
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
# If in any of the next five years, the boolean is true,
# If in any year of the lookahead window, the boolean is true,
# set the boolean reform_active to true, and stop the check,
# i.e., assume the reform is active in all subsequent years.
reform_active = True
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/crfb/tax_employer_payroll_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def create_tax_employer_payroll_tax_reform(parameters, period, bypass: bool = Fa
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
# If in any of the next five years, the boolean is true,
# If in any year of the lookahead window, the boolean is true,
# set the boolean reform_active to true, and stop the check,
# i.e., assume the reform is active in all subsequent years.
reform_active = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def create_tax_employer_social_security_tax_reform(
current_period = period_(period)
reform_active = False

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if parameter(current_period).in_effect:
# If in any of the next five years, the boolean is true,
# If in any year of the lookahead window, the boolean is true,
# set the boolean reform_active to true, and stop the check,
# i.e., assume the reform is active in all subsequent years.
reform_active = True
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/ctc/ctc_additional_bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_ctc_additional_bracket_reform(parameters, period, bypass: bool = Fals
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/ctc/ctc_linear_phase_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create_ctc_linear_phase_out_reform(parameters, period, bypass: bool = False)
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def create_ctc_minimum_refundable_amount_reform(

reform_active = False
current_period = period_(period)
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/ctc/ctc_per_child_phase_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_ctc_per_child_phase_in_reform(parameters, period, bypass: bool = Fals

reform_active = False
current_period = period_(period)
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/ctc/ctc_per_child_phase_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def create_ctc_per_child_phase_out_reform(parameters, period, bypass: bool = Fal

reform_active = False
current_period = period_(period)
for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_limit_salt_deduction_to_property_taxes_reform(
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).limit_salt_deduction_to_property_taxes:
reform_active = True
break
Expand Down
2 changes: 1 addition & 1 deletion policyengine_us/reforms/eitc/streamlined_eitc.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_streamlined_eitc_reform(parameters, period, bypass: bool = False):
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
4 changes: 2 additions & 2 deletions policyengine_us/reforms/local/ny/mamdani_income_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def formula(tax_unit, period, parameters):
taxable_income = tax_unit("nyc_taxable_income", period)
p = parameters(period).gov.local.ny.mamdani_income_tax
# The factory installs the reform for the whole simulation when
# in_effect is true on January 1 of any of the five years from the
# in_effect is true on January 1 of any year checked from the
# simulation's start instant, so gate each period on its own
# in_effect value.
return where(p.in_effect, p.rate.calc(taxable_income), 0)
Expand Down Expand Up @@ -70,7 +70,7 @@ def create_nyc_mamdani_income_tax_reform(parameters, period, bypass: bool = Fals
reform_active = False
current_period = period_(period)

for i in range(5):
for i in range(STRUCTURAL_REFORM_CHECK_YEARS):
if p(current_period).in_effect:
reform_active = True
break
Expand Down
Loading
Loading