Skip to content

Commit 988a73f

Browse files
authored
Merge pull request #412 from yvvijay121/initial&continuouseligibility
Creating More Detailed TANF Eligibility Variables
2 parents 2fb5fc8 + b2259f1 commit 988a73f

File tree

6 files changed

+131
-74
lines changed

6 files changed

+131
-74
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44

55
* First prototype version with a standard deduction variable
66

7-
## 0.3.0
7+
### 0.3.0
88

99
* Add Lifeline benefit
1010

11-
## 0.3.1
11+
#### 0.3.1
1212

1313
* Add automated tests
14+
15+
### 0.4.0
16+
17+
* Broke down TANF eligibility into demographic and financial variables, with financial separated by current enrollment in program
18+
* Specified demographic TANF eligibility per IL rules

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ documentation:
1212
jb build docs/book
1313
build:
1414
python setup.py sdist bdist_wheel
15+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
- name: "Default person is 18 and out of school, therefore ineligible for TANF"
2+
period: 2022
3+
output:
4+
is_person_demographic_tanf_eligible: false
5+
6+
- name: "Is eligible for TANF due to children under 18"
7+
period: 2022
8+
input:
9+
age: 17
10+
output:
11+
is_person_demographic_tanf_eligible: true
12+
13+
- name: "18-year-old out of school is not eligible for TANF"
14+
period: 2022
15+
input:
16+
age: 18
17+
output:
18+
is_person_demographic_tanf_eligible: false
19+
20+
- name: "Is eligible for TANF due to pregnancy"
21+
period: 2022
22+
input:
23+
is_pregnant: true
24+
output:
25+
is_person_demographic_tanf_eligible: true
26+
27+
- name: "Is eligible for TANF due to being an 18-year-old in school"
28+
period: 2022
29+
input:
30+
age: 18
31+
is_in_school: true
32+
output:
33+
is_person_demographic_tanf_eligible: true
Lines changed: 37 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,76 @@
1-
- name: "Is eligible for TANF due to children under 18"
1+
- name: "Default SPM unit is ineligible because economic eligibility defaults to false"
22
period: 2022
3-
absolute_error_margin: 0.01
4-
input:
5-
age: 17
6-
output:
7-
is_tanf_eligible: true
8-
9-
- name: "Is not eligible for TANF"
10-
period: 2022
11-
absolute_error_margin: 0.01
12-
input:
13-
age: 18
143
output:
154
is_tanf_eligible: false
165

17-
- name: "Is eligible for TANF due to pregnancy"
18-
period: 2022
19-
absolute_error_margin: 0.01
20-
input:
21-
is_pregnant: true
22-
output:
23-
is_tanf_eligible: true
24-
25-
- name: "Is eligible for TANF due to being an 18-year-old in school"
26-
period: 2022
27-
absolute_error_margin: 0.01
28-
input:
29-
age: 18
30-
is_in_school: true
31-
output:
32-
is_tanf_eligible: true
33-
34-
- name: "Is eligible for TANF due to family with ineligible adult and eligible pregnant person"
6+
- name: "TANF: Unit test: two people, continued application, is eligible economically and demographically"
357
period: 2022
36-
absolute_error_margin: 0.01
378
input:
389
people:
3910
person1:
40-
age: 30
11+
is_person_demographic_tanf_eligible: false
4112
person2:
42-
age: 29
43-
is_pregnant: true
13+
is_person_demographic_tanf_eligible: true
4414
spm_units:
4515
spm_unit:
4616
members: [person1, person2]
47-
households:
48-
household:
49-
state_code: IL
17+
is_tanf_enrolled: true
18+
continuous_tanf_eligibility: true
19+
initial_tanf_eligibility: false
5020
output:
5121
is_tanf_eligible: true
5222

53-
- name: "Is ineligible for TANF due to family with two ineligible adults"
23+
- name: "TANF: Unit test: two people, continued application, is not eligible demographically"
5424
period: 2022
55-
absolute_error_margin: 0.01
5625
input:
5726
people:
5827
person1:
59-
age: 30
28+
is_person_demographic_tanf_eligible: false
6029
person2:
61-
age: 56
30+
is_person_demographic_tanf_eligible: false
6231
spm_units:
6332
spm_unit:
6433
members: [person1, person2]
34+
is_tanf_enrolled: true
35+
continuous_tanf_eligibility: false
36+
initial_tanf_eligibility: false
6537
output:
6638
is_tanf_eligible: false
6739

68-
- name: "Is eligible for TANF due to family with ineligible adult and eligible child"
40+
- name: "TANF: Unit test: three people, initial application, is not eligible economically"
6941
period: 2022
70-
absolute_error_margin: 0.01
7142
input:
7243
people:
73-
father:
74-
age: 38
75-
child:
76-
age: 11
44+
person1:
45+
is_person_demographic_tanf_eligible: false
46+
person2:
47+
is_person_demographic_tanf_eligible: true
48+
person3:
49+
is_person_demographic_tanf_eligible: false
7750
spm_units:
7851
spm_unit:
79-
members: [father, child]
52+
members: [person1, person2, person3]
53+
is_tanf_enrolled: false
54+
continuous_tanf_eligibility: false
55+
initial_tanf_eligibility: false
8056
output:
81-
is_tanf_eligible: true
57+
is_tanf_eligible: false
8258

83-
- name: "Is eligible for TANF due to family with eligible child and eligible pregnant person"
59+
- name: "TANF: Unit test: three people, initial application, is not eligible economically or demographically"
8460
period: 2022
85-
absolute_error_margin: 0.01
8661
input:
8762
people:
88-
mother:
89-
age: 30
90-
is_pregnant: true
91-
child:
92-
age: 7
63+
person1:
64+
is_person_demographic_tanf_eligible: false
65+
person2:
66+
is_person_demographic_tanf_eligible: false
67+
person3:
68+
is_person_demographic_tanf_eligible: false
9369
spm_units:
9470
spm_unit:
95-
members: [mother, child]
71+
members: [person1, person2, person3]
72+
is_tanf_enrolled: false
73+
continuous_tanf_eligibility: false
74+
initial_tanf_eligibility: false
9675
output:
97-
is_tanf_eligible: true
76+
is_tanf_eligible: false

openfisca_us/variables/hhs/tanf.py

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class tanf(Variable):
1212
documentation = (
1313
"Amount of Temporary Assistance for Needy Families benefit received."
1414
)
15-
unit = "currency-USD"
15+
unit = USD
1616

1717
def formula(spm_unit, period, parameters):
1818
# Obtain eligibility.
@@ -22,6 +22,45 @@ def formula(spm_unit, period, parameters):
2222
return where(eligible, amount_if_eligible, 0)
2323

2424

25+
class continuous_tanf_eligibility(Variable):
26+
value_type = bool
27+
entity = SPMUnit
28+
definition_period = YEAR
29+
label = "Continued Economic Eligibility for TANF"
30+
documentation = "Whether the familiy meets the economic requirements for the Temporary Assistance for Needy Families program after being approved."
31+
32+
33+
class initial_tanf_eligibility(Variable):
34+
value_type = bool
35+
entity = SPMUnit
36+
definition_period = YEAR
37+
label = "Initial Economic Eligibility for TANF"
38+
documentation = "Whether the familiy meets the economic requirements for the Temporary Assistance for Needy Families program on application."
39+
40+
41+
class is_person_demographic_tanf_eligible(Variable):
42+
value_type = bool
43+
entity = Person
44+
definition_period = YEAR
45+
label = "Person-level eligiblity for TANF based on age, pregnancy, etc."
46+
documentation = "Whether a person in a family applying for the Temporary Assistance for Needy Families program meets demographic requirements."
47+
48+
def formula(person, period, parameters):
49+
child_0_17 = person("is_child", period)
50+
is_18 = person("age", period) == 18
51+
school_enrolled_18_year_old = person("is_in_school", period) & is_18
52+
pregnant = person("is_pregnant", period)
53+
return child_0_17 | school_enrolled_18_year_old | pregnant
54+
55+
56+
class is_tanf_enrolled(Variable):
57+
value_type = bool
58+
entity = SPMUnit
59+
definition_period = YEAR
60+
label = "Current Enrollement in TANF"
61+
documentation = "Whether the familiy is currently enrolled in the Temporary Assistance for Needy Families program."
62+
63+
2564
class is_tanf_eligible(Variable):
2665
value_type = bool
2766
entity = SPMUnit
@@ -30,15 +69,15 @@ class is_tanf_eligible(Variable):
3069
documentation = "Whether the family is eligible for Temporary Assistance for Needy Families benefit."
3170

3271
def formula(spm_unit, period, parameters):
33-
children_0_17 = spm_unit.sum(spm_unit.members("is_child", period))
34-
school_enrolled_18_year_olds = spm_unit.sum(
35-
(spm_unit.members("is_in_school", period))
36-
& (spm_unit.members("age", period) == 18)
72+
demographic_eligible = spm_unit.any(
73+
spm_unit.members("is_person_demographic_tanf_eligible", period)
74+
)
75+
economic_eligible = where(
76+
spm_unit("is_tanf_enrolled", period),
77+
spm_unit("continuous_tanf_eligibility", period),
78+
spm_unit("initial_tanf_eligibility", period),
3779
)
38-
pregnant_people = spm_unit.sum(spm_unit.members("is_pregnant", period))
39-
return (
40-
children_0_17 + school_enrolled_18_year_olds + pregnant_people
41-
) > 0
80+
return demographic_eligible & economic_eligible
4281

4382

4483
# Quick fix, should be fixed by resolving https://github.com/openfisca/openfisca-core/issues/1085
@@ -57,7 +96,7 @@ class tanf_max_amount(Variable):
5796
definition_period = YEAR
5897
label = "TANF maximum benefit"
5998
documentation = "The maximum benefit amount a family could receive from Temporary Assistance for Needy Families given their state and family size."
60-
unit = "currency-USD"
99+
unit = USD
61100

62101
def formula(spm_unit, period, parameters):
63102
family_size = spm_unit.nb_persons().astype(str)
@@ -72,7 +111,7 @@ class tanf_countable_income(Variable):
72111
definition_period = YEAR
73112
label = "TANF countable income"
74113
documentation = "Countable income for calculating Temporary Assistance for Needy Families benefit."
75-
unit = "currency-USD"
114+
unit = USD
76115

77116
def formula(spm_unit, period, parameters):
78117
tanf_gross_income = spm_unit("tanf_total_gross_income", period)
@@ -89,7 +128,7 @@ class tanf_total_gross_income(Variable):
89128
definition_period = YEAR
90129
label = "TANF gross income"
91130
documentation = "Gross income for calculating Temporary Assistance for Needy Families benefit. Includes both gross earned and unearned income."
92-
unit = "currency-USD"
131+
unit = USD
93132
reference = "https://www.dhs.state.il.us/page.aspx?item=15814"
94133

95134

@@ -99,7 +138,7 @@ class tanf_amount_if_eligible(Variable):
99138
definition_period = YEAR
100139
label = "TANF amount if family is eligible"
101140
documentation = "How much a family would receive if they were eligible for Temporary Assistance for Needy Families benefit."
102-
unit = "currency-USD"
141+
unit = USD
103142

104143
def formula(spm_unit, period, parameters):
105144
max_amount = spm_unit("tanf_max_amount", period)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name="OpenFisca-US",
7-
version="0.3.1",
7+
version="0.4.0",
88
author="Nikhil Woodruff",
99
author_email="[email protected]",
1010
classifiers=[

0 commit comments

Comments
 (0)