Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Income Exclusion Order and FBR Comparison for SSI Spousal Deeming #5615

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mexi-cano
Copy link

@mexi-cano mexi-cano commented Feb 18, 2025

Fixes #5608

  • Applied income exclusions to ineligible spouse's income first per §416.1163
  • Implemented correct order of operations: general exclusion ($20) → earned income exclusion ($65) → 50% remainder reduction
  • Added comparison logic against couple vs. individual FBR difference
  • Updated benefit calculation to follow SSI regulatory requirements

This resolves incorrect benefit calculations and ensures compliance with SSI regulations §416.1163 for spousal deeming cases.

…le income separately -

2. Compare it to the difference between couple and individual rates -
3. Only deem income if it exceeds that threshold -  4. Apply the correct deeming formula based on SSI regulations
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.07%. Comparing base (2b093e5) to head (bdeff6d).
Report is 53 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5615      +/-   ##
==========================================
- Coverage   99.10%   99.07%   -0.03%     
==========================================
  Files        2695     2695              
  Lines       39028    38989      -39     
  Branches      173      171       -2     
==========================================
- Hits        38677    38630      -47     
- Misses        316      326      +10     
+ Partials       35       33       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@MaxGhenis MaxGhenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor stylistic suggestions but adding pavel for a logic review

could you also link the issue?

age: 55
is_disabled: false
is_tax_unit_head: true
ssi_earned_income: 31080
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and elsewhere

Suggested change
ssi_earned_income: 31080
ssi_earned_income: 31_080

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this everywhere

)

return spousal_deemed_income * (spousal_deemed_income > person_rate)
return where(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return where(
return (is_eligible & has_ineligible_spouse) * deemed_income


# Check if they're in a marital unit
in_marital_unit = person.marital_unit.any(
person("is_tax_unit_spouse", period)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
person("is_tax_unit_spouse", period)
person("is_tax_unit_head_or_spouse", period)

@mexi-cano
Copy link
Author

Updated with the requested changes. Linking issue here.

# Check if they're in a marital unit
in_marital_unit = person.marital_unit.any(
person("is_tax_unit_head_or_spouse", period)
| person("is_tax_unit_head", period)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| person("is_tax_unit_head", period)

@@ -10,7 +10,24 @@ class is_ssi_ineligible_spouse(Variable):
reference = "https://www.law.cornell.edu/uscode/text/42/1382c#b"

def formula(person, period, parameters):
spouse = person("is_tax_unit_spouse", period)
# Consider both tax unit spouse and tax unit head as potential spouses
is_spouse = person("is_tax_unit_spouse", period) | person(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use person("is_tax_unit_head_or_spouse", period)

@mexi-cano mexi-cano changed the title Fix SSI Spousal Deeming: Correct Income Exclusion Order and FBR Comparison Fixes #5608 SSI Spousal Deeming: Correct Income Exclusion Order and FBR Comparison Feb 20, 2025
@mexi-cano
Copy link
Author

I mean https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue

Thanks! Should be linked now and pushed up an update.

@mexi-cano mexi-cano requested a review from MaxGhenis February 20, 2025 16:06
@@ -10,7 +10,21 @@ class is_ssi_ineligible_spouse(Variable):
reference = "https://www.law.cornell.edu/uscode/text/42/1382c#b"

def formula(person, period, parameters):
spouse = person("is_tax_unit_spouse", period)
# Consider both tax unit spouse and tax unit head as potential spouses
is_spouse = person("is_tax_unit_head_or_spouse", period)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_spouse = person("is_tax_unit_head_or_spouse", period)
is_head_or_spouse = person("is_tax_unit_head_or_spouse", period)


# Check if they're in a marital unit
in_marital_unit = person.marital_unit.any(
person("is_tax_unit_head_or_spouse", period)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
person("is_tax_unit_head_or_spouse", period)
is_head_or_spouse

# Consider both tax unit spouse and tax unit head as potential spouses
is_spouse = person("is_tax_unit_head_or_spouse", period)

# Check if they're in a marital unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose of this; won't it always be true? if they're themselves a head or spouse, their marital unit will have a head or spouse

@mexi-cano mexi-cano requested a review from MaxGhenis February 20, 2025 18:37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you amend the corresponding test file to reflect the changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no existing test file for this (this was an existing file). I created ssi_income_deemed_from_ineligible_spouse.yaml instead to test the output.

@MaxGhenis MaxGhenis changed the title Fixes #5608 SSI Spousal Deeming: Correct Income Exclusion Order and FBR Comparison Correct Income Exclusion Order and FBR Comparison for SSI Spousal Deeming Feb 20, 2025
@MaxGhenis MaxGhenis requested review from DTrim99 and removed request for PavelMakarchuk February 20, 2025 20:25
@MaxGhenis
Copy link
Contributor

Thanks I added @DTrim99 to review the logic. He's out of office tomorrow but will review next week. Could you resolve outstanding comments in the meantime?

@mexi-cano
Copy link
Author

Thanks I added @DTrim99 to review the logic. He's out of office tomorrow but will review next week. Could you resolve outstanding comments in the meantime?

Thanks! I believe I've addressed all of the latest comments in the last update. Is there one I missed specifically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix SSI Spousal Deeming: Correct Income Exclusion Order and FBR Comparison
2 participants