-
Notifications
You must be signed in to change notification settings - Fork 182
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
Exclude students from the SNAP unit with certain exceptions. #4975
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
151c206
Various state adjustments
PavelMakarchuk f4af94c
Exclude students from the SNAP unit with certain exceptions.
PavelMakarchuk d7ff142
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk a9c4d16
format and tests
PavelMakarchuk 71cc04f
eligibility file
PavelMakarchuk c8a9ee1
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk 1f9c054
use clip
PavelMakarchuk 5dfaad0
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk 55e2506
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk 93c9b68
add 0 threshold
PavelMakarchuk de931bb
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk 5028012
minor chnages
PavelMakarchuk 192a179
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk 757cb2e
rename var and cap at 0
PavelMakarchuk 5346be1
test adj
PavelMakarchuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- bump: minor | ||
changes: | ||
added: | ||
- Exclude students from the SNAP unit with certain exceptions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
policyengine_us/parameters/gov/usda/snap/student/age_threshold.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
description: The United States includes students in the Supplemental Nutrition Assistance Program unit if their age falls into the following range. | ||
brackets: | ||
- threshold: | ||
2018-01-01: 0 | ||
amount: | ||
2018-01-01: true | ||
- threshold: | ||
2018-01-01: 18 | ||
amount: | ||
2018-01-01: false | ||
- threshold: | ||
2018-01-01: 50 | ||
amount: | ||
2018-01-01: true | ||
|
||
metadata: | ||
type: single_amount | ||
threshold_unit: year | ||
amount_unit: bool | ||
label: SNAP student age eligibility threshold | ||
reference: | ||
- title: 7 U.S. Code § 2015 - Eligibility disqualifications (e)(1) | ||
href: https://www.law.cornell.edu/uscode/text/7/2015 |
12 changes: 12 additions & 0 deletions
12
policyengine_us/parameters/gov/usda/snap/student/working_hours_threshold.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description: The United States includes students who work more than this number of weekly hours in the Supplemental Nutrition Assistance Program unit. | ||
|
||
values: | ||
2005-01-01: 20 | ||
|
||
metadata: | ||
unit: hours | ||
label: SNAP student working hours threshold | ||
period: week | ||
reference: | ||
- title: 7 U.S. Code § 2015 - Eligibility disqualifications (e)(4) | ||
href: https://www.law.cornell.edu/uscode/text/7/2015 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...s/tests/policy/baseline/gov/usda/snap/eligibility/student/is_snap_ineligible_student.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- name: Student who does not meet any exemption criteria | ||
period: 2022 | ||
input: | ||
is_full_time_student: true | ||
age: 18 | ||
is_disabled: false | ||
weekly_hours_worked: false | ||
is_parent: false | ||
output: | ||
is_snap_ineligible_student: true | ||
|
||
- name: Student who is under the age limit | ||
period: 2022 | ||
input: | ||
is_full_time_student: true | ||
age: 17 | ||
is_disabled: false | ||
weekly_hours_worked: false | ||
is_parent: false | ||
output: | ||
is_snap_ineligible_student: false |
50 changes: 50 additions & 0 deletions
50
policyengine_us/tests/policy/baseline/gov/usda/snap/snap_unit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
- name: Household with one ineligible studnet | ||
period: 2022 | ||
input: | ||
people: | ||
person1: | ||
is_snap_ineligible_student: false | ||
person2: | ||
is_snap_ineligible_student: false | ||
person3: | ||
is_snap_ineligible_student: true | ||
spm_units: | ||
spm_unit1: | ||
members: [person1, person2, person3] | ||
spm_unit_size: 3 | ||
output: | ||
snap_unit_size: 2 | ||
|
||
- name: Everybody eligible | ||
period: 2022 | ||
input: | ||
people: | ||
person1: | ||
is_snap_ineligible_student: false | ||
person2: | ||
is_snap_ineligible_student: false | ||
person3: | ||
is_snap_ineligible_student: false | ||
spm_units: | ||
spm_unit1: | ||
members: [person1, person2, person3] | ||
spm_unit_size: 3 | ||
output: | ||
snap_unit_size: 3 | ||
|
||
- name: No eligible people | ||
period: 2022 | ||
input: | ||
people: | ||
person1: | ||
is_snap_ineligible_student: true | ||
person2: | ||
is_snap_ineligible_student: true | ||
person3: | ||
is_snap_ineligible_student: true | ||
spm_units: | ||
spm_unit1: | ||
members: [person1, person2, person3] | ||
spm_unit_size: 3 | ||
output: | ||
snap_unit_size: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
policyengine_us/variables/gov/usda/snap/eligibility/student/is_snap_ineligible_student.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from policyengine_us.model_api import * | ||
|
||
|
||
class is_snap_ineligible_student(Variable): | ||
value_type = bool | ||
entity = Person | ||
label = "Is an ineligible student for SNAP" | ||
documentation = "Whether this person is an ineligible student for SNAP and can not be counted towards the household size" | ||
definition_period = YEAR | ||
reference = "https://www.law.cornell.edu/uscode/text/7/2015" | ||
|
||
def formula(person, period, parameters): | ||
student = person( | ||
"is_full_time_student", period | ||
) # part-time students should also count | ||
age = person("age", period) | ||
p = parameters(period).gov.usda.snap.student | ||
age_eligible = p.age_threshold.calc(age) | ||
disabled = person("is_disabled", period) | ||
hours_worked = person("weekly_hours_worked", period) | ||
hours_eligible = hours_worked >= p.working_hours_threshold | ||
# The parental status applies to children under 6 (under 12 | ||
# if no care available) | ||
# Single parents with children under 12 are also eligible | ||
is_parent = person("is_parent", period) | ||
return student & ~( | ||
age_eligible | disabled | hours_eligible | is_parent | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from policyengine_us.model_api import * | ||
|
||
|
||
class snap_unit_size(Variable): | ||
value_type = int | ||
entity = SPMUnit | ||
label = "SNAP unit" | ||
definition_period = YEAR | ||
|
||
def formula(spm_unit, period, parameters): | ||
unit_size = spm_unit("spm_unit_size", period) | ||
person = spm_unit.members | ||
ineligible_student = person("is_snap_ineligible_student", period) | ||
ineligible_students = spm_unit.sum(ineligible_student) | ||
return max_(unit_size - ineligible_students, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
policyengine_us/variables/household/demographic/person/is_parent.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from policyengine_us.model_api import * | ||
|
||
|
||
class is_parent(Variable): | ||
value_type = bool | ||
entity = Person | ||
label = "Is a parent" | ||
definition_period = YEAR | ||
|
||
def formula(person, period, parameters): | ||
return person("own_children_in_household", period) > 0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would work right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I capped the formula at 0 to avoid negative values for units with just one student