Skip to content

Commit 25d7f2c

Browse files
MaxGhenisjuaristi22
authored andcommitted
Add changelog entry and remove debug file
1 parent 15a36ac commit 25d7f2c

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

changelog_entry.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
- bump: minor
22
changes:
33
added:
4-
- field_valid_values table in the targets database as source of truth for semantic or external target information.
5-
- constraint_validation.py to ensure constraint operations result in consistent and valid sets of constraints for a given stratum.
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
@@ -207,12 +207,17 @@ def add_takeup(self):
207207
aca_rate = load_take_up_rate("aca", self.time_period)
208208
medicaid_rate = load_take_up_rate("medicaid", self.time_period)
209209
head_start_rate = load_take_up_rate("head_start", self.time_period)
210-
early_head_start_rate = load_take_up_rate("early_head_start", self.time_period)
210+
early_head_start_rate = load_take_up_rate(
211+
"early_head_start", self.time_period
212+
)
211213

212214
# EITC: varies by number of children
213215
eitc_child_count = baseline.calculate("eitc_child_count").values
214216
eitc_takeup_rate = np.array(
215-
[eitc_rates_by_children.get(min(int(c), 3), 0.85) for c in eitc_child_count]
217+
[
218+
eitc_rates_by_children.get(min(int(c), 3), 0.85)
219+
for c in eitc_child_count
220+
]
216221
)
217222
data["takes_up_eitc"] = (
218223
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)