Skip to content

Commit a502f1a

Browse files
committed
Add changelog entry and remove debug file
1 parent 39fca44 commit a502f1a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: minor
2+
changes:
3+
added:
4+
- Move all randomness to data package for deterministic country package. Take-up decisions for SNAP, Medicaid, ACA, EITC, DC PTC, Head Start, and Early Head Start are now generated stochastically during dataset creation using take-up rates from YAML parameter files.

household_counts.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

policyengine_us_data/datasets/cps/cps.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,17 @@ def add_takeup(self):
220220
aca_rate = load_take_up_rate("aca", self.time_period)
221221
medicaid_rate = load_take_up_rate("medicaid", self.time_period)
222222
head_start_rate = load_take_up_rate("head_start", self.time_period)
223-
early_head_start_rate = load_take_up_rate("early_head_start", self.time_period)
223+
early_head_start_rate = load_take_up_rate(
224+
"early_head_start", self.time_period
225+
)
224226

225227
# EITC: varies by number of children
226228
eitc_child_count = baseline.calculate("eitc_child_count").values
227229
eitc_takeup_rate = np.array(
228-
[eitc_rates_by_children.get(min(int(c), 3), 0.85) for c in eitc_child_count]
230+
[
231+
eitc_rates_by_children.get(min(int(c), 3), 0.85)
232+
for c in eitc_child_count
233+
]
229234
)
230235
data["takes_up_eitc"] = (
231236
generator.random(len(data["tax_unit_id"])) < eitc_takeup_rate

policyengine_us_data/parameters/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
These parameters are stored in the data package to keep the country package
55
as a purely deterministic rules engine.
66
"""
7+
78
import yaml
89
from pathlib import Path
910

@@ -48,6 +49,8 @@ def load_take_up_rate(variable_name: str, year: int = 2018) -> float:
4849
break
4950

5051
if applicable_value is None:
51-
raise ValueError(f"No take-up rate found for {variable_name} in {year}")
52+
raise ValueError(
53+
f"No take-up rate found for {variable_name} in {year}"
54+
)
5255

5356
return applicable_value

0 commit comments

Comments
 (0)