Skip to content
Closed
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:
- New Jeresy TANF earned income disregards.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey fully excludes 50% earned income for person who enrolled TANF program over this amount of time.

metadata:
unit: month
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 7.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey fully excludes 100% of earned income for person who have enrolled in TANF program below this amount of time.

metadata:
unit: month
label: New Jersey TANF earned income deduction first month threshold
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey excludes this percentage of earned income for household enrolled in TANF for each additional month.

metadata:
unit: /1
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey excludes this percentage of earned income for 6 consecutive months for person who enrolles in TANF Program and continues work for more than 20h/week after the first month.

metadata:
unit: /1
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 0.75
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey fully excludes this percentage of earned income for person who enrolled in the first month of TANF program.

metadata:
unit: /1
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey excludes this percentage of earned income for household enrolled in TANF for each additional month.

metadata:
unit: /1
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New Jersey fully excludes this percentage of earned income for person who enrolled in the first month of TANF program.

metadata:
unit: /1
label: New Jersey TANF earned income deduction
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: New York excludes this percentage of earned income for the purposes of its TANF program.

metadata:
unit: hours
label: New Jeresy TANF
reference:
- title: New Jersey Administrative Code(N.J.A.C 10:90-3.8)
href: https://advance.lexis.com/documentpage/teaserdocument/?pdmfid=1000516&crid=1e9b7e3d-233e-4b7c-898f-b53548066f3f&config=00JAA1YTg5OGJlYi04MTI4LTRlNjQtYTc4Yi03NTQxN2E5NmE0ZjQKAFBvZENhdGFsb2ftaXPxZTR7bRPtX1Jok9kz&pddocfullpath=%2Fshared%2Fdocument%2Fadministrative-codes%2Furn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pddocid=urn%3AcontentItem%3A5XKV-PW31-F22N-X2CF-00008-00&pdcontentcomponentid=234122&pdteaserkey=h1&pditab=allpods&ecomp=8s65kkk&earg=sr0&prid=187e8c01-622c-460c-be94-0bb33d5ca4d2

values:
2022-10-01: 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
- name: NJ countable earned income = gross earned income*(1-100%) for first month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 1
hours_worked: 2_080
output:
nj_tanf_countable_earned_income: 0

- name: NJ countable earned income = gross earned income*(1-75%) for applicant with weekly working hours over 20 in 2nd month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 2
hours_worked: 2_080
output:
nj_tanf_countable_earned_income: 1_500

- name: NJ countable earned income = gross earned income*(1-50%) for applicant with weekly working hours under 20 in 2nd month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 2
hours_worked: 988
output:
nj_tanf_countable_earned_income: 3_000

- name: NJ countable earned income = gross earned income*(1-75%) for applicant with weekly working hours over 20 in 7nd month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 7
hours_worked: 2_080
output:
nj_tanf_countable_earned_income: 1_500

- name: NJ countable earned income = gross earned income*(1-50%) for applicant with weekly working hours over 20 in 8nd month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 8
hours_worked: 2_080
output:
nj_tanf_countable_earned_income: 3_000

- name: NJ countable earned income = gross earned income*(1-75%) for applicant with weekly working hours over 20 in 2nd month.
period: 2023
input:
state_code: NJ
nj_tanf_gross_earned_income: 6_000
months_enrolled_in_tanf: 2
hours_worked: 1_040
output:
nj_tanf_countable_earned_income: 1_500
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from policyengine_us.model_api import *


class nj_tanf_countable_earned_income(Variable):
value_type = float
entity = SPMUnit
label = "New Jersey TANF countable earned income"
unit = USD
definition_period = YEAR
defined_for = StateCode.NJ

def formula(spm_unit, period, parameters):
person = spm_unit.members
# Get gross earned income.
gross_earned_income = spm_unit("nj_tanf_gross_earned_income", period)
p = parameters(
period
).gov.states.nj.njdhs.tanf.income.earned_income_deduction
months_enrolled_in_tanf = person("months_enrolled_in_tanf", period)
weekly_hours_worked = person("weekly_hours_worked", period)
# New Jerset Admin Code 10:90-3.8(b)
person_meet_higher_work_hours_threshold = (
weekly_hours_worked >= p.work_hours_threshold
)
person_meet_lower_work_hours_threshold = (
weekly_hours_worked < p.work_hours_threshold
)
Comment on lines +22 to +27
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
person_meet_higher_work_hours_threshold = (
weekly_hours_worked >= p.work_hours_threshold
)
person_meet_lower_work_hours_threshold = (
weekly_hours_worked < p.work_hours_threshold
)
meets_hours_threshold = weekly_hours_worked >= p.work_hours_threshold

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a variable that is the opposite of the first variable. If you need to check if the number of hours is less than the threshold, you can use ~meets_hours_threshold, flipping all the booleans

person_enrolled_in_tanf_for_first_month = (
months_enrolled_in_tanf <= p.first_month_threshold
)
person_enrolled_in_tanf_for_consecutive_months_with_work_hours_over_20 = (
months_enrolled_in_tanf <= p.consecutive_month_threshold
and months_enrolled_in_tanf > p.first_month_threshold
and person_meet_higher_work_hours_threshold
)
person_enrolled_in_tanf_for_additional_months_with_work_hours_over_20 = (
months_enrolled_in_tanf > p.consecutive_month_threshold
and person_meet_higher_work_hours_threshold
)
person_enrolled_in_tanf_for_additional_months_with_work_hours_below_20 = (
months_enrolled_in_tanf > p.first_month_threshold
and person_meet_lower_work_hours_threshold
)
Comment on lines +31 to +43
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you want element-wise boolean operations, make sure you use & instead of and.

# The value of result will only change, if the first condition in "where" is met. If the condition is not met, the value of result will not change
result = 0
# If applicant is enrolled in TANF for the first month, the earned income deduction is 100%.
result = where(
person_enrolled_in_tanf_for_first_month,
gross_earned_income
* (1 - p.higher_work_hours.first_month_percent),
result,
)
# If applicant is enrolled in TANF for consecutive months with work hours over 20, the earned income deduction is 75%.
result = where(
(
person_meet_higher_work_hours_threshold
and person_enrolled_in_tanf_for_consecutive_months_with_work_hours_over_20
),
gross_earned_income
* (1 - p.higher_work_hours.consecutive_month_percent),
result,
)
# If applicant is enrolled in TANF for additional months with work hours over 20, the earned income deduction is 50%.
result = where(
person_enrolled_in_tanf_for_additional_months_with_work_hours_over_20,
gross_earned_income * (1 - p.higher_work_hours.additional_percent),
result,
)
# If applicant is enrolled in TANF for additional months with work hours below 20, the earned income deduction is 50%.
result = where(
person_enrolled_in_tanf_for_additional_months_with_work_hours_below_20,
gross_earned_income * (1 - p.lower_work_hours.additional_percent),
result,
)
return result
Comment on lines +45 to +75
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an example of how to use select():

The function's first argument is a condition list, the second argument is the list of values to return if that condition is true, and the (optional) third argument is the value to return if none of them are true (by default this is zero). The function goes through the condition list and returns the corresponding value. For example, if the third condition is true, the third value in the return list would be returned.
Here, you would want something like
select( [ enrolled_in_tanf_first_month, meets_hours_threshold, ... ], [ gross_earned_income * ( 1-p.higher_work_hours.first_month_percent), gross_earned_income * (1 - p.higher_work_hours.consecutive_month_percent), ... ] )
You don't need to specify a default return value since you want zero anyway.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from policyengine_us.model_api import *


class months_enrolled_in_tanf(Variable):
value_type = float
entity = Person
label = "Months enrolled in TANF"
definition_period = YEAR
unit = "month"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from policyengine_us.model_api import *


class hours_worked(Variable):
value_type = float
entity = Person
label = "Total amount of hours worked by this person"
definition_period = YEAR
unit = "hour"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from policyengine_us.model_api import *


class weekly_hours_worked(Variable):
value_type = float
entity = Person
label = "Weekly hours"
documentation = "Average weekly hours worked"
definition_period = YEAR
unit = "hour"
quantity_type = FLOW

def formula(person, period, parameters):
return person("hours_worked", period) / WEEKS_IN_YEAR