Skip to content

Commit acea6fb

Browse files
Merge pull request #157 from PolicyEngine/missing-hbai-variables
Add missing HBAI variables
2 parents e4b1ba7 + c76daf6 commit acea6fb

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

changelog_entry.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- bump: minor
2+
changes:
3+
added:
4+
- Structural insurance payments
5+
- External child payments
6+
- Healthy Start payments

policyengine_uk_data/datasets/frs/frs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def generate(self):
4646
"maint",
4747
"mortgage",
4848
"penprov",
49+
"extchild",
4950
)
5051
(
5152
adult,
@@ -61,6 +62,7 @@ def generate(self):
6162
maintenance,
6263
mortgage,
6364
pen_prov,
65+
extchild,
6466
) = [dwp_frs_files[table] for table in TABLES]
6567
dwp_frs_files.close()
6668

@@ -82,6 +84,7 @@ def generate(self):
8284
mortgage,
8385
childcare,
8486
pen_prov,
87+
extchild,
8588
)
8689
for variable in frs:
8790
frs[variable] = {self.dwp_frs.time_period: np.array(frs[variable])}
@@ -752,6 +755,8 @@ def add_benefit_income(
752755
0,
753756
)
754757

758+
frs["healthy_start_vouchers"] = person.HEARTVAL * 52
759+
755760
WEEKS_IN_YEAR = 52
756761

757762
frs["free_school_breakfasts"] = person.FSBVAL * WEEKS_IN_YEAR
@@ -768,6 +773,7 @@ def add_expenses(
768773
mortgage: DataFrame,
769774
childcare: DataFrame,
770775
pen_prov: DataFrame,
776+
extchild: DataFrame,
771777
):
772778
"""Adds expense variables
773779
@@ -848,6 +854,7 @@ def add_expenses(
848854
).sum()
849855
* 52
850856
)
857+
frs["structural_insurance_payments"] = household.STRUINS * 52
851858
frs["water_and_sewerage_charges"] = (
852859
pd.Series(
853860
np.where(
@@ -859,6 +866,12 @@ def add_expenses(
859866
* 52
860867
)
861868

869+
frs["external_child_payments"] = sum_to_entity(
870+
extchild.NHHAMT * 52,
871+
extchild.household_id,
872+
household.index,
873+
)
874+
862875

863876
def add_benunit_variables(frs: h5py.File, benunit: DataFrame):
864877
frs["benunit_rent"] = np.maximum(benunit.BURENT.fillna(0) * 52, 0)

0 commit comments

Comments
 (0)