From 582af67588e533b2159fa7fbcc422e1b618eeccf Mon Sep 17 00:00:00 2001 From: Martin Holmer Date: Fri, 3 Nov 2023 16:12:35 -0400 Subject: [PATCH] Finish elimination of taxcalc-related variables (#3226) * Remove unused tax_unit_net_capital_gains alias for c01000 * Rename c23650 variable to net_capital_gains * Relocate net_capital_gains variable * Rename c01000 variable to loss_limited_net_capital_gains * Move tax_unit_is_joint variable to own module * Relocate loss_limited_net_capital_gains.py module * Add capital_gains/loss_limit.yaml parameter and use it in formula * Relocate/rename hasqdivltcg variable as has_qdiv_or_ltcg * Remove taxcalc variable sep * Rename k1bx14 to s_corp_self_employment_income * Add adjusted_earnings variable (formerly earned) * Add filer_adjusted_earnings variable (formerly filer_earned) * Use new (filer_)adjusted_earnings variables in formulas and tests * Add changelog entry * Eliminate use of dsi alias variables * Move IL unit tests to more consistent directory location * Update changelog_entry.yaml --------- Co-authored-by: Max Ghenis --- changelog_entry.yaml | 10 +++ .../gov/irs/capital_gains/loss_limit.yaml | 16 ++++ .../income/exemption/phase_out/step_size.yaml | 2 +- .../gov/irs/investment/income/sources.yaml | 2 +- policyengine_us/reforms/winship.py | 16 ++-- .../gov/irs/credits/cdcc/head_earned.yaml | 2 +- .../gov/irs/credits/cdcc/spouse_earned.yaml | 4 +- .../taxable_self_employment_income.yaml | 6 +- .../net_investment_income_tax.yaml | 8 +- .../income/credits/young_child/ca_yctc.yaml | 10 +-- .../food_excise/hi_food_excise_credit.yaml | 16 ++-- .../hi_lihrtc_eligible.yaml | 8 +- .../income}/credits/il_eitc.yaml | 0 .../il_k12_education_expense_credit.yaml | 0 .../credits/il_property_tax_credit.yaml | 0 .../exemptions/il_aged_blind_exemption.yaml | 0 .../exemptions/il_dependent_exemption.yaml | 0 .../exemptions/il_is_exemption_eligible.yaml | 0 ...personal_exemption_eligibility_status.yaml | 32 +++---- .../income}/income/il_base_income.yaml | 0 .../income}/income/il_taxable_income.yaml | 0 ...come_tax_before_nonrefundable_credits.yaml | 0 ..._income_tax_before_refundable_credits.yaml | 0 .../income}/taxes/il_use_tax.yaml | 0 ...me_sales_tax_fairness_credit_eligible.yaml | 6 +- .../tax/income/exemptions/mi_exemptions.yaml | 6 +- .../gov/states/mn/tax/income/mn_wfc.yaml | 8 +- .../credits/eitc/nj_eitc_income_eligible.yaml | 2 +- .../income/credits/cdcc/nm_cdcc_eligible.yaml | 22 ++--- .../credits/nm_medical_expense_credit.yaml | 12 +-- ...ction_for_certain_dependents_eligible.yaml | 6 +- .../2021_income/nm_2021_income_rebate.yaml | 10 +-- .../nm_additional_2021_income_rebate.yaml | 14 ++-- .../nm_supplemental_2021_income_rebate.yaml | 14 ++-- .../standard/or_standard_deduction.yaml | 6 +- .../exemptions/vt_personal_exemptions.yaml | 40 ++++----- .../credits/working_families_tax_credit.yaml | 4 +- .../tools/taxcalc/variable_mapping.yaml | 4 +- .../gov/irs/credits/cdcc/head_earned.py | 6 +- .../gov/irs/credits/cdcc/spouse_earned.py | 6 +- .../credits/earned_income/eitc_phased_in.py | 4 +- .../credits/earned_income/eitc_reduction.py | 7 +- .../eitc_relevant_investment_income.py | 9 +- .../gov/irs/income/adjusted_earnings.py | 18 ++++ .../gov/irs/income/filer_adjusted_earnings.py | 12 +++ .../irs_gross_income/has_qdiv_or_ltcg.py | 25 ++++++ .../loss_limited_net_capital_gains.py | 16 ++++ .../basic_standard_deduction.py | 8 +- .../federal_income/alternative_minimum_tax.py | 17 ++-- .../federal_income/capital_gains/dwks10.py | 4 +- .../federal_income/capital_gains/dwks13.py | 2 +- .../federal_income/capital_gains/dwks14.py | 2 +- .../federal_income/capital_gains/dwks19.py | 2 +- .../tax/federal_income/capital_gains/dwks9.py | 4 +- .../taxable_self_employment_income.py | 12 ++- .../gov/irs/tax_unit/tax_unit_is_joint.py | 13 +++ .../variables/gov/irs/taxcalc/outputs.py | 83 ------------------- .../variables/gov/irs/taxcalc/sources.py | 51 ------------ .../income/credits/earned_income/ca_eitc.py | 2 +- .../tax/income/credits/young_child/ca_yctc.py | 2 +- .../food_excise/hi_food_excise_credit.py | 7 +- ...r_low_income_household_renters_eligible.py | 4 +- ...l_personal_exemption_eligibility_status.py | 17 ++-- .../credits/earned_income_credit/in_eitc.py | 2 +- .../me_sales_tax_fairness_credit_eligible.py | 4 +- .../mi/tax/income/exemptions/mi_exemptions.py | 15 ++-- .../states/mn/tax/income/credits/mn_wfc.py | 2 +- .../credits/eitc/nj_eitc_income_eligible.py | 9 +- .../income/credits/cdcc/nm_cdcc_eligible.py | 4 +- .../credits/nm_medical_expense_credit.py | 13 ++- ...duction_for_certain_dependents_eligible.py | 8 +- .../2021_rebate/nm_2021_income_rebate.py | 16 ++-- .../nm_additional_2021_income_rebate.py | 10 +-- .../nm_supplemental_2021_income_rebate.py | 10 +-- .../deductions/ny_standard_deduction.py | 2 +- .../deductions/or_standard_deduction.py | 6 +- .../exemptions/vt_personal_exemptions.py | 16 ++-- .../credits/wa_working_families_tax_credit.py | 4 +- ...{dsi.py => head_is_dependent_elsewhere.py} | 7 +- ...se.py => spouse_is_dependent_elsewhere.py} | 7 +- .../s_corp_self_employment_income.py | 9 ++ .../income/tax_unit/net_capital_gains.py | 10 +++ 82 files changed, 370 insertions(+), 403 deletions(-) create mode 100644 policyengine_us/parameters/gov/irs/capital_gains/loss_limit.yaml rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/credits/il_eitc.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/credits/il_k12_education_expense_credit.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/credits/il_property_tax_credit.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/exemptions/il_aged_blind_exemption.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/exemptions/il_dependent_exemption.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/exemptions/il_is_exemption_eligible.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/exemptions/il_personal_exemption_eligibility_status.yaml (81%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/income/il_base_income.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/income/il_taxable_income.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/taxes/il_income_tax_before_nonrefundable_credits.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/taxes/il_income_tax_before_refundable_credits.yaml (100%) rename policyengine_us/tests/policy/baseline/gov/states/il/{income_tax => tax/income}/taxes/il_use_tax.yaml (100%) create mode 100644 policyengine_us/variables/gov/irs/income/adjusted_earnings.py create mode 100644 policyengine_us/variables/gov/irs/income/filer_adjusted_earnings.py create mode 100644 policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/has_qdiv_or_ltcg.py create mode 100644 policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/loss_limited_net_capital_gains.py create mode 100644 policyengine_us/variables/gov/irs/tax_unit/tax_unit_is_joint.py delete mode 100644 policyengine_us/variables/gov/irs/taxcalc/outputs.py delete mode 100644 policyengine_us/variables/gov/irs/taxcalc/sources.py rename policyengine_us/variables/household/demographic/tax_unit/{dsi.py => head_is_dependent_elsewhere.py} (59%) rename policyengine_us/variables/household/demographic/tax_unit/{dsi_spouse.py => spouse_is_dependent_elsewhere.py} (55%) create mode 100644 policyengine_us/variables/household/income/person/self_employment/s_corp_self_employment_income.py create mode 100644 policyengine_us/variables/household/income/tax_unit/net_capital_gains.py diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb2d..082b466b0d0 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,10 @@ +- bump: minor + changes: + added: + - The `net_capital_gains` variable (formerly `c23650`). + - The `gov/irs/capital_gains/loss_limit.yaml` parameter file. + - The `loss_limited_net_capital_gains` variable (formerly `c01000`) that uses the `loss_limit` parameter. + removed: + - Formula code that avoids `sep` variable that had no formula, and therefore, was likely to cause bugs. + changed: + - Rename taxcalc variables to be consistent with this project's coding style and to be in more sensible directory locations. diff --git a/policyengine_us/parameters/gov/irs/capital_gains/loss_limit.yaml b/policyengine_us/parameters/gov/irs/capital_gains/loss_limit.yaml new file mode 100644 index 00000000000..0a71028a5e9 --- /dev/null +++ b/policyengine_us/parameters/gov/irs/capital_gains/loss_limit.yaml @@ -0,0 +1,16 @@ +description: Capital gains loss limit +metadata: + unit: currency-USD + reference: + - title: IRS Topic No. 409, Capital Gains and Losses + href: https://www.irs.gov/taxtopics/tc409 +HEAD_OF_HOUSEHOLD: + 2013-01-01: 3_000 +JOINT: + 2013-01-01: 3_000 +SEPARATE: + 2013-01-01: 1_500 +SINGLE: + 2013-01-01: 3_000 +WIDOW: + 2013-01-01: 3_000 diff --git a/policyengine_us/parameters/gov/irs/income/exemption/phase_out/step_size.yaml b/policyengine_us/parameters/gov/irs/income/exemption/phase_out/step_size.yaml index 793b2de33dd..9b172685b65 100644 --- a/policyengine_us/parameters/gov/irs/income/exemption/phase_out/step_size.yaml +++ b/policyengine_us/parameters/gov/irs/income/exemption/phase_out/step_size.yaml @@ -1,6 +1,6 @@ description: Personal exemption phase-out step size metadata: - unit: /1 + unit: currency-USD reference: - title: 26 U.S. Code ยง 151 - Allowance of deductions for personal exemptions (d)(3)(B) href: https://www.law.cornell.edu/uscode/text/26/151#d_3_B diff --git a/policyengine_us/parameters/gov/irs/investment/income/sources.yaml b/policyengine_us/parameters/gov/irs/investment/income/sources.yaml index 949c888b3ef..782e0ad63f2 100644 --- a/policyengine_us/parameters/gov/irs/investment/income/sources.yaml +++ b/policyengine_us/parameters/gov/irs/investment/income/sources.yaml @@ -4,7 +4,7 @@ values: - taxable_interest_income - dividend_income - rental_income - - c01000 # Loss-limited capital gains. + - loss_limited_net_capital_gains metadata: unit: currency-USD label: net investment income sources diff --git a/policyengine_us/reforms/winship.py b/policyengine_us/reforms/winship.py index 4978d45db47..5ef868eb83e 100644 --- a/policyengine_us/reforms/winship.py +++ b/policyengine_us/reforms/winship.py @@ -8,8 +8,8 @@ def create_eitc_winship_reform(parameters, period, bypass=False): ): return None - # Compute EITC under filer_earned = tax_unit_head_earned - # Then compute EITC under filer_earned = tax_unit_spouse_earned + # Compute EITC under filer_adj_earnings = filer head adj earnings + # Then compute EITC under filer_adj_earnings = filer spouse adj earnings # Then set EITC = sum of the two class original_eitc(Variable): @@ -40,18 +40,18 @@ def formula(tax_unit, period, parameters): person = tax_unit.members simulation = tax_unit.simulation agi = tax_unit("adjusted_gross_income", period) - earned_income = person("earned", period) + adj_earnings = person("adjusted_earnings", period) is_head = person("is_tax_unit_head", period) is_spouse = person("is_tax_unit_spouse", period) - filer_earned_head_only = tax_unit.sum(earned_income * is_head) - filer_earned_spouse_only = tax_unit.sum(earned_income * is_spouse) + filer_earned_head_only = tax_unit.sum(adj_earnings * is_head) + filer_earned_spouse_only = tax_unit.sum(adj_earnings * is_spouse) head_only_branch = simulation.get_branch("head_only") head_only_branch.set_input( - "filer_earned", period, filer_earned_head_only + "filer_adjusted_earnings", period, filer_earned_head_only ) - # Phase out with respect to individual earned income, instead of AGI. + # Phase out with respect to individual earnings instead of AGI head_only_branch.set_input( "adjusted_gross_income", period, filer_earned_head_only ) @@ -59,7 +59,7 @@ def formula(tax_unit, period, parameters): spouse_only_branch = simulation.get_branch("spouse_only") spouse_only_branch.set_input( - "filer_earned", period, filer_earned_spouse_only + "filer_adjusted_earnings", period, filer_earned_spouse_only ) spouse_only_branch.set_input( "adjusted_gross_income", period, filer_earned_spouse_only diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/head_earned.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/head_earned.yaml index d57cde0763f..96cce24617a 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/head_earned.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/head_earned.yaml @@ -2,6 +2,6 @@ period: 2018 input: is_tax_unit_head: true - earned: 1 + adjusted_earnings: 1 output: head_earned: 1 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/spouse_earned.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/spouse_earned.yaml index 30e713d8e9f..b54b753e91c 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/spouse_earned.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/spouse_earned.yaml @@ -4,10 +4,10 @@ people: head: is_tax_unit_head: true - earned: 1 + adjusted_earnings: 1 spouse: is_tax_unit_spouse: true - earned: 2 + adjusted_earnings: 2 tax_units: tax_unit: members: [head, spouse] diff --git a/policyengine_us/tests/policy/baseline/gov/irs/self_employment/taxable_self_employment_income.yaml b/policyengine_us/tests/policy/baseline/gov/irs/self_employment/taxable_self_employment_income.yaml index 9af2c1e0098..c5762f3da11 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/self_employment/taxable_self_employment_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/self_employment/taxable_self_employment_income.yaml @@ -6,20 +6,20 @@ - name: Negatives also produce zero. period: 2022 input: - sey: -1 + self_employment_income: -1 output: taxable_self_employment_income: 0 - name: Otherwise, half of self-employment taxes are deducted. period: 2022 input: - sey: 100_000 + self_employment_income: 100_000 output: taxable_self_employment_income: 92_350 - name: Zero if less than $400. period: 2022 input: - sey: 399 + self_employment_income: 399 output: taxable_self_employment_income: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/net_investment_income_tax.yaml b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/net_investment_income_tax.yaml index 04f2a15819b..662c45e3efd 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/net_investment_income_tax.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/net_investment_income_tax.yaml @@ -3,7 +3,7 @@ input: taxable_interest_income: 0 dividend_income: 0 - c01000: 0 + loss_limited_net_capital_gains: 0 rental_income: 0 filing_status: SINGLE output: @@ -14,7 +14,7 @@ input: taxable_interest_income: 0 dividend_income: 0 - c01000: 0 + loss_limited_net_capital_gains: 0 rental_income: 199_000 filing_status: SINGLE output: @@ -25,7 +25,7 @@ input: taxable_interest_income: 0 dividend_income: 0 - c01000: 0 + loss_limited_net_capital_gains: 0 adjusted_gross_income: 205_000 rental_income: 205_000 filing_status: SINGLE @@ -37,7 +37,7 @@ input: taxable_interest_income: 0 dividend_income: 0 - c01000: 0 + loss_limited_net_capital_gains: 0 adjusted_gross_income: 900_000 rental_income: 900_000 filing_status: SINGLE diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/young_child/ca_yctc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/young_child/ca_yctc.yaml index ffd60017cb4..c26330a541e 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/young_child/ca_yctc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/young_child/ca_yctc.yaml @@ -9,7 +9,7 @@ tax_units: tax_unit: members: [parent, child] - filer_earned: 25_000 + filer_adjusted_earnings: 25_000 ca_eitc: 1 households: household: @@ -29,7 +29,7 @@ tax_units: tax_unit: members: [parent, child] - filer_earned: 25_100 + filer_adjusted_earnings: 25_100 ca_eitc: 1 households: household: @@ -49,7 +49,7 @@ tax_units: tax_unit: members: [parent, child] - filer_earned: 25_100 + filer_adjusted_earnings: 25_100 ca_eitc: 1 households: household: @@ -90,7 +90,7 @@ tax_units: tax_unit: members: [parent, child] - filer_earned: 30_000 + filer_adjusted_earnings: 30_000 ca_eitc: 1 households: household: @@ -113,7 +113,7 @@ tax_units: tax_unit: members: [parent, child1, child2] - filer_earned: 25_100 + filer_adjusted_earnings: 25_100 ca_eitc: 1 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.yaml index 5b15dcf6e2f..60455ce0b98 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.yaml @@ -20,7 +20,7 @@ adjusted_gross_income: 4_000 filing_status: SINGLE exemptions_count: 3 - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2, person3] @@ -50,7 +50,7 @@ adjusted_gross_income: 4_000 filing_status: SINGLE exemptions_count: 3 - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2, person3] @@ -81,7 +81,7 @@ adjusted_gross_income: 4_000 filing_status: SINGLE exemptions_count: 2 - dsi: true + head_is_dependent_elsewhere: true households: household: members: [person1, person2] @@ -111,7 +111,7 @@ adjusted_gross_income: 35_000 filing_status: SINGLE exemptions_count: 3 - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2, person3] @@ -141,7 +141,7 @@ adjusted_gross_income: 35_000 filing_status: JOINT exemptions_count: 3 - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2, person3] @@ -171,7 +171,7 @@ adjusted_gross_income: 55_000 filing_status: JOINT exemptions_count: 3 - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2, person3] @@ -197,7 +197,7 @@ members: [person1, person2] adjusted_gross_income: 6_000 filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2] @@ -223,7 +223,7 @@ members: [person1, person2] adjusted_gross_income: 6_000 filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false households: household: members: [person1, person2] diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_lihrtc_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_lihrtc_eligible.yaml index 15a4a27f2c5..f01704c95f1 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_lihrtc_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_lihrtc_eligible.yaml @@ -2,7 +2,7 @@ period: 2021 input: state_code: HI - dsi: false + head_is_dependent_elsewhere: false adjusted_gross_income: 29_000 rent: 1_100 output: @@ -12,7 +12,7 @@ period: 2021 input: state_code: HI - dsi: false + head_is_dependent_elsewhere: false adjusted_gross_income: 31_000 rent: 1_100 output: @@ -22,7 +22,7 @@ period: 2021 input: state_code: HI - dsi: false + head_is_dependent_elsewhere: false adjusted_gross_income: 29_000 rent: 900 output: @@ -32,7 +32,7 @@ period: 2021 input: state_code: HI - dsi: false + head_is_dependent_elsewhere: false adjusted_gross_income: 32_000 rent: 900 output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_eitc.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_eitc.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_eitc.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_eitc.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_k12_education_expense_credit.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_k12_education_expense_credit.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_k12_education_expense_credit.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_k12_education_expense_credit.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_property_tax_credit.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_property_tax_credit.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/credits/il_property_tax_credit.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/credits/il_property_tax_credit.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_aged_blind_exemption.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_aged_blind_exemption.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_aged_blind_exemption.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_aged_blind_exemption.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_dependent_exemption.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_dependent_exemption.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_dependent_exemption.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_dependent_exemption.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_is_exemption_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_is_exemption_eligible.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_is_exemption_eligible.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_is_exemption_eligible.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_personal_exemption_eligibility_status.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.yaml similarity index 81% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_personal_exemption_eligibility_status.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.yaml index 1e30b9272cc..1420b755bf5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/exemptions/il_personal_exemption_eligibility_status.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.yaml @@ -2,8 +2,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: true + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: true il_base_income: 2_000 # Less than $2,375 personal exemption. state_code: IL output: @@ -13,8 +13,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: true + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: true il_base_income: 5_000 # More than $2,375 personal exemption. state_code: IL output: @@ -24,8 +24,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: false il_base_income: 2_000 # Less than $2,375 personal exemption. state_code: IL output: @@ -35,8 +35,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: false il_base_income: 5_000 # More than $2,375 personal exemption. state_code: IL output: @@ -46,8 +46,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: false - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: false + spouse_is_dependent_elsewhere: false il_base_income: 2_000 # Less than $2,375 personal exemption. state_code: IL output: @@ -57,8 +57,8 @@ period: 2021 input: filing_status: JOINT - tax_unit_dependent_elsewhere: false - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: false + spouse_is_dependent_elsewhere: false il_base_income: 5_000 # More than $2,375 personal exemption. state_code: IL output: @@ -68,7 +68,7 @@ period: 2021 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true il_base_income: 2_000 # Less than $2,375 personal exemption. state_code: IL output: @@ -78,7 +78,7 @@ period: 2021 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true il_base_income: 5_000 # More than $2,375 personal exemption. state_code: IL output: @@ -88,7 +88,7 @@ period: 2021 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false il_base_income: 2_000 # Less than $2,375 personal exemption. state_code: IL output: @@ -98,7 +98,7 @@ period: 2021 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false il_base_income: 5_000 # More than $2,375 personal exemption. state_code: IL output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/income/il_base_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/income/il_base_income.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/income/il_base_income.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/income/il_base_income.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/income/il_taxable_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/income/il_taxable_income.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/income/il_taxable_income.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/income/il_taxable_income.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_income_tax_before_nonrefundable_credits.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_income_tax_before_nonrefundable_credits.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_income_tax_before_nonrefundable_credits.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_income_tax_before_nonrefundable_credits.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_income_tax_before_refundable_credits.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_income_tax_before_refundable_credits.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_income_tax_before_refundable_credits.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_income_tax_before_refundable_credits.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_use_tax.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_use_tax.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/il/income_tax/taxes/il_use_tax.yaml rename to policyengine_us/tests/policy/baseline/gov/states/il/tax/income/taxes/il_use_tax.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/credits/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/credits/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.yaml index 88a0ae1ec9e..b3afa273542 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/credits/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/credits/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.yaml @@ -2,7 +2,7 @@ period: 2022 input: state_code: ME - dsi: true + head_is_dependent_elsewhere: true filing_status: JOINT output: me_sales_tax_fairness_credit_eligible: false @@ -11,7 +11,7 @@ period: 2022 input: state_code: ME - dsi: false + head_is_dependent_elsewhere: false filing_status: SINGLE output: me_sales_tax_fairness_credit_eligible: true @@ -20,7 +20,7 @@ period: 2022 input: state_code: ME - dsi: true + head_is_dependent_elsewhere: true filing_status: SEPARATE output: me_sales_tax_fairness_credit_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/mi/tax/income/exemptions/mi_exemptions.yaml b/policyengine_us/tests/policy/baseline/gov/states/mi/tax/income/exemptions/mi_exemptions.yaml index 4ae73154f0b..f2aac20bf66 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mi/tax/income/exemptions/mi_exemptions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mi/tax/income/exemptions/mi_exemptions.yaml @@ -80,7 +80,7 @@ period: 2021 input: tax_unit_size: 1 - dsi: true + head_is_dependent_elsewhere: true filing_status: SINGLE state_code: MI output: @@ -90,7 +90,7 @@ period: 2021 input: tax_unit_size: 1 - dsi: true + head_is_dependent_elsewhere: true filing_status: JOINT state_code: MI output: @@ -100,7 +100,7 @@ period: 2022 input: tax_unit_size: 1 - dsi: true + head_is_dependent_elsewhere: true filing_status: SINGLE state_code: MI output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/mn_wfc.yaml b/policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/mn_wfc.yaml index 6971b31e832..a9c87e4ec05 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/mn_wfc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/mn_wfc.yaml @@ -5,7 +5,7 @@ mn_wfc_eligible: true filing_status: JOINT eitc_child_count: 2 - filer_earned: 20_050 + filer_adjusted_earnings: 20_050 adjusted_gross_income: 20_050 state_code: MN output: # expected output from lookup table in Form M1 instructions @@ -18,7 +18,7 @@ mn_wfc_eligible: true filing_status: HEAD_OF_HOUSEHOLD eitc_child_count: 1 - filer_earned: 30_050 + filer_adjusted_earnings: 30_050 adjusted_gross_income: 30_050 state_code: MN output: # expected output from lookup table in Form M1 instructions @@ -31,7 +31,7 @@ mn_wfc_eligible: true filing_status: JOINT eitc_child_count: 2 - filer_earned: 20_050 + filer_adjusted_earnings: 20_050 adjusted_gross_income: 20_050 state_code: MN output: # expected output from lookup table in Form M1 instructions @@ -44,7 +44,7 @@ mn_wfc_eligible: true filing_status: HEAD_OF_HOUSEHOLD eitc_child_count: 1 - filer_earned: 30_050 + filer_adjusted_earnings: 30_050 adjusted_gross_income: 30_050 state_code: MN output: # expected output from lookup table in Form M1 instructions diff --git a/policyengine_us/tests/policy/baseline/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.yaml index 4ca611ed198..773d57402df 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.yaml @@ -13,7 +13,7 @@ absolute_error_margin: 0 input: adjusted_gross_income: 22_600 - capital_gains: 11_000 + short_term_capital_gains: 11_000 filing_status: JOINT state_code: NJ output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.yaml index 6b2b404f0f5..f879ac92eaa 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.yaml @@ -1,7 +1,7 @@ - name: Is dependent on another return period: 2022 input: - dsi: true + head_is_dependent_elsewhere: true state_code: NM earned_income: 1 is_disabled: false @@ -15,7 +15,7 @@ - name: No earned income period: 2022 input: - dsi: false + head_is_dependent_elsewhere: false state_code: NM earned_income: 0 is_disabled: false @@ -29,7 +29,7 @@ - name: No earned income but disabled - eligible period: 2022 input: - dsi: false + head_is_dependent_elsewhere: false state_code: NM earned_income: 0 is_disabled: true @@ -43,7 +43,7 @@ - name: Over income threshold period: 2022 input: - dsi: false + head_is_dependent_elsewhere: false state_code: NM earned_income: 0 is_disabled: false @@ -57,7 +57,7 @@ - name: Receives tanf period: 2022 input: - dsi: false + head_is_dependent_elsewhere: false state_code: NM earned_income: 0 is_disabled: false @@ -71,7 +71,7 @@ - name: Eligible period: 2022 input: - dsi: false + head_is_dependent_elsewhere: false state_code: NM earned_income: 1 is_disabled: false @@ -101,7 +101,7 @@ tax_units: tax_unit: members: [head, spouse] - dsi: false + head_is_dependent_elsewhere: false filing_status: JOINT nm_modified_gross_income: 30_159 households: @@ -130,7 +130,7 @@ tax_units: tax_unit: members: [head, spouse] - dsi: false + head_is_dependent_elsewhere: false filing_status: JOINT nm_modified_gross_income: 30_159 households: @@ -159,7 +159,7 @@ tax_units: tax_unit: members: [head, spouse] - dsi: false + head_is_dependent_elsewhere: false filing_status: JOINT nm_modified_gross_income: 30_159 households: @@ -188,7 +188,7 @@ tax_units: tax_unit: members: [head, spouse] - dsi: false + head_is_dependent_elsewhere: false filing_status: JOINT nm_modified_gross_income: 30_159 households: @@ -217,7 +217,7 @@ tax_units: tax_unit: members: [head, spouse] - dsi: false + head_is_dependent_elsewhere: false filing_status: JOINT nm_modified_gross_income: 30_159 households: diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/nm_medical_expense_credit.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/nm_medical_expense_credit.yaml index 843468b9277..aa58840788d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/nm_medical_expense_credit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/nm_medical_expense_credit.yaml @@ -4,7 +4,7 @@ state_code: NM age: 64 medical_expense: 30_000 - dsi: false + head_is_dependent_elsewhere: false output: nm_medical_expense_credit: 0 @@ -15,7 +15,7 @@ age: 65 medical_expense: 27_999 filing_status: JOINT - dsi: false + head_is_dependent_elsewhere: false output: nm_medical_expense_credit: 0 @@ -26,7 +26,7 @@ age: 65 medical_expense: 28_000 filing_status: JOINT - dsi: false + head_is_dependent_elsewhere: false output: nm_medical_expense_credit: 2_800 @@ -37,7 +37,7 @@ age: 65 medical_expense: 28_000 filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_medical_expense_credit: 1_400 @@ -48,7 +48,7 @@ age: 65 medical_expense: 40_000 filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false output: nm_medical_expense_credit: 2_800 @@ -59,6 +59,6 @@ age: 65 medical_expense: 40_000 filing_status: SINGLE - dsi: true + head_is_dependent_elsewhere: true output: nm_medical_expense_credit: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.yaml index e3f899084c9..6f65f043918 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.yaml @@ -3,7 +3,7 @@ input: exemptions: 0 state_code: NM - dsi: false + head_is_dependent_elsewhere: false output: nm_deduction_for_certain_dependents_eligible: true @@ -12,7 +12,7 @@ input: exemptions: 1 state_code: NM - dsi: false + head_is_dependent_elsewhere: false output: nm_deduction_for_certain_dependents_eligible: false @@ -22,6 +22,6 @@ input: exemptions: 0 state_code: NM - dsi: true + head_is_dependent_elsewhere: true output: nm_deduction_for_certain_dependents_eligible: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_2021_income_rebate.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_2021_income_rebate.yaml index e6e349fdd8e..596d82cb794 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_2021_income_rebate.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_2021_income_rebate.yaml @@ -4,7 +4,7 @@ state_code: NM adjusted_gross_income: 74_999 filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false output: nm_2021_income_rebate: 250 @@ -14,7 +14,7 @@ state_code: NM adjusted_gross_income: 75_000 filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_2021_income_rebate: 0 @@ -24,7 +24,7 @@ state_code: NM adjusted_gross_income: 149_999 filing_status: JOINT - dsi: false + head_is_dependent_elsewhere: false output: nm_2021_income_rebate: 500 @@ -34,7 +34,7 @@ state_code: NM adjusted_gross_income: 150_000 filing_status: WIDOW - dsi: false + head_is_dependent_elsewhere: false output: nm_2021_income_rebate: 0 @@ -44,6 +44,6 @@ state_code: NM adjusted_gross_income: 149_999 filing_status: JOINT - dsi: true + head_is_dependent_elsewhere: true output: nm_2021_income_rebate: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_additional_2021_income_rebate.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_additional_2021_income_rebate.yaml index 0763f3a90ec..519a3010cc2 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_additional_2021_income_rebate.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_additional_2021_income_rebate.yaml @@ -3,7 +3,7 @@ input: state_code: NM filing_status: JOINT - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 1_000 @@ -12,7 +12,7 @@ input: state_code: NM filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 500 @@ -21,7 +21,7 @@ input: state_code: NM filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 500 @@ -30,7 +30,7 @@ input: state_code: NM filing_status: WIDOW - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 1_000 @@ -39,7 +39,7 @@ input: state_code: NM filing_status: HEAD_OF_HOUSEHOLD - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 1_000 @@ -48,7 +48,7 @@ input: state_code: NM filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_additional_2021_income_rebate: 0 @@ -57,6 +57,6 @@ input: state_code: NM filing_status: SEPARATE - dsi: true + head_is_dependent_elsewhere: true output: nm_additional_2021_income_rebate: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_supplemental_2021_income_rebate.yaml b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_supplemental_2021_income_rebate.yaml index dc7c0bcbab4..7c1818f6fac 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_supplemental_2021_income_rebate.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/rebates/2021_income/nm_supplemental_2021_income_rebate.yaml @@ -3,7 +3,7 @@ input: state_code: NM filing_status: JOINT - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 1_000 @@ -12,7 +12,7 @@ input: state_code: NM filing_status: SINGLE - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 500 @@ -21,7 +21,7 @@ input: state_code: NM filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 0 @@ -30,7 +30,7 @@ input: state_code: NM filing_status: SEPARATE - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 500 @@ -39,7 +39,7 @@ input: state_code: NM filing_status: WIDOW - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 1_000 @@ -48,7 +48,7 @@ input: state_code: NM filing_status: HEAD_OF_HOUSEHOLD - dsi: false + head_is_dependent_elsewhere: false output: nm_supplemental_2021_income_rebate: 1_000 @@ -57,6 +57,6 @@ input: state_code: NM filing_status: HEAD_OF_HOUSEHOLD - dsi: true + head_is_dependent_elsewhere: true output: nm_supplemental_2021_income_rebate: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml index 4ec758e8d26..085503ebd46 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml @@ -68,7 +68,7 @@ state_code: OR filing_status: JOINT age_head: 35 - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true tax_unit_earned_income: 600 output: # $1100 base @@ -80,7 +80,7 @@ state_code: OR filing_status: SINGLE age_head: 35 - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true tax_unit_earned_income: 1_000 output: # $1000 income + $350 addition, below the $2,350 normal standard deduction cap. @@ -92,7 +92,7 @@ state_code: OR filing_status: SINGLE age: 35 - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true tax_unit_earned_income: 1_000 blind_head: true output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.yaml b/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.yaml index 1daf93067ae..cf8221ee344 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.yaml @@ -2,8 +2,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: true + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: true tax_unit_count_dependents: 0 state_code: VT output: @@ -13,8 +13,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: true + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: true tax_unit_count_dependents: 2 state_code: VT output: @@ -24,8 +24,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: false tax_unit_count_dependents: 0 state_code: VT output: @@ -35,8 +35,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: true - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: true + spouse_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: @@ -46,8 +46,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: false - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: false + spouse_is_dependent_elsewhere: false tax_unit_count_dependents: 0 state_code: VT output: @@ -57,8 +57,8 @@ period: 2022 input: filing_status: JOINT - tax_unit_dependent_elsewhere: false - tax_unit_spouse_dependent_elsewhere: false + head_is_dependent_elsewhere: false + spouse_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: @@ -68,7 +68,7 @@ period: 2022 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true tax_unit_count_dependents: 0 state_code: VT output: @@ -78,7 +78,7 @@ period: 2022 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: true + head_is_dependent_elsewhere: true tax_unit_count_dependents: 2 state_code: VT output: @@ -88,7 +88,7 @@ period: 2022 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 0 state_code: VT output: @@ -98,7 +98,7 @@ period: 2022 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: @@ -108,7 +108,7 @@ period: 2022 input: filing_status: SINGLE - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 0 state_code: NY output: @@ -118,7 +118,7 @@ period: 2022 input: filing_status: HEAD_OF_HOUSEHOLD - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: @@ -128,7 +128,7 @@ period: 2021 input: filing_status: HEAD_OF_HOUSEHOLD - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: @@ -138,7 +138,7 @@ period: 2021 input: filing_status: HEAD_OF_HOUSEHOLD - tax_unit_dependent_elsewhere: false + head_is_dependent_elsewhere: false tax_unit_count_dependents: 2 state_code: VT output: diff --git a/policyengine_us/tests/policy/baseline/gov/states/wa/tax/income/credits/working_families_tax_credit.yaml b/policyengine_us/tests/policy/baseline/gov/states/wa/tax/income/credits/working_families_tax_credit.yaml index 3aa48f33253..fc3bad3c12b 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/wa/tax/income/credits/working_families_tax_credit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/wa/tax/income/credits/working_families_tax_credit.yaml @@ -12,7 +12,7 @@ input: state_code: WA eitc: 1 - filer_earned: 0 + filer_adjusted_earnings: 0 eitc_child_count: 0 output: wa_working_families_tax_credit: 300 @@ -23,7 +23,7 @@ input: state_code: WA eitc: 1 - filer_earned: 100_000 + filer_adjusted_earnings: 100_000 eitc_child_count: 3 output: wa_working_families_tax_credit: 0 diff --git a/policyengine_us/tools/taxcalc/variable_mapping.yaml b/policyengine_us/tools/taxcalc/variable_mapping.yaml index e3eafe6448a..7cbbd955a74 100644 --- a/policyengine_us/tools/taxcalc/variable_mapping.yaml +++ b/policyengine_us/tools/taxcalc/variable_mapping.yaml @@ -53,14 +53,14 @@ tax_unit_weight: s006 business_is_qualified: pt_sstb_income w2_wages_from_qualified_business: pt_binc_w2_wages unadjusted_basis_qualified_property: pt_ubia_property -hasqdivltcg: hasqdivltcg +has_qdiv_or_ltcg: hasqdivltcg medical_expense_deduction: c17000 salt_deduction: c18300 interest_deduction: c19200 charitable_deduction: c19700 casualty_loss_deduction: c20500 taxable_income_deductions_if_itemizing: c04470 -tax_unit_dependent_elsewhere: dsi +head_is_dependent_elsewhere: dsi separate_filer_itemizes: midr amt_non_agi_income: cmbtp income_tax_before_refundable_credits: c09200 diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/head_earned.py b/policyengine_us/variables/gov/irs/credits/cdcc/head_earned.py index 149e79892f4..990aef2211d 100644 --- a/policyengine_us/variables/gov/irs/credits/cdcc/head_earned.py +++ b/policyengine_us/variables/gov/irs/credits/cdcc/head_earned.py @@ -4,12 +4,12 @@ class head_earned(Variable): value_type = float entity = TaxUnit - label = "Head's earnings" + label = "Head's adjusted earnings" unit = USD definition_period = YEAR def formula(tax_unit, period, parameters): person = tax_unit.members - earned_income = max_(0, person("earned", period)) + adjusted_earnings = person("adjusted_earnings", period) is_head = person("is_tax_unit_head", period) - return tax_unit.sum(is_head * earned_income) + return tax_unit.sum(is_head * adjusted_earnings) diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/spouse_earned.py b/policyengine_us/variables/gov/irs/credits/cdcc/spouse_earned.py index d85c589abf5..2258be560c1 100644 --- a/policyengine_us/variables/gov/irs/credits/cdcc/spouse_earned.py +++ b/policyengine_us/variables/gov/irs/credits/cdcc/spouse_earned.py @@ -4,12 +4,12 @@ class spouse_earned(Variable): value_type = float entity = TaxUnit - label = "Spouse's earnings" + label = "Spouse's adjusted earnings" unit = USD definition_period = YEAR def formula(tax_unit, period, parameters): person = tax_unit.members - earned_income = max_(0, person("earned", period)) + adjusted_earnings = person("adjusted_earnings", period) is_spouse = person("is_tax_unit_spouse", period) - return tax_unit.sum(is_spouse * earned_income) + return tax_unit.sum(is_spouse * adjusted_earnings) diff --git a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_phased_in.py b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_phased_in.py index 816b577af95..ef6a3615bae 100644 --- a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_phased_in.py +++ b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_phased_in.py @@ -12,6 +12,6 @@ class eitc_phased_in(Variable): def formula(tax_unit, period, parameters): maximum = tax_unit("eitc_maximum", period) phase_in_rate = tax_unit("eitc_phase_in_rate", period) - earned_income = max_(0, tax_unit("filer_earned", period)) - phased_in_amount = earned_income * phase_in_rate + earnings = tax_unit("filer_adjusted_earnings", period) + phased_in_amount = earnings * phase_in_rate return min_(maximum, phased_in_amount) diff --git a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_reduction.py b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_reduction.py index 98c1175d8d8..d0d3dca5f8b 100644 --- a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_reduction.py +++ b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_reduction.py @@ -10,10 +10,9 @@ class eitc_reduction(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/32#a_2" def formula(tax_unit, period, parameters): - earnings = tax_unit("filer_earned", period) - highest_income_variable = max_( - earnings, tax_unit("adjusted_gross_income", period) - ) + earnings = tax_unit("filer_adjusted_earnings", period) + agi = tax_unit("adjusted_gross_income", period) + highest_income_variable = max_(earnings, agi) phase_out_start = tax_unit("eitc_phase_out_start", period) phase_out_rate = tax_unit("eitc_phase_out_rate", period) phase_out_region = max_(0, highest_income_variable - phase_out_start) diff --git a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_relevant_investment_income.py b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_relevant_investment_income.py index 52cfdc22a53..aa2f0f12282 100644 --- a/policyengine_us/variables/gov/irs/credits/earned_income/eitc_relevant_investment_income.py +++ b/policyengine_us/variables/gov/irs/credits/earned_income/eitc_relevant_investment_income.py @@ -9,17 +9,14 @@ class eitc_relevant_investment_income(Variable): definition_period = YEAR def formula(tax_unit, period, parameters): - no_loss_capital_gains = max_( - 0, - add(tax_unit, period, ["capital_gains"]), - ) + no_loss_capital_gains = max_(0, tax_unit("net_capital_gains", period)) return ( add( tax_unit, period, ["net_investment_income", "tax_exempt_interest_income"], ) - # Replace limited-loss capital gains with no-loss capital gains. - - tax_unit("c01000", period) # Limited-loss capital gains. + # replace limited-loss capital gains with no-loss capital gains + - tax_unit("loss_limited_net_capital_gains", period) + no_loss_capital_gains ) diff --git a/policyengine_us/variables/gov/irs/income/adjusted_earnings.py b/policyengine_us/variables/gov/irs/income/adjusted_earnings.py new file mode 100644 index 00000000000..47b55af66c1 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/adjusted_earnings.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class adjusted_earnings(Variable): + value_type = float + entity = Person + definition_period = YEAR + label = "Personal earned income adjusted for self-employment tax" + unit = USD + + def formula(person, period, parameters): + misc = parameters(period).gov.irs.ald.misc + adjustment = ( + (1 - misc.self_emp_tax_adj) + * misc.employer_share + * person("self_employment_tax", period) + ) + return max_(0, person("earned_income", period) - adjustment) diff --git a/policyengine_us/variables/gov/irs/income/filer_adjusted_earnings.py b/policyengine_us/variables/gov/irs/income/filer_adjusted_earnings.py new file mode 100644 index 00000000000..6830b102d53 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/filer_adjusted_earnings.py @@ -0,0 +1,12 @@ +from policyengine_us.model_api import * + + +class filer_adjusted_earnings(Variable): + value_type = float + entity = TaxUnit + definition_period = YEAR + label = "Filer earned income adjusted for self-employment tax" + unit = USD + + def formula(tax_unit, period, parameters): + return tax_unit_non_dep_sum("adjusted_earnings", tax_unit, period) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/has_qdiv_or_ltcg.py b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/has_qdiv_or_ltcg.py new file mode 100644 index 00000000000..4fa9ec37e4d --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/has_qdiv_or_ltcg.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class has_qdiv_or_ltcg(Variable): + value_type = bool + entity = TaxUnit + label = "Has qualified dividends or long-term capital gains" + documentation = "Whether this tax unit has qualified dividend income or long-term capital gains income" + definition_period = YEAR + + def formula(tax_unit, period, parameters): + # negatives amounts cannot offset other income sources + INCOME_SOURCES = [ + "loss_limited_net_capital_gains", + "net_capital_gains", + "long_term_capital_gains", + "non_sch_d_capital_gains", + "qualified_dividend_income", + ] + return np.any( + [ + add(tax_unit, period, [income_source]) > 0 + for income_source in INCOME_SOURCES + ] + ) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/loss_limited_net_capital_gains.py b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/loss_limited_net_capital_gains.py new file mode 100644 index 00000000000..6aabd824a34 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/loss_limited_net_capital_gains.py @@ -0,0 +1,16 @@ +from policyengine_us.model_api import * + + +class loss_limited_net_capital_gains(Variable): + value_type = float + entity = TaxUnit + definition_period = YEAR + label = "Loss-limited net capital gains" + unit = USD + + def formula(tax_unit, period, parameters): + p = parameters(period).gov.irs + filing_status = tax_unit("filing_status", period) + loss_limit = p.capital_gains.loss_limit[filing_status] + net_capital_gains = tax_unit("net_capital_gains", period) + return max_(-loss_limit, net_capital_gains) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py index 3e79190af9d..89131c11c97 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py @@ -13,11 +13,8 @@ def formula(tax_unit, period, parameters): std = parameters(period).gov.irs.deductions.standard filing_status = tax_unit("filing_status", period) separate_filer_itemizes = tax_unit("separate_filer_itemizes", period) - claimed_as_dependent_elsewhere = tax_unit( - "tax_unit_dependent_elsewhere", period - ) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) standard_deduction = std.amount[filing_status] - standard_deduction_if_dependent = min_( standard_deduction, max_( @@ -26,11 +23,10 @@ def formula(tax_unit, period, parameters): std.dependent.amount, ), ) - return select( [ separate_filer_itemizes, - claimed_as_dependent_elsewhere, + dependent_elsewhere, True, ], [ diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/alternative_minimum_tax.py b/policyengine_us/variables/gov/irs/tax/federal_income/alternative_minimum_tax.py index 61d27a8a2e3..a0f533aa8a2 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/alternative_minimum_tax.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/alternative_minimum_tax.py @@ -110,8 +110,7 @@ def formula(tax_unit, period, parameters): ) dwks44 = tax_unit("income_tax_main_rates", period) dwks45 = min_(dwks43, dwks44) - hasqdivltcg = tax_unit("hasqdivltcg", period) - return where(hasqdivltcg, dwks45, dwks44) + return where(tax_unit("has_qdiv_or_ltcg", period), dwks45, dwks44) class alternative_minimum_tax(Variable): @@ -140,15 +139,21 @@ def formula(tax_unit, period, parameters): child = amt.exemption.child young_head = (age_head != 0) & (age_head < child.max_age) no_or_young_spouse = tax_unit("age_spouse", period) < child.max_age + adj_earnings = tax_unit("filer_adjusted_earnings", period) line29 = where( young_head & no_or_young_spouse, - min_(line29, tax_unit("filer_earned", period) + child.amount), + min_(line29, adj_earnings + child.amount), line29, ) line30 = max_(0, amt_income - line29) brackets = amt.brackets - amount_over_threshold = line30 - brackets.thresholds["1"] / tax_unit( - "sep", period + bracket_fraction = where( + filing_status == filing_status.possible_values.SEPARATE, + 0.5, + 1.0, + ) + amount_over_threshold = ( + line30 - brackets.thresholds["1"] * bracket_fraction ) line3163 = brackets.rates["1"] * line30 + brackets.rates["2"] * max_( 0, amount_over_threshold @@ -184,7 +189,7 @@ def formula(tax_unit, period, parameters): line40 = min_(line30, line39) line41 = max_(0, line30 - line40) amount_over_threshold = max_( - 0, line41 - amt.brackets.thresholds["1"] / tax_unit("sep", period) + 0, line41 - amt.brackets.thresholds["1"] * bracket_fraction ) line42 = ( amt.brackets.rates["1"] * line41 diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks10.py b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks10.py index 05b416158c4..321f6d7bbcb 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks10.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks10.py @@ -21,11 +21,11 @@ def formula(tax_unit, period, parameters): period, ["long_term_capital_gains", "qualified_dividend_income"], ), - tax_unit("c23650", period), + tax_unit("net_capital_gains", period), ), ) + add(tax_unit, period, ["non_sch_d_capital_gains"]) return where( - tax_unit("hasqdivltcg", period), + tax_unit("has_qdiv_or_ltcg", period), dwks10_if_gains, dwks10_if_no_gains, ) diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks13.py b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks13.py index 637d70b6f99..388176b984a 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks13.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks13.py @@ -19,4 +19,4 @@ def formula(tax_unit, period, parameters): dwks9 = tax_unit("dwks9", period) dwks12 = min_(dwks9, dwks11) dwks10 = tax_unit("dwks10", period) - return (dwks10 - dwks12) * tax_unit("hasqdivltcg", period) + return (dwks10 - dwks12) * tax_unit("has_qdiv_or_ltcg", period) diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks14.py b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks14.py index 70824b70b30..3c00b6136be 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks14.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks14.py @@ -14,4 +14,4 @@ class dwks14(Variable): def formula(tax_unit, period, parameters): dwks1 = tax_unit("taxable_income", period) dwks13 = tax_unit("dwks13", period) - return max_(0, dwks1 - dwks13) * tax_unit("hasqdivltcg", period) + return max_(0, dwks1 - dwks13) * tax_unit("has_qdiv_or_ltcg", period) diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks19.py b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks19.py index 7b6e7da5045..6290a56018c 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks19.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks19.py @@ -20,4 +20,4 @@ def formula(tax_unit, period, parameters): dwks17 = min_(dwks14, dwks16) dwks10 = tax_unit("dwks10", period) dwks18 = max_(0, dwks1 - dwks10) - return max_(dwks17, dwks18) * tax_unit("hasqdivltcg", period) + return max_(dwks17, dwks18) * tax_unit("has_qdiv_or_ltcg", period) diff --git a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks9.py b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks9.py index 03cf47d2809..4fa2cc1e62f 100644 --- a/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks9.py +++ b/policyengine_us/variables/gov/irs/tax/federal_income/capital_gains/dwks9.py @@ -9,13 +9,13 @@ class dwks9(Variable): definition_period = YEAR def formula(tax_unit, period, parameters): + # SchD lines 15 and 16, respectively p23250 = add( tax_unit, period, ["long_term_capital_gains", "qualified_dividend_income"], ) - c23650 = tax_unit("c23650", period) - dwks7 = min_(p23250, c23650) # SchD lines 15 and 16, respectively + dwks7 = min_(p23250, tax_unit("net_capital_gains", period)) # dwks8 = min(dwks3, dwks4) # dwks9 = max(0., dwks7 - dwks8) # BELOW TWO STATEMENTS ARE UNCLEAR IN LIGHT OF dwks9=... COMMENT diff --git a/policyengine_us/variables/gov/irs/tax/self_employment/taxable_self_employment_income.py b/policyengine_us/variables/gov/irs/tax/self_employment/taxable_self_employment_income.py index 6f33c229345..c32a4beff2a 100644 --- a/policyengine_us/variables/gov/irs/tax/self_employment/taxable_self_employment_income.py +++ b/policyengine_us/variables/gov/irs/tax/self_employment/taxable_self_employment_income.py @@ -10,10 +10,16 @@ class taxable_self_employment_income(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/1402#a" def formula(person, period, parameters): + SEI_SOURCES = [ + "self_employment_income", + "farm_income", + "s_corp_self_employment_income", + ] + gross_sei = add(person, period, SEI_SOURCES) irs = parameters(period).gov.irs se = irs.self_employment combined_rate = se.social_security_rate + se.medicare_rate deduction_rate = irs.ald.misc.employer_share * combined_rate - net_se = person("sey", period) * (1 - deduction_rate) - # Exclude net self-employment income below the reporting threshold. - return where(net_se < se.net_earnings_exemption, 0, net_se) + net_sei = gross_sei * (1 - deduction_rate) + # exclude net self-employment income below the reporting threshold. + return where(net_sei < se.net_earnings_exemption, 0, net_sei) diff --git a/policyengine_us/variables/gov/irs/tax_unit/tax_unit_is_joint.py b/policyengine_us/variables/gov/irs/tax_unit/tax_unit_is_joint.py new file mode 100644 index 00000000000..934d91b947f --- /dev/null +++ b/policyengine_us/variables/gov/irs/tax_unit/tax_unit_is_joint.py @@ -0,0 +1,13 @@ +from policyengine_us.model_api import * + + +class tax_unit_is_joint(Variable): + value_type = bool + entity = TaxUnit + label = "Is joint-filing tax unit" + documentation = "Whether this tax unit is a joint filer." + definition_period = YEAR + + def formula(tax_unit, period, parameters): + filing_status = tax_unit("filing_status", period) + return filing_status == filing_status.possible_values.JOINT diff --git a/policyengine_us/variables/gov/irs/taxcalc/outputs.py b/policyengine_us/variables/gov/irs/taxcalc/outputs.py deleted file mode 100644 index 6ab1f262a8e..00000000000 --- a/policyengine_us/variables/gov/irs/taxcalc/outputs.py +++ /dev/null @@ -1,83 +0,0 @@ -from policyengine_us.model_api import * - - -class sey(Variable): - value_type = float - entity = Person - definition_period = YEAR - unit = USD - - adds = ["self_employment_income", "farm_income", "k1bx14"] - - -class filer_earned(Variable): - value_type = float - entity = TaxUnit - definition_period = YEAR - documentation = ( - "search taxcalc/calcfunctions.py for how calculated and used" - ) - unit = USD - - def formula(tax_unit, period, parameters): - return max_(0, tax_unit_non_dep_sum("earned", tax_unit, period)) - - -class earned(Variable): - value_type = float - entity = Person - definition_period = YEAR - label = "Earned income" - documentation = ( - "search taxcalc/calcfunctions.py for how calculated and used" - ) - unit = USD - - def formula(person, period, parameters): - misc = parameters(period).gov.irs.ald.misc - adjustment = ( - (1 - misc.self_emp_tax_adj) - * misc.employer_share - * person("self_employment_tax", period) - ) - return person("earned_income", period) - adjustment - - -class sep(Variable): - value_type = int - entity = TaxUnit - definition_period = YEAR - default_value = 1 - documentation = ( - "2 when filing_status is 3 (married filing separately); otherwise 1" - ) - - -class c01000(Variable): - value_type = float - entity = TaxUnit - definition_period = YEAR - label = "Limitation on capital losses" - unit = USD - - def formula(tax_unit, period, parameters): - return max_( - (-3000.0 / tax_unit("sep", period)), tax_unit("c23650", period) - ) - - -tax_unit_net_capital_gains = variable_alias( - "tax_unit_net_capital_gains", c01000 -) - - -class tax_unit_is_joint(Variable): - value_type = bool - entity = TaxUnit - label = "Joint-filing tax unit" - documentation = "Whether this tax unit is a joint filer." - definition_period = YEAR - - def formula(tax_unit, period, parameters): - filing_status = tax_unit("filing_status", period) - return filing_status == filing_status.possible_values.JOINT diff --git a/policyengine_us/variables/gov/irs/taxcalc/sources.py b/policyengine_us/variables/gov/irs/taxcalc/sources.py deleted file mode 100644 index 574331ae850..00000000000 --- a/policyengine_us/variables/gov/irs/taxcalc/sources.py +++ /dev/null @@ -1,51 +0,0 @@ -from policyengine_us.model_api import * - - -class k1bx14(Variable): - value_type = float - entity = Person - definition_period = YEAR - documentation = ( - "Partner self-employment earnings/loss (included in e26270 total)" - ) - unit = USD - - -class hasqdivltcg(Variable): - value_type = bool - entity = TaxUnit - label = "Has qualified dividends or long-term capital gains" - documentation = "Whether this tax unit has qualified dividend income, or long-term capital gains income" - definition_period = YEAR - - def formula(tax_unit, period, parameters): - # Negatives cannot offset other income sources - INCOME_SOURCES = [ - "c01000", - "c23650", - "long_term_capital_gains", - "non_sch_d_capital_gains", - "qualified_dividend_income", - ] - return np.any( - [ - add(tax_unit, period, [income_source]) > 0 - for income_source in INCOME_SOURCES - ] - ) - - -class c23650(Variable): - value_type = float - entity = TaxUnit - definition_period = YEAR - label = "Net capital gains" - unit = USD - documentation = "Net capital gains (long and short term) before exclusion" - - def formula(tax_unit, period, parameters): - return add( - tax_unit, - period, - ["long_term_capital_gains", "short_term_capital_gains"], - ) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/earned_income/ca_eitc.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/earned_income/ca_eitc.py index 98f05ab6ce0..06f6a1ce8ff 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/credits/earned_income/ca_eitc.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/earned_income/ca_eitc.py @@ -14,7 +14,7 @@ def formula(tax_unit, period, parameters): eligible = tax_unit("ca_eitc_eligible", period) - earned_income = tax_unit("filer_earned", period) + earned_income = tax_unit("filer_adjusted_earnings", period) child_count = tax_unit("eitc_child_count", period) phase_in_rate = p.phase_in.rate.calc(child_count) * p.adjustment.factor diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/young_child/ca_yctc.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/young_child/ca_yctc.py index 8cc2beb587c..d7501fd6104 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/credits/young_child/ca_yctc.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/young_child/ca_yctc.py @@ -51,7 +51,7 @@ def formula(tax_unit, period, parameters): eligible = has_eligible_child & (gets_caleitc | is_loss_eligible) # phase out credit amount - eitc_earnings = tax_unit("filer_earned", period) + eitc_earnings = tax_unit("filer_adjusted_earnings", period) excess_earnings = max_(0, eitc_earnings - p.phase_out.start) increments = excess_earnings / p.phase_out.increment reduction = increments * p.phase_out.amount diff --git a/policyengine_us/variables/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.py b/policyengine_us/variables/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.py index 06bc1b43b18..c4f098d02f1 100644 --- a/policyengine_us/variables/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.py +++ b/policyengine_us/variables/gov/states/hi/tax/income/credits/food_excise/hi_food_excise_credit.py @@ -11,8 +11,8 @@ class hi_food_excise_credit(Variable): reference = "https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=44" def formula(tax_unit, period, parameters): - # Filer can not be a dependent on another return - dependent_on_another_return = tax_unit("dsi", period) + # filer can not be a dependent on another return + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) total_amount = add( tax_unit, period, @@ -21,5 +21,4 @@ def formula(tax_unit, period, parameters): "hi_food_excise_exemption_amount", ], ) - - return ~dependent_on_another_return * total_amount + return ~dependent_elsewhere * total_amount diff --git a/policyengine_us/variables/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_tax_credit_for_low_income_household_renters_eligible.py b/policyengine_us/variables/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_tax_credit_for_low_income_household_renters_eligible.py index 2ba88588488..c62218c5b8a 100644 --- a/policyengine_us/variables/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_tax_credit_for_low_income_household_renters_eligible.py +++ b/policyengine_us/variables/gov/states/hi/tax/income/credits/hi_low_income_household_renters/hi_tax_credit_for_low_income_household_renters_eligible.py @@ -10,12 +10,12 @@ class hi_tax_credit_for_low_income_household_renters_eligible(Variable): defined_for = StateCode.HI def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) p = parameters(period).gov.states.hi.tax.income.credits.lihrtc agi = tax_unit("adjusted_gross_income", period) rent = add(tax_unit, period, ["rent"]) return ( (rent > p.eligibility.rent_threshold) & (agi < p.eligibility.agi_limit) - & ~dependent_on_another_return + & ~dependent_elsewhere ) diff --git a/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.py b/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.py index d8040f50b21..9b90cb02500 100644 --- a/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.py +++ b/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption_eligibility_status.py @@ -22,7 +22,7 @@ def formula(tax_unit, period, parameters): period ).gov.states.il.tax.income.exemption.personal - # First, determine whether the tax unit is filing jointly or not. + # First, determine whether the tax unit is filing jointly or not filing_status = tax_unit("filing_status", period) joint = filing_status == filing_status.possible_values.JOINT @@ -30,11 +30,16 @@ def formula(tax_unit, period, parameters): personal_eligibility_amount * where(joint, 2, 1) ) - # Then, determine whether either the head or the spouse of the tax unit is claimable as a dependent in another unit. - claimable_count = add(tax_unit, period, ["dsi_spouse", "dsi"]) + # Then, determine whether either the head or the spouse of the + # tax unit is claimable as a dependent in another unit + claimable_count = add( + tax_unit, + period, + ["head_is_dependent_elsewhere", "spouse_is_dependent_elsewhere"], + ) il_base_income = tax_unit("il_base_income", period) - # Criteria for complete ineligibility. + # Criteria for complete ineligibility ineligible = ( ( ~joint @@ -53,7 +58,7 @@ def formula(tax_unit, period, parameters): ) ) - # Criteria for partial ineligibility. + # Criteria for partial ineligibility partner_ineligible = ( ( joint @@ -68,7 +73,7 @@ def formula(tax_unit, period, parameters): ) ) - # Based on the criteria, return the eligibility status. + # Based on the criteria, return the eligibility status return select( [ineligible, partner_ineligible], [ diff --git a/policyengine_us/variables/gov/states/in/tax/income/credits/earned_income_credit/in_eitc.py b/policyengine_us/variables/gov/states/in/tax/income/credits/earned_income_credit/in_eitc.py index 902a1831634..5bcae11259d 100644 --- a/policyengine_us/variables/gov/states/in/tax/income/credits/earned_income_credit/in_eitc.py +++ b/policyengine_us/variables/gov/states/in/tax/income/credits/earned_income_credit/in_eitc.py @@ -37,7 +37,7 @@ def formula(tax_unit, period, parameters): po_start = where(kids == 0, po_start0, po_start) po_rate = where(kids == 0, po_rate0, po_rate) # ... calculate eitc phase-in amount - earnings = max_(0, tax_unit("filer_earned", period)) + earnings = tax_unit("filer_adjusted_earnings", period) phase_in_amount = min_(earnings * pi_rate, maximum) # ... calculate eitc reduction federal_agi = tax_unit("adjusted_gross_income", period) diff --git a/policyengine_us/variables/gov/states/me/tax/income/credits/fairness/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.py b/policyengine_us/variables/gov/states/me/tax/income/credits/fairness/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.py index 22e648b0587..4158b66dcca 100644 --- a/policyengine_us/variables/gov/states/me/tax/income/credits/fairness/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.py +++ b/policyengine_us/variables/gov/states/me/tax/income/credits/fairness/sales_tax_fairness_credit/me_sales_tax_fairness_credit_eligible.py @@ -12,7 +12,7 @@ class me_sales_tax_fairness_credit_eligible(Variable): defined_for = StateCode.ME def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) filing_status = tax_unit("filing_status", period) separate = filing_status == filing_status.possible_values.SEPARATE - return ~dependent_on_another_return & ~separate + return ~dependent_elsewhere & ~separate diff --git a/policyengine_us/variables/gov/states/mi/tax/income/exemptions/mi_exemptions.py b/policyengine_us/variables/gov/states/mi/tax/income/exemptions/mi_exemptions.py index 244ffbe0067..e4fb7943e67 100644 --- a/policyengine_us/variables/gov/states/mi/tax/income/exemptions/mi_exemptions.py +++ b/policyengine_us/variables/gov/states/mi/tax/income/exemptions/mi_exemptions.py @@ -32,21 +32,16 @@ def formula(tax_unit, period, parameters): ) disabled_veteran_exemption = disabled_veterans * p.disabled_veteran - # Dependent on other return exemptions + # Dependent-on-other-return exemptions filing_status = tax_unit("filing_status", period) - is_dependent_on_other_return = tax_unit("dsi", period).astype(int) - is_dependent_exemption = ( - is_dependent_on_other_return - * p.dependent_on_other_return[filing_status] + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + dependent_exemption = ( + dependent_elsewhere * p.dependent_on_other_return[filing_status] ) # Total exemptions return ( - where( - is_dependent_exemption == 0, - personal_exemption, - is_dependent_exemption, - ) + where(dependent_elsewhere, dependent_exemption, personal_exemption) + disabled_exemption + disabled_veteran_exemption ) diff --git a/policyengine_us/variables/gov/states/mn/tax/income/credits/mn_wfc.py b/policyengine_us/variables/gov/states/mn/tax/income/credits/mn_wfc.py index b690cb43a83..207a1aaf2db 100644 --- a/policyengine_us/variables/gov/states/mn/tax/income/credits/mn_wfc.py +++ b/policyengine_us/variables/gov/states/mn/tax/income/credits/mn_wfc.py @@ -18,7 +18,7 @@ def formula(tax_unit, period, parameters): # determine count of eligible dependents using EITC rules count = tax_unit("eitc_child_count", period) # determine pre-phaseout credit amount using EITC earnings - earnings = max_(0, tax_unit("filer_earned", period)) + earnings = tax_unit("filer_adjusted_earnings", period) capped_earn = min_(earnings, wfc.phase_in.earnings_maximum.calc(count)) amount = capped_earn * wfc.phase_in.rate.calc(count) # determine phaseout reduction diff --git a/policyengine_us/variables/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.py b/policyengine_us/variables/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.py index ce42edfd496..fdd12e84a51 100644 --- a/policyengine_us/variables/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.py +++ b/policyengine_us/variables/gov/states/nj/tax/income/credits/eitc/nj_eitc_income_eligible.py @@ -14,18 +14,15 @@ def formula(tax_unit, period, parameters): p = parameters(period).gov.irs.credits.eitc # Check if they are above the investment income limit. - no_loss_capital_gains = max_( - 0, - add(tax_unit, period, ["capital_gains"]), - ) + no_loss_capital_gains = max_(0, tax_unit("net_capital_gains", period)) eitc_investment_income = ( add( tax_unit, period, ["net_investment_income", "tax_exempt_interest_income"], ) - # Replace limited-loss capital gains with no-loss capital gains. - - tax_unit("c01000", period) # Limited-loss capital gains. + # replace limited-loss capital gains with no-loss capital gains + - tax_unit("loss_limited_net_capital_gains", period) + no_loss_capital_gains ) inv_income_disqualified = ( diff --git a/policyengine_us/variables/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.py b/policyengine_us/variables/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.py index d736e902ff3..f6525a75a7f 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/credits/cdcc/nm_cdcc_eligible.py @@ -14,7 +14,7 @@ class nm_cdcc_eligible(Variable): def formula(tax_unit, period, parameters): person = tax_unit.members # Filer can not be a dependent on another tax return - dependent_on_another_return = tax_unit("dsi", period) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) p = parameters(period).gov.states.nm.tax.income.credits.cdcc # Filer has to be be gainfully employed to receive credit has_earnings = person("earned_income", period) > 0 @@ -43,7 +43,7 @@ def formula(tax_unit, period, parameters): ) income_eligible = nm_modified_gross_income <= income_limit return ( - ~dependent_on_another_return + ~dependent_elsewhere & employment_eligible & ~receives_tanf & income_eligible diff --git a/policyengine_us/variables/gov/states/nm/tax/income/credits/nm_medical_expense_credit.py b/policyengine_us/variables/gov/states/nm/tax/income/credits/nm_medical_expense_credit.py index 8a8e81aa38a..e2e201a7406 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/credits/nm_medical_expense_credit.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/credits/nm_medical_expense_credit.py @@ -11,18 +11,15 @@ class nm_medical_expense_credit(Variable): def formula(tax_unit, period, parameters): person = tax_unit.members - p = parameters( - period - ).gov.states.nm.tax.income.credits.unreimbursed_medical_care_expense + pcredits = parameters(period).gov.states.nm.tax.income.credits + p = pcredits.unreimbursed_medical_care_expense age = person("age", period) medical_expense = add(tax_unit, period, ["medical_expense"]) age_eligible = tax_unit.any(age >= p.age_eligibility) expense_eligible = medical_expense >= p.min_expenses - dependent_on_another_return = tax_unit("dsi", period) - eligible = ( - age_eligible & expense_eligible & ~dependent_on_another_return - ) - # Exemption is halved for married filing separately + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + eligible = age_eligible & expense_eligible & ~dependent_elsewhere + # exemption is halved for married filing separately filing_status = tax_unit("filing_status", period) separate = filing_status == filing_status.possible_values.SEPARATE denominator = where(separate, 2, 1) diff --git a/policyengine_us/variables/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.py b/policyengine_us/variables/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.py index 3a288ca601b..d0415b60595 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/deductions/certain_dependents/nm_deduction_for_certain_dependents_eligible.py @@ -10,8 +10,8 @@ class nm_deduction_for_certain_dependents_eligible(Variable): defined_for = StateCode.NM def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) - # The deduction does not apply if an exemption under IRS 151 is claimed - # IRC 151 refers to the personal exemption. + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + # deduction does not apply if an exemption under IRS 151 is claimed; + # IRC 151 refers to the federal personal exemption federal_exemption_amount = tax_unit("exemptions", period) - return ~dependent_on_another_return & (federal_exemption_amount == 0) + return ~dependent_elsewhere & (federal_exemption_amount == 0) diff --git a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_2021_income_rebate.py b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_2021_income_rebate.py index 2ac6c5e12b1..1f37e1c7c21 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_2021_income_rebate.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_2021_income_rebate.py @@ -10,15 +10,11 @@ class nm_2021_income_rebate(Variable): defined_for = StateCode.NM def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) - income = tax_unit("adjusted_gross_income", period) - p = ( - parameters(period) - .gov.states.nm.tax.income.rebates["2021_income"] - .main - ) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + agi = tax_unit("adjusted_gross_income", period) filing_status = tax_unit("filing_status", period) - income_eligible = income < p.income_limit[filing_status] - eligible = income_eligible & ~dependent_on_another_return - amount_if_eligible = p.amount[filing_status] + p = parameters(period).gov.states.nm.tax.income.rebates["2021_income"] + income_eligible = agi < p.main.income_limit[filing_status] + eligible = income_eligible & ~dependent_elsewhere + amount_if_eligible = p.main.amount[filing_status] return eligible * amount_if_eligible diff --git a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_additional_2021_income_rebate.py b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_additional_2021_income_rebate.py index eea6f2168be..891ce07d54e 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_additional_2021_income_rebate.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_additional_2021_income_rebate.py @@ -10,11 +10,7 @@ class nm_additional_2021_income_rebate(Variable): defined_for = StateCode.NM def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) - p = ( - parameters(period) - .gov.states.nm.tax.income.rebates["2021_income"] - .additional - ) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + p = parameters(period).gov.states.nm.tax.income.rebates["2021_income"] filing_status = tax_unit("filing_status", period) - return ~dependent_on_another_return * p.amount[filing_status] + return ~dependent_elsewhere * p.additional.amount[filing_status] diff --git a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_supplemental_2021_income_rebate.py b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_supplemental_2021_income_rebate.py index 3062688fbf0..7839b75873d 100644 --- a/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_supplemental_2021_income_rebate.py +++ b/policyengine_us/variables/gov/states/nm/tax/income/rebates/2021_rebate/nm_supplemental_2021_income_rebate.py @@ -10,11 +10,7 @@ class nm_supplemental_2021_income_rebate(Variable): defined_for = StateCode.NM def formula(tax_unit, period, parameters): - dependent_on_another_return = tax_unit("dsi", period) - p = ( - parameters(period) - .gov.states.nm.tax.income.rebates["2021_income"] - .supplemental - ) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) + p = parameters(period).gov.states.nm.tax.income.rebates["2021_income"] filing_status = tax_unit("filing_status", period) - return ~dependent_on_another_return * p.amount[filing_status] + return ~dependent_elsewhere * p.supplemental.amount[filing_status] diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/ny_standard_deduction.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/ny_standard_deduction.py index efa4881ec57..d98250ebddb 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/ny_standard_deduction.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/ny_standard_deduction.py @@ -11,7 +11,7 @@ class ny_standard_deduction(Variable): defined_for = StateCode.NY def formula(tax_unit, period, parameters): - dependent_elsewhere = tax_unit("tax_unit_dependent_elsewhere", period) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) standard_deduction = parameters( period ).gov.states.ny.tax.income.deductions.standard diff --git a/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py b/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py index 660541f703b..732c9b2bd8e 100644 --- a/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py +++ b/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py @@ -25,9 +25,7 @@ def formula(tax_unit, period, parameters): claimable_dep_earned_amount = ( earned_income + p.claimable_as_dependent.earned_income_addition ) - tax_unit_dependent_elsewhere = tax_unit( - "tax_unit_dependent_elsewhere", period - ) + dependent_elsewhere = tax_unit("head_is_dependent_elsewhere", period) # Set floor and ceiling around earned income plus additional amount. floored_claimable_dep_amount = max_( claimable_dep_earned_amount, claimable_dep_floor @@ -36,7 +34,7 @@ def formula(tax_unit, period, parameters): floored_claimable_dep_amount, initial_core_deduction ) core_deduction = where( - tax_unit_dependent_elsewhere, + dependent_elsewhere, capped_claimable_dep_amount, initial_core_deduction, ) diff --git a/policyengine_us/variables/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.py b/policyengine_us/variables/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.py index b7c7e4a7789..e299e6e34e7 100644 --- a/policyengine_us/variables/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.py +++ b/policyengine_us/variables/gov/states/vt/tax/income/exemptions/vt_personal_exemptions.py @@ -14,17 +14,13 @@ class vt_personal_exemptions(Variable): def formula(tax_unit, period, parameters): p = parameters(period).gov.states.vt.tax.income.exemption - # First, Need to determine the tax unit filing status, if they are filing jointly - filing_status = tax_unit("filing_status", period) - is_joint = filing_status == filing_status.possible_values.JOINT - # Then, determine whether either the head or the spouse of the tax unit is claimable as a dependent in another unit. - claimable_elsewhere_head = tax_unit("dsi", period) - claimable_elsewhere_spouse = tax_unit("dsi_spouse", period) - # If claimable elsewhere, it is not eligible for vt personal exemption (line 5a, line 5b) - eligible_head = (~claimable_elsewhere_head).astype(int) - eligible_spouse = (~claimable_elsewhere_spouse).astype(int) + is_joint = tax_unit("tax_unit_is_joint", period) + elsewhere_head = tax_unit("head_is_dependent_elsewhere", period) + elsewhere_spouse = tax_unit("spouse_is_dependent_elsewhere", period) + eligible_head = (~elsewhere_head).astype(int) + eligible_spouse = (~elsewhere_spouse).astype(int) eligible_count = eligible_head + (eligible_spouse * is_joint) - # Last, add number of other dependents claimed on federal Form 1040.(line 5c) + # add number of other dependents claimed on federal Form 1040 (line 5c) dependents = tax_unit("tax_unit_count_dependents", period) total_exemption_count = eligible_count + dependents return total_exemption_count * p.personal diff --git a/policyengine_us/variables/gov/states/wa/tax/income/credits/wa_working_families_tax_credit.py b/policyengine_us/variables/gov/states/wa/tax/income/credits/wa_working_families_tax_credit.py index 290f58382f3..c21cc931231 100644 --- a/policyengine_us/variables/gov/states/wa/tax/income/credits/wa_working_families_tax_credit.py +++ b/policyengine_us/variables/gov/states/wa/tax/income/credits/wa_working_families_tax_credit.py @@ -34,11 +34,11 @@ def formula_2022(tax_unit, period, parameters): # instructs DOR to revise it to get to zero by the EITC AGI limit. # https://app.leg.wa.gov/billsummary?BillNumber=1888&Year=2021&Initiative=false phase_out_rate = max_amount / phase_out_start_reduction - earnings = tax_unit("filer_earned", period) + earnings = tax_unit("filer_adjusted_earnings", period) excess = max_(0, earnings - phase_out_start) reduction = max_(0, excess * phase_out_rate) phased_out_amount = max_amount - reduction - # Minimum benefit applies if calculated amount exceeds zero. + # minimum benefit applies if calculated amount exceeds zero amount_if_eligible = where( phased_out_amount > 0, max_(p.min_amount, phased_out_amount), 0 ) diff --git a/policyengine_us/variables/household/demographic/tax_unit/dsi.py b/policyengine_us/variables/household/demographic/tax_unit/head_is_dependent_elsewhere.py similarity index 59% rename from policyengine_us/variables/household/demographic/tax_unit/dsi.py rename to policyengine_us/variables/household/demographic/tax_unit/head_is_dependent_elsewhere.py index 7bbb6d21a7a..21f619ea9bc 100644 --- a/policyengine_us/variables/household/demographic/tax_unit/dsi.py +++ b/policyengine_us/variables/household/demographic/tax_unit/head_is_dependent_elsewhere.py @@ -1,12 +1,9 @@ from policyengine_us.model_api import * -class tax_unit_dependent_elsewhere(Variable): +class head_is_dependent_elsewhere(Variable): value_type = bool entity = TaxUnit definition_period = YEAR - label = "Is tax unit dependent elsewhere" + label = "Is tax-unit head a dependent elsewhere" documentation = "Whether the filer for this tax unit is claimed as a dependent in another tax unit." - - -dsi = variable_alias("dsi", tax_unit_dependent_elsewhere) diff --git a/policyengine_us/variables/household/demographic/tax_unit/dsi_spouse.py b/policyengine_us/variables/household/demographic/tax_unit/spouse_is_dependent_elsewhere.py similarity index 55% rename from policyengine_us/variables/household/demographic/tax_unit/dsi_spouse.py rename to policyengine_us/variables/household/demographic/tax_unit/spouse_is_dependent_elsewhere.py index d724428f0c6..c1cc47e2406 100644 --- a/policyengine_us/variables/household/demographic/tax_unit/dsi_spouse.py +++ b/policyengine_us/variables/household/demographic/tax_unit/spouse_is_dependent_elsewhere.py @@ -1,12 +1,9 @@ from policyengine_us.model_api import * -class tax_unit_spouse_dependent_elsewhere(Variable): +class spouse_is_dependent_elsewhere(Variable): value_type = bool entity = TaxUnit definition_period = YEAR - label = "Spouse is tax unit dependent elsewhere" + label = "Tax-unit spouse is dependent elsewhere" documentation = "Whether the spouse of the filer for this tax unit is claimed as a dependent in another tax unit." - - -dsi_spouse = variable_alias("dsi_spouse", tax_unit_spouse_dependent_elsewhere) diff --git a/policyengine_us/variables/household/income/person/self_employment/s_corp_self_employment_income.py b/policyengine_us/variables/household/income/person/self_employment/s_corp_self_employment_income.py new file mode 100644 index 00000000000..eb643f68860 --- /dev/null +++ b/policyengine_us/variables/household/income/person/self_employment/s_corp_self_employment_income.py @@ -0,0 +1,9 @@ +from policyengine_us.model_api import * + + +class s_corp_self_employment_income(Variable): + value_type = float + entity = Person + definition_period = YEAR + documentation = "Partner self-employment earnings/loss (included in partnership_s_corp_income total)" + unit = USD diff --git a/policyengine_us/variables/household/income/tax_unit/net_capital_gains.py b/policyengine_us/variables/household/income/tax_unit/net_capital_gains.py new file mode 100644 index 00000000000..fd7f18a0cf4 --- /dev/null +++ b/policyengine_us/variables/household/income/tax_unit/net_capital_gains.py @@ -0,0 +1,10 @@ +from policyengine_us.model_api import * + + +class net_capital_gains(Variable): + value_type = float + entity = TaxUnit + definition_period = YEAR + label = "Net capital gains before loss limitation" + unit = USD + adds = ["long_term_capital_gains", "short_term_capital_gains"]