Repository: PolicyEngine/policyengine-us (language: python)

Issue:
Apply the TCJA mortgage interest deduction limits
We currently only account for pre-TCJA limits 
[Law](https://www.law.cornell.edu/uscode/text/26/163)



Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb2d..e30e8f0e935 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: minor
+  changes:
+    added:
+    - Apply the TCJA mortgage value limits under the mortgage interest deduction.
diff --git a/policyengine_us/parameters/gov/irs/deductions/itemized/interest/mortgage/cap.yaml b/policyengine_us/parameters/gov/irs/deductions/itemized/interest/mortgage/cap.yaml
index 2f371e152fd..fbaf727f974 100644
--- a/policyengine_us/parameters/gov/irs/deductions/itemized/interest/mortgage/cap.yaml
+++ b/policyengine_us/parameters/gov/irs/deductions/itemized/interest/mortgage/cap.yaml
@@ -1,21 +1,33 @@
-description: IRS limits the total home mortgage interest deduction to this amount, based on filing status.
+description: The IRS allows an itemized deduction for interest paid on mortgages up to this amount, based on filing status.
 SINGLE:
-  2018-01-01: 1_000_000
+  2017-01-01: 1_000_000
+  2018-01-01: 750_000
+  2026-01-01: 1_000_000
 JOINT:
-  2018-01-01: 1_000_000
+  2017-01-01: 1_000_000
+  2018-01-01: 750_000
+  2026-01-01: 1_000_000
 SEPARATE:
-  2018-01-01: 500_000
+  2017-01-01: 500_000
+  2018-01-01: 375_000
+  2026-01-01: 500_000
 HEAD_OF_HOUSEHOLD:
-  2018-01-01: 1_000_000
+  2017-01-01: 1_000_000
+  2018-01-01: 750_000
+  2026-01-01: 1_000_000
 SURVIVING_SPOUSE:
-  2018-01-01: 1_000_000
+  2017-01-01: 1_000_000
+  2018-01-01: 750_000
+  2026-01-01: 1_000_000
 metadata:
   breakdown: filing_status
   unit: currency-USD
-  label: IRS home mortgage interest deduction amount cap
+  period: year
+  label: IRS home mortgage value cap
   reference:
     # Hawaii applies this AGI threshold in the state itemized deductions computation
     - title: Hawaii Income Tax Law, Chapter 235, Section 235-2.4, (j)(3)
       href: https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=10
-    - title: 26 U.S. Code § 163 - Interest, (h)(3)(F)
+    # TCJA adjustemnts described in (h)(3)(F)(i)(II)
+    - title: 26 U.S. Code § 163 - Interest, (h)(3)(b)(ii)
       href: https://www.law.cornell.edu/uscode/text/26/163
diff --git a/policyengine_us/variables/household/expense/person/deductible_mortgage_interest.py b/policyengine_us/variables/household/expense/person/deductible_mortgage_interest.py
new file mode 100644
index 00000000000..0c0aa4d5720
--- /dev/null
+++ b/policyengine_us/variables/household/expense/person/deductible_mortgage_interest.py
@@ -0,0 +1,12 @@
+from policyengine_us.model_api import *
+
+
+class deductible_mortgage_interest(Variable):
+    value_type = float
+    entity = Person
+    label = "Deductible mortgage interest"
+    documentation = "Under the interest deduction, the US caps the mortgage value to which interest is applied which based on the year of purchase not tax year."
+    unit = USD
+    definition_period = YEAR
+
+    # This is a placeholder variable until we can implement the full mortgage interest deduction logic
diff --git a/policyengine_us/variables/household/expense/person/interest_expense.py b/policyengine_us/variables/household/expense/person/interest_expense.py
index f7426a9f881..05707a3b55b 100644
--- a/policyengine_us/variables/household/expense/person/interest_expense.py
+++ b/policyengine_us/variables/household/expense/person/interest_expense.py
@@ -7,4 +7,5 @@ class interest_expense(Variable):
     label = "Interest paid on all loans"
     unit = USD
     definition_period = YEAR
-    adds = ["mortgage_interest", "non_mortgage_interest"]
+
+    adds = ["deductible_mortgage_interest", "non_mortgage_interest"]


Test patch:
diff --git a/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/integration.yaml
index d323780686e..6e365931881 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/integration.yaml
@@ -241,7 +241,7 @@
         taxable_private_pension_income: 4000
         social_security_retirement: 12000
         real_estate_taxes: 2000
-        mortgage_interest: 1000
+        deductible_mortgage_interest: 1000
         self_employment_income: 121010
         business_is_qualified: true
         business_is_sstb: false
diff --git a/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/integration.yaml
index cfcdb32f2c8..97939484794 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/integration.yaml
@@ -106,7 +106,7 @@
         rental_income: 1005
         taxable_private_pension_income: 2500
         real_estate_taxes: 4000
-        mortgage_interest: 36000
+        deductible_mortgage_interest: 36000
         self_employment_income: 127010
         business_is_qualified: true
         business_is_sstb: false
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ky/tax/income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/ky/tax/income/integration.yaml
index 2915c9f8ea5..02bf191062e 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/ky/tax/income/integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/ky/tax/income/integration.yaml
@@ -275,11 +275,11 @@
       person1:
         age: 50
         employment_income: 80_000
-        mortgage_interest:  3_000
+        deductible_mortgage_interest:  3_000
       person2:
         age: 50
         employment_income: 20_000
-        mortgage_interest:  3_000
+        deductible_mortgage_interest:  3_000
     tax_units:
       tax_unit:
         members: [person1, person2]
diff --git a/policyengine_us/tests/policy/baseline/gov/states/ms/tax/income/deductions/itemized/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/ms/tax/income/deductions/itemized/integration.yaml
index 23a03247301..1793250a106 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/ms/tax/income/deductions/itemized/integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/ms/tax/income/deductions/itemized/integration.yaml
@@ -3,7 +3,7 @@
   period: 2021
   input:
     real_estate_taxes: 12_000
-    mortgage_interest: 36_000
+    deductible_mortgage_interest: 36_000
     state_fips: 28  # MS
   output:  # expected results from filling out 2021 MS form 80-108
     ms_itemized_deductions_unit: 46_000
diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yaml
index f85b14efbdb..80257f26b5c 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.yaml
@@ -36,7 +36,7 @@
     filing_status: JOINT
     adjusted_gross_income: 364_695
     state_and_local_sales_or_income_tax: 19_956
-    mortgage_interest: 36_000
+    deductible_mortgage_interest: 36_000
     state_code: VA
   output:
     va_reduced_itemized_deductions: 35_282
diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/integration.yaml
index 891e1adfbd2..9ffd6bc9db0 100644
--- a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/integration.yaml
+++ b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/integration.yaml
@@ -91,7 +91,7 @@
         long_term_capital_gains: 1005.0
         rental_income: 2505.0
         real_estate_taxes: 24000
-        mortgage_interest: 14000
+        deductible_mortgage_interest: 14000
         self_employment_income: 141010
         business_is_qualified: true
         business_is_sstb: false