The model deducts more than an Alabama filer's medical and miscellaneous expenses when Alabama AGI falls below zero
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 64/100
Hướng nghiên cứu
Bắt đầu với al_medical_expense_deduction.py (dòng 22-23) và al_misc_deduction.py (dòng 36-37), nơi các mức 4% và 2% nhân với al_agi mà không có giới hạn dưới. Bọc al_agi trong max_(..., 0) ở cả hai công thức, giống như bản sửa lỗi casualty loss trong #9912. Hoàn thành khi bảng tái hiện cho thấy các khoản khấu trừ y tế và khác đều bằng 0 đối với người nộp thuế A-C, và các bài kiểm tra với AGI âm của Alabama đều đạt cho từng khoản khấu trừ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When a tax unit's Alabama adjusted gross income (AGI) falls below zero, the model adds 4% of the loss to the Alabama medical expense deduction and 2% of the loss to the miscellaneous deduction. For example, a single filer who reports a $10,000 business loss as their only 2025 income, and who has no expenses, gets a $400 medical deduction and a $200 miscellaneous deduction. With $1,000 of medical expenses and $500 of unreimbursed employee expenses, the same filer gets $1,400 and $700.
Alabama income tax does not change, since the model floors Alabama taxable income at zero and these filers already start below zero. The extra amounts show up in al_medical_expense_deduction, al_misc_deduction, al_itemized_deductions and state_itemized_deductions. They reach al_deductions whenever the itemized total, with them, exceeds the standard deduction. For example, the model gives the second filer $3,100 of itemized deductions, $1,000 of it from a casualty loss deduction it builds the same way. Without the extra $600, the total falls to $2,500, under the $3,000 standard deduction.
What Alabama allows
The Legislature limits the medical and dental expense deduction to "the excess of those expenses over 4.0 percent of adjusted gross income" (Ala. Code § 40-18-15(a)(13), reprinted on PDF pages 5 and 6 of HB527 of 2026, as enrolled). In Rule 810-3-15-.16, the Department of Revenue allows the deduction "for expenses paid during the taxable year". In its 2025 Form 40 instructions, the Department tells filers to deduct only the part of their medical and dental expenses above 4% of Form 40 line 10.
The Legislature groups unreimbursed employee business expenses with the section 212 deduction for the costs of producing income and of figuring a tax. It allows them "only to the extent that the aggregate of the deductions exceeds 2 percent of adjusted gross income" (§ 40-18-15(a)(23), PDF pages 7 and 8).
We read both provisions to cap each deduction at the expenses, so a filer with negative AGI deducts those expenses in full and no more. For the medical deduction, the Legislature allows the expenses "as determined in accordance with 26 U.S.C. § 213", with 4% in place of 7.5%. In section 213(a), Congress allows the expenses paid "to the extent that such expenses exceed" a share of AGI. For the miscellaneous deduction, the Legislature allows the expenses themselves "only to the extent" that their total exceeds 2% of AGI.
On Schedule A, the Department has filers multiply Form 40 line 10 by 4% and by 2% and subtract each product from the expenses. A filer who follows those steps with a negative line 10 gets the model's figures. The Department does not say, on the form or in its instructions, how to fill in lines 3 and 23 when line 10 falls below zero.
Where the model does this
- In
al_medical_expense_deduction, the model multiplies the 4% rate byal_agiand subtracts the product from the expenses. - In
al_misc_deduction, it does the same with the 2% rate. - In
al_agi, it returns gross income less deductions with no lower bound, so a negativeal_agiturns each subtraction into an addition. - In
al_taxable_income, it floorsal_agilessal_deductionsat zero, which keeps the tax at 0.
For the federal medical_expense_deduction and misc_deduction, the model multiplies the rates by AGI floored at zero, positive_agi. In al_casualty_loss_deduction, the model subtracts 10% of al_agi the same way and gives the first filer $1,000; in the open pull request #9912, we floor al_agi at zero there.
Reproduction
At main (f9266153215817169964d8a31ec6d2464d8c2b45):
from policyengine_us import Simulation
YEAR = 2025
def single_alabama_filer(person=None, tax_unit=None):
return {
"people": {"filer": {"age": {YEAR: 40}, **(person or {})}},
"tax_units": {"tax_unit": {"members": ["filer"], **(tax_unit or {})}},
"households": {
"household": {"members": ["filer"], "state_code": {YEAR: "AL"}}
},
}
CASES = {
"A": single_alabama_filer({"self_employment_income": {YEAR: -10_000}}),
"B": single_alabama_filer(
{
"self_employment_income": {YEAR: -10_000},
"other_medical_expenses": {YEAR: 1_000},
"unreimbursed_business_employee_expenses": {YEAR: 500},
}
),
"C": single_alabama_filer({"self_employment_income": {YEAR: -100_000}}),
"D": single_alabama_filer(
{
"employment_income": {YEAR: 50_000},
"other_medical_expenses": {YEAR: 3_000},
"unreimbursed_business_employee_expenses": {YEAR: 1_500},
}
),
}
VARIABLES = [
"al_agi",
"al_medical_expense_deduction",
"al_misc_deduction",
"al_casualty_loss_deduction",
"al_itemized_deductions",
"al_standard_deduction",
"al_deductions",
"al_taxable_income",
"al_income_tax",
]
sims = {name: Simulation(situation=situation) for name, situation in CASES.items()}
print(f"{'':30s}" + "".join(f"{name:>10s}" for name in CASES))
for variable in VARIABLES:
values = [float(sim.calculate(variable, YEAR)[0]) for sim in sims.values()]
print(f"{variable:30s}" + "".join(f"{value:>10,.0f}" for value in values))
A B C D
al_agi -10,000 -10,000 -100,000 50,000
al_medical_expense_deduction 400 1,400 4,000 1,000
al_misc_deduction 200 700 2,000 500
al_casualty_loss_deduction 1,000 1,000 10,000 0
al_itemized_deductions 1,600 3,100 16,000 5,325
al_standard_deduction 3,000 3,000 3,000 2,500
al_deductions 4,500 4,600 17,500 10,696
al_taxable_income 0 0 0 39,304
al_income_tax 0 0 0 1,925
Filer A has a $10,000 business loss and no expenses. Filer B has the same loss, $1,000 of medical expenses and $500 of unreimbursed employee expenses. Filer C has a $100,000 loss and no expenses. Filer D earns $50,000 in wages, has $3,000 of medical expenses and $1,500 of employee expenses, and deducts $1,000 and $500 after the 4% and 2% floors.
Fix
Floor al_agi at zero in both formulas with max_(tax_unit("al_agi", period), 0), as we do for the casualty loss deduction in #9912, and add a test at negative Alabama AGI for each deduction.
- Ngôn ngữ chính
- Python
- Star
- 171
- Fork
- 220
- Merge trung bình
- 4 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 291
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine-us
-
PolicyEngine backdates South Carolina’s EITC into 2015–2017Có thể đã có người làm @MaxGhenis đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine-us#10944 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
PolicyEngine/policyengine-us#10915 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
PolicyEngine/policyengine-us#10911 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
PolicyEngine/policyengine-us#10894 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
The model denies Medicaid to expansion-group adults in Virginia, Maine, Idaho and Utah in 2019 or 2020, when those states covered themCó thể đã có người làm @MaxGhenis đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
PolicyEngine/policyengine-us#10791 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của PolicyEngine/policyengine-us
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gorakhargosh/watchdog#1462 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
openwisp/openwisp-monitoring#889 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OpenFreeEnergy/Lomap#180 ·
-
generate_observation_scenario_from_cpgs exposure time conversion when auto-gain set to 'yes'Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
roman-corgi/corgisim#327 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
agent:WSL bug code-review linux pri:medium sev:low tooling
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày