The model deducts more than an Alabama filer's medical and miscellaneous expenses when Alabama AGI falls below zero
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
al_medical_expense_deduction.py(22~23行目)とal_misc_deduction.py(36~37行目)から始めてください。ここでは4%と2%の税率が下限なしでal_agiに掛けられています。#9912の災害損失の修正と同様に、両方の式でal_agiをmax_(..., 0)で囲んでください。再現表で申告者A~Cの医療費控除とその他控除がいずれも0になり、各控除について負のアラバマ州AGIでのテストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 171
- フォーク
- 220
- 平均マージ
- 4日 13時間
- マージ済み PR(30日)
- 291
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-us のほかの issue
-
PolicyEngine backdates South Carolina’s EITC into 2015–2017対応中かも @MaxGhenis が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PolicyEngine/policyengine-us#10944 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
PolicyEngine/policyengine-us#10915 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
PolicyEngine/policyengine-us#10911 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
PolicyEngine/policyengine-us#10894 ·
メンテナーはふだん 2 日以内に返信
-
The model denies Medicaid to expansion-group adults in Virginia, Maine, Idaho and Utah in 2019 or 2020, when those states covered them対応中かも @MaxGhenis が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
PolicyEngine/policyengine-us#10791 ·
メンテナーはふだん 2 日以内に返信
PolicyEngine/policyengine-us の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
roman-corgi/corgisim#327 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: opencode_go chat route drops reasoning_effort (even 'none'), while the same endpoint honors it via custom_llm_provider=openai対応中かも @arvindkumar-ship-it が今日担当しました。 オープンllm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
BerriAI/litellm#51871 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
fix(frontend): resolve SSE parser crash on unhandled Ref methods and undefined actions identifierオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kodokbakar/MiroFish-Local#94 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
akhsterminator/sf-exit#13 ·