Skip to content

Commit

Permalink
Separate out SSI eligibility from the general uncapped_ssi file (#4942
Browse files Browse the repository at this point in the history
)
  • Loading branch information
PavelMakarchuk authored Aug 22, 2024
1 parent 47e6b6d commit c02054c
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
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

0 comments on commit c02054c

Please sign in to comment.