The model deducts more than an Alabama filer's medical and miscellaneous expenses when Alabama AGI falls below zero

Abierto Apto para principiantes
#10,916 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
64/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Empieza con al_medical_expense_deduction.py (líneas 22-23) y al_misc_deduction.py (líneas 36-37), donde las tasas del 4 % y del 2 % multiplican al_agi sin un mínimo. Envuelve al_agi en max_(..., 0) en ambas fórmulas, como hace la corrección de pérdidas por siniestro en #9912. Estará terminado cuando la tabla de reproducción muestre deducciones médicas y varias de 0 para los contribuyentes A-C, y las pruebas con AGI negativo de Alabama pasen para cada deducción.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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 by al_agi and 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 negative al_agi turns each subtraction into an addition.
  • In al_taxable_income, it floors al_agi less al_deductions at 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.

Lenguaje dominante
Python
Estrellas
171
Forks
220
Merge medio
4 d 13 h
PR fusionados (30 d)
291

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/policyengine-us

Todos los issues de PolicyEngine/policyengine-us

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.