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

Separate out SSI eligibility from the general uncapped_ssi file #4942

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
added:
- Separate out SSI eligibility from the general uncapped_ssi file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Eligible
period: 2022
input:
meets_ssi_resource_test: true
is_ssi_eligible_individual: true
output:
is_ssi_eligible: true

- name: Resource ineligible
period: 2022
input:
meets_ssi_resource_test: false
is_ssi_eligible_individual: true
output:
is_ssi_eligible: false

- name: Ineligible individual
period: 2022
input:
meets_ssi_resource_test: true
is_ssi_eligible_individual: false
output:
is_ssi_eligible: false
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,21 @@
ssi_countable_income: 0
output:
uncapped_ssi: 0

- name: Eligible using defined for
period: 2022
input:
ssi_amount_if_eligible: 100
is_ssi_eligible: true
ssi_countable_income: 0
output:
uncapped_ssi: 100

- name: Ineligible using defined for
period: 2022
input:
ssi_amount_if_eligible: 100
is_ssi_eligible: false
ssi_countable_income: 0
output:
uncapped_ssi: 0
13 changes: 13 additions & 0 deletions policyengine_us/variables/gov/ssa/ssi/is_ssi_eligible.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from policyengine_us.model_api import *


class is_ssi_eligible(Variable):
value_type = float
entity = Person
label = "Is SSI eligible person"
definition_period = YEAR

def formula(person, period, parameters):
meets_resource_test = person("meets_ssi_resource_test", period)
eligible = person("is_ssi_eligible_individual", period)
return meets_resource_test & eligible
5 changes: 2 additions & 3 deletions policyengine_us/variables/gov/ssa/ssi/uncapped_ssi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ class uncapped_ssi(Variable):
unit = USD
documentation = "Maximum SSI, less countable income (can be below zero)."
definition_period = YEAR
defined_for = "is_ssi_eligible"

def formula(person, period, parameters):
amount = person("ssi_amount_if_eligible", period)
meets_resource_test = person("meets_ssi_resource_test", period)
eligible = person("is_ssi_eligible_individual", period)
countable_income = person("ssi_countable_income", period)
return (meets_resource_test & eligible) * (amount - countable_income)
return amount - countable_income
Loading