policyengine-us 1.449.4__py3-none-any.whl → 1.449.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,181 @@
1
+ # WIC Integration Tests
2
+ # Tests the full eligibility pipeline from demographics to benefits.
3
+ # Per 42 U.S.C. § 1786, eligibility requires:
4
+ # 1. Valid demographic category (pregnant, postpartum, breastfeeding, infant, child)
5
+ # 2. Income ≤ 185% FPG OR categorical eligibility (SNAP/TANF/Medicaid)
6
+ # 3. Nutritional risk assessment (assumed true in individual simulation)
7
+ #
8
+ # Note: WIC package values are uprated from 2018 base values using CPI-U.
9
+ # Note: school_meal_countable_income is input as ANNUAL but computed as monthly.
10
+
11
+ - name: Case 1, infant in low-income family eligible for WIC.
12
+ period: 2024-01
13
+ absolute_error_margin: 0.01
14
+ input:
15
+ people:
16
+ person1:
17
+ # Parent - not WIC eligible (adult)
18
+ age: 30
19
+ person2:
20
+ # Infant - WIC eligible
21
+ age: 0
22
+ spm_units:
23
+ spm_unit:
24
+ members: [person1, person2]
25
+ # Annual income: $24,000
26
+ # Monthly: $2,000
27
+ # 2-person FPG 2024: $20,440/year = $1,703/month
28
+ # Ratio: 2000/1703 = 1.17 < 1.85 ✓
29
+ school_meal_countable_income: 24_000
30
+ output:
31
+ wic_category: [NONE, INFANT]
32
+ meets_wic_income_test: true
33
+ is_wic_eligible: [false, true]
34
+ # INFANT value uprated from $138.64 (2018) to ~$173.28 (2024)
35
+ wic: [0, 173.28]
36
+
37
+ - name: Case 2, pregnant woman fails income but passes categorical via SNAP.
38
+ period: 2024-01
39
+ absolute_error_margin: 0.01
40
+ input:
41
+ people:
42
+ person1:
43
+ age: 25
44
+ is_pregnant: true
45
+ spm_units:
46
+ spm_unit:
47
+ members: [person1]
48
+ # Annual income: $60,000
49
+ # Monthly: $5,000
50
+ # Pregnant adds +1 to household → 2-person FPG: $20,440/year = $1,703/month
51
+ # Ratio: 5000/1703 = 2.94 > 1.85 ✗
52
+ school_meal_countable_income: 60_000
53
+ snap: 200
54
+ output:
55
+ wic_category: PREGNANT
56
+ meets_wic_income_test: false
57
+ meets_wic_categorical_eligibility: true
58
+ is_wic_eligible: true
59
+ # PREGNANT value uprated from $37.33 (2018) to ~$46.66 (2024)
60
+ wic: 46.66
61
+
62
+ - name: Case 3, child age 3 eligible through Medicaid.
63
+ period: 2024-01
64
+ absolute_error_margin: 0.01
65
+ input:
66
+ people:
67
+ person1:
68
+ age: 3
69
+ medicaid_enrolled: true
70
+ spm_units:
71
+ spm_unit:
72
+ members: [person1]
73
+ # Annual income: $48,000
74
+ # Monthly: $4,000
75
+ # 1-person FPG 2024: $15,060/year = $1,255/month
76
+ # Ratio: 4000/1255 = 3.19 > 1.85 ✗
77
+ school_meal_countable_income: 48_000
78
+ # Explicitly disable SNAP to test Medicaid pathway
79
+ snap: 0
80
+ output:
81
+ wic_category: CHILD
82
+ meets_wic_income_test: false
83
+ meets_wic_categorical_eligibility: true
84
+ is_wic_eligible: true
85
+ # CHILD value uprated from $31.78 (2018) to ~$39.72 (2024)
86
+ wic: 39.72
87
+
88
+ - name: Case 4, healthy adult not eligible even with SNAP.
89
+ period: 2024-01
90
+ input:
91
+ people:
92
+ person1:
93
+ age: 35
94
+ spm_units:
95
+ spm_unit:
96
+ members: [person1]
97
+ school_meal_countable_income: 12_000
98
+ snap: 200
99
+ output:
100
+ wic_category: NONE
101
+ meets_wic_income_test: true
102
+ meets_wic_categorical_eligibility: true
103
+ # Not eligible - adult is not in valid WIC demographic category
104
+ is_wic_eligible: false
105
+ wic: 0
106
+
107
+ - name: Case 5, child age 5 not eligible (too old).
108
+ period: 2024-01
109
+ input:
110
+ people:
111
+ person1:
112
+ age: 5
113
+ # Explicitly disable Medicaid to test demographic-only rejection
114
+ medicaid_enrolled: false
115
+ spm_units:
116
+ spm_unit:
117
+ members: [person1]
118
+ school_meal_countable_income: 18_000
119
+ # Explicitly disable SNAP/TANF
120
+ snap: 0
121
+ tanf: 0
122
+ output:
123
+ # Age 5+ is category NONE per 42 U.S.C. § 1786(b)(2)
124
+ wic_category: NONE
125
+ meets_wic_income_test: true
126
+ meets_wic_categorical_eligibility: false
127
+ is_wic_eligible: false
128
+ wic: 0
129
+
130
+ - name: Case 6, family with pregnant mother and toddler.
131
+ period: 2024-01
132
+ absolute_error_margin: 0.01
133
+ input:
134
+ people:
135
+ person1:
136
+ age: 32
137
+ person2:
138
+ age: 28
139
+ is_pregnant: true
140
+ person3:
141
+ age: 2
142
+ spm_units:
143
+ spm_unit:
144
+ members: [person1, person2, person3]
145
+ # Annual income: $36,000
146
+ # Monthly: $3,000
147
+ # 3 people + 1 for pregnancy = 4-person equivalent
148
+ # 4-person FPG 2024: $31,200/year = $2,600/month
149
+ # Ratio: 3000/2600 = 1.15 < 1.85 ✓
150
+ school_meal_countable_income: 36_000
151
+ output:
152
+ wic_category: [NONE, PREGNANT, CHILD]
153
+ is_wic_eligible: [false, true, true]
154
+ # Father: $0, Mother: ~$46.66, Child: ~$39.72
155
+ wic: [0, 46.66, 39.72]
156
+
157
+ - name: Case 7, income above 185% FPG without categorical eligibility.
158
+ period: 2024-01
159
+ input:
160
+ people:
161
+ person1:
162
+ age: 2
163
+ # Explicitly disable Medicaid to test income-only pathway
164
+ medicaid_enrolled: false
165
+ spm_units:
166
+ spm_unit:
167
+ members: [person1]
168
+ # Annual income: $36,000
169
+ # Monthly: $3,000
170
+ # 1-person FPG 2024: $15,060/year = $1,255/month
171
+ # Ratio: 3000/1255 = 2.39 > 1.85 ✗
172
+ school_meal_countable_income: 36_000
173
+ # Explicitly disable SNAP/TANF
174
+ snap: 0
175
+ tanf: 0
176
+ output:
177
+ wic_category: CHILD
178
+ meets_wic_income_test: false
179
+ meets_wic_categorical_eligibility: false
180
+ is_wic_eligible: false
181
+ wic: 0
@@ -0,0 +1,33 @@
1
+ # Nutritional risk is a health assessment per 42 U.S.C. § 1786(b)(8).
2
+ # In individual simulation, all persons are assumed at nutritional risk.
3
+ # In microsimulation, risk is assigned probabilistically by category.
4
+
5
+ - name: Case 1, infant assumed at nutritional risk in individual simulation.
6
+ period: 2024-01
7
+ input:
8
+ age: 0
9
+ output:
10
+ is_wic_at_nutritional_risk: true
11
+
12
+ - name: Case 2, child assumed at nutritional risk in individual simulation.
13
+ period: 2024-01
14
+ input:
15
+ age: 3
16
+ output:
17
+ is_wic_at_nutritional_risk: true
18
+
19
+ - name: Case 3, adult assumed at nutritional risk in individual simulation.
20
+ period: 2024-01
21
+ input:
22
+ age: 35
23
+ output:
24
+ # Even adults are assumed at nutritional risk in individual simulation.
25
+ # Demographic eligibility is checked separately in is_wic_eligible.
26
+ is_wic_at_nutritional_risk: true
27
+
28
+ - name: Case 4, person receiving WIC is at nutritional risk.
29
+ period: 2024-01
30
+ input:
31
+ receives_wic: true
32
+ output:
33
+ is_wic_at_nutritional_risk: true
@@ -1,39 +1,52 @@
1
1
  # WIC requires each of the following:
2
- # - Either meeting the income test or categorical eligibility,
3
- # - Meeting a demographic test (pregnancy, age, parental status), and
2
+ # - Being in a valid demographic category (pregnant, postpartum, breastfeeding, infant, or child),
3
+ # - Either meeting the income test or categorical eligibility, and
4
4
  # - Being assessed to be at nutritional risk.
5
- - name: Case 1, satisfied all conditions hence is eligible
5
+
6
+ # Unit tests with stubbed inputs
7
+ - name: Case 1, child satisfies all conditions hence is eligible.
6
8
  period: 2022
7
9
  input:
10
+ wic_category: CHILD
8
11
  meets_wic_income_test: true
9
- meets_wic_categorical_eligibility: true
10
12
  is_wic_at_nutritional_risk: true
11
13
  output:
12
14
  is_wic_eligible: true
13
15
 
14
- - name: Case 2, not nutritional risk hence not eligible
16
+ - name: Case 2, healthy adult not eligible even with all other conditions met.
15
17
  period: 2022
16
18
  input:
19
+ wic_category: NONE
17
20
  meets_wic_income_test: true
18
21
  meets_wic_categorical_eligibility: true
19
- is_wic_at_nutritional_risk: false
22
+ is_wic_at_nutritional_risk: true
20
23
  output:
21
24
  is_wic_eligible: false
22
25
 
23
- - name: Case 3, eligible when either income test or categorical passed
26
+ - name: Case 3, child not eligible without income or categorical eligibility.
24
27
  period: 2022
25
28
  input:
26
- meets_wic_income_test: true
29
+ wic_category: CHILD
30
+ meets_wic_income_test: false
27
31
  meets_wic_categorical_eligibility: false
28
32
  is_wic_at_nutritional_risk: true
29
33
  output:
30
- is_wic_eligible: true
34
+ is_wic_eligible: false
31
35
 
32
- - name: Case 4, eligible when either income test or categorical passed
33
- period: 2022
36
+ - name: Case 4, family with adult, infant, and child age 6.
37
+ period: 2024-01
34
38
  input:
35
- meets_wic_income_test: false
36
- meets_wic_categorical_eligibility: true
37
- is_wic_at_nutritional_risk: true
39
+ people:
40
+ person1:
41
+ age: 30
42
+ person2:
43
+ age: 0
44
+ person3:
45
+ age: 6
46
+ spm_units:
47
+ spm_unit:
48
+ members: [person1, person2, person3]
49
+ school_meal_countable_income: 30_000
38
50
  output:
39
- is_wic_eligible: true
51
+ # Adult: not eligible, infant: eligible, age 6: not eligible
52
+ is_wic_eligible: [false, true, false]
@@ -10,21 +10,14 @@ class is_wic_at_nutritional_risk(Variable):
10
10
  reference = "https://www.law.cornell.edu/uscode/text/42/1786#b_8"
11
11
 
12
12
  def formula(person, period, parameters):
13
- # Assign households WIC nutritional risk status probabilistically in microsimulation.
13
+ # Assign nutritional risk status probabilistically in microsimulation.
14
+ # Nutritional risk is a health assessment independent of income per § 1786(b)(8).
14
15
  # Assume all meet qualification in individual simulation.
15
16
  if person.simulation.dataset is not None:
16
17
  wic_reported = person("receives_wic", period)
17
- meets_income_test = person.spm_unit(
18
- "meets_wic_income_test", period
19
- )
20
- meets_categorical_test = person(
21
- "meets_wic_categorical_eligibility", period
22
- )
23
18
  category = person("wic_category", period)
24
19
  risk = parameters(period).gov.usda.wic.nutritional_risk
25
- imputed_risk = (random(person) < risk[category]) & (
26
- meets_income_test | meets_categorical_test
27
- )
20
+ imputed_risk = random(person) < risk[category]
28
21
  return wic_reported | imputed_risk
29
22
  else:
30
23
  return True
@@ -15,4 +15,13 @@ class is_wic_eligible(Variable):
15
15
  "meets_wic_categorical_eligibility", period
16
16
  )
17
17
  nutritional_risk = person("is_wic_at_nutritional_risk", period)
18
- return (meets_income_test | meets_categorical_test) & nutritional_risk
18
+ # Must be in a valid WIC demographic category per 42 U.S.C. § 1786(d)(1)
19
+ wic_category = person("wic_category", period)
20
+ demographic_eligible = (
21
+ wic_category != wic_category.possible_values.NONE
22
+ )
23
+ return (
24
+ demographic_eligible
25
+ & (meets_income_test | meets_categorical_test)
26
+ & nutritional_risk
27
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-us
3
- Version: 1.449.4
3
+ Version: 1.449.5
4
4
  Summary: Add your description here.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License-File: LICENSE
@@ -5502,7 +5502,9 @@ policyengine_us/tests/policy/baseline/gov/usda/snap/income/deductions/self_emplo
5502
5502
  policyengine_us/tests/policy/baseline/gov/usda/snap/income/deductions/self_employment_income/snap_self_employment_income_after_expense_deduction.yaml,sha256=v_65QQc8LyKv3npBh4E3q1Xon7Wa0r4tHS2w5iTyC9A,222
5503
5503
  policyengine_us/tests/policy/baseline/gov/usda/snap/income/gross/snap_child_support_gross_income_deduction.yaml,sha256=9BWpjo7BY5k9Mri6qehcLcYUidxrcvlQFVgCGrlhKiQ,341
5504
5504
  policyengine_us/tests/policy/baseline/gov/usda/snap/income/gross/snap_gross_income_fpg_ratio.yaml,sha256=A023I194Z3a0dVxHQe-2_LrF9uomZE7KmAw3oymuchM,190
5505
- policyengine_us/tests/policy/baseline/gov/usda/wic/is_wic_eligible.yaml,sha256=gQ9h6yUO-FGPhv9-sVJMKGH16sK_CYyqd3h0p5SdN9I,1175
5505
+ policyengine_us/tests/policy/baseline/gov/usda/wic/integration.yaml,sha256=SCfkopqWhZdN_Y8YcRbnp_XrM51Bh-I-bx1UflaE6Fo,5299
5506
+ policyengine_us/tests/policy/baseline/gov/usda/wic/is_wic_at_nutritional_risk.yaml,sha256=-HEH-GozRVD7DXYwacpLMvOQqm_rax7IQL66josLu3A,1009
5507
+ policyengine_us/tests/policy/baseline/gov/usda/wic/is_wic_eligible.yaml,sha256=WVyuHaIZDoAVBnr7Y-IFvOBAVKqF9n-JgQah5GXYOBs,1488
5506
5508
  policyengine_us/tests/policy/baseline/gov/usda/wic/meets_wic_categorical_eligibility.yaml,sha256=uzo3fxLaP8ILq33jsAbOzYMtyepI8KQxBI-_s-uGrX8,1314
5507
5509
  policyengine_us/tests/policy/baseline/gov/usda/wic/meets_wic_income_test.yaml,sha256=pcDSjkO8xslbGu0jLAmuwF7Xijo3YEE85LX0okk_nzM,404
5508
5510
  policyengine_us/tests/policy/baseline/gov/usda/wic/wic.yaml,sha256=EPGgkZYNDiLsQsF9HtDbOQuzsURjHZHcGMr4fyyApWI,943
@@ -8487,8 +8489,8 @@ policyengine_us/variables/gov/usda/snap/income/deductions/shelter/snap_utility_a
8487
8489
  policyengine_us/variables/gov/usda/snap/income/gross/snap_child_support_gross_income_deduction.py,sha256=7BtYXfX0HFUmcl-lUiTfoc6S2u7BQO1Cs7PUeKIz9_0,781
8488
8490
  policyengine_us/variables/gov/usda/snap/income/gross/snap_gross_income.py,sha256=jnjugC4wYH0zNRvp31EvAOQFmS1YZVYOXUcapdrtzLA,560
8489
8491
  policyengine_us/variables/gov/usda/snap/income/gross/snap_gross_income_fpg_ratio.py,sha256=9tzVez38pAx1xI2njPg9Z-1c8HhuUwzhh5bqz8rv0TQ,484
8490
- policyengine_us/variables/gov/usda/wic/is_wic_at_nutritional_risk.py,sha256=smw7e68TUhTyi7AEmMkn9t4C-5PbULcmBNbnAsGdeAg,1304
8491
- policyengine_us/variables/gov/usda/wic/is_wic_eligible.py,sha256=uN3pJ66nm809Nk7p5SB7iCF3WQJWstQ76Tf8QjioGq0,748
8492
+ policyengine_us/variables/gov/usda/wic/is_wic_at_nutritional_risk.py,sha256=mSKEf161BzVeh1qFUKHVPgzO5gQ7xCvAJEhVu0_zpcY,1071
8493
+ policyengine_us/variables/gov/usda/wic/is_wic_eligible.py,sha256=qbVv6uQK7FdOOBoZiFECMAcsbmqkMtJLCPliZeybF0k,1060
8492
8494
  policyengine_us/variables/gov/usda/wic/meets_wic_categorical_eligibility.py,sha256=JZei-PtT3b3qnikn_1KzEnjVN62Qiz_WYrG-JoHYD4A,1297
8493
8495
  policyengine_us/variables/gov/usda/wic/meets_wic_income_test.py,sha256=coY3NFmW9kRFuBjH8GyfNEuULLHs-ytirvP3THCBTDs,944
8494
8496
  policyengine_us/variables/gov/usda/wic/receives_wic.py,sha256=JPkMh_hPJAKa-S9NCUYynI-LMBfWU9C3jlYa_RDerG4,182
@@ -8986,8 +8988,8 @@ policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy5
8986
8988
  policyengine_us/variables/input/geography.py,sha256=Ux0ueAf0rhZaflyEqz81UuXP3xKCKBDvoO3CrKhiQEc,5421
8987
8989
  policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
8988
8990
  policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
8989
- policyengine_us-1.449.4.dist-info/METADATA,sha256=j7GDjb_PJO8HLpR2DMd1aCygLgKBBK26pcG9IMT-iCw,1649
8990
- policyengine_us-1.449.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
8991
- policyengine_us-1.449.4.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8992
- policyengine_us-1.449.4.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8993
- policyengine_us-1.449.4.dist-info/RECORD,,
8991
+ policyengine_us-1.449.5.dist-info/METADATA,sha256=drBnIvL3LBL7UDpRzu9DCCdp6YtLMhfeHXByl2DaaBA,1649
8992
+ policyengine_us-1.449.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
8993
+ policyengine_us-1.449.5.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8994
+ policyengine_us-1.449.5.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8995
+ policyengine_us-1.449.5.dist-info/RECORD,,