Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into PavelMakarchuk/issue5416
  • Loading branch information
PavelMakarchuk committed Dec 27, 2024
2 parents e741119 + f0b00ef commit fee2f90
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.166.0] - 2024-12-27 21:44:15

### Added

- Abolish SNAP net income test reform.
- Abolish SNAP deductions reform.

## [1.165.0] - 2024-12-26 12:59:32

### Added
Expand Down Expand Up @@ -10481,6 +10488,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[1.166.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.165.0...1.166.0
[1.165.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.164.0...1.165.0
[1.164.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.163.1...1.164.0
[1.163.1]: https://github.com/PolicyEngine/policyengine-us/compare/1.163.0...1.163.1
Expand Down
6 changes: 6 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8859,3 +8859,9 @@
added:
- SSI qualified non-citizen eligibility.
date: 2024-12-26 12:59:32
- bump: minor
changes:
added:
- Abolish SNAP net income test reform.
- Abolish SNAP deductions reform.
date: 2024-12-27 21:44:15
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description: SNAP deductions are abolished, if this is true.
metadata:
unit: bool
period: year
label: Abolish SNAP deductions in effect

values:
0000-01-01: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description: SNAP net income test is abolished, if this is true.
metadata:
unit: bool
period: year
label: Abolish SNAP net income test in effect

values:
0000-01-01: false
12 changes: 12 additions & 0 deletions policyengine_us/reforms/reforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
from .ctc.eppc import (
create_expanded_ctc_reform,
)
from .snap import (
create_abolish_snap_deductions_reform,
create_abolish_snap_net_income_test_reform,
)


from policyengine_core.reforms import Reform
Expand Down Expand Up @@ -152,6 +156,12 @@ def create_structural_reforms_from_parameters(parameters, period):
parameters, period
)
expanded_ctc = create_expanded_ctc_reform(parameters, period)
abolish_snap_deductions = create_abolish_snap_deductions_reform(
parameters, period
)
abolish_snap_net_income_test = create_abolish_snap_net_income_test_reform(
parameters, period
)

reforms = [
afa_reform,
Expand Down Expand Up @@ -184,6 +194,8 @@ def create_structural_reforms_from_parameters(parameters, period):
ctc_older_child_supplement,
second_earner_tax_reform,
expanded_ctc,
abolish_snap_deductions,
abolish_snap_net_income_test,
]
reforms = tuple(filter(lambda x: x is not None, reforms))

Expand Down
6 changes: 6 additions & 0 deletions policyengine_us/reforms/snap/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .abolish_snap_deductions import (
create_abolish_snap_deductions_reform,
)
from .abolish_snap_net_income_test import (
create_abolish_snap_net_income_test_reform,
)
40 changes: 40 additions & 0 deletions policyengine_us/reforms/snap/abolish_snap_deductions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from policyengine_us.model_api import *


def create_abolish_snap_deductions() -> Reform:
class snap_deductions(Variable):
value_type = float
entity = SPMUnit
label = "SNAP income deductions"
unit = USD
documentation = "Deductions made from gross income for SNAP benefits"
definition_period = MONTH
reference = "https://www.law.cornell.edu/uscode/text/7/2014#e"

def formula(spm_unit, period, parameters):
return 0

class reform(Reform):
def apply(self):
self.update_variable(snap_deductions)

return reform


def create_abolish_snap_deductions_reform(
parameters, period, bypass: bool = False
):
if bypass:
return create_abolish_snap_deductions()

p = parameters(period).gov.contrib.snap.abolish_deductions

if p.in_effect:
return create_abolish_snap_deductions()
else:
return None


abolish_snap_deductions = create_abolish_snap_deductions_reform(
None, None, bypass=True
)
42 changes: 42 additions & 0 deletions policyengine_us/reforms/snap/abolish_snap_net_income_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from policyengine_us.model_api import *


def create_abolish_snap_net_income_test() -> Reform:
class meets_snap_net_income_test(Variable):
value_type = bool
entity = SPMUnit
label = "Meets SNAP net income test"
documentation = "Whether this SPM unit meets the SNAP net income test"
definition_period = MONTH
reference = (
"https://www.law.cornell.edu/uscode/text/7/2017#a",
"https://www.law.cornell.edu/uscode/text/7/2014#c",
)

def formula(spm_unit, period, parameters):
return True

class reform(Reform):
def apply(self):
self.update_variable(meets_snap_net_income_test)

return reform


def create_abolish_snap_net_income_test_reform(
parameters, period, bypass: bool = False
):
if bypass:
return create_abolish_snap_net_income_test()

p = parameters(period).gov.contrib.snap.abolish_net_income_test

if p.in_effect:
return create_abolish_snap_net_income_test()
else:
return None


abolish_snap_net_income_test = create_abolish_snap_net_income_test_reform(
None, None, bypass=True
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: Reform not in effect
period: 2024
input:
snap_standard_deduction: 3_000
snap_child_support_deduction: 1_000
output:
snap_deductions: 4_000

- name: Reform in effect
period: 2024
reforms: policyengine_us.reforms.snap.abolish_snap_deductions.abolish_snap_deductions
input:
gov.contrib.snap.abolish_deductions.in_effect: true
snap_standard_deduction: 3_000
snap_child_support_deduction: 1_000
output:
snap_deductions: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Reform not in effect
period: 2024
input:
snap_net_income_fpg_ratio: 1.5
output:
meets_snap_net_income_test: false

- name: Reform in effect
period: 2024
reforms: policyengine_us.reforms.snap.abolish_snap_net_income_test.abolish_snap_net_income_test
input:
gov.contrib.snap.abolish_net_income_test.in_effect: true
snap_net_income_fpg_ratio: 1.5
output:
meets_snap_net_income_test: true
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="policyengine-us",
version="1.165.0",
version="1.166.0",
author="PolicyEngine",
author_email="[email protected]",
long_description=readme,
Expand Down

0 comments on commit fee2f90

Please sign in to comment.