From 334145aef266d8637e519dd09b2d87c51bf6073c Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:44:36 +0000 Subject: [PATCH 01/19] Chapter 7 bankruptcy means test Fixes #5109 --- changelog_entry.yaml | 4 ++++ .../parameters/gov/bankruptcy/README.md | 1 + .../food_clothing_and_others/additional.yaml | 12 ++++++++++ .../food_clothing_and_others/base.yaml | 22 +++++++++++++++++++ .../age_threshold.yaml | 12 ++++++++++ .../amount/above_age.yaml | 12 ++++++++++ .../amount/below_age.yaml | 12 ++++++++++ .../gov/bankruptcy/adjust_monthly_income.py | 0 .../additional_expense_deductions.py | 5 +++++ .../deductions/debt_payment_deductions.py | 2 ++ .../deductions/local_standards_deductions.py | 1 + .../national_standards_deductions.py | 2 ++ .../other_necessary_expenses_deductions.py | 5 +++++ .../bankruptcy/deductions/total_deductions.py | 13 +++++++++++ .../gov/bankruptcy/expenses/xx_expense.py | 1 + 15 files changed, 104 insertions(+) create mode 100644 policyengine_us/parameters/gov/bankruptcy/README.md create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml create mode 100644 policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb2d..05fa6eac906 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Chapter 7 bankruptcy means test. diff --git a/policyengine_us/parameters/gov/bankruptcy/README.md b/policyengine_us/parameters/gov/bankruptcy/README.md new file mode 100644 index 00000000000..14c4bb278e7 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/README.md @@ -0,0 +1 @@ +# Chapter 7 Bankruptcy Means Test diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml new file mode 100644 index 00000000000..8cdea4f9762 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml @@ -0,0 +1,12 @@ +description: Additonal amount for each person increase. + +values: + 2024-01-01: 386 + +metadata: + unit: currency-USD + period: year + label: + reference: + - title: National standards -- Food, clothing and other items + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-food-clothing-and-other-items diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml new file mode 100644 index 00000000000..8bda4dc85b2 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml @@ -0,0 +1,22 @@ +description: Base amount + +values: +1: + 2024-01-01: 808 +2: + 2024-01-01: 1_411 +3: + 2024-01-01: 1_677 +4: + 2024-01-01: 2_027 + +metadata: + unit: currency-USD + period: year + label: + breakdown: + - list(range(1,4)) + reference: + - title: National standards -- Food, clothing and other items + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-food-clothing-and-other-items + diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml new file mode 100644 index 00000000000..a76a133ef41 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml @@ -0,0 +1,12 @@ +description: + +values: + 2024-01-01: 65 + +metadata: + unit: age + period: year + label: + reference: + - title: National standards -- Out-of-pocket health care + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml new file mode 100644 index 00000000000..7dfad013c83 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml @@ -0,0 +1,12 @@ +description: + +values: + 2024-01-01: 158 + +metadata: + unit: currency-USD + period: year + label: + reference: + - title: National standards -- Out-of-pocket health care + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml new file mode 100644 index 00000000000..cd236070bc9 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml @@ -0,0 +1,12 @@ +description: + +values: + 2024-01-01: 83 + +metadata: + unit: currency-USD + period: year + label: + reference: + - title: National standards -- Out-of-pocket health care + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py new file mode 100644 index 00000000000..b67566e3ad3 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py @@ -0,0 +1,5 @@ +#Line 25 ok +#Line 26 not sure +#Line 27,28,29,30 skip? +#Line 31 not sure +#Line 32 sum diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py new file mode 100644 index 00000000000..7b6b81f9b1c --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py @@ -0,0 +1,2 @@ +# Line 33,34,35,36 ??? +# Line 37 sum \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py new file mode 100644 index 00000000000..7d187e19784 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py @@ -0,0 +1 @@ +# Housing and utilities + vehicle operation (owned or lease, public transportation) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py new file mode 100644 index 00000000000..7e2e0ee22fe --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py @@ -0,0 +1,2 @@ +# get household size +# food_clothing_and_other + out_of_pocket_health_care \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py new file mode 100644 index 00000000000..41e1ec0b2e3 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py @@ -0,0 +1,5 @@ +#Line 16 ok +#Line 17, 18, 19 skip?? +#Line 20,21,22 ok +#Line 23 skip? +#Line 24 sum diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py new file mode 100644 index 00000000000..5720bcda4b6 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py @@ -0,0 +1,13 @@ +from policyengine_us.model_api import * + + +class total_deductions(Variable): + value_type = float + entity = SPMUnit + label = "Total deductions from Income" + unit = USD + definition_period = YEAR + + adds = ["national_standards_deductions","local_standards_deductions", + "other_necessary_expenses_deductions","additional_expense_deductions", + "debt_payment_deductions","additional_expense_deductions"] diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py new file mode 100644 index 00000000000..0543b060ec5 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py @@ -0,0 +1 @@ +# This folder contains all the new variables created for this program. \ No newline at end of file From c6e4343502d6efa672b8262d0d82e6434959482c Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Mon, 18 Nov 2024 03:24:07 +0000 Subject: [PATCH 02/19] add parameters --- .../insurance_and_operating.yaml | 27 ++++++++++++++ .../mortage_or_rent.yaml | 27 ++++++++++++++ .../vehicle_operation/ownership_costs.yaml | 17 +++++++++ .../public_transportation.yaml | 12 +++++++ .../region_operating_costs.yaml | 35 +++++++++++++++++++ .../food_clothing_and_others/additional.yaml | 4 +-- .../food_clothing_and_others/base.yaml | 6 ++-- .../age_threshold.yaml | 4 +-- .../amount/above_age.yaml | 4 +-- .../amount/below_age.yaml | 4 +-- 10 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml new file mode 100644 index 00000000000..c23f5671ffa --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -0,0 +1,27 @@ +description: The Chapter 7 bankruptcy means test limits the expense of insurance and operating by the local standards to this amount, based on household size. + +values: +AL: + 1: + 2024-01-01: 594 + 2: + 2024-01-01: 698 + 3: + 2024-01-01: 736 + 4: + 2024-01-01: 820 + 5: + 2024-01-01: 834 + + + +metadata: + unit: currency-USD + period: year + label: Local standards of insurance and operating expense + breakdown: + - state_code + - list(range(1,6)) + reference: + - title: Local standards -- Housing and Utilities and Transportation + href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml new file mode 100644 index 00000000000..a955c379dba --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml @@ -0,0 +1,27 @@ +description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. + +values: +AL: + 1: + 2024-01-01: 677 + 2: + 2024-01-01: 796 + 3: + 2024-01-01: 838 + 4: + 2024-01-01: 935 + 5: + 2024-01-01: 950 + + + +metadata: + unit: currency-USD + period: year + label: Local standards of mortgage or rent expense + breakdown: + - state_code + - list(range(1,6)) + reference: + - title: Local standards -- Housing and Utilities and Transportation + href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml new file mode 100644 index 00000000000..77ea339e6eb --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml @@ -0,0 +1,17 @@ +description: The Chapter 7 bankruptcy means test limits the ownership costs by the local standards to this amount, based on the number of owned vehicle. + +values: +1: + 2024-01-01: 619 +2: + 2024-01-01: 1_238 + +metadata: + unit: currency-USD + period: year + label: Local standards of ownership costs + breakdown: + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml new file mode 100644 index 00000000000..05ad53c2585 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml @@ -0,0 +1,12 @@ +description: The Chapter 7 bankruptcy means test limits the expense of public transportation by the local standards to this amount. + +values: + 2024-01-01: 215 + +metadata: + unit: currency-USD + period: year + label: Local standards of public transportation amount + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml new file mode 100644 index 00000000000..1e0489d100b --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml @@ -0,0 +1,35 @@ +description: The Chapter 7 bankruptcy means test limits the expense of operating costs by the local standards to this amount, based on region and the number of owned vehicle. + +values: +Northeast_region: + 1: + 2024-01-01: 285 + 2: + 2024-01-01: 570 +Midwest_region: + 1: + 2024-01-01: 239 + 2: + 2024-01-01: 478 +South_region: + 1: + 2024-01-01: 260 + 2: + 2024-01-01: 520 +West_region: + 1: + 2024-01-01: 273 + 2: + 2024-01-01: 546 + + +metadata: + unit: currency-USD + period: year + label: Local standards of operating costs amount + breakdown: + - irs_local_standard_region + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml index 8cdea4f9762..947e24d8e55 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml @@ -1,4 +1,4 @@ -description: Additonal amount for each person increase. +description: The Chapter 7 bankruptcy means test increases the expense of food, clothing and other items by the national standards to this amount, for each additonal person. values: 2024-01-01: 386 @@ -6,7 +6,7 @@ values: metadata: unit: currency-USD period: year - label: + label: National standards of food, clothing and other items additional amount reference: - title: National standards -- Food, clothing and other items href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-food-clothing-and-other-items diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml index 8bda4dc85b2..b00d7a5650a 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml @@ -1,4 +1,4 @@ -description: Base amount +description: The Chapter 7 bankruptcy means test limits the expense of food, clothing and other items by the national standards to this base amount, based on household size. values: 1: @@ -13,9 +13,9 @@ values: metadata: unit: currency-USD period: year - label: + label: National standards of food, clothing and other items base amount breakdown: - - list(range(1,4)) + - list(range(1,5)) reference: - title: National standards -- Food, clothing and other items href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-food-clothing-and-other-items diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml index a76a133ef41..0b837b30db6 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml @@ -1,4 +1,4 @@ -description: +description: The Chapter 7 bankruptcy means test sets different expense limit of out-of-pocket health care by the national standards to the person that is above or below this age. values: 2024-01-01: 65 @@ -6,7 +6,7 @@ values: metadata: unit: age period: year - label: + label: National standards of out-of-pocket health care age threshold reference: - title: National standards -- Out-of-pocket health care href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml index 7dfad013c83..b73ee5a0429 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml @@ -1,4 +1,4 @@ -description: +description: The Chapter 7 bankruptcy means test limits the expense of out-of-pocket health care by the national standards to this above age amount. values: 2024-01-01: 158 @@ -6,7 +6,7 @@ values: metadata: unit: currency-USD period: year - label: + label: National standards of out-of-pocket health care above age amount reference: - title: National standards -- Out-of-pocket health care href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml index cd236070bc9..3f5c78b935b 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml @@ -1,4 +1,4 @@ -description: +description: The Chapter 7 bankruptcy means test limits the expense of out-of-pocket health care by the national standards to this below age amount. values: 2024-01-01: 83 @@ -6,7 +6,7 @@ values: metadata: unit: currency-USD period: year - label: + label: National standards of out-of-pocket health care below age amount reference: - title: National standards -- Out-of-pocket health care href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care From 497b3ad966f6e54731eaecde731c039d3892c5d6 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:26:09 +0000 Subject: [PATCH 03/19] Chapter 7 bankruptcy means test Fixes #5109 Co-authored-by: Pinyan --- .../gov/bankruptcy/adjust_monthly_income.py | 1 + .../additional_expense_deductions.py | 30 +++++++++++++++---- .../deductions/debt_payment_deductions.py | 14 +++++++-- .../other_necessary_expenses_deductions.py | 28 +++++++++++++---- 4 files changed, 61 insertions(+), 12 deletions(-) diff --git a/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py index e69de29bb2d..769358b1770 100644 --- a/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py +++ b/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py @@ -0,0 +1 @@ +# line 1-4 \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py index b67566e3ad3..9a0c4d86969 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py @@ -1,5 +1,25 @@ -#Line 25 ok -#Line 26 not sure -#Line 27,28,29,30 skip? -#Line 31 not sure -#Line 32 sum +from policyengine_us.model_api import * + + +class additonal_expenses_deductions(Variable): + value_type = bool + entity = SPMUnit + label = "Additional expenses deductions" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=6" + defined_for = StateCode.CA + + def formula(spm_unit, period, parameters): + health_insurance_expense = add(spm_unit, period,["health_insurance_premiums"]) + health_savings_account_expense = add(spm_unit, period,["health_savings_account_payroll_contributions"]) + # disability_insurance ?? + care_expense = add(spm_unit, period, ["care_expeses"]) + home_energy_costs = spm_unit.household("current_home_energy_use", period) + education_expense = add(spm_unit, period, ["k12_tuition_and_fees"]) ## no more than $189.58 + charitable_contributions = add( + spm_unit, + period, + ["charitable_cash_donations", "charitable_non_cash_donations"], + ) + total = health_insurance_expense + health_savings_account_expense + care_expense + home_energy_costs + education_expense + charitable_contributions + return total/MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py index 7b6b81f9b1c..cdf7aa7478d 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py @@ -1,2 +1,12 @@ -# Line 33,34,35,36 ??? -# Line 37 sum \ No newline at end of file +from policyengine_us.model_api import * + + +class debt_payment_deductions(Variable): + value_type = bool + entity = SPMUnit + label = "Debt payment deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=7" + defined_for = StateCode.CA + + def formula(spm_unit, period, parameters): diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py index 41e1ec0b2e3..0520c2e573b 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py @@ -1,5 +1,23 @@ -#Line 16 ok -#Line 17, 18, 19 skip?? -#Line 20,21,22 ok -#Line 23 skip? -#Line 24 sum +from policyengine_us.model_api import * + + +class other_necessary_expenses_deductions(Variable): + value_type = bool + entity = SPMUnit + label = "Other necessary expenses deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=5" + defined_for = StateCode.CA + + def formula(spm_unit, period, parameters): + taxes = add(spm_unit, period, ["income_tax"]) + ## retirement_contribution + child_support_expense = add(spm_unit, period, ["child_support_expense"]) + childcare_expenses = spm_unit("childcare_expenses", period) + ## ??? + line_7 = spm_unit("line_7",period) + out_of_pocket_healthcare_expense = add(spm_unit, period,["medical_out_of_pocket_expenses"]) + line_22 = out_of_pocket_healthcare_expense - line_7 + ## + total = taxes + child_support_expense + childcare_expenses + line_22 + return total/MONTHS_IN_YEAR From 88eb9cdca91a886927bb4ab18e88f853c70ad321 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:28:54 +0000 Subject: [PATCH 04/19] minor --- .../insurance_and_operating.yaml | 126 +++++++++++++- .../mortage_or_rent.yaml | 126 +++++++++++++- .../region_operating_costs.yaml | 157 ++++++++++++++++-- 3 files changed, 383 insertions(+), 26 deletions(-) diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml index c23f5671ffa..f04b69d8aee 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -1,5 +1,5 @@ description: The Chapter 7 bankruptcy means test limits the expense of insurance and operating by the local standards to this amount, based on household size. - +# The excle sheets have the values for all counties, the follwoing values are the average value based on state level. values: AL: 1: @@ -12,9 +12,127 @@ AL: 2024-01-01: 820 5: 2024-01-01: 834 - - - +AL: + 1: + 2024-01-01: 705 + 2: + 2024-01-01: 828 + 3: + 2024-01-01: 872 + 4: + 2024-01-01: 973 + 5: + 2024-01-01: 988 +AZ: + 1: + 2024-01-01: 547 + 2: + 2024-01-01: 642 + 3: + 2024-01-01: 676 + 4: + 2024-01-01: 754 + 5: + 2024-01-01: 766 +AR: + 1: + 2024-01-01: 563 + 2: + 2024-01-01: 661 + 3: + 2024-01-01: 696 + 4: + 2024-01-01: 776 + 5: + 2024-01-01: 789 +CA: + 1: + 2024-01-01: 579 + 2: + 2024-01-01: 680 + 3: + 2024-01-01: 716 + 4: + 2024-01-01: 799 + 5: + 2024-01-01: 812 +CO: + 1: + 2024-01-01: 560 + 2: + 2024-01-01: 658 + 3: + 2024-01-01: 693 + 4: + 2024-01-01: 773 + 5: + 2024-01-01: 785 +CT: + 1: + 2024-01-01: 627 + 2: + 2024-01-01: 736 + 3: + 2024-01-01: 775 + 4: + 2024-01-01: 864 + 5: + 2024-01-01: 878 +DE: + 1: + 2024-01-01: 586 + 2: + 2024-01-01: 688 + 3: + 2024-01-01: 725 + 4: + 2024-01-01: 809 + 5: + 2024-01-01: 822 +DC: + 1: + 2024-01-01: 638 + 2: + 2024-01-01: 749 + 3: + 2024-01-01: 789 + 4: + 2024-01-01: 880 + 5: + 2024-01-01: 894 +FL: + 1: + 2024-01-01: 549 + 2: + 2024-01-01: 645 + 3: + 2024-01-01: 680 + 4: + 2024-01-01: 758 + 5: + 2024-01-01: 770 +GA: + 1: + 2024-01-01: 578 + 2: + 2024-01-01: 679 + 3: + 2024-01-01: 716 + 4: + 2024-01-01: 798 + 5: + 2024-01-01: 811 +HI: + 1: + 2024-01-01: 602 + 2: + 2024-01-01: 706 + 3: + 2024-01-01: 744 + 4: + 2024-01-01: 830 + 5: + 2024-01-01: 843 metadata: unit: currency-USD period: year diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml index a955c379dba..783c267dd88 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml @@ -1,5 +1,5 @@ description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. - +# The excle sheets have the values for all counties, the follwoing values are the average value based on state level. values: AL: 1: @@ -12,9 +12,127 @@ AL: 2024-01-01: 935 5: 2024-01-01: 950 - - - +AL: + 1: + 2024-01-01: 1_049 + 2: + 2024-01-01: 1_232 + 3: + 2024-01-01: 1_298 + 4: + 2024-01-01: 1_448 + 5: + 2024-01-01: 1_471 +AZ: + 1: + 2024-01-01: 840 + 2: + 2024-01-01: 987 + 3: + 2024-01-01: 1_040 + 4: + 2024-01-01: 1_160 + 5: + 2024-01-01: 1_178 +AR: + 1: + 2024-01-01: 614 + 2: + 2024-01-01: 721 + 3: + 2024-01-01: 759 + 4: + 2024-01-01: 847 + 5: + 2024-01-01: 860 +CA: + 1: + 2024-01-01: 1_558 + 2: + 2024-01-01: 1_830 + 3: + 2024-01-01: 1_928 + 4: + 2024-01-01: 2_150 + 5: + 2024-01-01: 2_184 +CO: + 1: + 2024-01-01: 1_063 + 2: + 2024-01-01: 1_248 + 3: + 2024-01-01: 1_315 + 4: + 2024-01-01: 1_466 + 5: + 2024-01-01: 1_490 +CT: + 1: + 2024-01-01: 1_507 + 2: + 2024-01-01: 1_770 + 3: + 2024-01-01: 1_865 + 4: + 2024-01-01: 2_080 + 5: + 2024-01-01: 2_114 +DE: + 1: + 2024-01-01: 1_107 + 2: + 2024-01-01: 1_301 + 3: + 2024-01-01: 1_371 + 4: + 2024-01-01: 1_528 + 5: + 2024-01-01: 1_553 +DC: + 1: + 2024-01-01: 1_958 + 2: + 2024-01-01: 2_300 + 3: + 2024-01-01: 2_424 + 4: + 2024-01-01: 2_702 + 5: + 2024-01-01: 2_746 +FL: + 1: + 2024-01-01: 935 + 2: + 2024-01-01: 1_098 + 3: + 2024-01-01: 1_157 + 4: + 2024-01-01: 1_290 + 5: + 2024-01-01: 1_311 +GA: + 1: + 2024-01-01: 790 + 2: + 2024-01-01: 928 + 3: + 2024-01-01: 978 + 4: + 2024-01-01: 1_090 + 5: + 2024-01-01: 1_108 +HI: + 1: + 2024-01-01: 1_733 + 2: + 2024-01-01: 2_036 + 3: + 2024-01-01: 2_145 + 4: + 2024-01-01: 2_392 + 5: + 2024-01-01: 2_431 metadata: unit: currency-USD period: year diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml index 1e0489d100b..b2a6e35b774 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml @@ -2,33 +2,154 @@ description: The Chapter 7 bankruptcy means test limits the expense of operating values: Northeast_region: - 1: - 2024-01-01: 285 - 2: - 2024-01-01: 570 + Northeast_region: + 1: + 2024-01-01: 285 + 2: + 2024-01-01: 570 + Boston: + 1: + 2024-01-01: 310 + 2: + 2024-01-01: 620 + New_York: + 1: + 2024-01-01: 377 + 2: + 2024-01-01: 754 + Philadelphia: + 1: + 2024-01-01: 307 + 2: + 2024-01-01: 614 Midwest_region: - 1: - 2024-01-01: 239 - 2: - 2024-01-01: 478 + Midwest_region: + 1: + 2024-01-01: 239 + 2: + 2024-01-01: 478 + Chicago: + 1: + 2024-01-01: 266 + 2: + 2024-01-01: 532 + Cleveland: + 1: + 2024-01-01: 239 + 2: + 2024-01-01: 478 + Detroit: + 1: + 2024-01-01: 299 + 2: + 2024-01-01: 598 + Minneapolis_St.Paul: + 1: + 2024-01-01: 243 + 2: + 2024-01-01: 486 + St.Louis: + 1: + 2024-01-01: 220 + 2: + 2024-01-01: 440 + South_region: - 1: - 2024-01-01: 260 - 2: - 2024-01-01: 520 -West_region: - 1: - 2024-01-01: 273 - 2: - 2024-01-01: 546 + South_region: + 1: + 2024-01-01: 260 + 2: + 2024-01-01: 520 + Atlanta: + 1: + 2024-01-01: 304 + 2: + 2024-01-01: 608 + Baltimore: + 1: + 2024-01-01: 272 + 2: + 2024-01-01: 544 + Dallas_Ft.Worth: + 1: + 2024-01-01: 292 + 2: + 2024-01-01: 584 + Houston: + 1: + 2024-01-01: 332 + 2: + 2024-01-01: 664 + Miami: + 1: + 2024-01-01: 355 + 2: + 2024-01-01: 710 + Tampa: + 1: + 2024-01-01: 305 + 2: + 2024-01-01: 610 + Washington_DC: + 1: + 2024-01-01: 301 + 2: + 2024-01-01: 602 +West_region: + West_region: + 1: + 2024-01-01: 273 + 2: + 2024-01-01: 546 + Anchorage: + 1: + 2024-01-01: 200 + 2: + 2024-01-01: 400 + Denver: + 1: + 2024-01-01: 321 + 2: + 2024-01-01: 642 + Honolulu: + 1: + 2024-01-01: 254 + 2: + 2024-01-01: 508 + Los_Angeles: + 1: + 2024-01-01: 331 + 2: + 2024-01-01: 662 + Phoenix: + 1: + 2024-01-01: 300 + 2: + 2024-01-01: 600 + San_Diego: + 1: + 2024-01-01: 310 + 2: + 2024-01-01: 620 + San_Francisco: + 1: + 2024-01-01: 348 + 2: + 2024-01-01: 696 + Seattle: + 1: + 2024-01-01: 271 + 2: + 2024-01-01: 542 metadata: unit: currency-USD period: year label: Local standards of operating costs amount breakdown: - - irs_local_standard_region + - chapter7_bankruptcy_region + - county_region - list(range(1,3)) reference: - title: Local standards -- Transportation From 3f0973f0a9176e0ca0c4683b73ae6cfe86e4eb1c Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Thu, 21 Nov 2024 05:48:26 +0000 Subject: [PATCH 05/19] draft --- .../county_group/midwest/chicago.yaml | 0 .../county_group/midwest/cleveland.yaml | 0 .../county_group/midwest/detroit.yaml | 0 .../midwest/minneapolis_st.paul.yaml | 0 .../county_group/midwest/st.louis.yaml | 0 .../county_group/northeast/boston.yaml | 18 +++++++ .../county_group/northeast/new_york.yaml | 0 .../county_group/northeast/philadelphia.yaml | 23 +++++++++ .../region_operating_costs/northeast.yaml | 34 +++++++++++++ .../region_operating_costs.yaml | 8 ++-- .../gov/bankruptcy/region/midwest_county.py | 0 .../gov/bankruptcy/region/northeast_county.py | 48 +++++++++++++++++++ 12 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml rename policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/{ => region_operating_costs}/region_operating_costs.yaml (97%) create mode 100644 policyengine_us/variables/gov/bankruptcy/region/midwest_county.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/northeast_county.py diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml new file mode 100644 index 00000000000..f1468f917d8 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml @@ -0,0 +1,18 @@ +description: The following counties belongs to Boston area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: Boston area counties by MSA definitions + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ESSEXE_COUNTY_MA + - MIDDLESEX_COUNTY_MA + - NORFOLK_COUNTY_MA + - PLYMOUTH_COUNTY_MA + - SUFFOLK_COUNTY_MA + - ROCKINGHAM_COUNTY_NH + - STRAFFORD_COUNTY_NH diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml new file mode 100644 index 00000000000..b8a35e6a222 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml @@ -0,0 +1,23 @@ +description: The following counties belongs to Philadelphia area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: Philadelphia area counties by MSA definitions + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - BUCKS_COUNTY_PA + - CHESTER_COUNTY_PA + - DELAWARE_COUNTY_PA + - MONTGOMERY_COUNTY_PA + - PHILADELPHIA_COUNTY_PA + - BURLINGTON_COUNTY_NJ + - CAMDEN_COUNTY_NJ + - GLOUCESTER_COUNTY_NJ + - SALEM_COUNTY_NJ + - NEW_CASTLE_COUNTY_DE + - CECIL_COUNTY_MD + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml new file mode 100644 index 00000000000..27725547ac8 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -0,0 +1,34 @@ +description: The Chapter 7 bankruptcy means test limits the expense of operating costs by the local standards to this amount, based on region and the number of owned vehicle. + +values: +NORTHEAST: + 1: + 2024-01-01: 285 + 2: + 2024-01-01: 570 +BOSTON: + 1: + 2024-01-01: 310 + 2: + 2024-01-01: 620 +NEW_YORK: + 1: + 2024-01-01: 377 + 2: + 2024-01-01: 754 +PHILADELPHIA: + 1: + 2024-01-01: 307 + 2: + 2024-01-01: 614 + +metadata: + unit: currency-USD + period: year + label: Local standards of operating costs amount + breakdown: + - northeast_county + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml similarity index 97% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml rename to policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml index b2a6e35b774..8e9b7987b09 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml @@ -2,22 +2,22 @@ description: The Chapter 7 bankruptcy means test limits the expense of operating values: Northeast_region: - Northeast_region: + NORTHEAST: 1: 2024-01-01: 285 2: 2024-01-01: 570 - Boston: + BOSTON: 1: 2024-01-01: 310 2: 2024-01-01: 620 - New_York: + NEW_YORK: 1: 2024-01-01: 377 2: 2024-01-01: 754 - Philadelphia: + PHILADELPHIA: 1: 2024-01-01: 307 2: diff --git a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py b/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py new file mode 100644 index 00000000000..f77307d7f0e --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py @@ -0,0 +1,48 @@ +from policyengine_us.model_api import * + + +class NorthEastCounty(Enum): + BOSTON = "Boston" + NEW_YORK = "New York" + PHILADELPHIA = "Philadelphia" + NORTHEAST = "Northeast" + + +class northeast_county(Variable): + value_type = Enum + entity = Household + possible_values = NorthEastCounty + default_value = NorthEastCounty.NORTHEAST + definition_period = YEAR + label = "South Carolina use tax county group" + + + def formula(household, period, parameters): + + county = household("county_str", period) + + boston_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.boston + + new_york_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.new_york + + philadelphia_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.philadelphia + + return select( + [ + np.isin(county, boston_counties), + np.isin(county, new_york_counties), + np.isin(county, philadelphia_counties), + ], + [ + NorthEastCounty.BOSTON, + NorthEastCounty.NEW_YORK, + NorthEastCounty.PHILADELPHIA, + ], + default=NorthEastCounty.NORTHEAST, + ) From 3b7ec64d8f28b8b8f8c0c9e2695d5b9865373287 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Mon, 25 Nov 2024 00:22:45 +0000 Subject: [PATCH 06/19] Chapter 7 bankruptcy means test Fixes #5109 --- .../insurance_and_operating.yaml | 2 +- .../mortage_or_rent.yaml | 2 +- .../county_group/midwest/chicago.yaml | 26 ++++++++++++ .../county_group/midwest/cleveland.yaml | 21 ++++++++++ .../county_group/midwest/detroit.yaml | 18 +++++++++ .../midwest/minneapolis_st.paul.yaml | 0 .../midwest/minneapolis_st_paul.yaml | 27 +++++++++++++ .../county_group/midwest/st.louis.yaml | 0 .../county_group/midwest/st_louis.yaml | 26 ++++++++++++ .../county_group/northeast/boston.yaml | 4 +- .../county_group/northeast/new_york.yaml | 36 +++++++++++++++++ .../county_group/northeast/philadelphia.yaml | 4 +- .../county_group/south/atlanta.yaml | 40 +++++++++++++++++++ .../county_group/south/baltimore.yaml | 18 +++++++++ .../county_group/south/dallas_ft_worth.yaml | 24 +++++++++++ .../county_group/south/houston.yaml | 21 ++++++++++ .../county_group/south/miami.yaml | 14 +++++++ .../county_group/south/tampa.yaml | 15 +++++++ .../county_group/south/washington_dc.yaml | 35 ++++++++++++++++ .../county_group/west/anchorage.yaml | 13 ++++++ .../county_group/west/denver.yaml | 21 ++++++++++ .../county_group/west/honolulu.yaml | 12 ++++++ .../county_group/west/los_angeles.yaml | 15 +++++++ .../county_group/west/phoenix.yaml | 13 ++++++ .../county_group/west/san_diego.yaml | 12 ++++++ .../county_group/west/san_francisco.yaml | 16 ++++++++ .../county_group/west/seattle.yaml | 14 +++++++ .../additional_expense_deductions.py | 2 +- .../other_necessary_expenses_deductions.py | 4 +- .../gov/bankruptcy/region/northeast_county.py | 5 ++- 30 files changed, 449 insertions(+), 11 deletions(-) delete mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml delete mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml index f04b69d8aee..5dcf6253e64 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -1,5 +1,4 @@ description: The Chapter 7 bankruptcy means test limits the expense of insurance and operating by the local standards to this amount, based on household size. -# The excle sheets have the values for all counties, the follwoing values are the average value based on state level. values: AL: 1: @@ -141,5 +140,6 @@ metadata: - state_code - list(range(1,6)) reference: + # We use average state level values while the amount can vary based on county - title: Local standards -- Housing and Utilities and Transportation href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml index 783c267dd88..da3837a34b0 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml @@ -1,5 +1,4 @@ description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. -# The excle sheets have the values for all counties, the follwoing values are the average value based on state level. values: AL: 1: @@ -141,5 +140,6 @@ metadata: - state_code - list(range(1,6)) reference: + # We use average state level values while the amount can vary based on county - title: Local standards -- Housing and Utilities and Transportation href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml index e69de29bb2d..8a4b74b781c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml @@ -0,0 +1,26 @@ +description: The following counties belongs to Chicago area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Chicago area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - COOK_COUNTY_IL + - DEKALB_COUNTY_IL + - DUPAGE_COUNTY_IL + - GRUNDY_COUNTY_IL + - KANE_COUNTY_IL + - KENDALL_COUNTY_IL + - LAKE_COUNTY_IL + - MCHENRY_COUNTY_IL + - WILL_COUNTY_IL + - JASPER_COUNTY_IN + - LAKE_COUNTY_IN + - NEWTON_COUNTY_IN + - PORTER_COUNTY_IN + - KENOSHA_COUNTY_WI + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml index e69de29bb2d..8d67d5f553a 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml @@ -0,0 +1,21 @@ +description: The following counties belongs to Cleveland area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Cleveland area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ASHTABULA_COUNTY_OH + - CUYAHOGA_COUNTY_OH + - GEAUGA_COUNTY_OH + - LAKE_COUNTY_OH + - LORAIN_COUNTY_OH + - MEDINA_COUNTY_OH + - PORTAGE_COUNTY_OH + - SUMMIT_COUNTY_OH + + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml index e69de29bb2d..c8adee82b62 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml @@ -0,0 +1,18 @@ +description: The following counties belongs to Detroit area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Detroit area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - LAPEER_COUNTY_MI + - LIVINGSTON_COUNTY_MI + - MACOMB_COUNTY_MI + - OAKLAND_COUNTY_MI + - ST_CLAIR_COUNTY_MI + - WAYNE_COUNTY_MI + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st.paul.yaml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml new file mode 100644 index 00000000000..40a19b63d73 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml @@ -0,0 +1,27 @@ +description: The following counties belongs to Minneapolis-St.Paul area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Minneapolis-St.Paul area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ANOKA_COUNTY_MN + - CARVER_COUNTY_MN + - CHISAGO_COUNTY_MN + - DAKOTA_COUNTY_MN + - HENNEPIN_COUNTY_MN + - ISANTI_COUNTY_MN + - LESUEUR_COUNTY_MN + - MILLE_LACS_COUNTY_MN + - RAMSEY_COUNTY_MN + - SCOTT_COUNTY_MN + - SHERBURNE_COUNTY_MN + - SIBLEY_COUNTY_MN + - WASHINGTON_COUNTY_MN + - WRIGHT_COUNTY_MN + - PIERCE_COUNTY_WI + - ST_CROIX_WI diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st.louis.yaml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml new file mode 100644 index 00000000000..055dc389e62 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml @@ -0,0 +1,26 @@ +description: The following counties belongs to St.Louis area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area St.Louis area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - FRANKLIN_COUNTY_MO + - JEFFERSON_COUNTY_MO + - LINCOLN_COUNTY_MO + - ST_CHARLES_COUNTY_MO + - ST_LOUIS_COUNTY_MO + - WARREN_COUNTY_MO + - ST_LOUIS_CITY_COUNTY_MO + - BOND_COUNTY_IL + - CALHOUN_COUNTY_IL + - CLINTON_COUNTY_IL + - JERSEY_COUNTY_IL + - MACOUPIN_COUNTY_IL + - MADISON_COUNTY_IL + - MONROW_COUNTY_IL + - ST_CLAIR_COUNTY_IL diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml index f1468f917d8..0f2367e3b9a 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml @@ -3,9 +3,9 @@ description: The following counties belongs to Boston area by Metropolitan Stati metadata: unit: list period: year - label: Boston area counties by MSA definitions + label: IRS Metropolitan Statistical Area Boston area counties reference: - - title: Local standards -- Transportation + - title: Internal Revenue Service, Local standards -- Transportation href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation values: 2024-01-01: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml index e69de29bb2d..e8aa72ca3b2 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml @@ -0,0 +1,36 @@ +description: The following counties belongs to New York area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area New York area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - BRONX_COUNTY_NY + - DUTCHESS_COUNTY_NY + - KINGS_COUNTY_NY + - NASSAU_COUNTY_NY + - NEW_YORK_COUNTY_NY + - ORANGE_COUNTY_NY + - PUTNAM_COUNTY_NY + - QUEENS_COUNTY_NY + - RICHMOND_COUNTY_NY + - ROCKLAND_COUNTY_NY + - SUFFOLK_COUNTY_NY + - WESTCHESTER_COUNTY_NY + - BERGEN_COUNTY_NJ + - ESSEX_COUNTY_NJ + - HUDSON_COUNTY_NJ + - HUNTERDON_COUNTY_NJ + - MIDDLESEX_COUNTY_NJ + - MONMOUTH_COUNTY_NJ + - MORRIS_COUNTY_NJ + - OCEAN_COUNTY_NJ + - PASSAIC_COUNTY_NJ + - SOMERSET_COUNTY_NJ + - SUSSEX_COUNTY_NJ + - UNION_COUNTY_NJ + - PIKE_COUNTY_PA diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml index b8a35e6a222..0f28a454498 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml @@ -3,9 +3,9 @@ description: The following counties belongs to Philadelphia area by Metropolitan metadata: unit: list period: year - label: Philadelphia area counties by MSA definitions + label: IRS Metropolitan Statistical Area Philadelphia area counties reference: - - title: Local standards -- Transportation + - title: Internal Revenue Service, Local standards -- Transportation href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation values: 2024-01-01: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml new file mode 100644 index 00000000000..5181a96b594 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml @@ -0,0 +1,40 @@ +description: The following counties belongs to Atlanta area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Atlanta area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - BARROW_COUNTY_GA + - BARTOW_COUNTY_GA + - BUTTS_COUNTY_GA + - CARROLL_COUNTY_GA + - CHEROKEE_COUNTY_GA + - CLAYTON_COUNTY_GA + - COBB_COUNTY_GA + - COWETA_COUNTY_GA + - DAWSON_COUNTY_GA + - DEKALB_COUNTY_GA + - DOUGLAS_COUNTY_GA + - FAYETTE_COUNTY_GA + - FORSYTH_COUNTY_GA + - FULTON_COUNTY_GA + - GWINNETT_COUNTY_GA + - HARALSON_COUNTY_GA + - HEARD_COUNTY_GA + - HENRY_COUNTY_GA + - JASPER_COUNTY_GA + - LAMAR_COUNTY_GA + - MERIWETHER_COUNTY_GA + - MORGAN_COUNTY_GA + - NEWTON_COUNTY_GA + - PAULDING_COUNTY_GA + - PICKENS_COUNTY_GA + - PIKE_COUNTY_GA + - ROCKDALE_COUNTY_GA + - SPALDING_COUNTY_GA + - WALTON_COUNTY_GA diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml new file mode 100644 index 00000000000..5dea0522013 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml @@ -0,0 +1,18 @@ +description: The following counties belongs to Baltimore area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Baltimore area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ANNE_ARUNDEL_COUNTY_MD + - BALTIMORE_COUNTY_MD + - CARROLL_COUNTY_MD + - HARFORD_COUNTY_MD + - HOWARD_COUNTY_MD + - QUEEN_ANNE_S_COUNTY_MD + - BALTIMORE_CITY_MD diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml new file mode 100644 index 00000000000..64bd1f70e03 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml @@ -0,0 +1,24 @@ +description: The following counties belongs to Dallas Ft.Worth area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Dallas Ft.Worth area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - COLLIN_COUNTY_TX + - DALLAS_COUNTY_TX + - DENTON_COUNTY_TX + - ELLIS_COUNTY_TX + - HOOD_COUNTY_TX + - HUNT_COUNTY_TX + - JOHNSON_COUNTY_TX + - KAUFMAN_COUNTY_TX + - PARKER_COUNTY_TX + - ROCKWALL_COUNTY_TX + - SOMERVELL_COUNTY_TX + - TARRANT_COUNTY_TX + - WISE_COUNTY_TX diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml new file mode 100644 index 00000000000..af46ff9703b --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml @@ -0,0 +1,21 @@ +description: The following counties belongs to Houston area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Houston area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - AUSTIN_COUNTY_TX + - BRAZORIA_COUNTY_TX + - CHAMBERS_COUNTY_TX + - FORT_BEND_COUNTY_TX + - GALVESTON_COUNTY_TX + - HARRIS_COUNTY_TX + - LIBERTY_COUNTY_TX + - MONTGOMERY_COUNTY_TX + - WALLER_COUNTY_TX + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml new file mode 100644 index 00000000000..176e36e0ba4 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml @@ -0,0 +1,14 @@ +description: The following counties belongs to Miami area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Miami area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - BROWARD_COUNTY_FL + - MIAMI_DADE_COUNTY_FL + - PALM_BEACH_COUNTY_FL diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml new file mode 100644 index 00000000000..5882cd0d006 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml @@ -0,0 +1,15 @@ +description: The following counties belongs to Tampa area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Tampa area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - HERNANDO_COUNTY_FL + - HILLSBOROUGH_COUNTY_FL + - PASCO_COUNTY_FL + - PINELLAS_COUNTY_FL diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml new file mode 100644 index 00000000000..53815bae8b5 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml @@ -0,0 +1,35 @@ +description: The following counties belongs to Washington DC area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Washington DC area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - DISTRICT_OF_COLUMBIA_DC + - CALVERT_COUNTY_MD + - CHARLES_COUNTY_MD + - FREDERICK_COUNTY_MD + - MONTGOMERY_COUNTY_MD + - PRINCE_GEORGE_COUNTY_MD + - ARLINGTON_COUNTY_VA + - CLARKE_COUNTY_VA + - CULPEPER_COUNTY_VA + - FAIRFAX_COUNTY_VA + - FAUQUIER_COUNTY_VA + - LOUDOUN_COUNTY_VA + - PRINCE_WILLIAM_COUNTY_VA + - RAPPAHANNOCK_COUNTY_VA + - SPOTSYLVANIA_COUNTY_VA + - STAFFORD_COUNTY_VA + - WARREN_COUNTY_VA + - ALEXANDRIA_CITY_VA + - FAIRFAX_CITY_VA + - FALLS_CHURCH_CITY_VA + - FREDERICKSBURG_CITY_VA + # - MANASSAS_CITY_VA ## We don't have this county in county_enum.py + - MANASSAS_PARK_CITY_VA + - JEFFERSON_COUNTY_WV diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml new file mode 100644 index 00000000000..06cfda18488 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml @@ -0,0 +1,13 @@ +description: The following counties belongs to Anchorage area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Anchorage area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ANCHORAGE_MUNICIPALITY_AK + - MATANUSKA_SUSITNA_BOROUGH_AK diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml new file mode 100644 index 00000000000..3e858b26b2b --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml @@ -0,0 +1,21 @@ +description: The following counties belongs to Denver area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Denver area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ADAMS_COUNTY_CO + - ARAPAHOE_COUNTY_CO + - BROOMFIELD_COUNTY_CO + - CLEAR_CREEK_COUNTY_CO + - DENVER_COUNTY_CO + - DOUGLAS_COUNTY_CO + - ELBERT_COUNTY_CO + - GILPIN_COUNTY_CO + - JEFFERSON_COUNTY_CO + - PARK_COUNTY_CO diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml new file mode 100644 index 00000000000..0136532d1a8 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml @@ -0,0 +1,12 @@ +description: The following county belongs to Honolulu area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Honolulu area county + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - HONOLULU_COUNTY_HI diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml new file mode 100644 index 00000000000..c37fb980f28 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml @@ -0,0 +1,15 @@ +description: The following county belongs to Los Angeles area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Los Angeles area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - LOS_ANGELES_COUNTY_CA + - ORANGE_COUNTY_CA + - RIVERSIDE_COUNTY_CA + - SAN_BERNARDINO_COUNTY_CA diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml new file mode 100644 index 00000000000..1b0337cab54 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml @@ -0,0 +1,13 @@ +description: The following counties belongs to Phoenix area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Phoenix area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - MARICOPA_COUNTY_AZ + - PINAL_COUNTY_AZ diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml new file mode 100644 index 00000000000..ae4772ab065 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml @@ -0,0 +1,12 @@ +description: The following counties belongs to San Diego area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area San Diego area county + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - SAN_DIEGO_COUNTY_CA diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml new file mode 100644 index 00000000000..e9c7077feca --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml @@ -0,0 +1,16 @@ +description: The following counties belongs to San Francisco area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area San Francisco area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ALAMEDA_COUNTY_CA + - CONTRA_COSTA_COUNTY_CA + - MARIN_COUNTY_CA + - SAN_FRANCISCO_COUNTY_CA + - SAN_MATEO_COUNTY_CA diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml new file mode 100644 index 00000000000..6520eb60b9e --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml @@ -0,0 +1,14 @@ +description: The following counties belongs to Seattle area by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area Seattle area counties + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - KING_COUNTY_WA + - PIERCE_COUNTY_WA + - SNOHOMISH_COUNTY_WA diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py index 9a0c4d86969..530154cf38e 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py @@ -12,7 +12,7 @@ class additonal_expenses_deductions(Variable): def formula(spm_unit, period, parameters): health_insurance_expense = add(spm_unit, period,["health_insurance_premiums"]) health_savings_account_expense = add(spm_unit, period,["health_savings_account_payroll_contributions"]) - # disability_insurance ?? + care_expense = add(spm_unit, period, ["care_expeses"]) home_energy_costs = spm_unit.household("current_home_energy_use", period) education_expense = add(spm_unit, period, ["k12_tuition_and_fees"]) ## no more than $189.58 diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py index 0520c2e573b..13033d91670 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py @@ -10,7 +10,7 @@ class other_necessary_expenses_deductions(Variable): defined_for = StateCode.CA def formula(spm_unit, period, parameters): - taxes = add(spm_unit, period, ["income_tax"]) + income_tax = add(spm_unit, period, ["income_tax"]) ## retirement_contribution child_support_expense = add(spm_unit, period, ["child_support_expense"]) childcare_expenses = spm_unit("childcare_expenses", period) @@ -19,5 +19,5 @@ def formula(spm_unit, period, parameters): out_of_pocket_healthcare_expense = add(spm_unit, period,["medical_out_of_pocket_expenses"]) line_22 = out_of_pocket_healthcare_expense - line_7 ## - total = taxes + child_support_expense + childcare_expenses + line_22 + total = income_tax + child_support_expense + childcare_expenses + line_22 return total/MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py index f77307d7f0e..4e9ab1a5d71 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py @@ -5,7 +5,7 @@ class NorthEastCounty(Enum): BOSTON = "Boston" NEW_YORK = "New York" PHILADELPHIA = "Philadelphia" - NORTHEAST = "Northeast" + NORTHEAST_DEFAULT = "Northeast default" class northeast_county(Variable): @@ -14,6 +14,7 @@ class northeast_county(Variable): possible_values = NorthEastCounty default_value = NorthEastCounty.NORTHEAST definition_period = YEAR + defined_for ="is_northeast_region" label = "South Carolina use tax county group" @@ -44,5 +45,5 @@ def formula(household, period, parameters): NorthEastCounty.NEW_YORK, NorthEastCounty.PHILADELPHIA, ], - default=NorthEastCounty.NORTHEAST, + default=NorthEastCounty.NORTHEAST_DEFAULT, ) From 52ca648acad25ac918a5175ec33ef2d92b3ef3bd Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:04:26 +0000 Subject: [PATCH 07/19] minor --- .../additional_expense_deductions.py | 37 ++++++--- .../other_necessary_expenses_deductions.py | 18 ++-- .../bankruptcy/deductions/total_deductions.py | 11 ++- .../gov/bankruptcy/region/midwest_county.py | 61 ++++++++++++++ .../gov/bankruptcy/region/northeast_county.py | 8 +- .../gov/bankruptcy/region/south_county.py | 75 +++++++++++++++++ .../gov/bankruptcy/region/west_county.py | 82 +++++++++++++++++++ 7 files changed, 267 insertions(+), 25 deletions(-) create mode 100644 policyengine_us/variables/gov/bankruptcy/region/south_county.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/west_county.py diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py index 530154cf38e..c2f8696e3f8 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py @@ -10,16 +10,31 @@ class additonal_expenses_deductions(Variable): defined_for = StateCode.CA def formula(spm_unit, period, parameters): - health_insurance_expense = add(spm_unit, period,["health_insurance_premiums"]) - health_savings_account_expense = add(spm_unit, period,["health_savings_account_payroll_contributions"]) - + health_insurance_expense = add( + spm_unit, period, ["health_insurance_premiums"] + ) + health_savings_account_expense = add( + spm_unit, period, ["health_savings_account_payroll_contributions"] + ) + care_expense = add(spm_unit, period, ["care_expeses"]) - home_energy_costs = spm_unit.household("current_home_energy_use", period) - education_expense = add(spm_unit, period, ["k12_tuition_and_fees"]) ## no more than $189.58 + home_energy_costs = spm_unit.household( + "current_home_energy_use", period + ) + education_expense = add( + spm_unit, period, ["k12_tuition_and_fees"] + ) ## no more than $189.58 charitable_contributions = add( - spm_unit, - period, - ["charitable_cash_donations", "charitable_non_cash_donations"], - ) - total = health_insurance_expense + health_savings_account_expense + care_expense + home_energy_costs + education_expense + charitable_contributions - return total/MONTHS_IN_YEAR + spm_unit, + period, + ["charitable_cash_donations", "charitable_non_cash_donations"], + ) + total = ( + health_insurance_expense + + health_savings_account_expense + + care_expense + + home_energy_costs + + education_expense + + charitable_contributions + ) + return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py index 13033d91670..e47a61ca5dc 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py @@ -11,13 +11,19 @@ class other_necessary_expenses_deductions(Variable): def formula(spm_unit, period, parameters): income_tax = add(spm_unit, period, ["income_tax"]) - ## retirement_contribution - child_support_expense = add(spm_unit, period, ["child_support_expense"]) + ## retirement_contribution + child_support_expense = add( + spm_unit, period, ["child_support_expense"] + ) childcare_expenses = spm_unit("childcare_expenses", period) ## ??? - line_7 = spm_unit("line_7",period) - out_of_pocket_healthcare_expense = add(spm_unit, period,["medical_out_of_pocket_expenses"]) + line_7 = spm_unit("line_7", period) + out_of_pocket_healthcare_expense = add( + spm_unit, period, ["medical_out_of_pocket_expenses"] + ) line_22 = out_of_pocket_healthcare_expense - line_7 ## - total = income_tax + child_support_expense + childcare_expenses + line_22 - return total/MONTHS_IN_YEAR + total = ( + income_tax + child_support_expense + childcare_expenses + line_22 + ) + return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py index 5720bcda4b6..6c2be363501 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py @@ -8,6 +8,11 @@ class total_deductions(Variable): unit = USD definition_period = YEAR - adds = ["national_standards_deductions","local_standards_deductions", - "other_necessary_expenses_deductions","additional_expense_deductions", - "debt_payment_deductions","additional_expense_deductions"] + adds = [ + "national_standards_deductions", + "local_standards_deductions", + "other_necessary_expenses_deductions", + "additional_expense_deductions", + "debt_payment_deductions", + "additional_expense_deductions", + ] diff --git a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py b/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py index e69de29bb2d..dcea7eadc32 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py @@ -0,0 +1,61 @@ +from policyengine_us.model_api import * + + +class MidWestCounty(Enum): + CHICAGO = "Chicago" + CLEVELAND = "Cleveland" + DETROIT = "Detroit" + MINNEAPOLIS_ST_PAUL = "Minneapolis-St. Paul" + ST_LOUIS = "St. Louis" + MIDWEST_DEFAULT = "Midwest default" + + +class midwest_county(Variable): + value_type = Enum + entity = Household + possible_values = MidWestCounty + default_value = MidWestCounty.MIDWEST_DEFAULT + definition_period = YEAR + defined_for = "is_midwest_region" + label = "Midwest region state group" + + def formula(household, period, parameters): + county = household("county_str", period) + + chicago_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.chicago + + cleveland_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.cleveland + + detroit_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.detroit + + minneapolis_st_paul_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.minneapolis_st_paul + + st_louis_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.st_louis + + return select( + [ + np.isin(county, chicago_counties), + np.isin(county, cleveland_counties), + np.isin(county, detroit_counties), + np.isin(county, minneapolis_st_paul_counties), + np.isin(county, st_louis_counties), + ], + [ + MidWestCounty.CHICAGO, + MidWestCounty.CLEVELAND, + MidWestCounty.DETROIT, + MidWestCounty.MINNEAPOLIS_ST_PAUL, + MidWestCounty.ST_LOUIS, + ], + default=MidWestCounty.MIDWEST_DEFAULT, + ) diff --git a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py index 4e9ab1a5d71..66f48707515 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py @@ -12,14 +12,12 @@ class northeast_county(Variable): value_type = Enum entity = Household possible_values = NorthEastCounty - default_value = NorthEastCounty.NORTHEAST + default_value = NorthEastCounty.NORTHEAST_DEFAULT definition_period = YEAR - defined_for ="is_northeast_region" - label = "South Carolina use tax county group" - + defined_for = "is_northeast_region" + label = "Northeast region state group" def formula(household, period, parameters): - county = household("county_str", period) boston_counties = parameters( diff --git a/policyengine_us/variables/gov/bankruptcy/region/south_county.py b/policyengine_us/variables/gov/bankruptcy/region/south_county.py new file mode 100644 index 00000000000..f4530dd570f --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/south_county.py @@ -0,0 +1,75 @@ +from policyengine_us.model_api import * + + +class SouthCounty(Enum): + ATLANTA = "Atlanta" + BALTIMORE = "Baltimore" + DALLAS_FT_WORTH = "Dallas-Ft. Worth" + HOUSTON = "Houston" + MIAMI = "Miami" + TAMPA = "Tampa" + WASHINGTON_DC = "Washington DC" + SOUTH_DEFAULT = "South default" + + +class south_county(Variable): + value_type = Enum + entity = Household + possible_values = SouthCounty + default_value = SouthCounty.SOUTH_DEFAULT + definition_period = YEAR + defined_for = "is_south_region" + label = "South region state group" + + def formula(household, period, parameters): + county = household("county_str", period) + + atlanta_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.atlanta + + baltimore_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.baltimore + + dallas_ft_worth_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.dallas_ft_worth + + houston_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.houston + + miami_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.miami + + tampa_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.tampa + + washington_dc_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.washington_dc + + return select( + [ + np.isin(county, atlanta_counties), + np.isin(county, baltimore_counties), + np.isin(county, dallas_ft_worth_counties), + np.isin(county, houston_counties), + np.isin(county, miami_counties), + np.isin(county, tampa_counties), + np.isin(county, washington_dc_counties), + ], + [ + SouthCounty.ATLANTA, + SouthCounty.BALTIMORE, + SouthCounty.DALLAS_FT_WORTH, + SouthCounty.HOUSTON, + SouthCounty.MIAMI, + SouthCounty.TAMPA, + SouthCounty.WASHINGTON_DC, + ], + default=SouthCounty.SOUTH_DEFAULT, + ) diff --git a/policyengine_us/variables/gov/bankruptcy/region/west_county.py b/policyengine_us/variables/gov/bankruptcy/region/west_county.py new file mode 100644 index 00000000000..b475f18c979 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/west_county.py @@ -0,0 +1,82 @@ +from policyengine_us.model_api import * + + +class WestCounty(Enum): + ANCHORAGE = "Anchorage" + DENVER = "Denver" + HONOLULU = "Honolulu" + LOS_ANGELES = "Los Angeles" + PHOENIX = "Phoenix" + SAN_DIEGO = "San Diego" + SAN_FRANCISCO = "San Francisco" + SEATTLE = "Seattle" + WEST_DEFAULT = "West default" + + +class west_county(Variable): + value_type = Enum + entity = Household + possible_values = WestCounty + default_value = WestCounty.WEST_DEFAULT + definition_period = YEAR + defined_for = "is_west_region" + label = "West region state group" + + def formula(household, period, parameters): + county = household("county_str", period) + + anchorage_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.anchorage + + denver_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.denver + + honolulu_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.honolulu + + los_angeles_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.los_angeles + + phoenix_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.phoenix + + san_diego_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.san_diego + + san_francisco_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.san_francisco + + seattle_counties = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.seattle + + return select( + [ + np.isin(county, anchorage_counties), + np.isin(county, denver_counties), + np.isin(county, honolulu_counties), + np.isin(county, los_angeles_counties), + np.isin(county, phoenix_counties), + np.isin(county, san_diego_counties), + np.isin(county, san_francisco_counties), + np.isin(county, seattle_counties), + ], + [ + WestCounty.ANCHORAGE, + WestCounty.DENVER, + WestCounty.HONOLULU, + WestCounty.LOS_ANGELES, + WestCounty.PHOENIX, + WestCounty.SAN_DIEGO, + WestCounty.SAN_FRANCISCO, + WestCounty.SEATTLE, + ], + default=WestCounty.WEST_DEFAULT, + ) From 877ec8c06b636da8bb9b227fc6558bd410031f87 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Tue, 3 Dec 2024 04:58:50 +0000 Subject: [PATCH 08/19] draft --- .../insurance_and_operating.yaml | 429 +++++++++++++ .../mortage_or_rent.yaml | 145 ----- .../mortgage_or_rent.yaml | 574 ++++++++++++++++++ .../state_group/midwest.yaml | 24 + .../state_group/northeast.yaml | 21 + .../vehicle_operation/state_group/south.yaml | 28 + .../vehicle_operation/state_group/west.yaml | 25 + .../{base.yaml => main.yaml} | 4 +- .../out_of_pocket_health_care/amount.yaml | 20 + .../amount/{above_age.yaml => older.yaml} | 0 .../amount/{below_age.yaml => younger.yaml} | 0 .../eitc/family_security_act_2024_eitc.py | 1 - .../ny/wftc/ny_working_families_tax_credit.py | 1 - .../gov/bankruptcy/adjust_monthly_income.py | 1 - ...pter_7_bankruptcy_adjust_monthly_income.py | 46 ++ ...nkruptcy_additional_expense_deductions.py} | 3 +- ...r_7_bankruptcy_debt_payment_deductions.py} | 4 +- ...7_bankruptcy_local_standards_deductions.py | 30 + ...ankruptcy_national_standards_deductions.py | 25 + ...cy_other_necessary_expenses_deductions.py} | 3 +- .../chapter_7_bankruptcy_total_deductions.py | 17 + .../deductions/local_standards_deductions.py | 1 - .../national_standards_deductions.py | 2 - .../bankruptcy/deductions/total_deductions.py | 18 - .../expenses/public_transportation_expense.py | 9 + .../gov/bankruptcy/expenses/xx_expense.py | 2 +- .../bankruptcy/region/is_midwest_region.py | 18 + .../bankruptcy/region/is_northeast_region.py | 18 + .../gov/bankruptcy/region/is_south_region.py | 18 + .../gov/bankruptcy/region/is_west_region.py | 18 + .../gov/bankruptcy/region/midwest_county.py | 30 +- .../gov/bankruptcy/region/northeast_county.py | 18 +- .../gov/bankruptcy/region/south_county.py | 42 +- .../gov/bankruptcy/region/west_county.py | 48 +- .../credits/ctc/refundable/ctc_phase_in.py | 1 - 35 files changed, 1358 insertions(+), 286 deletions(-) delete mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml rename policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/{base.yaml => main.yaml} (80%) create mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml rename policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/{above_age.yaml => older.yaml} (100%) rename policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/{below_age.yaml => younger.yaml} (100%) delete mode 100644 policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py create mode 100644 policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py rename policyengine_us/variables/gov/bankruptcy/deductions/{additional_expense_deductions.py => chapter_7_bankruptcy_additional_expense_deductions.py} (94%) rename policyengine_us/variables/gov/bankruptcy/deductions/{debt_payment_deductions.py => chapter_7_bankruptcy_debt_payment_deductions.py} (62%) create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py rename policyengine_us/variables/gov/bankruptcy/deductions/{other_necessary_expenses_deductions.py => chapter_7_bankruptcy_other_necessary_expenses_deductions.py} (92%) create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py delete mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py delete mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py delete mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/expenses/public_transportation_expense.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/is_south_region.py create mode 100644 policyengine_us/variables/gov/bankruptcy/region/is_west_region.py diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml index 5dcf6253e64..ba9b57aa412 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -132,6 +132,435 @@ HI: 2024-01-01: 830 5: 2024-01-01: 843 +ID: + 1: + 2024-01-01: 522 + 2: + 2024-01-01: 614 + 3: + 2024-01-01: 646 + 4: + 2024-01-01: 721 + 5: + 2024-01-01: 732 +IL: + 1: + 2024-01-01: 578 + 2: + 2024-01-01: 678 + 3: + 2024-01-01: 715 + 4: + 2024-01-01: 797 + 5: + 2024-01-01: 810 +IN: + 1: + 2024-01-01: 581 + 2: + 2024-01-01: 683 + 3: + 2024-01-01: 719 + 4: + 2024-01-01: 802 + 5: + 2024-01-01: 815 +IA: + 1: + 2024-01-01: 582 + 2: + 2024-01-01: 684 + 3: + 2024-01-01: 720 + 4: + 2024-01-01: 803 + 5: + 2024-01-01: 816 +KS: + 1: + 2024-01-01: 588 + 2: + 2024-01-01: 690 + 3: + 2024-01-01: 727 + 4: + 2024-01-01: 811 + 5: + 2024-01-01: 824 +KY: + 1: + 2024-01-01: 562 + 2: + 2024-01-01: 660 + 3: + 2024-01-01: 696 + 4: + 2024-01-01: 776 + 5: + 2024-01-01: 788 +LA: + 1: + 2024-01-01: 555 + 2: + 2024-01-01: 652 + 3: + 2024-01-01: 687 + 4: + 2024-01-01: 766 + 5: + 2024-01-01: 779 +ME: + 1: + 2024-01-01: 563 + 2: + 2024-01-01: 661 + 3: + 2024-01-01: 696 + 4: + 2024-01-01: 776 + 5: + 2024-01-01: 789 +MD: + 1: + 2024-01-01: 593 + 2: + 2024-01-01: 697 + 3: + 2024-01-01: 734 + 4: + 2024-01-01: 819 + 5: + 2024-01-01: 832 +MA: + 1: + 2024-01-01: 636 + 2: + 2024-01-01: 747 + 3: + 2024-01-01: 787 + 4: + 2024-01-01: 878 + 5: + 2024-01-01: 892 +MI: + 1: + 2024-01-01: 571 + 2: + 2024-01-01: 671 + 3: + 2024-01-01: 707 + 4: + 2024-01-01: 789 + 5: + 2024-01-01: 801 +MN: + 1: + 2024-01-01: 580 + 2: + 2024-01-01: 681 + 3: + 2024-01-01: 717 + 4: + 2024-01-01: 800 + 5: + 2024-01-01: 813 +MS: + 1: + 2024-01-01: 577 + 2: + 2024-01-01: 678 + 3: + 2024-01-01: 714 + 4: + 2024-01-01: 797 + 5: + 2024-01-01: 809 +MO: + 1: + 2024-01-01: 575 + 2: + 2024-01-01: 675 + 3: + 2024-01-01: 711 + 4: + 2024-01-01: 793 + 5: + 2024-01-01: 806 +MT: + 1: + 2024-01-01: 551 + 2: + 2024-01-01: 647 + 3: + 2024-01-01: 682 + 4: + 2024-01-01: 760 + 5: + 2024-01-01: 773 + NE: + 1: + 2024-01-01: 592 + 2: + 2024-01-01: 695 + 3: + 2024-01-01: 732 + 4: + 2024-01-01: 816 + 5: + 2024-01-01: 830 +NV: + 1: + 2024-01-01: 547 + 2: + 2024-01-01: 643 + 3: + 2024-01-01: 677 + 4: + 2024-01-01: 756 + 5: + 2024-01-01: 768 +NH: + 1: + 2024-01-01: 596 + 2: + 2024-01-01: 700 + 3: + 2024-01-01: 738 + 4: + 2024-01-01: 823 + 5: + 2024-01-01: 836 +NJ: + 1: + 2024-01-01: 626 + 2: + 2024-01-01: 736 + 3: + 2024-01-01: 775 + 4: + 2024-01-01: 865 + 5: + 2024-01-01: 879 +NM: + 1: + 2024-01-01: 568 + 2: + 2024-01-01: 667 + 3: + 2024-01-01: 703 + 4: + 2024-01-01: 784 + 5: + 2024-01-01: 796 +NY: + 1: + 2024-01-01: 589 + 2: + 2024-01-01: 692 + 3: + 2024-01-01: 729 + 4: + 2024-01-01: 813 + 5: + 2024-01-01: 826 +NC: + 1: + 2024-01-01: 564 + 2: + 2024-01-01: 662 + 3: + 2024-01-01: 698 + 4: + 2024-01-01: 778 + 5: + 2024-01-01: 791 +ND: + 1: + 2024-01-01: 597 + 2: + 2024-01-01: 701 + 3: + 2024-01-01: 739 + 4: + 2024-01-01: 824 + 5: + 2024-01-01: 837 +OH: + 1: + 2024-01-01: 576 + 2: + 2024-01-01: 676 + 3: + 2024-01-01: 713 + 4: + 2024-01-01: 794 + 5: + 2024-01-01: 807 +OK: + 1: + 2024-01-01: 574 + 2: + 2024-01-01: 674 + 3: + 2024-01-01: 710 + 4: + 2024-01-01: 791 + 5: + 2024-01-01: 804 +OR: + 1: + 2024-01-01: 536 + 2: + 2024-01-01: 630 + 3: + 2024-01-01: 664 + 4: + 2024-01-01: 740 + 5: + 2024-01-01: 752 +PA: + 1: + 2024-01-01: 583 + 2: + 2024-01-01: 684 + 3: + 2024-01-01: 721 + 4: + 2024-01-01: 804 + 5: + 2024-01-01: 817 +RI: + 1: + 2024-01-01: 603 + 2: + 2024-01-01: 708 + 3: + 2024-01-01: 746 + 4: + 2024-01-01: 831 + 5: + 2024-01-01: 845 +SC: + 1: + 2024-01-01: 581 + 2: + 2024-01-01: 682 + 3: + 2024-01-01: 719 + 4: + 2024-01-01: 801 + 5: + 2024-01-01: 814 +SD: + 1: + 2024-01-01: 603 + 2: + 2024-01-01: 708 + 3: + 2024-01-01: 746 + 4: + 2024-01-01: 832 + 5: + 2024-01-01: 846 +TN: + 1: + 2024-01-01: 552 + 2: + 2024-01-01: 648 + 3: + 2024-01-01: 683 + 4: + 2024-01-01: 761 + 5: + 2024-01-01: 773 +TX: + 1: + 2024-01-01: 584 + 2: + 2024-01-01: 686 + 3: + 2024-01-01: 723 + 4: + 2024-01-01: 806 + 5: + 2024-01-01: 819 +UT: + 1: + 2024-01-01: 523 + 2: + 2024-01-01: 615 + 3: + 2024-01-01: 648 + 4: + 2024-01-01: 722 + 5: + 2024-01-01: 734 +VT: + 1: + 2024-01-01: 581 + 2: + 2024-01-01: 682 + 3: + 2024-01-01: 719 + 4: + 2024-01-01: 802 + 5: + 2024-01-01: 814 +VA: + 1: + 2024-01-01: 564 + 2: + 2024-01-01: 663 + 3: + 2024-01-01: 699 + 4: + 2024-01-01: 779 + 5: + 2024-01-01: 791 +WA: + 1: + 2024-01-01: 638 + 2: + 2024-01-01: 632 + 3: + 2024-01-01: 666 + 4: + 2024-01-01: 743 + 5: + 2024-01-01: 755 +WV: + 1: + 2024-01-01: 562 + 2: + 2024-01-01: 660 + 3: + 2024-01-01: 695 + 4: + 2024-01-01: 775 + 5: + 2024-01-01: 788 +WI: + 1: + 2024-01-01: 555 + 2: + 2024-01-01: 651 + 3: + 2024-01-01: 686 + 4: + 2024-01-01: 765 + 5: + 2024-01-01: 778 +WY: + 1: + 2024-01-01: 554 + 2: + 2024-01-01: 651 + 3: + 2024-01-01: 686 + 4: + 2024-01-01: 764 + 5: + 2024-01-01: 777 metadata: unit: currency-USD period: year diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml deleted file mode 100644 index da3837a34b0..00000000000 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortage_or_rent.yaml +++ /dev/null @@ -1,145 +0,0 @@ -description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. -values: -AL: - 1: - 2024-01-01: 677 - 2: - 2024-01-01: 796 - 3: - 2024-01-01: 838 - 4: - 2024-01-01: 935 - 5: - 2024-01-01: 950 -AL: - 1: - 2024-01-01: 1_049 - 2: - 2024-01-01: 1_232 - 3: - 2024-01-01: 1_298 - 4: - 2024-01-01: 1_448 - 5: - 2024-01-01: 1_471 -AZ: - 1: - 2024-01-01: 840 - 2: - 2024-01-01: 987 - 3: - 2024-01-01: 1_040 - 4: - 2024-01-01: 1_160 - 5: - 2024-01-01: 1_178 -AR: - 1: - 2024-01-01: 614 - 2: - 2024-01-01: 721 - 3: - 2024-01-01: 759 - 4: - 2024-01-01: 847 - 5: - 2024-01-01: 860 -CA: - 1: - 2024-01-01: 1_558 - 2: - 2024-01-01: 1_830 - 3: - 2024-01-01: 1_928 - 4: - 2024-01-01: 2_150 - 5: - 2024-01-01: 2_184 -CO: - 1: - 2024-01-01: 1_063 - 2: - 2024-01-01: 1_248 - 3: - 2024-01-01: 1_315 - 4: - 2024-01-01: 1_466 - 5: - 2024-01-01: 1_490 -CT: - 1: - 2024-01-01: 1_507 - 2: - 2024-01-01: 1_770 - 3: - 2024-01-01: 1_865 - 4: - 2024-01-01: 2_080 - 5: - 2024-01-01: 2_114 -DE: - 1: - 2024-01-01: 1_107 - 2: - 2024-01-01: 1_301 - 3: - 2024-01-01: 1_371 - 4: - 2024-01-01: 1_528 - 5: - 2024-01-01: 1_553 -DC: - 1: - 2024-01-01: 1_958 - 2: - 2024-01-01: 2_300 - 3: - 2024-01-01: 2_424 - 4: - 2024-01-01: 2_702 - 5: - 2024-01-01: 2_746 -FL: - 1: - 2024-01-01: 935 - 2: - 2024-01-01: 1_098 - 3: - 2024-01-01: 1_157 - 4: - 2024-01-01: 1_290 - 5: - 2024-01-01: 1_311 -GA: - 1: - 2024-01-01: 790 - 2: - 2024-01-01: 928 - 3: - 2024-01-01: 978 - 4: - 2024-01-01: 1_090 - 5: - 2024-01-01: 1_108 -HI: - 1: - 2024-01-01: 1_733 - 2: - 2024-01-01: 2_036 - 3: - 2024-01-01: 2_145 - 4: - 2024-01-01: 2_392 - 5: - 2024-01-01: 2_431 -metadata: - unit: currency-USD - period: year - label: Local standards of mortgage or rent expense - breakdown: - - state_code - - list(range(1,6)) - reference: - # We use average state level values while the amount can vary based on county - - title: Local standards -- Housing and Utilities and Transportation - href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml new file mode 100644 index 00000000000..3f9b0316ddc --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml @@ -0,0 +1,574 @@ +description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. +values: +AL: + 1: + 2024-01-01: 677 + 2: + 2024-01-01: 796 + 3: + 2024-01-01: 838 + 4: + 2024-01-01: 935 + 5: + 2024-01-01: 950 +AL: + 1: + 2024-01-01: 1_049 + 2: + 2024-01-01: 1_232 + 3: + 2024-01-01: 1_298 + 4: + 2024-01-01: 1_448 + 5: + 2024-01-01: 1_471 +AZ: + 1: + 2024-01-01: 840 + 2: + 2024-01-01: 987 + 3: + 2024-01-01: 1_040 + 4: + 2024-01-01: 1_160 + 5: + 2024-01-01: 1_178 +AR: + 1: + 2024-01-01: 614 + 2: + 2024-01-01: 721 + 3: + 2024-01-01: 759 + 4: + 2024-01-01: 847 + 5: + 2024-01-01: 860 +CA: + 1: + 2024-01-01: 1_558 + 2: + 2024-01-01: 1_830 + 3: + 2024-01-01: 1_928 + 4: + 2024-01-01: 2_150 + 5: + 2024-01-01: 2_184 +CO: + 1: + 2024-01-01: 1_063 + 2: + 2024-01-01: 1_248 + 3: + 2024-01-01: 1_315 + 4: + 2024-01-01: 1_466 + 5: + 2024-01-01: 1_490 +CT: + 1: + 2024-01-01: 1_507 + 2: + 2024-01-01: 1_770 + 3: + 2024-01-01: 1_865 + 4: + 2024-01-01: 2_080 + 5: + 2024-01-01: 2_114 +DE: + 1: + 2024-01-01: 1_107 + 2: + 2024-01-01: 1_301 + 3: + 2024-01-01: 1_371 + 4: + 2024-01-01: 1_528 + 5: + 2024-01-01: 1_553 +DC: + 1: + 2024-01-01: 1_958 + 2: + 2024-01-01: 2_300 + 3: + 2024-01-01: 2_424 + 4: + 2024-01-01: 2_702 + 5: + 2024-01-01: 2_746 +FL: + 1: + 2024-01-01: 935 + 2: + 2024-01-01: 1_098 + 3: + 2024-01-01: 1_157 + 4: + 2024-01-01: 1_290 + 5: + 2024-01-01: 1_311 +GA: + 1: + 2024-01-01: 790 + 2: + 2024-01-01: 928 + 3: + 2024-01-01: 978 + 4: + 2024-01-01: 1_090 + 5: + 2024-01-01: 1_108 +HI: + 1: + 2024-01-01: 1_733 + 2: + 2024-01-01: 2_036 + 3: + 2024-01-01: 2_145 + 4: + 2024-01-01: 2_392 + 5: + 2024-01-01: 2_431 +ID: + 1: + 2024-01-01: 865 + 2: + 2024-01-01: 1_016 + 3: + 2024-01-01: 1_071 + 4: + 2024-01-01: 1_194 + 5: + 2024-01-01: 1_213 +IL: + 1: + 2024-01-01: 788 + 2: + 2024-01-01: 926 + 3: + 2024-01-01: 975 + 4: + 2024-01-01: 1_087 + 5: + 2024-01-01: 1_105 +IN: + 1: + 2024-01-01: 699 + 2: + 2024-01-01: 821 + 3: + 2024-01-01: 865 + 4: + 2024-01-01: 965 + 5: + 2024-01-01: 981 +IA: + 1: + 2024-01-01: 746 + 2: + 2024-01-01: 876 + 3: + 2024-01-01: 923 + 4: + 2024-01-01: 1_029 + 5: + 2024-01-01: 1_046 +KS: + 1: + 2024-01-01: 747 + 2: + 2024-01-01: 877 + 3: + 2024-01-01: 924 + 4: + 2024-01-01: 1_031 + 5: + 2024-01-01: 1_047 +KY: + 1: + 2024-01-01: 683 + 2: + 2024-01-01: 802 + 3: + 2024-01-01: 845 + 4: + 2024-01-01: 942 + 5: + 2024-01-01: 957 +LA: + 1: + 2024-01-01: 788 + 2: + 2024-01-01: 926 + 3: + 2024-01-01: 975 + 4: + 2024-01-01: 1_088 + 5: + 2024-01-01: 1_105 +ME: + 1: + 2024-01-01: 880 + 2: + 2024-01-01: 1_034 + 3: + 2024-01-01: 1_089 + 4: + 2024-01-01: 1_216 + 5: + 2024-01-01: 1_234 +MD: + 1: + 2024-01-01: 1_314 + 2: + 2024-01-01: 1_575 + 3: + 2024-01-01: 1_660 + 4: + 2024-01-01: 1_851 + 5: + 2024-01-01: 1_881 +MA: + 1: + 2024-01-01: 1_602 + 2: + 2024-01-01: 1_881 + 3: + 2024-01-01: 1_982 + 4: + 2024-01-01: 2_210 + 5: + 2024-01-01: 2_246 +MI: + 1: + 2024-01-01: 749 + 2: + 2024-01-01: 879 + 3: + 2024-01-01: 927 + 4: + 2024-01-01: 1_033 + 5: + 2024-01-01: 1_050 +MN: + 1: + 2024-01-01: 896 + 2: + 2024-01-01: 1_053 + 3: + 2024-01-01: 1_109 + 4: + 2024-01-01: 1_237 + 5: + 2024-01-01: 1_257 +MS: + 1: + 2024-01-01: 662 + 2: + 2024-01-01: 778 + 3: + 2024-01-01: 819 + 4: + 2024-01-01: 914 + 5: + 2024-01-01: 928 +MO: + 1: + 2024-01-01: 686 + 2: + 2024-01-01: 806 + 3: + 2024-01-01: 850 + 4: + 2024-01-01: 947 + 5: + 2024-01-01: 962 +MT: + 1: + 2024-01-01: 865 + 2: + 2024-01-01: 1_016 + 3: + 2024-01-01: 1_071 + 4: + 2024-01-01: 1_194 + 5: + 2024-01-01: 1_213 +NE: + 1: + 2024-01-01: 735 + 2: + 2024-01-01: 864 + 3: + 2024-01-01: 910 + 4: + 2024-01-01: 1_015 + 5: + 2024-01-01: 1_031 +NV: + 1: + 2024-01-01: 960 + 2: + 2024-01-01: 1_127 + 3: + 2024-01-01: 1_188 + 4: + 2024-01-01: 1_324 + 5: + 2024-01-01: 1_346 +NH: + 1: + 2024-01-01: 1_272 + 2: + 2024-01-01: 1_494 + 3: + 2024-01-01: 1_575 + 4: + 2024-01-01: 1_756 + 5: + 2024-01-01: 1_784 +NJ: + 1: + 2024-01-01: 1_801 + 2: + 2024-01-01: 2_115 + 3: + 2024-01-01: 2_229 + 4: + 2024-01-01: 2_485 + 5: + 2024-01-01: 2_525 +NM: + 1: + 2024-01-01: 762 + 2: + 2024-01-01: 895 + 3: + 2024-01-01: 943 + 4: + 2024-01-01: 1_051 + 5: + 2024-01-01: 1_068 +NY: + 1: + 2024-01-01: 1_157 + 2: + 2024-01-01: 1_359 + 3: + 2024-01-01: 1_432 + 4: + 2024-01-01: 1_596 + 5: + 2024-01-01: 1_622 +NC: + 1: + 2024-01-01: 829 + 2: + 2024-01-01: 973 + 3: + 2024-01-01: 1_026 + 4: + 2024-01-01: 1_144 + 5: + 2024-01-01: 1_162 +ND: + 1: + 2024-01-01: 782 + 2: + 2024-01-01: 918 + 3: + 2024-01-01: 968 + 4: + 2024-01-01: 1_079 + 5: + 2024-01-01: 1_096 +OH: + 1: + 2024-01-01: 797 + 2: + 2024-01-01: 936 + 3: + 2024-01-01: 986 + 4: + 2024-01-01: 1_099 + 5: + 2024-01-01: 1_117 +OK: + 1: + 2024-01-01: 699 + 2: + 2024-01-01: 821 + 3: + 2024-01-01: 866 + 4: + 2024-01-01: 965 + 5: + 2024-01-01: 981 +OR: + 1: + 2024-01-01: 1_045 + 2: + 2024-01-01: 1_227 + 3: + 2024-01-01: 1_293 + 4: + 2024-01-01: 1_442 + 5: + 2024-01-01: 1_465 +PA: + 1: + 2024-01-01: 888 + 2: + 2024-01-01: 1_043 + 3: + 2024-01-01: 1_099 + 4: + 2024-01-01: 1_225 + 5: + 2024-01-01: 1_245 +RI: + 1: + 2024-01-01: 1_506 + 2: + 2024-01-01: 1_769 + 3: + 2024-01-01: 1_864 + 4: + 2024-01-01: 2_079 + 5: + 2024-01-01: 2_113 +SC: + 1: + 2024-01-01: 758 + 2: + 2024-01-01: 890 + 3: + 2024-01-01: 938 + 4: + 2024-01-01: 1_046 + 5: + 2024-01-01: 1_063 +NJ: + 1: + 2024-01-01: 749 + 2: + 2024-01-01: 879 + 3: + 2024-01-01: 926 + 4: + 2024-01-01: 1_033 + 5: + 2024-01-01: 1_050 +TN: + 1: + 2024-01-01: 730 + 2: + 2024-01-01: 857 + 3: + 2024-01-01: 903 + 4: + 2024-01-01: 1_007 + 5: + 2024-01-01: 1_024 +TX: + 1: + 2024-01-01: 854 + 2: + 2024-01-01: 1_003 + 3: + 2024-01-01: 1_057 + 4: + 2024-01-01: 1_178 + 5: + 2024-01-01: 1_197 +UT: + 1: + 2024-01-01: 997 + 2: + 2024-01-01: 1_171 + 3: + 2024-01-01: 1_234 + 4: + 2024-01-01: 1_376 + 5: + 2024-01-01: 1_398 +VT: + 1: + 2024-01-01: 1_109 + 2: + 2024-01-01: 1_302 + 3: + 2024-01-01: 1_372 + 4: + 2024-01-01: 1_530 + 5: + 2024-01-01: 1_555 +VA: + 1: + 2024-01-01: 1_026 + 2: + 2024-01-01: 1_205 + 3: + 2024-01-01: 1_270 + 4: + 2024-01-01: 1_416 + 5: + 2024-01-01: 1_439 +WA: + 1: + 2024-01-01: 1_138 + 2: + 2024-01-01: 1_337 + 3: + 2024-01-01: 1_408 + 4: + 2024-01-01: 1_570 + 5: + 2024-01-01: 1_596 +WV: + 1: + 2024-01-01: 614 + 2: + 2024-01-01: 721 + 3: + 2024-01-01: 760 + 4: + 2024-01-01: 847 + 5: + 2024-01-01: 861 +WI: + 1: + 2024-01-01: 920 + 2: + 2024-01-01: 1_081 + 3: + 2024-01-01: 1_139 + 4: + 2024-01-01: 1_270 + 5: + 2024-01-01: 1_290 +WY: + 1: + 2024-01-01: 1_044 + 2: + 2024-01-01: 1_227 + 3: + 2024-01-01: 1_293 + 4: + 2024-01-01: 1_441 + 5: + 2024-01-01: 1_465 +metadata: + unit: currency-USD + period: year + label: Local standards of mortgage or rent expense + breakdown: + - state_code + - list(range(1,6)) + reference: + # We use average state level values while the amount can vary based on county + - title: Local standards -- Housing and Utilities and Transportation + href: https://www.justice.gov/ust/means-testing/20221101 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml new file mode 100644 index 00000000000..fd12ac32b7f --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml @@ -0,0 +1,24 @@ +description: The following states belongs to midwest region by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area midwest region states + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ND + - SD + - NE + - KS + - MO + - IL + - IN + - OH + - MI + - WI + - MN + - IA + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml new file mode 100644 index 00000000000..b06c96d1083 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml @@ -0,0 +1,21 @@ +description: The following states belongs to northeast region by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area northeast region states + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - ME + - NH + - VT + - MA + - RI + - CT + - PA + - NY + - NJ + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml new file mode 100644 index 00000000000..64b7694ad60 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml @@ -0,0 +1,28 @@ +description: The following states belongs to south region by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area south region states + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - TX + - OK + - AR + - LA + - MS + - TN + - KY + - WV + - MD + - DC + - DE + - NC + - SC + - GA + - FL + - AL + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml new file mode 100644 index 00000000000..41fa57b2665 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml @@ -0,0 +1,25 @@ +description: The following states belongs to west region by Metropolitan Statistical Area definitions. + +metadata: + unit: list + period: year + label: IRS Metropolitan Statistical Area west region states + reference: + - title: Internal Revenue Service, Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation +values: + 2024-01-01: + - NM + - AZ + - CO + - WY + - MT + - NV + - UT + - WA + - OR + - ID + - CA + - AK + - HI + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml similarity index 80% rename from policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml rename to policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml index b00d7a5650a..fe5e0fa8a58 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/base.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of food, clothing and other items by the national standards to this base amount, based on household size. +description: The Chapter 7 bankruptcy means test limits the expense of food, clothing and other items by the national standards to this amount, based on household size. values: 1: @@ -13,7 +13,7 @@ values: metadata: unit: currency-USD period: year - label: National standards of food, clothing and other items base amount + label: National standards of food, clothing and other items amount breakdown: - list(range(1,5)) reference: diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml new file mode 100644 index 00000000000..6165edcd2ac --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml @@ -0,0 +1,20 @@ +description: The IRS sets different expense limits on out-of-pocket health care for filers based on this age threshold under the Chapter 7 Bankruptcy means test. +brackets: + - threshold: + 2024-01-01: 0 + amount: + 2024-01-01: 83 + - threshold: + 2024-01-01: 65 + amount: + 2024-01-01: 158 +metadata: + label: National Standards out of pocket health care allowance + type: single_amount + threshold_unit: year + amount_unit: currency-USD + period: year + reference: + - title: National standards -- Out-of-pocket health care + href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care + diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/above_age.yaml rename to policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/below_age.yaml rename to policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml diff --git a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py index 00b7fc73be0..d8920d739a5 100644 --- a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py +++ b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py @@ -3,7 +3,6 @@ def create_family_security_act_2024_eitc() -> Reform: - class eitc_maximum(Variable): value_type = float entity = TaxUnit diff --git a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py index c96190d4eeb..4db3aa2d414 100644 --- a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py +++ b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py @@ -486,7 +486,6 @@ class ny_exemptions(Variable): defined_for = StateCode.NY def formula(tax_unit, period, parameters): - count_dependents = add( tax_unit, period, ["ny_exemptions_dependent"] ) diff --git a/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py deleted file mode 100644 index 769358b1770..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/adjust_monthly_income.py +++ /dev/null @@ -1 +0,0 @@ -# line 1-4 \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py new file mode 100644 index 00000000000..e7fcce3e846 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py @@ -0,0 +1,46 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_adjust_monthly_income(Variable): + value_type = bool + entity = SPMUnit + label = "Adjust monthly income" + definition_period = MONTH + reference = ( + "https://www.uscourts.gov/sites/default/files/form_b122a-1.pdf#page=1" + ) + documentation = "Line 4 in form 122A-2" + + # Can I create a list parameter which includes all of the following varaibles? + def formula(spm_unit, period, parameters): + employment_income = add(spm_unit, period, ["irs_employment_income"]) + alimony_income = add(spm_unit, period, ["alimony_income"]) + child_support_received = add( + spm_unit, period, ["child_support_received"] + ) + business_and_farm_income = add( + spm_unit, period, ["partnership_s_corp_income", "farm_income"] + ) + rental_income = add( + spm_unit, period, ["farm_rent_income", "rental_income"] + ) + interest_and_dividends_income = add( + spm_unit, period, ["divident_income", "interest_income"] + ) + unemployment_compensation = add( + spm_unit, period, ["unemployment_compensation"] + ) + pension_and_retirement_income = add( + spm_unit, period, ["pension_income", "retirement_distribution"] + ) + total = ( + employment_income + + alimony_income + + child_support_received + + business_and_farm_income + + rental_income + + interest_and_dividends_income + + unemployment_compensation + + pension_and_retirement_income + ) + return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py similarity index 94% rename from policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py rename to policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index c2f8696e3f8..fb2e1a4726a 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -1,13 +1,12 @@ from policyengine_us.model_api import * -class additonal_expenses_deductions(Variable): +class chapter_7_bankruptcy_additonal_expenses_deductions(Variable): value_type = bool entity = SPMUnit label = "Additional expenses deductions" definition_period = MONTH reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=6" - defined_for = StateCode.CA def formula(spm_unit, period, parameters): health_insurance_expense = add( diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py similarity index 62% rename from policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py rename to policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py index cdf7aa7478d..bb2e479e75c 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py @@ -1,12 +1,12 @@ from policyengine_us.model_api import * -class debt_payment_deductions(Variable): +class chapter_7_bankruptcy_debt_payment_deductions(Variable): value_type = bool entity = SPMUnit label = "Debt payment deduction" definition_period = MONTH reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=7" - defined_for = StateCode.CA def formula(spm_unit, period, parameters): + # seems to be redudent to the calculation process as we already have local standard deduction in line 9 line 13. \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py new file mode 100644 index 00000000000..9f37ea43962 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -0,0 +1,30 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_local_standards_deductions(Variable): + value_type = bool + entity = SPMUnit + label = "Local standards deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=3" + + def formula(spm_unit, period, parameters): + # Housing and utilities + vehicle operation (owned or lease, public transportation) + p = parameters( + period + ).gov.bankruptcy.local_standards + size = spm_unit("spm_unit_size", period) + state = spm_unit.household("state_code_str", period) + insurance_and_operating_allowance = p.housing_and_utilities.insurance_and_operating[state][size] + + mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[state][size] + monthly_housing_payment = add(spm_unit,period,["housing_cost"])/MONTHS_IN_YEAR + net_mortgage_or_rent_expense = max_(mortgage_or_rent_allowance - monthly_housing_payment,0) + + ## vehciel opertating expense + + public_transportation_allowance = p.vehicle_operation.public_transportation + public_transportation_expense = add(spm_unit,period,["public_transportation_expense"]) + net_public_transportation_expense = max_(public_transportation_allowance - public_transportation_expense,0) + + return net_mortgage_or_rent_expense + net_public_transportation_expense \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py new file mode 100644 index 00000000000..ce20d1d52ff --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_national_standards_deductions(Variable): + value_type = bool + entity = SPMUnit + label = "National standards deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=2" + + def formula(spm_unit, period, parameters): + p = parameters( + period + ).gov.bankruptcy.national_standards + size = spm_unit("spm_unit_size", period) + capped_people = min_(size, 4).astype(int) + additional_people = size - capped_people + base = p.food_clothing_and_others.main[capped_people] + additional_amount = p.food_clothing_and_others.additional * additional_people + food_clothing_and_others_allowance = base + additional_amount + + age = spm_unit.members("age",period) + out_of_pocket_health_care_allowance = p.out_of_pocket_health_care.amount.calc(age) + return food_clothing_and_others_allowance + out_of_pocket_health_care_allowance + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py similarity index 92% rename from policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py rename to policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py index e47a61ca5dc..3498d6084b0 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py @@ -1,13 +1,12 @@ from policyengine_us.model_api import * -class other_necessary_expenses_deductions(Variable): +class chapter_7_bankruptcy_other_necessary_expenses_deductions(Variable): value_type = bool entity = SPMUnit label = "Other necessary expenses deduction" definition_period = MONTH reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=5" - defined_for = StateCode.CA def formula(spm_unit, period, parameters): income_tax = add(spm_unit, period, ["income_tax"]) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py new file mode 100644 index 00000000000..54ebf399b58 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py @@ -0,0 +1,17 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_total_deductions(Variable): + value_type = float + entity = SPMUnit + label = "Total deductions from Income" + unit = USD + definition_period = YEAR + + adds = [ + "chapter_7_bankruptcy_national_standards_deductions", + "chapter_7_bankruptcy_local_standards_deductions", + "chapter_7_bankruptcy_other_necessary_expenses_deductions", + "chapter_7_bankruptcy_additional_expense_deductions", + "chapter_7_bankruptcy_debt_payment_deductions", + ] diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py deleted file mode 100644 index 7d187e19784..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/deductions/local_standards_deductions.py +++ /dev/null @@ -1 +0,0 @@ -# Housing and utilities + vehicle operation (owned or lease, public transportation) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py deleted file mode 100644 index 7e2e0ee22fe..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/deductions/national_standards_deductions.py +++ /dev/null @@ -1,2 +0,0 @@ -# get household size -# food_clothing_and_other + out_of_pocket_health_care \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py deleted file mode 100644 index 6c2be363501..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/deductions/total_deductions.py +++ /dev/null @@ -1,18 +0,0 @@ -from policyengine_us.model_api import * - - -class total_deductions(Variable): - value_type = float - entity = SPMUnit - label = "Total deductions from Income" - unit = USD - definition_period = YEAR - - adds = [ - "national_standards_deductions", - "local_standards_deductions", - "other_necessary_expenses_deductions", - "additional_expense_deductions", - "debt_payment_deductions", - "additional_expense_deductions", - ] diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/public_transportation_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/public_transportation_expense.py new file mode 100644 index 00000000000..e1b6a6afa9b --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/expenses/public_transportation_expense.py @@ -0,0 +1,9 @@ +from policyengine_us.model_api import * + + +class public_transportation_expense(Variable): + value_type = float + entity = Person + label = "Public transportation expense" + unit = USD + definition_period = YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py index 0543b060ec5..90762841ddb 100644 --- a/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py +++ b/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py @@ -1 +1 @@ -# This folder contains all the new variables created for this program. \ No newline at end of file +# This folder contains all the new variables created for this program. diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py b/policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py new file mode 100644 index 00000000000..2a437e755f6 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class is_midwest_region(Variable): + value_type = bool + entity = SPMUnit + label = "Is in Midwest region" + definition_period = YEAR + reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" + + def formula(spm_unit, period, parameters): + state = spm_unit.household("state_code", period) + + p = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.state_group + + return np.isin(state, p.midwest) diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py b/policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py new file mode 100644 index 00000000000..5076907eb99 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class is_northeast_region(Variable): + value_type = bool + entity = SPMUnit + label = "Is in Northeast region" + definition_period = YEAR + reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" + + def formula(spm_unit, period, parameters): + state = spm_unit.household("state_code", period) + + p = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.state_group + + return np.isin(state, p.northeast) diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_south_region.py b/policyengine_us/variables/gov/bankruptcy/region/is_south_region.py new file mode 100644 index 00000000000..8bf7aac9041 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/is_south_region.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class is_south_region(Variable): + value_type = bool + entity = SPMUnit + label = "Is in South region" + definition_period = YEAR + reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" + + def formula(spm_unit, period, parameters): + state = spm_unit.household("state_code", period) + + p = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.state_group + + return np.isin(state, p.south) diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py b/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py new file mode 100644 index 00000000000..6421571cef6 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class is_west_region(Variable): + value_type = bool + entity = SPMUnit + label = "Is in West region" + definition_period = YEAR + reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" + + def formula(spm_unit, period, parameters): + state = spm_unit.household("state_code", period) + + p = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.state_group + + return np.isin(state, p.west) diff --git a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py b/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py index dcea7eadc32..d67481f1c65 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py @@ -22,33 +22,17 @@ class midwest_county(Variable): def formula(household, period, parameters): county = household("county_str", period) - chicago_counties = parameters( + p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.chicago - - cleveland_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.cleveland - - detroit_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.detroit - - minneapolis_st_paul_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.minneapolis_st_paul - - st_louis_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.midwest.st_louis + ).gov.bankruptcy.local_standards.vehicle_operation.region_group return select( [ - np.isin(county, chicago_counties), - np.isin(county, cleveland_counties), - np.isin(county, detroit_counties), - np.isin(county, minneapolis_st_paul_counties), - np.isin(county, st_louis_counties), + np.isin(county, p.midwest.chicago), + np.isin(county, p.midwest.cleveland), + np.isin(county, p.midwest.detroit), + np.isin(county, p.midwest.minneapolis_st_paul), + np.isin(county, p.midwest.st_louis), ], [ MidWestCounty.CHICAGO, diff --git a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py index 66f48707515..ed535c0fc87 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py @@ -20,23 +20,15 @@ class northeast_county(Variable): def formula(household, period, parameters): county = household("county_str", period) - boston_counties = parameters( + p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.boston - - new_york_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.new_york - - philadelphia_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.northeast.philadelphia + ).gov.bankruptcy.local_standards.vehicle_operation.region_group return select( [ - np.isin(county, boston_counties), - np.isin(county, new_york_counties), - np.isin(county, philadelphia_counties), + np.isin(county, p.northeast.boston), + np.isin(county, p.northeast.new_york), + np.isin(county, p.northeast.philadelphia), ], [ NorthEastCounty.BOSTON, diff --git a/policyengine_us/variables/gov/bankruptcy/region/south_county.py b/policyengine_us/variables/gov/bankruptcy/region/south_county.py index f4530dd570f..258983d70d9 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/south_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/south_county.py @@ -24,43 +24,19 @@ class south_county(Variable): def formula(household, period, parameters): county = household("county_str", period) - atlanta_counties = parameters( + p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.atlanta - - baltimore_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.baltimore - - dallas_ft_worth_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.dallas_ft_worth - - houston_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.houston - - miami_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.miami - - tampa_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.tampa - - washington_dc_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.south.washington_dc + ).gov.bankruptcy.local_standards.vehicle_operation.region_group return select( [ - np.isin(county, atlanta_counties), - np.isin(county, baltimore_counties), - np.isin(county, dallas_ft_worth_counties), - np.isin(county, houston_counties), - np.isin(county, miami_counties), - np.isin(county, tampa_counties), - np.isin(county, washington_dc_counties), + np.isin(county, p.south.atlanta), + np.isin(county, p.northeast.baltimore), + np.isin(county, p.northeast.dallas_ft_worth), + np.isin(county, p.northeast.houston), + np.isin(county, p.northeast.miami), + np.isin(county, p.northeast.tampa), + np.isin(county, p.northeast.washington_dc), ], [ SouthCounty.ATLANTA, diff --git a/policyengine_us/variables/gov/bankruptcy/region/west_county.py b/policyengine_us/variables/gov/bankruptcy/region/west_county.py index b475f18c979..8b74e2e8faf 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/west_county.py +++ b/policyengine_us/variables/gov/bankruptcy/region/west_county.py @@ -25,48 +25,20 @@ class west_county(Variable): def formula(household, period, parameters): county = household("county_str", period) - anchorage_counties = parameters( + p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.anchorage - - denver_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.denver - - honolulu_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.honolulu - - los_angeles_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.los_angeles - - phoenix_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.phoenix - - san_diego_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.san_diego - - san_francisco_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.san_francisco - - seattle_counties = parameters( - period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group.west.seattle + ).gov.bankruptcy.local_standards.vehicle_operation.region_groupp return select( [ - np.isin(county, anchorage_counties), - np.isin(county, denver_counties), - np.isin(county, honolulu_counties), - np.isin(county, los_angeles_counties), - np.isin(county, phoenix_counties), - np.isin(county, san_diego_counties), - np.isin(county, san_francisco_counties), - np.isin(county, seattle_counties), + np.isin(county, p.west.anchorage), + np.isin(county, p.west.denver), + np.isin(county, p.west.honolulu), + np.isin(county, p.west.los_angeles), + np.isin(county, p.west.phoenix), + np.isin(county, p.west.san_diego), + np.isin(county, p.west.san_francisco), + np.isin(county, p.west.seattle), ], [ WestCounty.ANCHORAGE, diff --git a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py index ea632bcdfeb..f8ab3d42805 100644 --- a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py +++ b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py @@ -10,7 +10,6 @@ class ctc_phase_in(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/24#d" def formula(tax_unit, period, parameters): - ctc = parameters(period).gov.irs.credits.ctc earnings = tax_unit("tax_unit_earned_income", period) From be7f70bff5692da4dc5dace1880c964e09c639ec Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:06:36 +0000 Subject: [PATCH 09/19] adjust description, add formula --- .../insurance_and_operating.yaml | 2 +- .../mortgage_or_rent.yaml | 2 +- .../county_group/midwest/chicago.yaml | 2 +- .../county_group/midwest/cleveland.yaml | 2 +- .../county_group/midwest/detroit.yaml | 2 +- .../midwest/minneapolis_st_paul.yaml | 2 +- .../county_group/midwest/st_louis.yaml | 2 +- .../county_group/northeast/boston.yaml | 2 +- .../county_group/northeast/new_york.yaml | 2 +- .../county_group/northeast/philadelphia.yaml | 2 +- .../county_group/south/atlanta.yaml | 2 +- .../county_group/south/baltimore.yaml | 2 +- .../county_group/south/dallas_ft_worth.yaml | 2 +- .../county_group/south/houston.yaml | 2 +- .../county_group/south/miami.yaml | 2 +- .../county_group/south/tampa.yaml | 2 +- .../county_group/south/washington_dc.yaml | 2 +- .../county_group/west/anchorage.yaml | 2 +- .../county_group/west/denver.yaml | 2 +- .../county_group/west/honolulu.yaml | 2 +- .../county_group/west/los_angeles.yaml | 2 +- .../county_group/west/phoenix.yaml | 2 +- .../county_group/west/san_diego.yaml | 2 +- .../county_group/west/san_francisco.yaml | 2 +- .../county_group/west/seattle.yaml | 2 +- .../vehicle_operation/ownership_costs.yaml | 2 +- .../public_transportation.yaml | 2 +- .../region_operating_costs/midwest.yaml | 44 +++++ .../region_operating_costs/northeast.yaml | 2 +- .../region_operating_costs.yaml | 156 ------------------ .../region_operating_costs/south.yaml | 53 ++++++ .../region_operating_costs/west.yaml | 59 +++++++ .../state_group/midwest.yaml | 2 +- .../state_group/northeast.yaml | 2 +- .../vehicle_operation/state_group/south.yaml | 2 +- .../vehicle_operation/state_group/west.yaml | 2 +- .../food_clothing_and_others/additional.yaml | 2 +- .../food_clothing_and_others/main.yaml | 2 +- .../amount/older.yaml | 2 +- ...pter_7_bankruptcy_adjust_monthly_income.py | 4 +- ...ankruptcy_additional_expense_deductions.py | 2 +- ...er_7_bankruptcy_debt_payment_deductions.py | 6 +- ...ptcy_food_clothing_and_others_deduction.py | 23 +++ ...7_bankruptcy_local_standards_deductions.py | 24 ++- ...ankruptcy_national_standards_deductions.py | 25 --- ...tcy_other_necessary_expenses_deductions.py | 12 +- ...ruptcy_out_of_pocket_health_care_deduction | 19 +++ .../chapter_7_bankruptcy_total_deductions.py | 4 +- ...tcy_vehicle_operation_expense_deduction.py | 29 ++++ .../expenses/vehicle_mortgage_expense.py | 9 + .../gov/bankruptcy/expenses/xx_expense.py | 1 - .../gov/bankruptcy/is_presumption_of_abuse.py | 24 +++ 52 files changed, 328 insertions(+), 236 deletions(-) create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml delete mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py delete mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction create mode 100644 policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py create mode 100644 policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py delete mode 100644 policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py create mode 100644 policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml index ba9b57aa412..22f2606260d 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of insurance and operating by the local standards to this amount, based on household size. +description: The IRS limits the expense of insurance and operating by the local standards to this amount, based on household size under the chapter 7 bankruptcy means test. values: AL: 1: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml index 3f9b0316ddc..a71766fd118 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of mortgage or rent by the local standards to this amount, based on household size. +description: The IRS limits the expense of mortgage or rent by the local standards to this amount, based on household size under the chapter 7 bankruptcy means test. values: AL: 1: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml index 8a4b74b781c..eb524bef12e 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Chicago area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Chicago area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml index 8d67d5f553a..ea3311d3e3c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Cleveland area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Cleveland area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml index c8adee82b62..0b3cba910c5 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Detroit area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Detroit area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml index 40a19b63d73..7d4768d899b 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Minneapolis-St.Paul area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Minneapolis-St.Paul area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml index 055dc389e62..c865ed904ef 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to St.Louis area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the St.Louis area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml index 0f2367e3b9a..a9eca685a44 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Boston area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Boston area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml index e8aa72ca3b2..c8e69bc05ec 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to New York area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the New York area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml index 0f28a454498..026632a3b52 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Philadelphia area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Philadelphia area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml index 5181a96b594..9bed0bedf74 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Atlanta area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Atlanta area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml index 5dea0522013..e912649bb0c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Baltimore area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Baltimore area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml index 64bd1f70e03..8c39c6db33e 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Dallas Ft.Worth area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Dallas Ft.Worth area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml index af46ff9703b..30544be7edb 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Houston area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Houston area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml index 176e36e0ba4..85097626cba 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Miami area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Miami area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml index 5882cd0d006..bf5d71f612c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Tampa area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Tampa area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml index 53815bae8b5..35c7f6c6d02 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Washington DC area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Washington DC area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml index 06cfda18488..00fd889940d 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Anchorage area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Anchorage area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml index 3e858b26b2b..82d5b78b8aa 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Denver area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Denver area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml index 0136532d1a8..e08420d8166 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml @@ -1,4 +1,4 @@ -description: The following county belongs to Honolulu area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Honolulu area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml index c37fb980f28..864cb1e0b7a 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml @@ -1,4 +1,4 @@ -description: The following county belongs to Los Angeles area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Los Angeles area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml index 1b0337cab54..99268837800 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Phoenix area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Phoenix area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml index ae4772ab065..0506cc9f119 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to San Diego area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the San Diego area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml index e9c7077feca..e83aec1a792 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to San Francisco area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the San Francisco area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml index 6520eb60b9e..1d6d74443fa 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml @@ -1,4 +1,4 @@ -description: The following counties belongs to Seattle area by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default counties in the Seattle area under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml index 77ea339e6eb..babd56f6ff9 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the ownership costs by the local standards to this amount, based on the number of owned vehicle. +description: The IRS limits the ownership costs by the local standards to this amount, based on the number of owned vehicle, under the chapter 7 bankruptcy means test. values: 1: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml index 05ad53c2585..07848031ad2 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of public transportation by the local standards to this amount. +description: The IRS limits the expense of public transportation by the local standards to this amount under the chapter 7 bankruptcy means test. values: 2024-01-01: 215 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml new file mode 100644 index 00000000000..61fecae9b9f --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml @@ -0,0 +1,44 @@ +description: The IRS limits the expense of midwest region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. + +values: +Midwest_region: + 1: + 2024-01-01: 239 + 2: + 2024-01-01: 478 +Chicago: + 1: + 2024-01-01: 266 + 2: + 2024-01-01: 532 +Cleveland: + 1: + 2024-01-01: 239 + 2: + 2024-01-01: 478 +Detroit: + 1: + 2024-01-01: 299 + 2: + 2024-01-01: 598 +Minneapolis_St.Paul: + 1: + 2024-01-01: 243 + 2: + 2024-01-01: 486 +St.Louis: + 1: + 2024-01-01: 220 + 2: + 2024-01-01: 440 + +metadata: + unit: currency-USD + period: year + label: Local standards of operating costs amount + breakdown: + - midwest_county + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml index 27725547ac8..9e0c0e3292f 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of operating costs by the local standards to this amount, based on region and the number of owned vehicle. +description: The IRS limits the expense of northeast region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. values: NORTHEAST: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml deleted file mode 100644 index 8e9b7987b09..00000000000 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/region_operating_costs.yaml +++ /dev/null @@ -1,156 +0,0 @@ -description: The Chapter 7 bankruptcy means test limits the expense of operating costs by the local standards to this amount, based on region and the number of owned vehicle. - -values: -Northeast_region: - NORTHEAST: - 1: - 2024-01-01: 285 - 2: - 2024-01-01: 570 - BOSTON: - 1: - 2024-01-01: 310 - 2: - 2024-01-01: 620 - NEW_YORK: - 1: - 2024-01-01: 377 - 2: - 2024-01-01: 754 - PHILADELPHIA: - 1: - 2024-01-01: 307 - 2: - 2024-01-01: 614 -Midwest_region: - Midwest_region: - 1: - 2024-01-01: 239 - 2: - 2024-01-01: 478 - Chicago: - 1: - 2024-01-01: 266 - 2: - 2024-01-01: 532 - Cleveland: - 1: - 2024-01-01: 239 - 2: - 2024-01-01: 478 - Detroit: - 1: - 2024-01-01: 299 - 2: - 2024-01-01: 598 - Minneapolis_St.Paul: - 1: - 2024-01-01: 243 - 2: - 2024-01-01: 486 - St.Louis: - 1: - 2024-01-01: 220 - 2: - 2024-01-01: 440 - -South_region: - South_region: - 1: - 2024-01-01: 260 - 2: - 2024-01-01: 520 - Atlanta: - 1: - 2024-01-01: 304 - 2: - 2024-01-01: 608 - Baltimore: - 1: - 2024-01-01: 272 - 2: - 2024-01-01: 544 - Dallas_Ft.Worth: - 1: - 2024-01-01: 292 - 2: - 2024-01-01: 584 - Houston: - 1: - 2024-01-01: 332 - 2: - 2024-01-01: 664 - Miami: - 1: - 2024-01-01: 355 - 2: - 2024-01-01: 710 - Tampa: - 1: - 2024-01-01: 305 - 2: - 2024-01-01: 610 - Washington_DC: - 1: - 2024-01-01: 301 - 2: - 2024-01-01: 602 - -West_region: - West_region: - 1: - 2024-01-01: 273 - 2: - 2024-01-01: 546 - Anchorage: - 1: - 2024-01-01: 200 - 2: - 2024-01-01: 400 - Denver: - 1: - 2024-01-01: 321 - 2: - 2024-01-01: 642 - Honolulu: - 1: - 2024-01-01: 254 - 2: - 2024-01-01: 508 - Los_Angeles: - 1: - 2024-01-01: 331 - 2: - 2024-01-01: 662 - Phoenix: - 1: - 2024-01-01: 300 - 2: - 2024-01-01: 600 - San_Diego: - 1: - 2024-01-01: 310 - 2: - 2024-01-01: 620 - San_Francisco: - 1: - 2024-01-01: 348 - 2: - 2024-01-01: 696 - Seattle: - 1: - 2024-01-01: 271 - 2: - 2024-01-01: 542 - -metadata: - unit: currency-USD - period: year - label: Local standards of operating costs amount - breakdown: - - chapter7_bankruptcy_region - - county_region - - list(range(1,3)) - reference: - - title: Local standards -- Transportation - href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml new file mode 100644 index 00000000000..ef77621d7da --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml @@ -0,0 +1,53 @@ +description: The IRS limits the expense of south region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. +values: +South_region: + 1: + 2024-01-01: 260 + 2: + 2024-01-01: 520 +Atlanta: + 1: + 2024-01-01: 304 + 2: + 2024-01-01: 608 +Baltimore: + 1: + 2024-01-01: 272 + 2: + 2024-01-01: 544 +Dallas_Ft.Worth: + 1: + 2024-01-01: 292 + 2: + 2024-01-01: 584 +Houston: + 1: + 2024-01-01: 332 + 2: + 2024-01-01: 664 +Miami: + 1: + 2024-01-01: 355 + 2: + 2024-01-01: 710 +Tampa: + 1: + 2024-01-01: 305 + 2: + 2024-01-01: 610 +Washington_DC: + 1: + 2024-01-01: 301 + 2: + 2024-01-01: 602 + +metadata: + unit: currency-USD + period: year + label: Local standards of operating costs amount + breakdown: + - south_county + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml new file mode 100644 index 00000000000..6c7b2dbd700 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml @@ -0,0 +1,59 @@ +description: The IRS limits the expense of west region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. + +values: +West_region: + 1: + 2024-01-01: 273 + 2: + 2024-01-01: 546 +Anchorage: + 1: + 2024-01-01: 200 + 2: + 2024-01-01: 400 +Denver: + 1: + 2024-01-01: 321 + 2: + 2024-01-01: 642 +Honolulu: + 1: + 2024-01-01: 254 + 2: + 2024-01-01: 508 +Los_Angeles: + 1: + 2024-01-01: 331 + 2: + 2024-01-01: 662 +Phoenix: + 1: + 2024-01-01: 300 + 2: + 2024-01-01: 600 +San_Diego: + 1: + 2024-01-01: 310 + 2: + 2024-01-01: 620 +San_Francisco: + 1: + 2024-01-01: 348 + 2: + 2024-01-01: 696 +Seattle: + 1: + 2024-01-01: 271 + 2: + 2024-01-01: 542 + +metadata: + unit: currency-USD + period: year + label: Local standards of operating costs amount + breakdown: + - west_county + - list(range(1,3)) + reference: + - title: Local standards -- Transportation + href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml index fd12ac32b7f..9dfce2b07cf 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml @@ -1,4 +1,4 @@ -description: The following states belongs to midwest region by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default states in the midwest region under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml index b06c96d1083..4ec9a7edc12 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml @@ -1,4 +1,4 @@ -description: The following states belongs to northeast region by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default states in the northeast region under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml index 64b7694ad60..9bdf6b72328 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml @@ -1,4 +1,4 @@ -description: The following states belongs to south region by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default states in the south region under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml index 41fa57b2665..e023d290ca0 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml @@ -1,4 +1,4 @@ -description: The following states belongs to west region by Metropolitan Statistical Area definitions. +description: The IRS follows the Metropolitan Statistical Area to define the default states in the west region under the Chapter 7 Bankruptcy means test. metadata: unit: list diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml index 947e24d8e55..9a1d9f7e255 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/additional.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test increases the expense of food, clothing and other items by the national standards to this amount, for each additonal person. +description: The IRS increases the expense of food, clothing and other items by the national standards to this amount, for each additonal person under the chapter 7 bankruptcy means test. values: 2024-01-01: 386 diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml index fe5e0fa8a58..18a6031474f 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of food, clothing and other items by the national standards to this amount, based on household size. +description: The IRS limits the expense of food, clothing and other items by the national standards to this amount, based on household size under the chapter 7 bankruptcy means test. values: 1: diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml index b73ee5a0429..807aab8e07c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml @@ -1,4 +1,4 @@ -description: The Chapter 7 bankruptcy means test limits the expense of out-of-pocket health care by the national standards to this above age amount. +description: The IRS limits the expense of out-of-pocket health care by the national standards to this above age amount under the chapter 7 bankruptcy means test. values: 2024-01-01: 158 diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py index e7fcce3e846..5eb10990f8c 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py @@ -2,12 +2,12 @@ class chapter_7_bankruptcy_adjust_monthly_income(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Adjust monthly income" definition_period = MONTH reference = ( - "https://www.uscourts.gov/sites/default/files/form_b122a-1.pdf#page=1" + "https://www.uscourts.gov/sites/default/files/form_b122a-1.pdf#page=1", "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=1", ) documentation = "Line 4 in form 122A-2" diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index fb2e1a4726a..d63aad8cfe0 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -22,7 +22,7 @@ def formula(spm_unit, period, parameters): ) education_expense = add( spm_unit, period, ["k12_tuition_and_fees"] - ) ## no more than $189.58 + ) ## no more than $189.58 per child charitable_contributions = add( spm_unit, period, diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py index bb2e479e75c..1f66f7c890b 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py @@ -9,4 +9,8 @@ class chapter_7_bankruptcy_debt_payment_deductions(Variable): reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=7" def formula(spm_unit, period, parameters): - # seems to be redudent to the calculation process as we already have local standard deduction in line 9 line 13. \ No newline at end of file + housing_expense = add(spm_unit,period,["housing_cost"]) + vehicle_mortgage_expense = add(spm_unit,period,["vehicle_mortgage_expense"]) + total = housing_expense + vehicle_mortgage_expense + return total/MONTHS_IN_YEAR + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py new file mode 100644 index 00000000000..c9427fc1ae9 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py @@ -0,0 +1,23 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_food_clothing_and_others_deduction(Variable): + value_type = bool + entity = SPMUnit + label = "National standards of food, clothing and other items deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=2" + documentation = "Line 6 in form 122A-2" + + def formula(spm_unit, period, parameters): + p = parameters( + period + ).gov.bankruptcy.national_standards.food_clothing_and_others + size = spm_unit("spm_unit_size", period) + capped_people = min_(size, 4).astype(int) + additional_people = size - capped_people + base = p.main[capped_people] + additional_amount = p.additional * additional_people + + return base + additional_amount + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index 9f37ea43962..064973e8a46 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -7,9 +7,9 @@ class chapter_7_bankruptcy_local_standards_deductions(Variable): label = "Local standards deduction" definition_period = MONTH reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=3" + documentation = "Line 8 to line 15 (expect line 12)in form 122A-2" def formula(spm_unit, period, parameters): - # Housing and utilities + vehicle operation (owned or lease, public transportation) p = parameters( period ).gov.bankruptcy.local_standards @@ -18,13 +18,21 @@ def formula(spm_unit, period, parameters): insurance_and_operating_allowance = p.housing_and_utilities.insurance_and_operating[state][size] mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[state][size] - monthly_housing_payment = add(spm_unit,period,["housing_cost"])/MONTHS_IN_YEAR - net_mortgage_or_rent_expense = max_(mortgage_or_rent_allowance - monthly_housing_payment,0) - - ## vehciel opertating expense + monthly_housing_expense = add(spm_unit,period,["housing_cost"])/MONTHS_IN_YEAR + net_mortgage_or_rent_expense = max_(mortgage_or_rent_allowance - monthly_housing_expense,0) + household_vehicles_owned = spm_unit.household("household_vehicles_owned", period) + household_vehicles_owned_cap = min_(household_vehicles_owned, 2) + ownership_costs_allowance = p.vehicle_operation.ownership_costs[household_vehicles_owned_cap] + vehicle_mortgage_expense = add(spm_unit,period,["vehicle_mortgage_expense"])/MONTHS_IN_YEAR + net_vehicle_ownership_expense = max_(ownership_costs_allowance - vehicle_mortgage_expense,0) + public_transportation_allowance = p.vehicle_operation.public_transportation - public_transportation_expense = add(spm_unit,period,["public_transportation_expense"]) - net_public_transportation_expense = max_(public_transportation_allowance - public_transportation_expense,0) + public_transportation_expense = add(spm_unit,period,["public_transportation_expense"])/MONTHS_IN_YEAR + + have_one_ore_more_vehicles = household_vehicles_owned >= 1 + capped_public_transportation_expense = min_(public_transportation_expense, public_transportation_allowance) + additional_public_transportation_allowance = where(have_one_ore_more_vehicles,capped_public_transportation_expense,0) - return net_mortgage_or_rent_expense + net_public_transportation_expense \ No newline at end of file + return insurance_and_operating_allowance + net_mortgage_or_rent_expense + net_vehicle_ownership_expense + public_transportation_allowance + additional_public_transportation_allowance + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py deleted file mode 100644 index ce20d1d52ff..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_national_standards_deductions.py +++ /dev/null @@ -1,25 +0,0 @@ -from policyengine_us.model_api import * - - -class chapter_7_bankruptcy_national_standards_deductions(Variable): - value_type = bool - entity = SPMUnit - label = "National standards deduction" - definition_period = MONTH - reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=2" - - def formula(spm_unit, period, parameters): - p = parameters( - period - ).gov.bankruptcy.national_standards - size = spm_unit("spm_unit_size", period) - capped_people = min_(size, 4).astype(int) - additional_people = size - capped_people - base = p.food_clothing_and_others.main[capped_people] - additional_amount = p.food_clothing_and_others.additional * additional_people - food_clothing_and_others_allowance = base + additional_amount - - age = spm_unit.members("age",period) - out_of_pocket_health_care_allowance = p.out_of_pocket_health_care.amount.calc(age) - return food_clothing_and_others_allowance + out_of_pocket_health_care_allowance - \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py index 3498d6084b0..b23ea532ff7 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py @@ -10,19 +10,19 @@ class chapter_7_bankruptcy_other_necessary_expenses_deductions(Variable): def formula(spm_unit, period, parameters): income_tax = add(spm_unit, period, ["income_tax"]) - ## retirement_contribution + child_support_expense = add( spm_unit, period, ["child_support_expense"] ) childcare_expenses = spm_unit("childcare_expenses", period) - ## ??? - line_7 = spm_unit("line_7", period) + + out_of_pocket_healthcare_allowance = spm_unit("chapter_7_bankruptcy_out_of_pocket_health_care_deductions", period) out_of_pocket_healthcare_expense = add( spm_unit, period, ["medical_out_of_pocket_expenses"] ) - line_22 = out_of_pocket_healthcare_expense - line_7 - ## + additional_health_care_expenses = max_(out_of_pocket_healthcare_expense - out_of_pocket_healthcare_allowance,0) + total = ( - income_tax + child_support_expense + childcare_expenses + line_22 + income_tax + child_support_expense + childcare_expenses + additional_health_care_expenses ) return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction new file mode 100644 index 00000000000..94c5736b6cb --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction @@ -0,0 +1,19 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_out_of_pocket_health_care_deduction(Variable): + value_type = bool + entity = SPMUnit + label = "National standard of Out-of-pocket health care deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=2" + documentation = "Line 7 in form 122A-2" + + def formula(spm_unit, period, parameters): + p = parameters( + period + ).gov.bankruptcy.national_standards.out_of_pocket_health_care.amount + + age = spm_unit.members("age",period) + return p.calc(age) + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py index 54ebf399b58..e6c18b715a9 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py @@ -9,8 +9,10 @@ class chapter_7_bankruptcy_total_deductions(Variable): definition_period = YEAR adds = [ - "chapter_7_bankruptcy_national_standards_deductions", + "chapter_7_bankruptcy_food_clothing_and_others_deduction", + "chapter_7_bankruptcy_out_of_pocket_health_care_deduction", "chapter_7_bankruptcy_local_standards_deductions", + "chapter_7_bankruptcy_vehicle_operation_expense_deduction", "chapter_7_bankruptcy_other_necessary_expenses_deductions", "chapter_7_bankruptcy_additional_expense_deductions", "chapter_7_bankruptcy_debt_payment_deductions", diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py new file mode 100644 index 00000000000..4830aac7622 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -0,0 +1,29 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_vehicle_operation_expense_deduction(Variable): + value_type = bool + entity = SPMUnit + label = "Vehicle operation expense deduction" + definition_period = MONTH + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=4" + documentation = "Line 12 in form 122A-2" + + def formula(spm_unit, period, parameters): + p = parameters( + period + ).gov.bankruptcy.local_standards.vehicle_operation.region_operating_costs + + household_vehicles_owned = spm_unit.household("household_vehicles_owned", period) + household_vehicles_owned_cap = min_(household_vehicles_owned, 2) + northeast = spm_unit("northeast_county",period) + midwest = spm_unit("midwest_county",period) + south = spm_unit("south_county",period) + west = spm_unit("west_county",period) + vehicle_operating_expense_northeast = p.northeast[northeast][household_vehicles_owned_cap] + vehicle_operating_expense_midwest = p.midwest[midwest][household_vehicles_owned_cap] + vehicle_operating_expense_south = p.south[south][household_vehicles_owned_cap] + vehicle_operating_expense_west = p.west[west][household_vehicles_owned_cap] + + return vehicle_operating_expense_northeast + vehicle_operating_expense_midwest + vehicle_operating_expense_south + vehicle_operating_expense_west + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py new file mode 100644 index 00000000000..a3e425c97d0 --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py @@ -0,0 +1,9 @@ +from policyengine_us.model_api import * + + +class vehicle_mortgage_expense(Variable): + value_type = float + entity = Person + label = "Vehivle mortgage expense" + unit = USD + definition_period = YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py deleted file mode 100644 index 90762841ddb..00000000000 --- a/policyengine_us/variables/gov/bankruptcy/expenses/xx_expense.py +++ /dev/null @@ -1 +0,0 @@ -# This folder contains all the new variables created for this program. diff --git a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py new file mode 100644 index 00000000000..de93488a2ef --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py @@ -0,0 +1,24 @@ +from policyengine_us.model_api import * + + +class is_presumption_of_abuse(Variable): + value_type = bool + entity = SPMUnit + label = "Is presumption of abuse" + definition_period = MONTH + reference = ( + "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8" + ) + documentation = "Line 39-xx in form 122A-2" + + + def formula(spm_unit, period, parameters): + adjusted_monthly_income = spm_unit("chapter_7_bankruptcy_adjust_monthly_income", period) + total_deductions = spm_unit("chapter_7_bankruptcy_total_deductions", period) + monthly_disposable_income = adjusted_monthly_income - total_deductions + monthly_disposable_income_60_months = monthly_disposable_income * MONTHS_IN_YEAR * 5 + # if monthly_disposable_income_60_months < 9075, false, + # if monthly_disposable_income_60_months > 15150, true + # if 9075 < monthly_disposable_income_60_months < 15150, go line 41 + ## + \ No newline at end of file From 9c2dbdfda56b47bd26fab84bbff60a7e26e24e9f Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:09:18 +0000 Subject: [PATCH 10/19] format --- .../county_group/midwest/cleveland.yaml | 3 +- .../county_group/midwest/detroit.yaml | 1 - .../vehicle_operation/state_group/west.yaml | 2 +- ...pter_7_bankruptcy_adjust_monthly_income.py | 3 +- ...er_7_bankruptcy_debt_payment_deductions.py | 9 ++- ...ptcy_food_clothing_and_others_deduction.py | 3 +- ...7_bankruptcy_local_standards_deductions.py | 75 +++++++++++++------ ...tcy_other_necessary_expenses_deductions.py | 21 ++++-- ...tcy_vehicle_operation_expense_deduction.py | 40 ++++++---- .../gov/bankruptcy/is_presumption_of_abuse.py | 20 ++--- 10 files changed, 115 insertions(+), 62 deletions(-) diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml index ea3311d3e3c..a197726091c 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml @@ -17,5 +17,4 @@ values: - MEDINA_COUNTY_OH - PORTAGE_COUNTY_OH - SUMMIT_COUNTY_OH - - \ No newline at end of file + \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml index 0b3cba910c5..46673be4d14 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml @@ -15,4 +15,3 @@ values: - OAKLAND_COUNTY_MI - ST_CLAIR_COUNTY_MI - WAYNE_COUNTY_MI - \ No newline at end of file diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml index e023d290ca0..286d984ddbc 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml @@ -22,4 +22,4 @@ values: - CA - AK - HI - \ No newline at end of file + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py index 5eb10990f8c..621a2742b98 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py @@ -7,7 +7,8 @@ class chapter_7_bankruptcy_adjust_monthly_income(Variable): label = "Adjust monthly income" definition_period = MONTH reference = ( - "https://www.uscourts.gov/sites/default/files/form_b122a-1.pdf#page=1", "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=1", + "https://www.uscourts.gov/sites/default/files/form_b122a-1.pdf#page=1", + "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=1", ) documentation = "Line 4 in form 122A-2" diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py index 1f66f7c890b..11a6ab46cd6 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py @@ -9,8 +9,9 @@ class chapter_7_bankruptcy_debt_payment_deductions(Variable): reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=7" def formula(spm_unit, period, parameters): - housing_expense = add(spm_unit,period,["housing_cost"]) - vehicle_mortgage_expense = add(spm_unit,period,["vehicle_mortgage_expense"]) + housing_expense = add(spm_unit, period, ["housing_cost"]) + vehicle_mortgage_expense = add( + spm_unit, period, ["vehicle_mortgage_expense"] + ) total = housing_expense + vehicle_mortgage_expense - return total/MONTHS_IN_YEAR - \ No newline at end of file + return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py index c9427fc1ae9..7b2119e9d13 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py @@ -18,6 +18,5 @@ def formula(spm_unit, period, parameters): additional_people = size - capped_people base = p.main[capped_people] additional_amount = p.additional * additional_people - + return base + additional_amount - \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index 064973e8a46..ccbb2442a62 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -10,29 +10,58 @@ class chapter_7_bankruptcy_local_standards_deductions(Variable): documentation = "Line 8 to line 15 (expect line 12)in form 122A-2" def formula(spm_unit, period, parameters): - p = parameters( - period - ).gov.bankruptcy.local_standards + p = parameters(period).gov.bankruptcy.local_standards size = spm_unit("spm_unit_size", period) state = spm_unit.household("state_code_str", period) - insurance_and_operating_allowance = p.housing_and_utilities.insurance_and_operating[state][size] - - mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[state][size] - monthly_housing_expense = add(spm_unit,period,["housing_cost"])/MONTHS_IN_YEAR - net_mortgage_or_rent_expense = max_(mortgage_or_rent_allowance - monthly_housing_expense,0) - - household_vehicles_owned = spm_unit.household("household_vehicles_owned", period) + insurance_and_operating_allowance = ( + p.housing_and_utilities.insurance_and_operating[state][size] + ) + + mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[ + state + ][size] + monthly_housing_expense = ( + add(spm_unit, period, ["housing_cost"]) / MONTHS_IN_YEAR + ) + net_mortgage_or_rent_expense = max_( + mortgage_or_rent_allowance - monthly_housing_expense, 0 + ) + + household_vehicles_owned = spm_unit.household( + "household_vehicles_owned", period + ) household_vehicles_owned_cap = min_(household_vehicles_owned, 2) - ownership_costs_allowance = p.vehicle_operation.ownership_costs[household_vehicles_owned_cap] - vehicle_mortgage_expense = add(spm_unit,period,["vehicle_mortgage_expense"])/MONTHS_IN_YEAR - net_vehicle_ownership_expense = max_(ownership_costs_allowance - vehicle_mortgage_expense,0) - - public_transportation_allowance = p.vehicle_operation.public_transportation - public_transportation_expense = add(spm_unit,period,["public_transportation_expense"])/MONTHS_IN_YEAR - - have_one_ore_more_vehicles = household_vehicles_owned >= 1 - capped_public_transportation_expense = min_(public_transportation_expense, public_transportation_allowance) - additional_public_transportation_allowance = where(have_one_ore_more_vehicles,capped_public_transportation_expense,0) - - return insurance_and_operating_allowance + net_mortgage_or_rent_expense + net_vehicle_ownership_expense + public_transportation_allowance + additional_public_transportation_allowance - \ No newline at end of file + ownership_costs_allowance = p.vehicle_operation.ownership_costs[ + household_vehicles_owned_cap + ] + vehicle_mortgage_expense = ( + add(spm_unit, period, ["vehicle_mortgage_expense"]) + / MONTHS_IN_YEAR + ) + net_vehicle_ownership_expense = max_( + ownership_costs_allowance - vehicle_mortgage_expense, 0 + ) + + public_transportation_allowance = ( + p.vehicle_operation.public_transportation + ) + public_transportation_expense = ( + add(spm_unit, period, ["public_transportation_expense"]) + / MONTHS_IN_YEAR + ) + + have_one_ore_more_vehicles = household_vehicles_owned >= 1 + capped_public_transportation_expense = min_( + public_transportation_expense, public_transportation_allowance + ) + additional_public_transportation_allowance = where( + have_one_ore_more_vehicles, capped_public_transportation_expense, 0 + ) + + return ( + insurance_and_operating_allowance + + net_mortgage_or_rent_expense + + net_vehicle_ownership_expense + + public_transportation_allowance + + additional_public_transportation_allowance + ) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py index b23ea532ff7..208a22ad9f0 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py @@ -10,19 +10,28 @@ class chapter_7_bankruptcy_other_necessary_expenses_deductions(Variable): def formula(spm_unit, period, parameters): income_tax = add(spm_unit, period, ["income_tax"]) - + child_support_expense = add( spm_unit, period, ["child_support_expense"] ) childcare_expenses = spm_unit("childcare_expenses", period) - - out_of_pocket_healthcare_allowance = spm_unit("chapter_7_bankruptcy_out_of_pocket_health_care_deductions", period) + + out_of_pocket_healthcare_allowance = spm_unit( + "chapter_7_bankruptcy_out_of_pocket_health_care_deductions", period + ) out_of_pocket_healthcare_expense = add( spm_unit, period, ["medical_out_of_pocket_expenses"] ) - additional_health_care_expenses = max_(out_of_pocket_healthcare_expense - out_of_pocket_healthcare_allowance,0) - + additional_health_care_expenses = max_( + out_of_pocket_healthcare_expense + - out_of_pocket_healthcare_allowance, + 0, + ) + total = ( - income_tax + child_support_expense + childcare_expenses + additional_health_care_expenses + income_tax + + child_support_expense + + childcare_expenses + + additional_health_care_expenses ) return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index 4830aac7622..75a7c446584 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -13,17 +13,31 @@ def formula(spm_unit, period, parameters): p = parameters( period ).gov.bankruptcy.local_standards.vehicle_operation.region_operating_costs - - household_vehicles_owned = spm_unit.household("household_vehicles_owned", period) + + household_vehicles_owned = spm_unit.household( + "household_vehicles_owned", period + ) household_vehicles_owned_cap = min_(household_vehicles_owned, 2) - northeast = spm_unit("northeast_county",period) - midwest = spm_unit("midwest_county",period) - south = spm_unit("south_county",period) - west = spm_unit("west_county",period) - vehicle_operating_expense_northeast = p.northeast[northeast][household_vehicles_owned_cap] - vehicle_operating_expense_midwest = p.midwest[midwest][household_vehicles_owned_cap] - vehicle_operating_expense_south = p.south[south][household_vehicles_owned_cap] - vehicle_operating_expense_west = p.west[west][household_vehicles_owned_cap] - - return vehicle_operating_expense_northeast + vehicle_operating_expense_midwest + vehicle_operating_expense_south + vehicle_operating_expense_west - \ No newline at end of file + northeast = spm_unit("northeast_county", period) + midwest = spm_unit("midwest_county", period) + south = spm_unit("south_county", period) + west = spm_unit("west_county", period) + vehicle_operating_expense_northeast = p.northeast[northeast][ + household_vehicles_owned_cap + ] + vehicle_operating_expense_midwest = p.midwest[midwest][ + household_vehicles_owned_cap + ] + vehicle_operating_expense_south = p.south[south][ + household_vehicles_owned_cap + ] + vehicle_operating_expense_west = p.west[west][ + household_vehicles_owned_cap + ] + + return ( + vehicle_operating_expense_northeast + + vehicle_operating_expense_midwest + + vehicle_operating_expense_south + + vehicle_operating_expense_west + ) diff --git a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py index de93488a2ef..ccdf3782c08 100644 --- a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py +++ b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py @@ -6,19 +6,21 @@ class is_presumption_of_abuse(Variable): entity = SPMUnit label = "Is presumption of abuse" definition_period = MONTH - reference = ( - "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8" - ) + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8" documentation = "Line 39-xx in form 122A-2" - def formula(spm_unit, period, parameters): - adjusted_monthly_income = spm_unit("chapter_7_bankruptcy_adjust_monthly_income", period) - total_deductions = spm_unit("chapter_7_bankruptcy_total_deductions", period) + adjusted_monthly_income = spm_unit( + "chapter_7_bankruptcy_adjust_monthly_income", period + ) + total_deductions = spm_unit( + "chapter_7_bankruptcy_total_deductions", period + ) monthly_disposable_income = adjusted_monthly_income - total_deductions - monthly_disposable_income_60_months = monthly_disposable_income * MONTHS_IN_YEAR * 5 + monthly_disposable_income_60_months = ( + monthly_disposable_income * MONTHS_IN_YEAR * 5 + ) # if monthly_disposable_income_60_months < 9075, false, # if monthly_disposable_income_60_months > 15150, true # if 9075 < monthly_disposable_income_60_months < 15150, go line 41 - ## - \ No newline at end of file + ## From fefb69d2a95cf2b121855fd8f31cf9d2f764feac Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:13:27 +0000 Subject: [PATCH 11/19] undo some formattings --- .../eitc/family_security_act_2024_eitc.py | 1 + .../reforms/states/ny/wftc/ny_working_families_tax_credit.py | 1 + .../variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py | 1 + 3 files changed, 3 insertions(+) diff --git a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py index d8920d739a5..ce223f65cdf 100644 --- a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py +++ b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py @@ -3,6 +3,7 @@ def create_family_security_act_2024_eitc() -> Reform: + class eitc_maximum(Variable): value_type = float entity = TaxUnit diff --git a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py index 4db3aa2d414..82a4b005c31 100644 --- a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py +++ b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py @@ -486,6 +486,7 @@ class ny_exemptions(Variable): defined_for = StateCode.NY def formula(tax_unit, period, parameters): + count_dependents = add( tax_unit, period, ["ny_exemptions_dependent"] ) diff --git a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py index f8ab3d42805..0a4d571f56d 100644 --- a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py +++ b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py @@ -10,6 +10,7 @@ class ctc_phase_in(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/24#d" def formula(tax_unit, period, parameters): + ctc = parameters(period).gov.irs.credits.ctc earnings = tax_unit("tax_unit_earned_income", period) From 6c19cefae54e72f98a7dd096f4ce54e216bc0bc7 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Thu, 5 Dec 2024 03:58:07 +0000 Subject: [PATCH 12/19] minor change --- .../gov/bankruptcy/dependent_expense.yaml | 13 ++++++++++++ ...er_7_bankruptcy_adjust_monthly_income.yaml | 0 .../gov/bankruptcy/region/is_west_region.yaml | 20 +++++++++++++++++++ .../gov/bankruptcy/region/west_county.yaml | 0 ...ankruptcy_additional_expense_deductions.py | 9 +++++++-- ...7_bankruptcy_local_standards_deductions.py | 14 ++++++------- .../expenses/vehicle_mortgage_expense.py | 2 +- .../gov/bankruptcy/region/is_west_region.py | 4 ++-- .../demographic/person/is_vehicle_loaned.py | 11 ++++++++++ 9 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml create mode 100644 policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py diff --git a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml new file mode 100644 index 00000000000..17e0917d440 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml @@ -0,0 +1,13 @@ +description: The IRS limits the expense of dependent children education to this amount to each child under the chapter 7 bankruptcy means test. + +values: + 2024-01-01: 2275 + +metadata: + unit: currency-USD + period: year + label: Dependent children education expense per child + reference: + # The number, $189.58,comes from line 28 of the form, multiply by 12 and get the annual amount. + - title: Official Form 122A-2 Chapter 7 Means Test Calculation + href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=6 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml new file mode 100644 index 00000000000..0d2ac1d624b --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml @@ -0,0 +1,20 @@ +- name: New Mexico is in west region. + period: 2024 + input: + state_code_str: NM + output: + is_west_region: true + +- name: California is in west region. + period: 2024 + input: + state_code_str: CA + output: + is_west_region: true + +- name: Massachusetts is not in west region. + period: 2024 + input: + state_code_str: MA + output: + is_west_region: false diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index d63aad8cfe0..6ba146dbff8 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -22,7 +22,12 @@ def formula(spm_unit, period, parameters): ) education_expense = add( spm_unit, period, ["k12_tuition_and_fees"] - ) ## no more than $189.58 per child + ) + child_count = add(spm_unit,period,["is_child_dependent"]) + p = parameters(period).gov.bankruptcy + education_expense_allowance = child_count * p.dependent_expense + adjust_education_expense = min_(education_expense,education_expense_allowance) + charitable_contributions = add( spm_unit, period, @@ -33,7 +38,7 @@ def formula(spm_unit, period, parameters): + health_savings_account_expense + care_expense + home_energy_costs - + education_expense + + adjust_education_expense + charitable_contributions ) return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index ccbb2442a62..d3dd6221a8c 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -17,9 +17,9 @@ def formula(spm_unit, period, parameters): p.housing_and_utilities.insurance_and_operating[state][size] ) - mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[ - state - ][size] + mortgage_or_rent_allowance = ( + p.housing_and_utilities.mortgage_or_rent[state][size] + ) monthly_housing_expense = ( add(spm_unit, period, ["housing_cost"]) / MONTHS_IN_YEAR ) @@ -27,12 +27,10 @@ def formula(spm_unit, period, parameters): mortgage_or_rent_allowance - monthly_housing_expense, 0 ) - household_vehicles_owned = spm_unit.household( - "household_vehicles_owned", period - ) - household_vehicles_owned_cap = min_(household_vehicles_owned, 2) + qualify_vehicles_owned = add(spm_unit,period,["is_vehicle_loaned"]) + qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) ownership_costs_allowance = p.vehicle_operation.ownership_costs[ - household_vehicles_owned_cap + qualify_vehicles_owned_cap ] vehicle_mortgage_expense = ( add(spm_unit, period, ["vehicle_mortgage_expense"]) diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py index a3e425c97d0..56c75eb72ee 100644 --- a/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py +++ b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py @@ -4,6 +4,6 @@ class vehicle_mortgage_expense(Variable): value_type = float entity = Person - label = "Vehivle mortgage expense" + label = "Vehicle mortgage expense" unit = USD definition_period = YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py b/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py index 6421571cef6..ff2b11291dc 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py +++ b/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py @@ -9,10 +9,10 @@ class is_west_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state = spm_unit.household("state_code", period) + state_code = spm_unit.household("state_code_str", period) p = parameters( period ).gov.bankruptcy.local_standards.vehicle_operation.state_group - return np.isin(state, p.west) + return np.isin(state_code, p.west) diff --git a/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py b/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py new file mode 100644 index 00000000000..13f7bcf3922 --- /dev/null +++ b/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py @@ -0,0 +1,11 @@ +from policyengine_us.model_api import * + + +class is_vehicle_loaned(Variable): + value_type = bool + entity = Person + label = "Is the vehicel loaned or leased" + definition_period = YEAR + + def formula(person, period, parameters): + return person("vehicle_mortgage_expense",period) > 0 From 02713d733cfcc67d4f6446cbb78f35de56e7c86b Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Thu, 5 Dec 2024 04:19:10 +0000 Subject: [PATCH 13/19] add test cases --- .../gov/bankruptcy/dependent_expense.yaml | 2 +- .../gov/bankruptcy/region/west_county.yaml | 24 +++++++++++++++++++ ...ankruptcy_additional_expense_deductions.py | 2 +- ...er_7_bankruptcy_debt_payment_deductions.py | 2 +- ...ptcy_food_clothing_and_others_deduction.py | 2 +- ...7_bankruptcy_local_standards_deductions.py | 2 +- ...tcy_other_necessary_expenses_deductions.py | 2 +- ...ruptcy_out_of_pocket_health_care_deduction | 2 +- .../chapter_7_bankruptcy_total_deductions.py | 3 +-- ...tcy_vehicle_operation_expense_deduction.py | 2 +- 10 files changed, 33 insertions(+), 10 deletions(-) diff --git a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml index 17e0917d440..232bc0ba88e 100644 --- a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml @@ -8,6 +8,6 @@ metadata: period: year label: Dependent children education expense per child reference: - # The number, $189.58,comes from line 28 of the form, multiply by 12 and get the annual amount. + # The number $189.58 comes from line 28 of the form, multiply it by 12 and get the annual amount. - title: Official Form 122A-2 Chapter 7 Means Test Calculation href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=6 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml index e69de29bb2d..4eb570af85b 100644 --- a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml @@ -0,0 +1,24 @@ +- name: Orange county belongs to Los Angeles by MSA. + period: 2024 + input: + state_code_str: CA + county_str: ORANGE_COUNTY_CA + output: + west_county: LOS_ANGELES + +- name: Kern county belongs to default west. + period: 2024 + input: + state_code_str: CA + county_str: KERN_COUNTY_CA + output: + west_county: WEST_DEFAULT + +- name: Not part of any west region. + period: 2024 + input: + state_code_str: MA + county_str: SUFFOLK_COUNTY_MA + output: + west_county: Null + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index 6ba146dbff8..b0ee9d3b38b 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_additonal_expenses_deductions(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Additional expenses deductions" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py index 11a6ab46cd6..499be68c203 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_debt_payment_deductions(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Debt payment deduction" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py index 7b2119e9d13..55b1967b698 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_food_clothing_and_others_deduction(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "National standards of food, clothing and other items deduction" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index d3dd6221a8c..43bec7e5597 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_local_standards_deductions(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Local standards deduction" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py index 208a22ad9f0..9b1d2527f5a 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_other_necessary_expenses_deductions(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Other necessary expenses deduction" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction index 94c5736b6cb..b55bd21d6cb 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction @@ -2,7 +2,7 @@ from policyengine_us.model_api import * class chapter_7_bankruptcy_out_of_pocket_health_care_deduction(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "National standard of Out-of-pocket health care deduction" definition_period = MONTH diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py index e6c18b715a9..fd97573a928 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_total_deductions.py @@ -5,8 +5,7 @@ class chapter_7_bankruptcy_total_deductions(Variable): value_type = float entity = SPMUnit label = "Total deductions from Income" - unit = USD - definition_period = YEAR + definition_period = MONTH adds = [ "chapter_7_bankruptcy_food_clothing_and_others_deduction", diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index 75a7c446584..dc0b12063c4 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -2,7 +2,7 @@ class chapter_7_bankruptcy_vehicle_operation_expense_deduction(Variable): - value_type = bool + value_type = float entity = SPMUnit label = "Vehicle operation expense deduction" definition_period = MONTH From 4ce7947f24c35a1f9c982cb13224254366bb37a6 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:35:44 +0000 Subject: [PATCH 14/19] move county and region folder to houshold/demo/geo --- .../county_group/midwest/chicago.yaml | 0 .../county_group/midwest/cleveland.yaml | 0 .../county_group/midwest/detroit.yaml | 0 .../county_group/midwest/minneapolis_st_paul.yaml | 0 .../county_group/midwest/st_louis.yaml | 0 .../county_group/northeast/boston.yaml | 0 .../county_group/northeast/new_york.yaml | 0 .../county_group/northeast/philadelphia.yaml | 0 .../county_group/south/atlanta.yaml | 0 .../county_group/south/baltimore.yaml | 0 .../county_group/south/dallas_ft_worth.yaml | 0 .../county_group/south/houston.yaml | 0 .../county_group/south/miami.yaml | 0 .../county_group/south/tampa.yaml | 0 .../county_group/south/washington_dc.yaml | 0 .../county_group/west/anchorage.yaml | 0 .../county_group/west/denver.yaml | 0 .../county_group/west/honolulu.yaml | 0 .../county_group/west/los_angeles.yaml | 0 .../county_group/west/phoenix.yaml | 0 .../county_group/west/san_diego.yaml | 0 .../county_group/west/san_francisco.yaml | 0 .../county_group/west/seattle.yaml | 0 .../state_group/midwest.yaml | 0 .../state_group/northeast.yaml | 0 .../state_group/south.yaml | 0 .../state_group/west.yaml | 0 ...chapter_7_bankruptcy_adjust_monthly_income.yaml | 0 .../geographic}/region/is_west_region.yaml | 0 .../geographic}/region/west_county.yaml | 0 ...pter_7_bankruptcy_local_standards_deductions.py | 2 +- ...kruptcy_out_of_pocket_health_care_deduction.py} | 0 ...nkruptcy_vehicle_operation_expense_deduction.py | 14 ++++++-------- .../expenses/vehicle_mortgage_expense.py | 1 + .../gov/bankruptcy/is_presumption_of_abuse.py | 3 ++- .../geographic}/region/is_midwest_region.py | 0 .../geographic}/region/is_northeast_region.py | 0 .../geographic}/region/is_south_region.py | 0 .../geographic}/region/is_west_region.py | 2 +- .../geographic}/region/midwest_county.py | 0 .../geographic}/region/northeast_county.py | 0 .../demographic/geographic}/region/south_county.py | 0 .../demographic/geographic}/region/west_county.py | 0 43 files changed, 11 insertions(+), 11 deletions(-) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/midwest/chicago.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/midwest/cleveland.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/midwest/detroit.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/midwest/minneapolis_st_paul.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/midwest/st_louis.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/northeast/boston.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/northeast/new_york.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/northeast/philadelphia.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/atlanta.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/baltimore.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/dallas_ft_worth.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/houston.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/miami.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/tampa.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/south/washington_dc.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/anchorage.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/denver.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/honolulu.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/los_angeles.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/phoenix.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/san_diego.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/san_francisco.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/county_group/west/seattle.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/state_group/midwest.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/state_group/northeast.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/state_group/south.yaml (100%) rename policyengine_us/parameters/gov/{bankruptcy/local_standards/vehicle_operation => household}/state_group/west.yaml (100%) delete mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml rename policyengine_us/tests/policy/baseline/{gov/bankruptcy => household/demographic/geographic}/region/is_west_region.yaml (100%) rename policyengine_us/tests/policy/baseline/{gov/bankruptcy => household/demographic/geographic}/region/west_county.yaml (100%) rename policyengine_us/variables/gov/bankruptcy/deductions/{chapter_7_bankruptcy_out_of_pocket_health_care_deduction => chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py} (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/is_midwest_region.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/is_northeast_region.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/is_south_region.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/is_west_region.py (88%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/midwest_county.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/northeast_county.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/south_county.py (100%) rename policyengine_us/variables/{gov/bankruptcy => household/demographic/geographic}/region/west_county.py (100%) diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml b/policyengine_us/parameters/gov/household/county_group/midwest/chicago.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/chicago.yaml rename to policyengine_us/parameters/gov/household/county_group/midwest/chicago.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/gov/household/county_group/midwest/cleveland.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/cleveland.yaml rename to policyengine_us/parameters/gov/household/county_group/midwest/cleveland.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml b/policyengine_us/parameters/gov/household/county_group/midwest/detroit.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/detroit.yaml rename to policyengine_us/parameters/gov/household/county_group/midwest/detroit.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml b/policyengine_us/parameters/gov/household/county_group/midwest/minneapolis_st_paul.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/minneapolis_st_paul.yaml rename to policyengine_us/parameters/gov/household/county_group/midwest/minneapolis_st_paul.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml b/policyengine_us/parameters/gov/household/county_group/midwest/st_louis.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/midwest/st_louis.yaml rename to policyengine_us/parameters/gov/household/county_group/midwest/st_louis.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml b/policyengine_us/parameters/gov/household/county_group/northeast/boston.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/boston.yaml rename to policyengine_us/parameters/gov/household/county_group/northeast/boston.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml b/policyengine_us/parameters/gov/household/county_group/northeast/new_york.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/new_york.yaml rename to policyengine_us/parameters/gov/household/county_group/northeast/new_york.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/gov/household/county_group/northeast/philadelphia.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/northeast/philadelphia.yaml rename to policyengine_us/parameters/gov/household/county_group/northeast/philadelphia.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml b/policyengine_us/parameters/gov/household/county_group/south/atlanta.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/atlanta.yaml rename to policyengine_us/parameters/gov/household/county_group/south/atlanta.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml b/policyengine_us/parameters/gov/household/county_group/south/baltimore.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/baltimore.yaml rename to policyengine_us/parameters/gov/household/county_group/south/baltimore.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml b/policyengine_us/parameters/gov/household/county_group/south/dallas_ft_worth.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/dallas_ft_worth.yaml rename to policyengine_us/parameters/gov/household/county_group/south/dallas_ft_worth.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml b/policyengine_us/parameters/gov/household/county_group/south/houston.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/houston.yaml rename to policyengine_us/parameters/gov/household/county_group/south/houston.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml b/policyengine_us/parameters/gov/household/county_group/south/miami.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/miami.yaml rename to policyengine_us/parameters/gov/household/county_group/south/miami.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml b/policyengine_us/parameters/gov/household/county_group/south/tampa.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/tampa.yaml rename to policyengine_us/parameters/gov/household/county_group/south/tampa.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml b/policyengine_us/parameters/gov/household/county_group/south/washington_dc.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/south/washington_dc.yaml rename to policyengine_us/parameters/gov/household/county_group/south/washington_dc.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml b/policyengine_us/parameters/gov/household/county_group/west/anchorage.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/anchorage.yaml rename to policyengine_us/parameters/gov/household/county_group/west/anchorage.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml b/policyengine_us/parameters/gov/household/county_group/west/denver.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/denver.yaml rename to policyengine_us/parameters/gov/household/county_group/west/denver.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml b/policyengine_us/parameters/gov/household/county_group/west/honolulu.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/honolulu.yaml rename to policyengine_us/parameters/gov/household/county_group/west/honolulu.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml b/policyengine_us/parameters/gov/household/county_group/west/los_angeles.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/los_angeles.yaml rename to policyengine_us/parameters/gov/household/county_group/west/los_angeles.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml b/policyengine_us/parameters/gov/household/county_group/west/phoenix.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/phoenix.yaml rename to policyengine_us/parameters/gov/household/county_group/west/phoenix.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml b/policyengine_us/parameters/gov/household/county_group/west/san_diego.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_diego.yaml rename to policyengine_us/parameters/gov/household/county_group/west/san_diego.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml b/policyengine_us/parameters/gov/household/county_group/west/san_francisco.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/san_francisco.yaml rename to policyengine_us/parameters/gov/household/county_group/west/san_francisco.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml b/policyengine_us/parameters/gov/household/county_group/west/seattle.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/county_group/west/seattle.yaml rename to policyengine_us/parameters/gov/household/county_group/west/seattle.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml b/policyengine_us/parameters/gov/household/state_group/midwest.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/midwest.yaml rename to policyengine_us/parameters/gov/household/state_group/midwest.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml b/policyengine_us/parameters/gov/household/state_group/northeast.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/northeast.yaml rename to policyengine_us/parameters/gov/household/state_group/northeast.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml b/policyengine_us/parameters/gov/household/state_group/south.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/south.yaml rename to policyengine_us/parameters/gov/household/state_group/south.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml b/policyengine_us/parameters/gov/household/state_group/west.yaml similarity index 100% rename from policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/state_group/west.yaml rename to policyengine_us/parameters/gov/household/state_group/west.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/bankruptcy/region/is_west_region.yaml rename to policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/bankruptcy/region/west_county.yaml rename to policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index 43bec7e5597..d7da7094cc8 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -48,7 +48,7 @@ def formula(spm_unit, period, parameters): / MONTHS_IN_YEAR ) - have_one_ore_more_vehicles = household_vehicles_owned >= 1 + have_one_ore_more_vehicles = qualify_vehicles_owned >= 1 capped_public_transportation_expense = min_( public_transportation_expense, public_transportation_allowance ) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction rename to policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index dc0b12063c4..620b5c45fbf 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -14,25 +14,23 @@ def formula(spm_unit, period, parameters): period ).gov.bankruptcy.local_standards.vehicle_operation.region_operating_costs - household_vehicles_owned = spm_unit.household( - "household_vehicles_owned", period - ) - household_vehicles_owned_cap = min_(household_vehicles_owned, 2) + qualify_vehicles_owned = add(spm_unit,period,["is_vehicle_loaned"]) + qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) northeast = spm_unit("northeast_county", period) midwest = spm_unit("midwest_county", period) south = spm_unit("south_county", period) west = spm_unit("west_county", period) vehicle_operating_expense_northeast = p.northeast[northeast][ - household_vehicles_owned_cap + qualify_vehicles_owned_cap ] vehicle_operating_expense_midwest = p.midwest[midwest][ - household_vehicles_owned_cap + qualify_vehicles_owned_cap ] vehicle_operating_expense_south = p.south[south][ - household_vehicles_owned_cap + qualify_vehicles_owned_cap ] vehicle_operating_expense_west = p.west[west][ - household_vehicles_owned_cap + qualify_vehicles_owned_cap ] return ( diff --git a/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py index 56c75eb72ee..c9da02b5719 100644 --- a/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py +++ b/policyengine_us/variables/gov/bankruptcy/expenses/vehicle_mortgage_expense.py @@ -7,3 +7,4 @@ class vehicle_mortgage_expense(Variable): label = "Vehicle mortgage expense" unit = USD definition_period = YEAR + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=4" diff --git a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py index ccdf3782c08..691eaae54cb 100644 --- a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py +++ b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py @@ -20,7 +20,8 @@ def formula(spm_unit, period, parameters): monthly_disposable_income_60_months = ( monthly_disposable_income * MONTHS_IN_YEAR * 5 ) + return monthly_disposable_income_60_months > 15150 # if monthly_disposable_income_60_months < 9075, false, # if monthly_disposable_income_60_months > 15150, true # if 9075 < monthly_disposable_income_60_months < 15150, go line 41 - ## + ## diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/is_midwest_region.py rename to policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/is_northeast_region.py rename to policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_south_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/is_south_region.py rename to policyengine_us/variables/household/demographic/geographic/region/is_south_region.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py similarity index 88% rename from policyengine_us/variables/gov/bankruptcy/region/is_west_region.py rename to policyengine_us/variables/household/demographic/geographic/region/is_west_region.py index ff2b11291dc..341d0deaade 100644 --- a/policyengine_us/variables/gov/bankruptcy/region/is_west_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py @@ -9,7 +9,7 @@ class is_west_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state_code = spm_unit.household("state_code_str", period) + state_code = spm_unit.household("state_code", period) p = parameters( period diff --git a/policyengine_us/variables/gov/bankruptcy/region/midwest_county.py b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/midwest_county.py rename to policyengine_us/variables/household/demographic/geographic/region/midwest_county.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/northeast_county.py b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/northeast_county.py rename to policyengine_us/variables/household/demographic/geographic/region/northeast_county.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/south_county.py b/policyengine_us/variables/household/demographic/geographic/region/south_county.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/south_county.py rename to policyengine_us/variables/household/demographic/geographic/region/south_county.py diff --git a/policyengine_us/variables/gov/bankruptcy/region/west_county.py b/policyengine_us/variables/household/demographic/geographic/region/west_county.py similarity index 100% rename from policyengine_us/variables/gov/bankruptcy/region/west_county.py rename to policyengine_us/variables/household/demographic/geographic/region/west_county.py From 699bcb360b59253236a140986bf8e5fd25dc84df Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Mon, 9 Dec 2024 04:37:02 +0000 Subject: [PATCH 15/19] move folder, add formula, parameters, and tests --- .../gov/bankruptcy/dependent_expense.yaml | 2 +- .../insurance_and_operating.yaml | 8 +-- .../mortgage_or_rent.yaml | 8 +-- .../vehicle_operation/ownership_costs.yaml | 1 - .../region_operating_costs/midwest.yaml | 1 - .../region_operating_costs/northeast.yaml | 1 - .../region_operating_costs/south.yaml | 2 +- .../region_operating_costs/west.yaml | 1 - .../vehicle_operation/vehicles_owned_cap.yaml | 12 +++++ .../food_clothing_and_others/main.yaml | 1 - .../age_threshold.yaml | 12 ----- .../out_of_pocket_health_care/amount.yaml | 2 +- .../amount/older.yaml | 12 ----- .../amount/younger.yaml | 12 ----- .../presumption_abuse/amount/higher.yaml | 12 +++++ .../presumption_abuse/amount/lower.yaml | 12 +++++ .../bankruptcy/presumption_abuse/rate.yaml | 14 ++++++ .../county_group/midwest/chicago.yaml | 0 .../county_group/midwest/cleveland.yaml | 0 .../county_group/midwest/detroit.yaml | 0 .../midwest/minneapolis_st_paul.yaml | 0 .../county_group/midwest/st_louis.yaml | 0 .../county_group/northeast/boston.yaml | 0 .../county_group/northeast/new_york.yaml | 0 .../county_group/northeast/philadelphia.yaml | 0 .../household/county_group/south/atlanta.yaml | 0 .../county_group/south/baltimore.yaml | 0 .../county_group/south/dallas_ft_worth.yaml | 0 .../household/county_group/south/houston.yaml | 0 .../household/county_group/south/miami.yaml | 0 .../household/county_group/south/tampa.yaml | 0 .../county_group/south/washington_dc.yaml | 0 .../county_group/west/anchorage.yaml | 0 .../household/county_group/west/denver.yaml | 0 .../household/county_group/west/honolulu.yaml | 0 .../county_group/west/los_angeles.yaml | 0 .../household/county_group/west/phoenix.yaml | 0 .../county_group/west/san_diego.yaml | 0 .../county_group/west/san_francisco.yaml | 0 .../household/county_group/west/seattle.yaml | 0 .../household/state_group/midwest.yaml | 0 .../household/state_group/northeast.yaml | 0 .../household/state_group/south.yaml | 0 .../{gov => }/household/state_group/west.yaml | 0 ...cy_food_clothing_and_others_deduction.yaml | 27 ++++++++++ ...y_out_of_pocket_health_care_deduction.yaml | 50 +++++++++++++++++++ .../bankruptcy/is_presumption_of_abuse.yaml | 39 +++++++++++++++ .../geographic/region/west_county.yaml | 1 + .../person/has_a_vehicle_loan.yaml | 14 ++++++ ...pter_7_bankruptcy_adjust_monthly_income.py | 1 - ...7_bankruptcy_nonpriority_unsecured_debt.py | 10 ++++ ...7_bankruptcy_local_standards_deductions.py | 2 +- ...tcy_out_of_pocket_health_care_deduction.py | 6 ++- ...tcy_vehicle_operation_expense_deduction.py | 2 +- .../gov/bankruptcy/is_presumption_of_abuse.py | 21 +++++--- .../geographic/region/is_midwest_region.py | 2 +- .../geographic/region/is_northeast_region.py | 2 +- .../geographic/region/is_south_region.py | 2 +- .../geographic/region/is_west_region.py | 2 +- .../geographic/region/midwest_county.py | 2 +- .../geographic/region/northeast_county.py | 2 +- .../demographic/person/has_a_vehicle_loan.py | 12 +++++ .../demographic/person/is_vehicle_loaned.py | 11 ---- 63 files changed, 240 insertions(+), 81 deletions(-) create mode 100644 policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/vehicles_owned_cap.yaml delete mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml delete mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml delete mode 100644 policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/higher.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/lower.yaml create mode 100644 policyengine_us/parameters/gov/bankruptcy/presumption_abuse/rate.yaml rename policyengine_us/parameters/{gov => }/household/county_group/midwest/chicago.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/midwest/cleveland.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/midwest/detroit.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/midwest/minneapolis_st_paul.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/midwest/st_louis.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/northeast/boston.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/northeast/new_york.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/northeast/philadelphia.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/atlanta.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/baltimore.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/dallas_ft_worth.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/houston.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/miami.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/tampa.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/south/washington_dc.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/anchorage.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/denver.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/honolulu.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/los_angeles.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/phoenix.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/san_diego.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/san_francisco.yaml (100%) rename policyengine_us/parameters/{gov => }/household/county_group/west/seattle.yaml (100%) rename policyengine_us/parameters/{gov => }/household/state_group/midwest.yaml (100%) rename policyengine_us/parameters/{gov => }/household/state_group/northeast.yaml (100%) rename policyengine_us/parameters/{gov => }/household/state_group/south.yaml (100%) rename policyengine_us/parameters/{gov => }/household/state_group/west.yaml (100%) create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/is_presumption_of_abuse.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml create mode 100644 policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py create mode 100644 policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py delete mode 100644 policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py diff --git a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml index 232bc0ba88e..bfbf06e22f7 100644 --- a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml @@ -1,7 +1,7 @@ description: The IRS limits the expense of dependent children education to this amount to each child under the chapter 7 bankruptcy means test. values: - 2024-01-01: 2275 + 2024-01-01: 2_275 metadata: unit: currency-USD diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml index 22f2606260d..c9041238a49 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/insurance_and_operating.yaml @@ -1,5 +1,5 @@ description: The IRS limits the expense of insurance and operating by the local standards to this amount, based on household size under the chapter 7 bankruptcy means test. -values: + AL: 1: 2024-01-01: 594 @@ -11,7 +11,7 @@ AL: 2024-01-01: 820 5: 2024-01-01: 834 -AL: +AK: 1: 2024-01-01: 705 2: @@ -297,7 +297,7 @@ MT: 2024-01-01: 760 5: 2024-01-01: 773 - NE: +NE: 1: 2024-01-01: 592 2: @@ -563,7 +563,7 @@ WY: 2024-01-01: 777 metadata: unit: currency-USD - period: year + period: month label: Local standards of insurance and operating expense breakdown: - state_code diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml index a71766fd118..e8d200974e0 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/housing_and_utilities/mortgage_or_rent.yaml @@ -1,5 +1,5 @@ description: The IRS limits the expense of mortgage or rent by the local standards to this amount, based on household size under the chapter 7 bankruptcy means test. -values: + AL: 1: 2024-01-01: 677 @@ -11,7 +11,7 @@ AL: 2024-01-01: 935 5: 2024-01-01: 950 -AL: +AK: 1: 2024-01-01: 1_049 2: @@ -451,7 +451,7 @@ SC: 2024-01-01: 1_046 5: 2024-01-01: 1_063 -NJ: +SD: 1: 2024-01-01: 749 2: @@ -563,7 +563,7 @@ WY: 2024-01-01: 1_465 metadata: unit: currency-USD - period: year + period: month label: Local standards of mortgage or rent expense breakdown: - state_code diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml index babd56f6ff9..59ccd1887b7 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml @@ -1,6 +1,5 @@ description: The IRS limits the ownership costs by the local standards to this amount, based on the number of owned vehicle, under the chapter 7 bankruptcy means test. -values: 1: 2024-01-01: 619 2: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml index 61fecae9b9f..53f18c04f5f 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml @@ -1,6 +1,5 @@ description: The IRS limits the expense of midwest region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -values: Midwest_region: 1: 2024-01-01: 239 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml index 9e0c0e3292f..20ea90f2e52 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -1,6 +1,5 @@ description: The IRS limits the expense of northeast region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -values: NORTHEAST: 1: 2024-01-01: 285 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml index ef77621d7da..148eef8b74a 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml @@ -1,5 +1,5 @@ description: The IRS limits the expense of south region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -values: + South_region: 1: 2024-01-01: 260 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml index 6c7b2dbd700..fdbdf33c939 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml @@ -1,6 +1,5 @@ description: The IRS limits the expense of west region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -values: West_region: 1: 2024-01-01: 273 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/vehicles_owned_cap.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/vehicles_owned_cap.yaml new file mode 100644 index 00000000000..6a8a0e17eea --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/vehicles_owned_cap.yaml @@ -0,0 +1,12 @@ +description: The IRS limits the number of owned vehicles to this amount under the chapter 7 bankruptcy means test. + +values: + 2024-01-01: 2 + +metadata: + unit: float + period: year + label: Qualified vehicles owned cap amount + reference: + - title: Form 122A-2 Chapter 7 Means Test Calculation + href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=4 diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml index 18a6031474f..bfda0e5d543 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/food_clothing_and_others/main.yaml @@ -1,6 +1,5 @@ description: The IRS limits the expense of food, clothing and other items by the national standards to this amount, based on household size under the chapter 7 bankruptcy means test. -values: 1: 2024-01-01: 808 2: diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml deleted file mode 100644 index 0b837b30db6..00000000000 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/age_threshold.yaml +++ /dev/null @@ -1,12 +0,0 @@ -description: The Chapter 7 bankruptcy means test sets different expense limit of out-of-pocket health care by the national standards to the person that is above or below this age. - -values: - 2024-01-01: 65 - -metadata: - unit: age - period: year - label: National standards of out-of-pocket health care age threshold - reference: - - title: National standards -- Out-of-pocket health care - href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml index 6165edcd2ac..317b29d8311 100644 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount.yaml @@ -13,7 +13,7 @@ metadata: type: single_amount threshold_unit: year amount_unit: currency-USD - period: year + period: month reference: - title: National standards -- Out-of-pocket health care href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml deleted file mode 100644 index 807aab8e07c..00000000000 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/older.yaml +++ /dev/null @@ -1,12 +0,0 @@ -description: The IRS limits the expense of out-of-pocket health care by the national standards to this above age amount under the chapter 7 bankruptcy means test. - -values: - 2024-01-01: 158 - -metadata: - unit: currency-USD - period: year - label: National standards of out-of-pocket health care above age amount - reference: - - title: National standards -- Out-of-pocket health care - href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml b/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml deleted file mode 100644 index 3f5c78b935b..00000000000 --- a/policyengine_us/parameters/gov/bankruptcy/national_standards/out_of_pocket_health_care/amount/younger.yaml +++ /dev/null @@ -1,12 +0,0 @@ -description: The Chapter 7 bankruptcy means test limits the expense of out-of-pocket health care by the national standards to this below age amount. - -values: - 2024-01-01: 83 - -metadata: - unit: currency-USD - period: year - label: National standards of out-of-pocket health care below age amount - reference: - - title: National standards -- Out-of-pocket health care - href: https://www.irs.gov/businesses/small-businesses-self-employed/national-standards-out-of-pocket-health-care diff --git a/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/higher.yaml b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/higher.yaml new file mode 100644 index 00000000000..4ed0e5f9249 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/higher.yaml @@ -0,0 +1,12 @@ +description: The IRS determines whether there is a presumption of abuse with this higher amount under the chapter 7 bankruptcy means test. + +values: + 2024-01-01: 15_150 + +metadata: + unit: currency-USD + period: year + label: Presumption of abuse higher amount + reference: + - title: Official Form 122A-2 Chapter 7 Means Test Calculation + href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8 diff --git a/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/lower.yaml b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/lower.yaml new file mode 100644 index 00000000000..b395eca5d7f --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/amount/lower.yaml @@ -0,0 +1,12 @@ +description: The IRS determines whether there is a presumption of abuse with this lower amount under the chapter 7 bankruptcy means test. + +values: + 2024-01-01: 9_075 + +metadata: + unit: currency-USD + period: year + label: Presumption of abuse lower amount + reference: + - title: Official Form 122A-2 Chapter 7 Means Test Calculation + href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8 diff --git a/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/rate.yaml b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/rate.yaml new file mode 100644 index 00000000000..96621cdb4a5 --- /dev/null +++ b/policyengine_us/parameters/gov/bankruptcy/presumption_abuse/rate.yaml @@ -0,0 +1,14 @@ +description: The IRS matches this percent of the nonpriorirty unsecured debt under the chapter 7 bankruptcy means test. + +values: + 2024-01-01: 0.25 + +metadata: + unit: /1 + period: year + label: Nonpriority unsecured debt rate + reference: + - title: Official Form 122A-2 Chapter 7 Means Test Calculation + href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=9 + - title: 11 U.S.C. § 707(b)(2)(A)(i)(I) + href: https://www.law.cornell.edu/uscode/text/11/707 diff --git a/policyengine_us/parameters/gov/household/county_group/midwest/chicago.yaml b/policyengine_us/parameters/household/county_group/midwest/chicago.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/midwest/chicago.yaml rename to policyengine_us/parameters/household/county_group/midwest/chicago.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/household/county_group/midwest/cleveland.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/midwest/cleveland.yaml rename to policyengine_us/parameters/household/county_group/midwest/cleveland.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/midwest/detroit.yaml b/policyengine_us/parameters/household/county_group/midwest/detroit.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/midwest/detroit.yaml rename to policyengine_us/parameters/household/county_group/midwest/detroit.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/midwest/minneapolis_st_paul.yaml b/policyengine_us/parameters/household/county_group/midwest/minneapolis_st_paul.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/midwest/minneapolis_st_paul.yaml rename to policyengine_us/parameters/household/county_group/midwest/minneapolis_st_paul.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/midwest/st_louis.yaml b/policyengine_us/parameters/household/county_group/midwest/st_louis.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/midwest/st_louis.yaml rename to policyengine_us/parameters/household/county_group/midwest/st_louis.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/northeast/boston.yaml b/policyengine_us/parameters/household/county_group/northeast/boston.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/northeast/boston.yaml rename to policyengine_us/parameters/household/county_group/northeast/boston.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/northeast/new_york.yaml b/policyengine_us/parameters/household/county_group/northeast/new_york.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/northeast/new_york.yaml rename to policyengine_us/parameters/household/county_group/northeast/new_york.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/northeast/philadelphia.yaml rename to policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/atlanta.yaml b/policyengine_us/parameters/household/county_group/south/atlanta.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/atlanta.yaml rename to policyengine_us/parameters/household/county_group/south/atlanta.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/baltimore.yaml b/policyengine_us/parameters/household/county_group/south/baltimore.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/baltimore.yaml rename to policyengine_us/parameters/household/county_group/south/baltimore.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/dallas_ft_worth.yaml b/policyengine_us/parameters/household/county_group/south/dallas_ft_worth.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/dallas_ft_worth.yaml rename to policyengine_us/parameters/household/county_group/south/dallas_ft_worth.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/houston.yaml b/policyengine_us/parameters/household/county_group/south/houston.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/houston.yaml rename to policyengine_us/parameters/household/county_group/south/houston.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/miami.yaml b/policyengine_us/parameters/household/county_group/south/miami.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/miami.yaml rename to policyengine_us/parameters/household/county_group/south/miami.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/tampa.yaml b/policyengine_us/parameters/household/county_group/south/tampa.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/tampa.yaml rename to policyengine_us/parameters/household/county_group/south/tampa.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/south/washington_dc.yaml b/policyengine_us/parameters/household/county_group/south/washington_dc.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/south/washington_dc.yaml rename to policyengine_us/parameters/household/county_group/south/washington_dc.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/anchorage.yaml b/policyengine_us/parameters/household/county_group/west/anchorage.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/anchorage.yaml rename to policyengine_us/parameters/household/county_group/west/anchorage.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/denver.yaml b/policyengine_us/parameters/household/county_group/west/denver.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/denver.yaml rename to policyengine_us/parameters/household/county_group/west/denver.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/honolulu.yaml b/policyengine_us/parameters/household/county_group/west/honolulu.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/honolulu.yaml rename to policyengine_us/parameters/household/county_group/west/honolulu.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/los_angeles.yaml b/policyengine_us/parameters/household/county_group/west/los_angeles.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/los_angeles.yaml rename to policyengine_us/parameters/household/county_group/west/los_angeles.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/phoenix.yaml b/policyengine_us/parameters/household/county_group/west/phoenix.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/phoenix.yaml rename to policyengine_us/parameters/household/county_group/west/phoenix.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/san_diego.yaml b/policyengine_us/parameters/household/county_group/west/san_diego.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/san_diego.yaml rename to policyengine_us/parameters/household/county_group/west/san_diego.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/san_francisco.yaml b/policyengine_us/parameters/household/county_group/west/san_francisco.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/san_francisco.yaml rename to policyengine_us/parameters/household/county_group/west/san_francisco.yaml diff --git a/policyengine_us/parameters/gov/household/county_group/west/seattle.yaml b/policyengine_us/parameters/household/county_group/west/seattle.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/county_group/west/seattle.yaml rename to policyengine_us/parameters/household/county_group/west/seattle.yaml diff --git a/policyengine_us/parameters/gov/household/state_group/midwest.yaml b/policyengine_us/parameters/household/state_group/midwest.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/state_group/midwest.yaml rename to policyengine_us/parameters/household/state_group/midwest.yaml diff --git a/policyengine_us/parameters/gov/household/state_group/northeast.yaml b/policyengine_us/parameters/household/state_group/northeast.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/state_group/northeast.yaml rename to policyengine_us/parameters/household/state_group/northeast.yaml diff --git a/policyengine_us/parameters/gov/household/state_group/south.yaml b/policyengine_us/parameters/household/state_group/south.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/state_group/south.yaml rename to policyengine_us/parameters/household/state_group/south.yaml diff --git a/policyengine_us/parameters/gov/household/state_group/west.yaml b/policyengine_us/parameters/household/state_group/west.yaml similarity index 100% rename from policyengine_us/parameters/gov/household/state_group/west.yaml rename to policyengine_us/parameters/household/state_group/west.yaml diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml new file mode 100644 index 00000000000..5ace65c81da --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml @@ -0,0 +1,27 @@ +- name: Case 1, size 1. + period: 2024-01 + input: + spm_unit_size: 1 + output: + chapter_7_bankruptcy_food_clothing_and_others_deduction: 808 + +- name: Case 2, size 4. + period: 2024-01 + input: + spm_unit_size: 4 + output: + chapter_7_bankruptcy_food_clothing_and_others_deduction: 2027 + +- name: Case 3, size 5. + period: 2024-01 + input: + spm_unit_size: 5 + output: + chapter_7_bankruptcy_food_clothing_and_others_deduction: 2413 + +- name: Case 4, size 7. + period: 2024-01 + input: + spm_unit_size: 7 + output: + chapter_7_bankruptcy_food_clothing_and_others_deduction: 3185 \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.yaml new file mode 100644 index 00000000000..2760d6b8f07 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.yaml @@ -0,0 +1,50 @@ +- name: Case 1, both people below age 65. + period: 2024-01 + input: + people: + person1: + age: 40 + person2: + age: 45 + spm_units: + spm_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + output: + chapter_7_bankruptcy_out_of_pocket_health_care_deduction: 166 + +- name: Case 2, one above age 65, one below age 65. + period: 2024-01 + input: + people: + person1: + age: 70 + person2: + age: 45 + spm_units: + spm_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + output: + chapter_7_bankruptcy_out_of_pocket_health_care_deduction: 241 + +- name: Case 3, both age above 65. + period: 2024-01 + input: + people: + person1: + age: 75 + person2: + age: 78 + spm_units: + spm_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + output: + chapter_7_bankruptcy_out_of_pocket_health_care_deduction: 316 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/is_presumption_of_abuse.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/is_presumption_of_abuse.yaml new file mode 100644 index 00000000000..d2e86807d71 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/is_presumption_of_abuse.yaml @@ -0,0 +1,39 @@ +- name: Case 1, total_disposable_income less than 9075, no abuse. + period: 2024 + input: + chapter_7_bankruptcy_adjust_monthly_income: 2_000 + chapter_7_bankruptcy_total_deductions: 1_900 + chapter_7_bankruptcy_nonpriority_unsecured_debt: 0 + output: + is_presumption_of_abuse: false + # (2000 - 1900)*60 = 6000 < 9075 + +- name: Case 2, total_disposable_income higher than 15150, has abuse. + period: 2024 + input: + chapter_7_bankruptcy_adjust_monthly_income: 2_000 + chapter_7_bankruptcy_total_deductions: 1_700 + chapter_7_bankruptcy_nonpriority_unsecured_debt: 0 + output: + is_presumption_of_abuse: true + # (2000-1700)*60 = 18000 > 15150 + +- name: Case 3, total_disposable_income in between, and enough to pay 25% of nonpriority unsecured debt. + period: 2024 + input: + chapter_7_bankruptcy_adjust_monthly_income: 2_000 + chapter_7_bankruptcy_total_deductions: 1_750 + chapter_7_bankruptcy_nonpriority_unsecured_debt: 1_000 + output: + is_presumption_of_abuse: true + # (2000-1750)*60 = 15000 is higher than 1000*25% + +- name: Case 4, total_disposable_income in between, and not enough to pay 25% of nonpriority unsecured debt. + period: 2024 + input: + chapter_7_bankruptcy_adjust_monthly_income: 2_000 + chapter_7_bankruptcy_total_deductions: 1_750 + chapter_7_bankruptcy_nonpriority_unsecured_debt: 61_000 + output: + is_presumption_of_abuse: false + # (2000-1750)*60 = 15000 is less than 61000*25% = 15250 diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml index 4eb570af85b..385a1660ad2 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml @@ -19,6 +19,7 @@ input: state_code_str: MA county_str: SUFFOLK_COUNTY_MA + is_west_region: false output: west_county: Null \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml b/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml new file mode 100644 index 00000000000..93cbfe42650 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml @@ -0,0 +1,14 @@ +- name: Has a vehicle loan. + period: 2024 + input: + vehicle_mortgage_expense: 1_000 + output: + has_a_vehicle_loan: true + +- name: Don't have a vehicle loan. + period: 2024 + input: + vehicle_mortgage_expense: 0 + output: + has_a_vehicle_loan: false + \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py index 621a2742b98..2fee9e944bb 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py @@ -12,7 +12,6 @@ class chapter_7_bankruptcy_adjust_monthly_income(Variable): ) documentation = "Line 4 in form 122A-2" - # Can I create a list parameter which includes all of the following varaibles? def formula(spm_unit, period, parameters): employment_income = add(spm_unit, period, ["irs_employment_income"]) alimony_income = add(spm_unit, period, ["alimony_income"]) diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py new file mode 100644 index 00000000000..309410aef1a --- /dev/null +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py @@ -0,0 +1,10 @@ +from policyengine_us.model_api import * + + +class chapter_7_bankruptcy_nonpriority_unsecured_debt(Variable): + value_type = float + entity = SPMUnit + label = "Nonpriority unsecured debt" + definition_period = YEAR + reference = ("https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=9") + documentation = "Line 41a in form 122A-2" diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index d7da7094cc8..d13431b34f4 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -28,7 +28,7 @@ def formula(spm_unit, period, parameters): ) qualify_vehicles_owned = add(spm_unit,period,["is_vehicle_loaned"]) - qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) + qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, p.vehicle_operation.vehicles_owned_cap) ownership_costs_allowance = p.vehicle_operation.ownership_costs[ qualify_vehicles_owned_cap ] diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py index b55bd21d6cb..2bee003292f 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py @@ -5,7 +5,7 @@ class chapter_7_bankruptcy_out_of_pocket_health_care_deduction(Variable): value_type = float entity = SPMUnit label = "National standard of Out-of-pocket health care deduction" - definition_period = MONTH + definition_period = YEAR reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=2" documentation = "Line 7 in form 122A-2" @@ -15,5 +15,7 @@ def formula(spm_unit, period, parameters): ).gov.bankruptcy.national_standards.out_of_pocket_health_care.amount age = spm_unit.members("age",period) - return p.calc(age) + out_of_pocket_health_care_allowance = p.calc(age) + + return spm_unit.sum(out_of_pocket_health_care_allowance)*MONTHS_IN_YEAR \ No newline at end of file diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index 620b5c45fbf..99cc39a48dd 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -14,7 +14,7 @@ def formula(spm_unit, period, parameters): period ).gov.bankruptcy.local_standards.vehicle_operation.region_operating_costs - qualify_vehicles_owned = add(spm_unit,period,["is_vehicle_loaned"]) + qualify_vehicles_owned = add(spm_unit,period,["has_a_vehicle_loan"]) qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) northeast = spm_unit("northeast_county", period) midwest = spm_unit("midwest_county", period) diff --git a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py index 691eaae54cb..efa56dd0f06 100644 --- a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py +++ b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py @@ -5,11 +5,15 @@ class is_presumption_of_abuse(Variable): value_type = bool entity = SPMUnit label = "Is presumption of abuse" - definition_period = MONTH + definition_period = YEAR reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=8" documentation = "Line 39-xx in form 122A-2" def formula(spm_unit, period, parameters): + p = parameters( + period + ).gov.bankruptcy.presumption_abuse + adjusted_monthly_income = spm_unit( "chapter_7_bankruptcy_adjust_monthly_income", period ) @@ -17,11 +21,14 @@ def formula(spm_unit, period, parameters): "chapter_7_bankruptcy_total_deductions", period ) monthly_disposable_income = adjusted_monthly_income - total_deductions - monthly_disposable_income_60_months = ( + total_disposable_income = ( monthly_disposable_income * MONTHS_IN_YEAR * 5 ) - return monthly_disposable_income_60_months > 15150 - # if monthly_disposable_income_60_months < 9075, false, - # if monthly_disposable_income_60_months > 15150, true - # if 9075 < monthly_disposable_income_60_months < 15150, go line 41 - ## + nonpriority_unsecured_debt = spm_unit("chapter_7_bankruptcy_nonpriority_unsecured_debt",period) + adjust_nonpriority_unsecured_debt = nonpriority_unsecured_debt*p.rate + is_income_high = total_disposable_income > p.amount.higher + is_income_in_between = p.amount.lower < total_disposable_income < p.amount.higher + is_income_exceeding_debt = total_disposable_income >= adjust_nonpriority_unsecured_debt + + return is_income_high | (is_income_in_between & is_income_exceeding_debt) + \ No newline at end of file diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py index 2a437e755f6..e5aaf84c28d 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py @@ -13,6 +13,6 @@ def formula(spm_unit, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.state_group + ).household.state_group return np.isin(state, p.midwest) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py index 5076907eb99..b17a2a606db 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py @@ -13,6 +13,6 @@ def formula(spm_unit, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.state_group + ).household.state_group return np.isin(state, p.northeast) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py index 8bf7aac9041..5dc01c474b3 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py @@ -13,6 +13,6 @@ def formula(spm_unit, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.state_group + ).household.state_group return np.isin(state, p.south) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py index 341d0deaade..ec874e5acf9 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py @@ -13,6 +13,6 @@ def formula(spm_unit, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.state_group + ).household.state_group return np.isin(state_code, p.west) diff --git a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py index d67481f1c65..1bb189e0216 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py @@ -24,7 +24,7 @@ def formula(household, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group + ).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py index ed535c0fc87..959ad208afe 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py @@ -22,7 +22,7 @@ def formula(household, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group + ).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py b/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py new file mode 100644 index 00000000000..6fc2ffe3206 --- /dev/null +++ b/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py @@ -0,0 +1,12 @@ +from policyengine_us.model_api import * + + +class has_a_vehicle_loan(Variable): + value_type = bool + entity = Person + label = "Has vehicel loan or lease" + definition_period = YEAR + + def formula(person, period, parameters): + total_mortage_expenses = person("vehicle_mortgage_expense",period) + return total_mortage_expenses > 0 diff --git a/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py b/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py deleted file mode 100644 index 13f7bcf3922..00000000000 --- a/policyengine_us/variables/household/demographic/person/is_vehicle_loaned.py +++ /dev/null @@ -1,11 +0,0 @@ -from policyengine_us.model_api import * - - -class is_vehicle_loaned(Variable): - value_type = bool - entity = Person - label = "Is the vehicel loaned or leased" - definition_period = YEAR - - def formula(person, period, parameters): - return person("vehicle_mortgage_expense",period) > 0 From 437dce81a5bf7b41955a0cb5424e1e7b3f5a9072 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:35:33 +0000 Subject: [PATCH 16/19] fix regions formula and add test cases --- .../geographic/region/is_mideast_region.yaml | 21 +++++++++++++++++++ .../region/is_northeast_region.yaml | 21 +++++++++++++++++++ .../geographic/region/is_south_region.yaml | 21 +++++++++++++++++++ .../geographic/region/is_west_region.yaml | 6 +++--- .../geographic/region/west_county.yaml | 12 +++++------ .../geographic/region/is_midwest_region.py | 4 ++-- .../geographic/region/is_northeast_region.py | 4 ++-- .../geographic/region/is_south_region.py | 4 ++-- .../geographic/region/is_west_region.py | 4 ++-- .../geographic/region/south_county.py | 2 +- .../geographic/region/west_county.py | 4 ++-- 11 files changed, 83 insertions(+), 20 deletions(-) create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml new file mode 100644 index 00000000000..8caa9b472fb --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml @@ -0,0 +1,21 @@ +- name: Illinois is in midwest region. + period: 2024 + input: + state_code: IL + output: + is_midwest_region: true + +- name: North Dakota is in midwest region. + period: 2024 + input: + state_code: ND + output: + is_midwest_region: true + +- name: Massachusetts is not in midwest region. + period: 2024 + input: + state_code: MA + output: + is_midwest_region: false + \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml new file mode 100644 index 00000000000..b4c94960ca3 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml @@ -0,0 +1,21 @@ +- name: Massachusetts is in northeast region. + period: 2024 + input: + state_code: MA + output: + is_northeast_region: true + +- name: Pennsylvania is in northeast region. + period: 2024 + input: + state_code: PA + output: + is_northeast_region: true + +- name: Illinois is not in northeast region. + period: 2024 + input: + state_code: IL + output: + is_northeast_region: false + \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml new file mode 100644 index 00000000000..b1e75802ef9 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml @@ -0,0 +1,21 @@ +- name: Georgia is in south region. + period: 2024 + input: + state_code: GA + output: + is_south_region: true + +- name: Florida is in south region. + period: 2024 + input: + state_code: FL + output: + is_south_region: true + +- name: Massachusetts is not in south region. + period: 2024 + input: + state_code: MA + output: + is_south_region: false + \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml index 0d2ac1d624b..861446846db 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_west_region.yaml @@ -1,20 +1,20 @@ - name: New Mexico is in west region. period: 2024 input: - state_code_str: NM + state_code: NM output: is_west_region: true - name: California is in west region. period: 2024 input: - state_code_str: CA + state_code: CA output: is_west_region: true - name: Massachusetts is not in west region. period: 2024 input: - state_code_str: MA + state_code: MA output: is_west_region: false diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml index 385a1660ad2..d3e975c226d 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml @@ -1,24 +1,24 @@ - name: Orange county belongs to Los Angeles by MSA. period: 2024 input: - state_code_str: CA - county_str: ORANGE_COUNTY_CA + state_code: CA + county: ORANGE_COUNTY_CA output: west_county: LOS_ANGELES - name: Kern county belongs to default west. period: 2024 input: - state_code_str: CA - county_str: KERN_COUNTY_CA + state_code: CA + county: KERN_COUNTY_CA output: west_county: WEST_DEFAULT - name: Not part of any west region. period: 2024 input: - state_code_str: MA - county_str: SUFFOLK_COUNTY_MA + state_code: MA + county: SUFFOLK_COUNTY_MA is_west_region: false output: west_county: Null diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py index e5aaf84c28d..60e5cb6e5ab 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py @@ -9,10 +9,10 @@ class is_midwest_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state = spm_unit.household("state_code", period) + state_code = spm_unit.household("state_code", period).decode_to_str() p = parameters( period ).household.state_group - return np.isin(state, p.midwest) + return np.isin(state_code, p.midwest) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py index b17a2a606db..800bf179853 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py @@ -9,10 +9,10 @@ class is_northeast_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state = spm_unit.household("state_code", period) + state_code = spm_unit.household("state_code", period).decode_to_str() p = parameters( period ).household.state_group - return np.isin(state, p.northeast) + return np.isin(state_code, p.northeast) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py index 5dc01c474b3..8f55c4454b0 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py @@ -9,10 +9,10 @@ class is_south_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state = spm_unit.household("state_code", period) + state_code = spm_unit.household("state_code", period).decode_to_str() p = parameters( period ).household.state_group - return np.isin(state, p.south) + return np.isin(state_code, p.south) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py index ec874e5acf9..59006e68298 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py @@ -9,8 +9,8 @@ class is_west_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state_code = spm_unit.household("state_code", period) - + + state_code = spm_unit.household("state_code", period).decode_to_str() p = parameters( period ).household.state_group diff --git a/policyengine_us/variables/household/demographic/geographic/region/south_county.py b/policyengine_us/variables/household/demographic/geographic/region/south_county.py index 258983d70d9..294d847ec3a 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/south_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/south_county.py @@ -26,7 +26,7 @@ def formula(household, period, parameters): p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_group + ).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/geographic/region/west_county.py b/policyengine_us/variables/household/demographic/geographic/region/west_county.py index 8b74e2e8faf..52f692ccf5d 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/west_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/west_county.py @@ -23,11 +23,11 @@ class west_county(Variable): label = "West region state group" def formula(household, period, parameters): - county = household("county_str", period) + county = household("county", period).decode_to_str() p = parameters( period - ).gov.bankruptcy.local_standards.vehicle_operation.region_groupp + ).household.county_group return select( [ From bef0e8f2f84dcda4df3602b1db4ce432459b4e0d Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Thu, 12 Dec 2024 02:05:49 +0000 Subject: [PATCH 17/19] adjustment on parameters --- .../region_operating_costs/midwest.yaml | 12 ++++----- .../region_operating_costs/northeast.yaml | 2 +- .../region_operating_costs/south.yaml | 16 +++++------ .../region_operating_costs/west.yaml | 18 ++++++------- .../county_group/midwest/chicago.yaml | 2 +- .../county_group/midwest/cleveland.yaml | 2 +- .../county_group/northeast/boston.yaml | 2 +- ...cy_food_clothing_and_others_deduction.yaml | 2 +- ...ast_region.yaml => is_midwest_region.yaml} | 2 +- .../geographic/region/midwest_county.yaml | 23 ++++++++++++++++ .../geographic/region/northeast_county.yaml | 23 ++++++++++++++++ .../geographic/region/south_county.yaml | 23 ++++++++++++++++ ...7_bankruptcy_nonpriority_unsecured_debt.py | 2 +- ...ankruptcy_additional_expense_deductions.py | 12 ++++----- ...7_bankruptcy_local_standards_deductions.py | 12 +++++---- ...tcy_out_of_pocket_health_care_deduction.py | 11 ++++---- ...tcy_vehicle_operation_expense_deduction.py | 2 +- .../gov/bankruptcy/is_presumption_of_abuse.py | 27 +++++++++++-------- .../geographic/region/is_midwest_region.py | 4 +-- .../geographic/region/is_northeast_region.py | 4 +-- .../geographic/region/is_south_region.py | 4 +-- .../geographic/region/is_west_region.py | 6 ++--- .../geographic/region/midwest_county.py | 6 ++--- .../geographic/region/northeast_county.py | 6 ++--- .../geographic/region/south_county.py | 18 ++++++------- .../geographic/region/west_county.py | 6 ++--- .../demographic/person/has_a_vehicle_loan.py | 4 +-- 27 files changed, 156 insertions(+), 95 deletions(-) rename policyengine_us/tests/policy/baseline/household/demographic/geographic/region/{is_mideast_region.yaml => is_midwest_region.yaml} (98%) create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml index 53f18c04f5f..cd890155dc8 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml @@ -1,31 +1,31 @@ description: The IRS limits the expense of midwest region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -Midwest_region: +MIDWEST_DEFAULT: 1: 2024-01-01: 239 2: 2024-01-01: 478 -Chicago: +CHICAGO: 1: 2024-01-01: 266 2: 2024-01-01: 532 -Cleveland: +CLEVELAND: 1: 2024-01-01: 239 2: 2024-01-01: 478 -Detroit: +DETROIT: 1: 2024-01-01: 299 2: 2024-01-01: 598 -Minneapolis_St.Paul: +MINNEAPOLIS_ST_PAUL: 1: 2024-01-01: 243 2: 2024-01-01: 486 -St.Louis: +ST_LOUIS: 1: 2024-01-01: 220 2: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml index 20ea90f2e52..029b5f9c7fd 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -1,6 +1,6 @@ description: The IRS limits the expense of northeast region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -NORTHEAST: +NORTHEAST_DEFAULT: 1: 2024-01-01: 285 2: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml index 148eef8b74a..db00b63ab9e 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml @@ -1,41 +1,41 @@ description: The IRS limits the expense of south region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -South_region: +SOUTH_DEFAULT: 1: 2024-01-01: 260 2: 2024-01-01: 520 -Atlanta: +ATLANTA: 1: 2024-01-01: 304 2: 2024-01-01: 608 -Baltimore: +BALTIMORE: 1: 2024-01-01: 272 2: 2024-01-01: 544 -Dallas_Ft.Worth: +DALLAS_FT_WORTH: 1: 2024-01-01: 292 2: 2024-01-01: 584 -Houston: +HOUSTON: 1: 2024-01-01: 332 2: 2024-01-01: 664 -Miami: +MIAMI: 1: 2024-01-01: 355 2: 2024-01-01: 710 -Tampa: +TAMPA: 1: 2024-01-01: 305 2: 2024-01-01: 610 -Washington_DC: +WASHINGTON_DC: 1: 2024-01-01: 301 2: diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml index fdbdf33c939..7e9c5abb8b1 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml @@ -1,46 +1,46 @@ description: The IRS limits the expense of west region operating costs by the local standards to this amount, based on the number of owned vehicle, under the Chapter 7 Bankruptcy means test. -West_region: +WEST_DEFAULT: 1: 2024-01-01: 273 2: 2024-01-01: 546 -Anchorage: +ANCHORAGE: 1: 2024-01-01: 200 2: 2024-01-01: 400 -Denver: +DENVER: 1: 2024-01-01: 321 2: 2024-01-01: 642 -Honolulu: +HONOLULU: 1: 2024-01-01: 254 2: 2024-01-01: 508 -Los_Angeles: +LOS_ANGELES: 1: 2024-01-01: 331 2: 2024-01-01: 662 -Phoenix: +PHOENIX: 1: 2024-01-01: 300 2: 2024-01-01: 600 -San_Diego: +SAN_DIEGO: 1: 2024-01-01: 310 2: 2024-01-01: 620 -San_Francisco: +SAN_FRANCISCO: 1: 2024-01-01: 348 2: 2024-01-01: 696 -Seattle: +SEATTLE: 1: 2024-01-01: 271 2: diff --git a/policyengine_us/parameters/household/county_group/midwest/chicago.yaml b/policyengine_us/parameters/household/county_group/midwest/chicago.yaml index eb524bef12e..dd624b1e37e 100644 --- a/policyengine_us/parameters/household/county_group/midwest/chicago.yaml +++ b/policyengine_us/parameters/household/county_group/midwest/chicago.yaml @@ -23,4 +23,4 @@ values: - NEWTON_COUNTY_IN - PORTER_COUNTY_IN - KENOSHA_COUNTY_WI - \ No newline at end of file + diff --git a/policyengine_us/parameters/household/county_group/midwest/cleveland.yaml b/policyengine_us/parameters/household/county_group/midwest/cleveland.yaml index a197726091c..6b462d040bd 100644 --- a/policyengine_us/parameters/household/county_group/midwest/cleveland.yaml +++ b/policyengine_us/parameters/household/county_group/midwest/cleveland.yaml @@ -17,4 +17,4 @@ values: - MEDINA_COUNTY_OH - PORTAGE_COUNTY_OH - SUMMIT_COUNTY_OH - \ No newline at end of file + diff --git a/policyengine_us/parameters/household/county_group/northeast/boston.yaml b/policyengine_us/parameters/household/county_group/northeast/boston.yaml index a9eca685a44..62ad9b83031 100644 --- a/policyengine_us/parameters/household/county_group/northeast/boston.yaml +++ b/policyengine_us/parameters/household/county_group/northeast/boston.yaml @@ -9,7 +9,7 @@ metadata: href: https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation values: 2024-01-01: - - ESSEXE_COUNTY_MA + - ESSEX_COUNTY_MA - MIDDLESEX_COUNTY_MA - NORFOLK_COUNTY_MA - PLYMOUTH_COUNTY_MA diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml index 5ace65c81da..74ac5dcc45b 100644 --- a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_food_clothing_and_others_deduction.yaml @@ -24,4 +24,4 @@ input: spm_unit_size: 7 output: - chapter_7_bankruptcy_food_clothing_and_others_deduction: 3185 \ No newline at end of file + chapter_7_bankruptcy_food_clothing_and_others_deduction: 3185 diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml similarity index 98% rename from policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml rename to policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml index 8caa9b472fb..68de6f27a0f 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_mideast_region.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml @@ -18,4 +18,4 @@ state_code: MA output: is_midwest_region: false - \ No newline at end of file + diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml new file mode 100644 index 00000000000..353fec85568 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml @@ -0,0 +1,23 @@ +- name: Cook county belongs to Chicago by MSA. + period: 2024 + input: + state_code: IL + county_str: COOK_COUNTY_IL + output: + midwest_county: CHICAGO + +- name: Slope county belongs to default midwest. + period: 2024 + input: + state_code: ND + county_str: SLOPE_COUNTY_ND + output: + midwest_county: MIDWEST_DEFAULT + +- name: Not part of any midwest region. + period: 2024 + input: + state_code: MA + county_str: SUFFOLK_COUNTY_MA + output: + midwest_county: Null diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml new file mode 100644 index 00000000000..745980421b1 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml @@ -0,0 +1,23 @@ +- name: Essex county belongs to Boston by MSA. + period: 2024 + input: + state_code: MA + county_str: ESSEX_COUNTY_MA + output: + northeast_county: BOSTON + +- name: Barnstable county belongs to default northeast. + period: 2024 + input: + state_code: MA + county_str: BARNSTABLE_COUNTY_MA + output: + northeast_county: NORTHEAST_DEFAULT + +- name: Not part of any northeast region. + period: 2024 + input: + state_code: IL + county_str: COOK_COUNTY_IL + output: + northeast_county: Null diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml new file mode 100644 index 00000000000..e9959e1803b --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml @@ -0,0 +1,23 @@ +- name: Fulton county belongs to Atlanta by MSA. + period: 2024 + input: + state_code: GA + county_str: FULTON_COUNTY_GA + output: + south_county: ATLANTA + +- name: Calhoun county belongs to default south. + period: 2024 + input: + state_code: FL + county_str: CALHOUN_COUNTY_FL + output: + south_county: SOUTH_DEFAULT + +- name: Not part of any south region. + period: 2024 + input: + state_code: MA + county_str: SUFFOLK_COUNTY_MA + output: + south_county: Null diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py index 309410aef1a..295de300eee 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py @@ -6,5 +6,5 @@ class chapter_7_bankruptcy_nonpriority_unsecured_debt(Variable): entity = SPMUnit label = "Nonpriority unsecured debt" definition_period = YEAR - reference = ("https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=9") + reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=9" documentation = "Line 41a in form 122A-2" diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index b0ee9d3b38b..ce151eabd4d 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -20,14 +20,14 @@ def formula(spm_unit, period, parameters): home_energy_costs = spm_unit.household( "current_home_energy_use", period ) - education_expense = add( - spm_unit, period, ["k12_tuition_and_fees"] - ) - child_count = add(spm_unit,period,["is_child_dependent"]) + education_expense = add(spm_unit, period, ["k12_tuition_and_fees"]) + child_count = add(spm_unit, period, ["is_child_dependent"]) p = parameters(period).gov.bankruptcy education_expense_allowance = child_count * p.dependent_expense - adjust_education_expense = min_(education_expense,education_expense_allowance) - + adjust_education_expense = min_( + education_expense, education_expense_allowance + ) + charitable_contributions = add( spm_unit, period, diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index d13431b34f4..af85150ff87 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -17,9 +17,9 @@ def formula(spm_unit, period, parameters): p.housing_and_utilities.insurance_and_operating[state][size] ) - mortgage_or_rent_allowance = ( - p.housing_and_utilities.mortgage_or_rent[state][size] - ) + mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[ + state + ][size] monthly_housing_expense = ( add(spm_unit, period, ["housing_cost"]) / MONTHS_IN_YEAR ) @@ -27,8 +27,10 @@ def formula(spm_unit, period, parameters): mortgage_or_rent_allowance - monthly_housing_expense, 0 ) - qualify_vehicles_owned = add(spm_unit,period,["is_vehicle_loaned"]) - qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, p.vehicle_operation.vehicles_owned_cap) + qualify_vehicles_owned = add(spm_unit, period, ["is_vehicle_loaned"]) + qualify_vehicles_owned_cap = min_( + qualify_vehicles_owned, p.vehicle_operation.vehicles_owned_cap + ) ownership_costs_allowance = p.vehicle_operation.ownership_costs[ qualify_vehicles_owned_cap ] diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py index 2bee003292f..4ddc4766149 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_out_of_pocket_health_care_deduction.py @@ -13,9 +13,10 @@ def formula(spm_unit, period, parameters): p = parameters( period ).gov.bankruptcy.national_standards.out_of_pocket_health_care.amount - - age = spm_unit.members("age",period) - out_of_pocket_health_care_allowance = p.calc(age) - return spm_unit.sum(out_of_pocket_health_care_allowance)*MONTHS_IN_YEAR - \ No newline at end of file + age = spm_unit.members("age", period) + out_of_pocket_health_care_allowance = p.calc(age) + + return ( + spm_unit.sum(out_of_pocket_health_care_allowance) * MONTHS_IN_YEAR + ) diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index 99cc39a48dd..cd73acefd94 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -14,7 +14,7 @@ def formula(spm_unit, period, parameters): period ).gov.bankruptcy.local_standards.vehicle_operation.region_operating_costs - qualify_vehicles_owned = add(spm_unit,period,["has_a_vehicle_loan"]) + qualify_vehicles_owned = add(spm_unit, period, ["has_a_vehicle_loan"]) qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) northeast = spm_unit("northeast_county", period) midwest = spm_unit("midwest_county", period) diff --git a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py index efa56dd0f06..25447928125 100644 --- a/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py +++ b/policyengine_us/variables/gov/bankruptcy/is_presumption_of_abuse.py @@ -10,10 +10,8 @@ class is_presumption_of_abuse(Variable): documentation = "Line 39-xx in form 122A-2" def formula(spm_unit, period, parameters): - p = parameters( - period - ).gov.bankruptcy.presumption_abuse - + p = parameters(period).gov.bankruptcy.presumption_abuse + adjusted_monthly_income = spm_unit( "chapter_7_bankruptcy_adjust_monthly_income", period ) @@ -24,11 +22,18 @@ def formula(spm_unit, period, parameters): total_disposable_income = ( monthly_disposable_income * MONTHS_IN_YEAR * 5 ) - nonpriority_unsecured_debt = spm_unit("chapter_7_bankruptcy_nonpriority_unsecured_debt",period) - adjust_nonpriority_unsecured_debt = nonpriority_unsecured_debt*p.rate + nonpriority_unsecured_debt = spm_unit( + "chapter_7_bankruptcy_nonpriority_unsecured_debt", period + ) + adjust_nonpriority_unsecured_debt = nonpriority_unsecured_debt * p.rate is_income_high = total_disposable_income > p.amount.higher - is_income_in_between = p.amount.lower < total_disposable_income < p.amount.higher - is_income_exceeding_debt = total_disposable_income >= adjust_nonpriority_unsecured_debt - - return is_income_high | (is_income_in_between & is_income_exceeding_debt) - \ No newline at end of file + is_income_in_between = ( + p.amount.lower < total_disposable_income < p.amount.higher + ) + is_income_exceeding_debt = ( + total_disposable_income >= adjust_nonpriority_unsecured_debt + ) + + return is_income_high | ( + is_income_in_between & is_income_exceeding_debt + ) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py index 60e5cb6e5ab..5d2e6e19f95 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_midwest_region.py @@ -11,8 +11,6 @@ class is_midwest_region(Variable): def formula(spm_unit, period, parameters): state_code = spm_unit.household("state_code", period).decode_to_str() - p = parameters( - period - ).household.state_group + p = parameters(period).household.state_group return np.isin(state_code, p.midwest) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py index 800bf179853..512e5bff2e3 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_northeast_region.py @@ -11,8 +11,6 @@ class is_northeast_region(Variable): def formula(spm_unit, period, parameters): state_code = spm_unit.household("state_code", period).decode_to_str() - p = parameters( - period - ).household.state_group + p = parameters(period).household.state_group return np.isin(state_code, p.northeast) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py index 8f55c4454b0..a1d445b7a31 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_south_region.py @@ -11,8 +11,6 @@ class is_south_region(Variable): def formula(spm_unit, period, parameters): state_code = spm_unit.household("state_code", period).decode_to_str() - p = parameters( - period - ).household.state_group + p = parameters(period).household.state_group return np.isin(state_code, p.south) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py index 59006e68298..0397d77eea6 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py @@ -9,10 +9,8 @@ class is_west_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - + state_code = spm_unit.household("state_code", period).decode_to_str() - p = parameters( - period - ).household.state_group + p = parameters(period).household.state_group return np.isin(state_code, p.west) diff --git a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py index 1bb189e0216..1c62c0f0e39 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py @@ -17,14 +17,12 @@ class midwest_county(Variable): default_value = MidWestCounty.MIDWEST_DEFAULT definition_period = YEAR defined_for = "is_midwest_region" - label = "Midwest region state group" + label = "Midwest region county group" def formula(household, period, parameters): county = household("county_str", period) - p = parameters( - period - ).household.county_group + p = parameters(period).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py index 959ad208afe..7d8d536dcbe 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py @@ -15,14 +15,12 @@ class northeast_county(Variable): default_value = NorthEastCounty.NORTHEAST_DEFAULT definition_period = YEAR defined_for = "is_northeast_region" - label = "Northeast region state group" + label = "Northeast region county group" def formula(household, period, parameters): county = household("county_str", period) - p = parameters( - period - ).household.county_group + p = parameters(period).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/geographic/region/south_county.py b/policyengine_us/variables/household/demographic/geographic/region/south_county.py index 294d847ec3a..aaf1486e144 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/south_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/south_county.py @@ -19,24 +19,22 @@ class south_county(Variable): default_value = SouthCounty.SOUTH_DEFAULT definition_period = YEAR defined_for = "is_south_region" - label = "South region state group" + label = "South region county group" def formula(household, period, parameters): county = household("county_str", period) - p = parameters( - period - ).household.county_group + p = parameters(period).household.county_group return select( [ np.isin(county, p.south.atlanta), - np.isin(county, p.northeast.baltimore), - np.isin(county, p.northeast.dallas_ft_worth), - np.isin(county, p.northeast.houston), - np.isin(county, p.northeast.miami), - np.isin(county, p.northeast.tampa), - np.isin(county, p.northeast.washington_dc), + np.isin(county, p.south.baltimore), + np.isin(county, p.south.dallas_ft_worth), + np.isin(county, p.south.houston), + np.isin(county, p.south.miami), + np.isin(county, p.south.tampa), + np.isin(county, p.south.washington_dc), ], [ SouthCounty.ATLANTA, diff --git a/policyengine_us/variables/household/demographic/geographic/region/west_county.py b/policyengine_us/variables/household/demographic/geographic/region/west_county.py index 52f692ccf5d..6b1b097275a 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/west_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/west_county.py @@ -20,14 +20,12 @@ class west_county(Variable): default_value = WestCounty.WEST_DEFAULT definition_period = YEAR defined_for = "is_west_region" - label = "West region state group" + label = "West region county group" def formula(household, period, parameters): county = household("county", period).decode_to_str() - p = parameters( - period - ).household.county_group + p = parameters(period).household.county_group return select( [ diff --git a/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py b/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py index 6fc2ffe3206..38191684874 100644 --- a/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py +++ b/policyengine_us/variables/household/demographic/person/has_a_vehicle_loan.py @@ -8,5 +8,5 @@ class has_a_vehicle_loan(Variable): definition_period = YEAR def formula(person, period, parameters): - total_mortage_expenses = person("vehicle_mortgage_expense",period) - return total_mortage_expenses > 0 + total_mortage_expenses = person("vehicle_mortgage_expense", period) + return total_mortage_expenses > 0 From 2c52eecfaf3514eff2289cb557af9d337dc3c17e Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Thu, 19 Dec 2024 03:19:54 +0000 Subject: [PATCH 18/19] fix the error of county_region. make format --- .../region_operating_costs/midwest.yaml | 5 ++ .../region_operating_costs/northeast.yaml | 5 ++ .../region_operating_costs/south.yaml | 5 ++ .../region_operating_costs/west.yaml | 5 ++ .../county_group/northeast/philadelphia.yaml | 1 - .../household/county_group/south/houston.yaml | 1 - .../household/state_group/midwest.yaml | 1 - .../household/state_group/northeast.yaml | 1 - .../household/state_group/south.yaml | 1 - .../household/state_group/west.yaml | 1 - .../eitc/family_security_act_2024_eitc.py | 2 +- .../ny/wftc/ny_working_families_tax_credit.py | 2 +- .../geographic/region/is_midwest_region.yaml | 1 - .../region/is_northeast_region.yaml | 1 - .../geographic/region/is_south_region.yaml | 1 - .../geographic/region/midwest_county.yaml | 2 +- .../geographic/region/northeast_county.yaml | 2 +- .../geographic/region/south_county.yaml | 2 +- .../geographic/region/west_county.yaml | 3 +- .../person/has_a_vehicle_loan.yaml | 2 +- .../credits/ctc/refundable/ctc_phase_in.py | 2 +- .../geographic/region/is_west_region.py | 2 +- .../geographic/region/midwest_county.py | 44 +++++++----- .../geographic/region/northeast_county.py | 33 +++++---- .../geographic/region/south_county.py | 62 +++++++++++------ .../geographic/region/west_county.py | 68 +++++++++++++------ 26 files changed, 166 insertions(+), 89 deletions(-) diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml index cd890155dc8..a39b68944f4 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml @@ -30,6 +30,11 @@ ST_LOUIS: 2024-01-01: 220 2: 2024-01-01: 440 +NONE: + 1: + 2024-01-01: 0 + 2: + 2024-01-01: 0 metadata: unit: currency-USD diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml index 029b5f9c7fd..35f79e30eda 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -20,6 +20,11 @@ PHILADELPHIA: 2024-01-01: 307 2: 2024-01-01: 614 +NONE: + 1: + 2024-01-01: 0 + 2: + 2024-01-01: 0 metadata: unit: currency-USD diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml index db00b63ab9e..b614bf05148 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml @@ -40,6 +40,11 @@ WASHINGTON_DC: 2024-01-01: 301 2: 2024-01-01: 602 +NONE: + 1: + 2024-01-01: 0 + 2: + 2024-01-01: 0 metadata: unit: currency-USD diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml index 7e9c5abb8b1..4da0f399526 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml @@ -45,6 +45,11 @@ SEATTLE: 2024-01-01: 271 2: 2024-01-01: 542 +NONE: + 1: + 2024-01-01: 0 + 2: + 2024-01-01: 0 metadata: unit: currency-USD diff --git a/policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml b/policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml index 026632a3b52..c034131ca1b 100644 --- a/policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml +++ b/policyengine_us/parameters/household/county_group/northeast/philadelphia.yaml @@ -20,4 +20,3 @@ values: - SALEM_COUNTY_NJ - NEW_CASTLE_COUNTY_DE - CECIL_COUNTY_MD - \ No newline at end of file diff --git a/policyengine_us/parameters/household/county_group/south/houston.yaml b/policyengine_us/parameters/household/county_group/south/houston.yaml index 30544be7edb..8911fd690a5 100644 --- a/policyengine_us/parameters/household/county_group/south/houston.yaml +++ b/policyengine_us/parameters/household/county_group/south/houston.yaml @@ -18,4 +18,3 @@ values: - LIBERTY_COUNTY_TX - MONTGOMERY_COUNTY_TX - WALLER_COUNTY_TX - \ No newline at end of file diff --git a/policyengine_us/parameters/household/state_group/midwest.yaml b/policyengine_us/parameters/household/state_group/midwest.yaml index 9dfce2b07cf..7b6534c4176 100644 --- a/policyengine_us/parameters/household/state_group/midwest.yaml +++ b/policyengine_us/parameters/household/state_group/midwest.yaml @@ -21,4 +21,3 @@ values: - WI - MN - IA - \ No newline at end of file diff --git a/policyengine_us/parameters/household/state_group/northeast.yaml b/policyengine_us/parameters/household/state_group/northeast.yaml index 4ec9a7edc12..68848211330 100644 --- a/policyengine_us/parameters/household/state_group/northeast.yaml +++ b/policyengine_us/parameters/household/state_group/northeast.yaml @@ -18,4 +18,3 @@ values: - PA - NY - NJ - \ No newline at end of file diff --git a/policyengine_us/parameters/household/state_group/south.yaml b/policyengine_us/parameters/household/state_group/south.yaml index 9bdf6b72328..4508e08ea9d 100644 --- a/policyengine_us/parameters/household/state_group/south.yaml +++ b/policyengine_us/parameters/household/state_group/south.yaml @@ -25,4 +25,3 @@ values: - GA - FL - AL - \ No newline at end of file diff --git a/policyengine_us/parameters/household/state_group/west.yaml b/policyengine_us/parameters/household/state_group/west.yaml index 286d984ddbc..7a7e8d27063 100644 --- a/policyengine_us/parameters/household/state_group/west.yaml +++ b/policyengine_us/parameters/household/state_group/west.yaml @@ -22,4 +22,3 @@ values: - CA - AK - HI - \ No newline at end of file diff --git a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py index ce223f65cdf..00b7fc73be0 100644 --- a/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py +++ b/policyengine_us/reforms/congress/romney/family_security_act_2024/eitc/family_security_act_2024_eitc.py @@ -3,7 +3,7 @@ def create_family_security_act_2024_eitc() -> Reform: - + class eitc_maximum(Variable): value_type = float entity = TaxUnit diff --git a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py index 82a4b005c31..c96190d4eeb 100644 --- a/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py +++ b/policyengine_us/reforms/states/ny/wftc/ny_working_families_tax_credit.py @@ -486,7 +486,7 @@ class ny_exemptions(Variable): defined_for = StateCode.NY def formula(tax_unit, period, parameters): - + count_dependents = add( tax_unit, period, ["ny_exemptions_dependent"] ) diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml index 68de6f27a0f..64c6751f9ad 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_midwest_region.yaml @@ -18,4 +18,3 @@ state_code: MA output: is_midwest_region: false - diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml index b4c94960ca3..c38bd8858eb 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_northeast_region.yaml @@ -18,4 +18,3 @@ state_code: IL output: is_northeast_region: false - \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml index b1e75802ef9..a140bf4778b 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/is_south_region.yaml @@ -18,4 +18,3 @@ state_code: MA output: is_south_region: false - \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml index 353fec85568..1df9a6f1324 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/midwest_county.yaml @@ -20,4 +20,4 @@ state_code: MA county_str: SUFFOLK_COUNTY_MA output: - midwest_county: Null + midwest_county: NONE diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml index 745980421b1..161992073d3 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/northeast_county.yaml @@ -20,4 +20,4 @@ state_code: IL county_str: COOK_COUNTY_IL output: - northeast_county: Null + northeast_county: NONE diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml index e9959e1803b..ec3e3042bbb 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/south_county.yaml @@ -20,4 +20,4 @@ state_code: MA county_str: SUFFOLK_COUNTY_MA output: - south_county: Null + south_county: NONE diff --git a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml index d3e975c226d..a2386b4e5a8 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/geographic/region/west_county.yaml @@ -21,5 +21,4 @@ county: SUFFOLK_COUNTY_MA is_west_region: false output: - west_county: Null - \ No newline at end of file + west_county: NONE diff --git a/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml b/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml index 93cbfe42650..5345fff1e29 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/person/has_a_vehicle_loan.yaml @@ -11,4 +11,4 @@ vehicle_mortgage_expense: 0 output: has_a_vehicle_loan: false - \ No newline at end of file + diff --git a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py index 0a4d571f56d..ea632bcdfeb 100644 --- a/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py +++ b/policyengine_us/variables/gov/irs/credits/ctc/refundable/ctc_phase_in.py @@ -10,7 +10,7 @@ class ctc_phase_in(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/24#d" def formula(tax_unit, period, parameters): - + ctc = parameters(period).gov.irs.credits.ctc earnings = tax_unit("tax_unit_earned_income", period) diff --git a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py index 0397d77eea6..d38061ea8e3 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py +++ b/policyengine_us/variables/household/demographic/geographic/region/is_west_region.py @@ -9,8 +9,8 @@ class is_west_region(Variable): reference = "https://www.irs.gov/businesses/small-businesses-self-employed/local-standards-transportation" def formula(spm_unit, period, parameters): - state_code = spm_unit.household("state_code", period).decode_to_str() + p = parameters(period).household.state_group return np.isin(state_code, p.west) diff --git a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py index 1c62c0f0e39..3a82314a810 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/midwest_county.py @@ -8,13 +8,14 @@ class MidWestCounty(Enum): MINNEAPOLIS_ST_PAUL = "Minneapolis-St. Paul" ST_LOUIS = "St. Louis" MIDWEST_DEFAULT = "Midwest default" + NONE = "None" class midwest_county(Variable): value_type = Enum entity = Household possible_values = MidWestCounty - default_value = MidWestCounty.MIDWEST_DEFAULT + default_value = MidWestCounty.NONE definition_period = YEAR defined_for = "is_midwest_region" label = "Midwest region county group" @@ -24,20 +25,31 @@ def formula(household, period, parameters): p = parameters(period).household.county_group + chicago = np.isin(county, p.midwest.chicago) + cleveland = np.isin(county, p.midwest.cleveland) + detroit = np.isin(county, p.midwest.detroit) + minneapolis_st_paul = np.isin(county, p.midwest.minneapolis_st_paul) + st_louis = np.isin(county, p.midwest.st_louis) + + conditions = [ + chicago, + cleveland, + detroit, + minneapolis_st_paul, + st_louis, + ~(chicago | cleveland | detroit | minneapolis_st_paul | st_louis), + ] + results = [ + MidWestCounty.CHICAGO, + MidWestCounty.CLEVELAND, + MidWestCounty.DETROIT, + MidWestCounty.MINNEAPOLIS_ST_PAUL, + MidWestCounty.ST_LOUIS, + MidWestCounty.MIDWEST_DEFAULT, + ] + return select( - [ - np.isin(county, p.midwest.chicago), - np.isin(county, p.midwest.cleveland), - np.isin(county, p.midwest.detroit), - np.isin(county, p.midwest.minneapolis_st_paul), - np.isin(county, p.midwest.st_louis), - ], - [ - MidWestCounty.CHICAGO, - MidWestCounty.CLEVELAND, - MidWestCounty.DETROIT, - MidWestCounty.MINNEAPOLIS_ST_PAUL, - MidWestCounty.ST_LOUIS, - ], - default=MidWestCounty.MIDWEST_DEFAULT, + conditions, + results, + default=MidWestCounty.NONE, ) diff --git a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py index 7d8d536dcbe..4023c1ee457 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/northeast_county.py @@ -6,13 +6,14 @@ class NorthEastCounty(Enum): NEW_YORK = "New York" PHILADELPHIA = "Philadelphia" NORTHEAST_DEFAULT = "Northeast default" + NONE = "None" class northeast_county(Variable): value_type = Enum entity = Household possible_values = NorthEastCounty - default_value = NorthEastCounty.NORTHEAST_DEFAULT + default_value = NorthEastCounty.NONE definition_period = YEAR defined_for = "is_northeast_region" label = "Northeast region county group" @@ -21,17 +22,25 @@ def formula(household, period, parameters): county = household("county_str", period) p = parameters(period).household.county_group + boston = np.isin(county, p.northeast.boston) + new_york = np.isin(county, p.northeast.new_york) + philadelphia = np.isin(county, p.northeast.philadelphia) + + conditions = [ + boston, + new_york, + philadelphia, + ~(boston | new_york | philadelphia), + ] + results = [ + NorthEastCounty.BOSTON, + NorthEastCounty.NEW_YORK, + NorthEastCounty.PHILADELPHIA, + NorthEastCounty.NORTHEAST_DEFAULT, + ] return select( - [ - np.isin(county, p.northeast.boston), - np.isin(county, p.northeast.new_york), - np.isin(county, p.northeast.philadelphia), - ], - [ - NorthEastCounty.BOSTON, - NorthEastCounty.NEW_YORK, - NorthEastCounty.PHILADELPHIA, - ], - default=NorthEastCounty.NORTHEAST_DEFAULT, + conditions, + results, + default=NorthEastCounty.NONE, ) diff --git a/policyengine_us/variables/household/demographic/geographic/region/south_county.py b/policyengine_us/variables/household/demographic/geographic/region/south_county.py index aaf1486e144..1a61c350212 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/south_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/south_county.py @@ -10,13 +10,14 @@ class SouthCounty(Enum): TAMPA = "Tampa" WASHINGTON_DC = "Washington DC" SOUTH_DEFAULT = "South default" + NONE = "None" class south_county(Variable): value_type = Enum entity = Household possible_values = SouthCounty - default_value = SouthCounty.SOUTH_DEFAULT + default_value = SouthCounty.NONE definition_period = YEAR defined_for = "is_south_region" label = "South region county group" @@ -26,24 +27,45 @@ def formula(household, period, parameters): p = parameters(period).household.county_group + atlanta = np.isin(county, p.south.atlanta) + baltimore = np.isin(county, p.south.baltimore) + dallas_ft_worth = np.isin(county, p.south.dallas_ft_worth) + houston = np.isin(county, p.south.houston) + miami = np.isin(county, p.south.miami) + tampa = np.isin(county, p.south.tampa) + washington_dc = np.isin(county, p.south.washington_dc) + + conditions = [ + atlanta, + baltimore, + dallas_ft_worth, + houston, + miami, + tampa, + washington_dc, + ~( + atlanta + | baltimore + | dallas_ft_worth + | houston + | miami + | tampa + | washington_dc + ), + ] + results = [ + SouthCounty.ATLANTA, + SouthCounty.BALTIMORE, + SouthCounty.DALLAS_FT_WORTH, + SouthCounty.HOUSTON, + SouthCounty.MIAMI, + SouthCounty.TAMPA, + SouthCounty.WASHINGTON_DC, + SouthCounty.SOUTH_DEFAULT, + ] + return select( - [ - np.isin(county, p.south.atlanta), - np.isin(county, p.south.baltimore), - np.isin(county, p.south.dallas_ft_worth), - np.isin(county, p.south.houston), - np.isin(county, p.south.miami), - np.isin(county, p.south.tampa), - np.isin(county, p.south.washington_dc), - ], - [ - SouthCounty.ATLANTA, - SouthCounty.BALTIMORE, - SouthCounty.DALLAS_FT_WORTH, - SouthCounty.HOUSTON, - SouthCounty.MIAMI, - SouthCounty.TAMPA, - SouthCounty.WASHINGTON_DC, - ], - default=SouthCounty.SOUTH_DEFAULT, + conditions, + results, + default=SouthCounty.NONE, ) diff --git a/policyengine_us/variables/household/demographic/geographic/region/west_county.py b/policyengine_us/variables/household/demographic/geographic/region/west_county.py index 6b1b097275a..44cffe22a8a 100644 --- a/policyengine_us/variables/household/demographic/geographic/region/west_county.py +++ b/policyengine_us/variables/household/demographic/geographic/region/west_county.py @@ -11,13 +11,14 @@ class WestCounty(Enum): SAN_FRANCISCO = "San Francisco" SEATTLE = "Seattle" WEST_DEFAULT = "West default" + NONE = "None" class west_county(Variable): value_type = Enum entity = Household possible_values = WestCounty - default_value = WestCounty.WEST_DEFAULT + default_value = WestCounty.NONE definition_period = YEAR defined_for = "is_west_region" label = "West region county group" @@ -27,26 +28,49 @@ def formula(household, period, parameters): p = parameters(period).household.county_group + anchorage = np.isin(county, p.west.anchorage) + denver = np.isin(county, p.west.denver) + honolulu = np.isin(county, p.west.honolulu) + los_angeles = np.isin(county, p.west.los_angeles) + phoenix = np.isin(county, p.west.phoenix) + san_diego = np.isin(county, p.west.san_diego) + san_francisco = np.isin(county, p.west.san_francisco) + seattle = np.isin(county, p.west.seattle) + + conditions = [ + anchorage, + denver, + honolulu, + los_angeles, + phoenix, + san_diego, + san_francisco, + seattle, + ~( + anchorage + | denver + | honolulu + | los_angeles + | phoenix + | san_diego + | san_francisco + | seattle + ), + ] + results = [ + WestCounty.ANCHORAGE, + WestCounty.DENVER, + WestCounty.HONOLULU, + WestCounty.LOS_ANGELES, + WestCounty.PHOENIX, + WestCounty.SAN_DIEGO, + WestCounty.SAN_FRANCISCO, + WestCounty.SEATTLE, + WestCounty.WEST_DEFAULT, + ] + return select( - [ - np.isin(county, p.west.anchorage), - np.isin(county, p.west.denver), - np.isin(county, p.west.honolulu), - np.isin(county, p.west.los_angeles), - np.isin(county, p.west.phoenix), - np.isin(county, p.west.san_diego), - np.isin(county, p.west.san_francisco), - np.isin(county, p.west.seattle), - ], - [ - WestCounty.ANCHORAGE, - WestCounty.DENVER, - WestCounty.HONOLULU, - WestCounty.LOS_ANGELES, - WestCounty.PHOENIX, - WestCounty.SAN_DIEGO, - WestCounty.SAN_FRANCISCO, - WestCounty.SEATTLE, - ], - default=WestCounty.WEST_DEFAULT, + conditions, + results, + default=WestCounty.NONE, ) From ba257325d18e154940ce863ccf55c830ceb824f6 Mon Sep 17 00:00:00 2001 From: hua7450 <113824411+hua7450@users.noreply.github.com> Date: Fri, 20 Dec 2024 05:50:16 +0000 Subject: [PATCH 19/19] add test files --- .../gov/bankruptcy/dependent_expense.yaml | 6 ++--- .../vehicle_operation/ownership_costs.yaml | 2 +- .../public_transportation.yaml | 2 +- .../region_operating_costs/midwest.yaml | 2 +- .../region_operating_costs/northeast.yaml | 2 +- .../region_operating_costs/south.yaml | 2 +- .../region_operating_costs/west.yaml | 2 +- ...er_7_bankruptcy_adjust_monthly_income.yaml | 17 +++++++++++++ ...kruptcy_additonal_expenses_deductions.yaml | 12 ++++++++++ ..._7_bankruptcy_debt_payment_deductions.yaml | 15 ++++++++++++ ...bankruptcy_local_standards_deductions.yaml | 13 ++++++++++ ...y_other_necessary_expenses_deductions.yaml | 24 +++++++++++++++++++ ...pter_7_bankruptcy_adjust_monthly_income.py | 6 ++--- ...7_bankruptcy_nonpriority_unsecured_debt.py | 2 +- ...ankruptcy_additional_expense_deductions.py | 5 ++-- ...er_7_bankruptcy_debt_payment_deductions.py | 3 +-- ...7_bankruptcy_local_standards_deductions.py | 19 +++++++-------- ...tcy_other_necessary_expenses_deductions.py | 5 ++-- ...tcy_vehicle_operation_expense_deduction.py | 8 +++---- 19 files changed, 111 insertions(+), 36 deletions(-) create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_additonal_expenses_deductions.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.yaml diff --git a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml index bfbf06e22f7..5760fb7e632 100644 --- a/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/dependent_expense.yaml @@ -1,13 +1,13 @@ description: The IRS limits the expense of dependent children education to this amount to each child under the chapter 7 bankruptcy means test. values: - 2024-01-01: 2_275 + 2024-01-01: 189.58 metadata: unit: currency-USD - period: year + period: month label: Dependent children education expense per child reference: - # The number $189.58 comes from line 28 of the form, multiply it by 12 and get the annual amount. + # The number $189.58 only appears in line 28 of the form. - title: Official Form 122A-2 Chapter 7 Means Test Calculation href: https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=6 diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml index 59ccd1887b7..9f29b8a52c8 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/ownership_costs.yaml @@ -7,7 +7,7 @@ description: The IRS limits the ownership costs by the local standards to this a metadata: unit: currency-USD - period: year + period: month label: Local standards of ownership costs breakdown: - list(range(1,3)) diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml index 07848031ad2..98f56ec40ec 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/public_transportation.yaml @@ -5,7 +5,7 @@ values: metadata: unit: currency-USD - period: year + period: month label: Local standards of public transportation amount reference: - title: Local standards -- Transportation diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml index a39b68944f4..d73363a9f15 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/midwest.yaml @@ -38,7 +38,7 @@ NONE: metadata: unit: currency-USD - period: year + period: month label: Local standards of operating costs amount breakdown: - midwest_county diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml index 35f79e30eda..80f3ca51f33 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/northeast.yaml @@ -28,7 +28,7 @@ NONE: metadata: unit: currency-USD - period: year + period: month label: Local standards of operating costs amount breakdown: - northeast_county diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml index b614bf05148..bc274030b91 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/south.yaml @@ -48,7 +48,7 @@ NONE: metadata: unit: currency-USD - period: year + period: month label: Local standards of operating costs amount breakdown: - south_county diff --git a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml index 4da0f399526..a3b1d603508 100644 --- a/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml +++ b/policyengine_us/parameters/gov/bankruptcy/local_standards/vehicle_operation/region_operating_costs/west.yaml @@ -53,7 +53,7 @@ NONE: metadata: unit: currency-USD - period: year + period: month label: Local standards of operating costs amount breakdown: - west_county diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml new file mode 100644 index 00000000000..a23dad776bd --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.yaml @@ -0,0 +1,17 @@ +- name: Case 1. + period: 2024 + input: + irs_employment_income: 100 + alimony_income: 100 + child_support_received: 100 + partnership_s_corp_income: 100 + farm_income: 100 + farm_rent_income: 100 + rental_income: 100 + dividend_income: 100 + interest_income: 100 + unemployment_compensation: 100 + pension_income: 100 + retirement_distributions: 100 + output: + chapter_7_bankruptcy_adjust_monthly_income: 1_200 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_additonal_expenses_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_additonal_expenses_deductions.yaml new file mode 100644 index 00000000000..0433ecf48ac --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_additonal_expenses_deductions.yaml @@ -0,0 +1,12 @@ +- name: Case 1, have housing cost and vehile mortgage expense. + period: 2024-01 + input: + health_insurance_premiums: 120 + health_savings_account_payroll_contributions: 120 + care_expenses: 0 + k12_tuition_and_fees: 2_400 + is_child_dependent: true + charitable_cash_donations: 0 + charitable_non_cash_donations: 0 + output: + chapter_7_bankruptcy_additonal_expenses_deductions: 209.58 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.yaml new file mode 100644 index 00000000000..4841619ffdf --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.yaml @@ -0,0 +1,15 @@ +- name: Case 1, have housing cost and vehile mortgage expense. + period: 2024-01 + input: + housing_cost: 120 + vehicle_mortgage_expense: 0 + output: + chapter_7_bankruptcy_debt_payment_deductions: 10 + +- name: Case 2, both expenses are 0. + period: 2024-01 + input: + housing_cost: 0 + vehicle_mortgage_expense: 0 + output: + chapter_7_bankruptcy_debt_payment_deductions: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.yaml new file mode 100644 index 00000000000..4c83867eefe --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.yaml @@ -0,0 +1,13 @@ +- name: Case 1, have housing cost and vehile mortgage expense. + period: 2024-01 + input: + spm_unit_size: 3 + state_code: CA + housing_cost: 22_800 + has_a_vehicle_loan: true + vehicle_mortgage_expense: 7_200 + public_transportation_expense: 230 + + output: + chapter_7_bankruptcy_local_standards_deductions: 978 + # 716 + 28 + 19 + 215 diff --git a/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.yaml new file mode 100644 index 00000000000..89e5cac1b2a --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.yaml @@ -0,0 +1,24 @@ +- name: Case 1, medical expense higher than medical deductions. + period: 2024-01 + input: + income_tax: 120 + child_support_expense: 0 + childcare_expenses: 0 + chapter_7_bankruptcy_out_of_pocket_health_care_deduction: 100 + medical_out_of_pocket_expenses: 220 + + output: + chapter_7_bankruptcy_other_necessary_expenses_deductions: 20 + +- name: Case 2, medical expense smaller than medical deductions. + period: 2024-01 + input: + income_tax: 120 + child_support_expense: 0 + childcare_expenses: 0 + chapter_7_bankruptcy_out_of_pocket_health_care_deduction: 100 + medical_out_of_pocket_expenses: 20 + + output: + chapter_7_bankruptcy_other_necessary_expenses_deductions: 10 + diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py index 2fee9e944bb..ac2c36612dc 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_adjust_monthly_income.py @@ -25,13 +25,13 @@ def formula(spm_unit, period, parameters): spm_unit, period, ["farm_rent_income", "rental_income"] ) interest_and_dividends_income = add( - spm_unit, period, ["divident_income", "interest_income"] + spm_unit, period, ["dividend_income", "interest_income"] ) unemployment_compensation = add( spm_unit, period, ["unemployment_compensation"] ) pension_and_retirement_income = add( - spm_unit, period, ["pension_income", "retirement_distribution"] + spm_unit, period, ["pension_income", "retirement_distributions"] ) total = ( employment_income @@ -43,4 +43,4 @@ def formula(spm_unit, period, parameters): + unemployment_compensation + pension_and_retirement_income ) - return total / MONTHS_IN_YEAR + return total diff --git a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py index 295de300eee..dc861a22cc3 100644 --- a/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py +++ b/policyengine_us/variables/gov/bankruptcy/chapter_7_bankruptcy_nonpriority_unsecured_debt.py @@ -5,6 +5,6 @@ class chapter_7_bankruptcy_nonpriority_unsecured_debt(Variable): value_type = float entity = SPMUnit label = "Nonpriority unsecured debt" - definition_period = YEAR + definition_period = MONTH reference = "https://www.cacb.uscourts.gov/sites/cacb/files/documents/forms/122A2.pdf#page=9" documentation = "Line 41a in form 122A-2" diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py index ce151eabd4d..f352cbbdc0d 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_additional_expense_deductions.py @@ -16,7 +16,7 @@ def formula(spm_unit, period, parameters): spm_unit, period, ["health_savings_account_payroll_contributions"] ) - care_expense = add(spm_unit, period, ["care_expeses"]) + care_expense = add(spm_unit, period, ["care_expenses"]) home_energy_costs = spm_unit.household( "current_home_energy_use", period ) @@ -33,7 +33,7 @@ def formula(spm_unit, period, parameters): period, ["charitable_cash_donations", "charitable_non_cash_donations"], ) - total = ( + return ( health_insurance_expense + health_savings_account_expense + care_expense @@ -41,4 +41,3 @@ def formula(spm_unit, period, parameters): + adjust_education_expense + charitable_contributions ) - return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py index 499be68c203..ac5abc5a9e1 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_debt_payment_deductions.py @@ -13,5 +13,4 @@ def formula(spm_unit, period, parameters): vehicle_mortgage_expense = add( spm_unit, period, ["vehicle_mortgage_expense"] ) - total = housing_expense + vehicle_mortgage_expense - return total / MONTHS_IN_YEAR + return housing_expense + vehicle_mortgage_expense diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py index af85150ff87..65caded19d8 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_local_standards_deductions.py @@ -20,24 +20,22 @@ def formula(spm_unit, period, parameters): mortgage_or_rent_allowance = p.housing_and_utilities.mortgage_or_rent[ state ][size] - monthly_housing_expense = ( - add(spm_unit, period, ["housing_cost"]) / MONTHS_IN_YEAR - ) + housing_expense = add(spm_unit, period, ["housing_cost"]) net_mortgage_or_rent_expense = max_( - mortgage_or_rent_allowance - monthly_housing_expense, 0 + mortgage_or_rent_allowance - housing_expense, 0 ) - qualify_vehicles_owned = add(spm_unit, period, ["is_vehicle_loaned"]) + qualify_vehicles_owned = add(spm_unit, period, ["has_a_vehicle_loan"]) qualify_vehicles_owned_cap = min_( qualify_vehicles_owned, p.vehicle_operation.vehicles_owned_cap ) ownership_costs_allowance = p.vehicle_operation.ownership_costs[ qualify_vehicles_owned_cap ] - vehicle_mortgage_expense = ( - add(spm_unit, period, ["vehicle_mortgage_expense"]) - / MONTHS_IN_YEAR + vehicle_mortgage_expense = add( + spm_unit, period, ["vehicle_mortgage_expense"] ) + net_vehicle_ownership_expense = max_( ownership_costs_allowance - vehicle_mortgage_expense, 0 ) @@ -45,9 +43,8 @@ def formula(spm_unit, period, parameters): public_transportation_allowance = ( p.vehicle_operation.public_transportation ) - public_transportation_expense = ( - add(spm_unit, period, ["public_transportation_expense"]) - / MONTHS_IN_YEAR + public_transportation_expense = add( + spm_unit, period, ["public_transportation_expense"] ) have_one_ore_more_vehicles = qualify_vehicles_owned >= 1 diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py index 9b1d2527f5a..4b0fef415cc 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_other_necessary_expenses_deductions.py @@ -17,7 +17,7 @@ def formula(spm_unit, period, parameters): childcare_expenses = spm_unit("childcare_expenses", period) out_of_pocket_healthcare_allowance = spm_unit( - "chapter_7_bankruptcy_out_of_pocket_health_care_deductions", period + "chapter_7_bankruptcy_out_of_pocket_health_care_deduction", period ) out_of_pocket_healthcare_expense = add( spm_unit, period, ["medical_out_of_pocket_expenses"] @@ -28,10 +28,9 @@ def formula(spm_unit, period, parameters): 0, ) - total = ( + return ( income_tax + child_support_expense + childcare_expenses + additional_health_care_expenses ) - return total / MONTHS_IN_YEAR diff --git a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py index cd73acefd94..8f157c25c19 100644 --- a/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py +++ b/policyengine_us/variables/gov/bankruptcy/deductions/chapter_7_bankruptcy_vehicle_operation_expense_deduction.py @@ -16,10 +16,10 @@ def formula(spm_unit, period, parameters): qualify_vehicles_owned = add(spm_unit, period, ["has_a_vehicle_loan"]) qualify_vehicles_owned_cap = min_(qualify_vehicles_owned, 2) - northeast = spm_unit("northeast_county", period) - midwest = spm_unit("midwest_county", period) - south = spm_unit("south_county", period) - west = spm_unit("west_county", period) + northeast = spm_unit.household("northeast_county", period) + midwest = spm_unit.household("midwest_county", period) + south = spm_unit.household("south_county", period) + west = spm_unit.household("west_county", period) vehicle_operating_expense_northeast = p.northeast[northeast][ qualify_vehicles_owned_cap ]