diff --git a/policyengine-us b/policyengine-us new file mode 160000 index 00000000000..6958e3b0953 --- /dev/null +++ b/policyengine-us @@ -0,0 +1 @@ +Subproject commit 6958e3b09533627924be93bef5f13d919cd3ad05 diff --git a/policyengine_us/parameters/gov/states/md/tanf/income/sources/earned.yaml b/policyengine_us/parameters/gov/states/md/tanf/income/sources/earned.yaml new file mode 100644 index 00000000000..ed0ae4e95f5 --- /dev/null +++ b/policyengine_us/parameters/gov/states/md/tanf/income/sources/earned.yaml @@ -0,0 +1,11 @@ +description: Maryland TANF counts these income sources as earned income. +values: + 2022-11-01: + - employment_income + - self_employment_income + - armed_services_basic_allowance_for_housing +metadata: + unit: list + reference: + title: 0903 Unearned Income 11.22.doc + diff --git a/policyengine_us/parameters/gov/states/md/tanf/income/sources/unearned.yaml b/policyengine_us/parameters/gov/states/md/tanf/income/sources/unearned.yaml new file mode 100644 index 00000000000..67ff72d5f3e --- /dev/null +++ b/policyengine_us/parameters/gov/states/md/tanf/income/sources/unearned.yaml @@ -0,0 +1,25 @@ + +description: Maryland TANF counts these income sources as unearned income. +values: + 2022-11-01: + - pension_income + - investment_income + - social_security + - sick_accident + - alimony_income + - monetary_gifts + - dividend_income + - interest_income + - lottery_winnings + - lawsuit_settlements + - inheritances + - rent_subsidies + - worker_compensation + - unemployment_compensation + - veterans_benefits + - criminal_injuries_compensation + +metadata: + unit: list + reference: + title: 0903 Unearned Income 11.22.doc \ No newline at end of file diff --git a/policyengine_us/tests/policy/baseline/gov/states/md/tanf/md_is_child.yaml b/policyengine_us/tests/policy/baseline/gov/states/md/tanf/md_is_child.yaml new file mode 100644 index 00000000000..97963a34e6c --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/md/tanf/md_is_child.yaml @@ -0,0 +1,38 @@ +- name: "Person who is age 20 and is full time student". + period: 2023 + input: + age:20 + is_full_time_college_student:true + is_k12_student:false + output: + is_child:false + + +- name: "Person who is age 18 and is full time k12 student". + period: 2023 + input: + age:18 + is_full_time_college_student:true + is_k12_student:true + output: + is_child:true + + +- name: "Person who is age 19 and is full time college student". + period: 2023 + input: + age:19 + is_full_time_college_student:true + is_k12_student:false + output: + is_child:true + + +- name: "Person who is age 19 and is full time k12 student". + period: 2023 + input: + age:19 + is_full_time_college_student:false + is_k12_student:true + output: + is_child:false diff --git a/policyengine_us/variables/gov/states/md/tanf/income/earned/md_tanf_countable_gross_earned_income.py b/policyengine_us/variables/gov/states/md/tanf/income/earned/md_tanf_countable_gross_earned_income.py new file mode 100644 index 00000000000..d1f02ee02c1 --- /dev/null +++ b/policyengine_us/variables/gov/states/md/tanf/income/earned/md_tanf_countable_gross_earned_income.py @@ -0,0 +1,14 @@ +from policyengine_us.model_api import * + + +class md_tanf_countable_gross_earned_income(Variable): + value_type = int + entity = SPMUnit + label = "Maryland TANF countable gross earned income" + unit = USD + definition_period = YEAR + + def formula(spm_unit, period, parameters): + p = parameters(period).gov.states.md.tanf.income.sources + gross_earned = add(spm_unit, period, p.earned) + return gross_earned diff --git a/policyengine_us/variables/gov/states/md/tanf/income/uneared/md_tanf_countable_gross_unearned_income.py b/policyengine_us/variables/gov/states/md/tanf/income/uneared/md_tanf_countable_gross_unearned_income.py new file mode 100644 index 00000000000..78fb30b848a --- /dev/null +++ b/policyengine_us/variables/gov/states/md/tanf/income/uneared/md_tanf_countable_gross_unearned_income.py @@ -0,0 +1,18 @@ +from policyengine_us.model_api import * + + +class md_tanf_countable_gross_unearned_income(Variable): + value_type = float + entity = SPMUnit + label = "Maryland TANF countable gross unearned income" + unit = USD + definition_period = YEAR + defined_for = StateCode.MD + + def formula(spm_unit, period, parameters): + p = parameters(period).gov.states.md.tanf.income.sources + # Sum unearned sources, plus child support if not currently enrolled. + gross_unearned = add(spm_unit, period, p.unearned) + child_support = add(spm_unit, period, ["child_support_received"]) + enrolled = spm_unit("is_tanf_enrolled", period) + return gross_unearned + where(enrolled, 0, child_support) diff --git a/policyengine_us/variables/gov/states/md/tanf/md_tanf.py b/policyengine_us/variables/gov/states/md/tanf/md_tanf.py new file mode 100644 index 00000000000..d54d1a6e734 --- /dev/null +++ b/policyengine_us/variables/gov/states/md/tanf/md_tanf.py @@ -0,0 +1,32 @@ +from policyengine_us.model_api import * + + +class md_tanf(Variable): + value_type = float + entity = SPMUnit + label = "Maryland TANF" + unit = USD + definition_period = YEAR + defined_for = "md_tanf_eligible" + + def formula(spm_unit, period, parameters): + grant_standard = spm_unit("md_tanf_maximun_benefit", period) + earned_income = spm_unit( + "md_tanf_countable_gross_earned_income", period + ) + earned_income_deduction = spm_unit( + "md_tanf_gross_earned_income_deduction", period + ) + unearned_income = spm_unit( + "md_tanf_countable_gross_unearned_income", period + ) + unearned_income_deduction = spm_unit( + "md_tanf_gross_unearned_income_deduction", period + ) + income = add( + spm_unit, + period, + earned_income - earned_income_deduction, + unearned_income - unearned_income_deduction, + ) + return max(grant_standard - income, 0) diff --git a/policyengine_us/variables/gov/states/md/tanf/md_tanf_is_child.py b/policyengine_us/variables/gov/states/md/tanf/md_tanf_is_child.py new file mode 100644 index 00000000000..6f325a839c6 --- /dev/null +++ b/policyengine_us/variables/gov/states/md/tanf/md_tanf_is_child.py @@ -0,0 +1,26 @@ +from policyengine_us.model_api import * + + + + +class md_tanf_is_child(Variable): + value_type = bool + entity = Person + definition_period = YEAR + label = "Wether is a child for MD TANF based on age, education, etc." + documentation = "0307 Age rev 11.22.doc" + + + def formula(person, period, parameters): + # younger than age 18 + child_0_17 = person("is_child", period) + # Younger than age 19 and A full time k12 student + younger_than_19 = person("age", period) <= 19 + k12 = person("is_k12_student", period) + k12_younger_than_19 = k12 & younger_than_19 + # age 19 and a full time student + age_19 = person("age", period) == 19 + full_time_student = person("is_full_time_college_student", period) + school_enrolled_19_year_old = full_time_student & younger_than_19 + # return + return child_0_17 | school_enrolled_19_year_old | k12_younger_than_19