Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal childcare entitlement #1010

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
adf96a0
Implement tax free childcare
vahid-ahmadi Jan 10, 2025
ee24d61
Parameterize values
vahid-ahmadi Jan 13, 2025
12d24be
Reformatting to pass the tests
vahid-ahmadi Jan 13, 2025
235fd08
Reformatting with black
vahid-ahmadi Jan 13, 2025
b3b1967
Reformatting with black
vahid-ahmadi Jan 13, 2025
55ce6c3
Format code with black
vahid-ahmadi Jan 13, 2025
9952ed9
Format code with black using 79-char line length
vahid-ahmadi Jan 13, 2025
d6b22e5
Fix YAML structure
vahid-ahmadi Jan 13, 2025
b06a47c
Fix age condition YAML file
vahid-ahmadi Jan 13, 2025
90eb823
Fix age condition YAML file
vahid-ahmadi Jan 13, 2025
0c871a5
Fix other YAML files
vahid-ahmadi Jan 13, 2025
b28b5f8
Edit parameterization
vahid-ahmadi Jan 13, 2025
ff1f456
Fix formatting
vahid-ahmadi Jan 13, 2025
d3ad685
Edit age in YAML files
vahid-ahmadi Jan 13, 2025
5c6d359
Replace if with where
vahid-ahmadi Jan 13, 2025
e0221f8
Format with black
vahid-ahmadi Jan 13, 2025
fc83a03
Edit for test passing
vahid-ahmadi Jan 13, 2025
4421154
Edit format with black
vahid-ahmadi Jan 13, 2025
b4e8d1a
Edit format of benefit py file
vahid-ahmadi Jan 13, 2025
cf7f6e6
Edit child as not being boolean
vahid-ahmadi Jan 13, 2025
d4ff3b2
Change if to where
vahid-ahmadi Jan 14, 2025
0058402
Change disability definition
vahid-ahmadi Jan 14, 2025
37c7228
Solve .values problem
vahid-ahmadi Jan 14, 2025
af96f3a
Edit .values error
vahid-ahmadi Jan 14, 2025
e96bc2e
Edit vectorization problem
vahid-ahmadi Jan 14, 2025
153c2f6
Change folder from hmrc to dwp
vahid-ahmadi Jan 14, 2025
c9fbd0c
Use is_disabled_for_benefits variable
vahid-ahmadi Jan 14, 2025
a2f73d2
Add .astype(bool) to fix error
vahid-ahmadi Jan 14, 2025
a061877
Fix bitwise AND operation error
vahid-ahmadi Jan 14, 2025
a9ca8a7
Add .astype(bool) to conditions
vahid-ahmadi Jan 14, 2025
c7c6762
Add unit tests
vahid-ahmadi Jan 14, 2025
59e1b78
Reformat with black
vahid-ahmadi Jan 14, 2025
cebaace
Fix the folders
vahid-ahmadi Jan 15, 2025
c1a5cf0
Fix the folders
vahid-ahmadi Jan 15, 2025
49ec556
Merge branch 'tax-free-childcare-new' of https://github.com/policyeng…
vahid-ahmadi Jan 15, 2025
4a5cad5
Implement free childcare program
vahid-ahmadi Jan 15, 2025
4432db2
Format with black
vahid-ahmadi Jan 15, 2025
c7c1998
Change tests
vahid-ahmadi Jan 15, 2025
789f676
Edit format based on Pavel's comments
vahid-ahmadi Jan 17, 2025
cd3ff72
Implement universal 15-hours free childcare
vahid-ahmadi Jan 17, 2025
e792de8
Edit folders
vahid-ahmadi Jan 24, 2025
aacf564
Edit codes and labels
vahid-ahmadi Jan 24, 2025
d736589
Format with black
vahid-ahmadi Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: The Department for Education provides universal childcare entitlement in England for children until a maximum age, when they reach compulsory school age.
metadata:
unit: year
period: year
label: Maximum age for universal childcare entitlement
reference:
- title: Childcare Act 2006 - section 7 & part of the regulation that says children are eligible under compulsory school age in the second link.
href: https://www.legislation.gov.uk/ukpga/2006/21/section/7 & https://commonslibrary.parliament.uk/free-childcare-entitlements-for-three-and-four-year-olds-in-england/
- title: Ducment for 15 hours free childcare for 3 and 4-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-and-education-for-3-to-4-year-olds?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b
values:
2015-01-01: 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: The Department for Education provides universal childcare entitlement in England for children from a minimum age, when they reach compulsory school age.
metadata:
unit: year
period: year
label: Minimum age for universal childcare entitlement
reference:
- title: The Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014 - regulation 3
href: https://www.legislation.gov.uk/uksi/2014/2147/regulation/3/made
- title: Ducment for 15 hours free childcare for 3 and 4-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-and-education-for-3-to-4-year-olds?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b
values:
2015-01-01: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: The Department for Education provides universal childcare entitlement in England, offering specific hours per year.
metadata:
unit: hour
period: year
label: Annual universal childcare entitlement hours
reference:
- title: The Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014 - regulation 4
href: https://www.legislation.gov.uk/uksi/2014/2147/regulation/4/made
- title: Ducment for 15 hours free childcare for 3 and 4-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-and-education-for-3-to-4-year-olds?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b
values:
2015-01-01: 570
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- name: non eligible
period: 2025
input:
age: 2
is_child: true
output:
universal_childcare_entitlement_eligibility: false


- name: Eligible 4
period: 2025
input:
age: 4
is_child: true
output:
universal_childcare_entitlement_eligibility: true


- name: non Eligible 5
period: 2025
input:
age: 5
is_child: true
output:
universal_childcare_entitlement_eligibility: false


- name: Eligible 3
period: 2025
input:
age: 3.5
is_child: true
output:
universal_childcare_entitlement_eligibility: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Eligible child gets full hours
period: 2025
input:
universal_childcare_entitlement_eligibility: true
output:
universal_childcare_entitlement_hours: 570

- name: Non eligible child
period: 2025
input:
universal_childcare_entitlement_eligibility: false
output:
universal_childcare_entitlement_hours: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from policyengine_uk.model_api import *


class universal_childcare_entitlement_eligibility(Variable):
value_type = bool
entity = BenUnit
label = "universal childcare entitlement eligibility"
documentation = "Whether the benefit unit has any children eligible for universal childcare entitlement"
definition_period = YEAR

def formula(benunit, period, parameters):
"""
Calculate eligibility for universal childcare entitlement.

Args:
benunit: The benefit unit
period: The time period
parameters: Policy parameters

Returns:
bool: Whether the benefit unit has any eligible children
"""
# Get parameters
p = parameters(period).gov.dwp.universal_childcare_entitlement.age

# Get ages of all members in the benefit unit
age = benunit.members("age", period)

# Check if they are children
is_child = benunit.members("is_child", period)

# Check if age is within eligible range using parameters
is_eligible_age = (age >= p.min_age) & (age <= p.max_age)

# Child must be within age range and officially counted as a child
has_eligible_child = benunit.any(is_child & is_eligible_age)

return has_eligible_child.astype(bool)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from policyengine_uk.model_api import *


class universal_childcare_entitlement_hours(Variable):
value_type = float
entity = BenUnit
label = "universal childcare entitlement hours per year"
documentation = "Number of free childcare hours per year the benefit unit is entitled to"
definition_period = YEAR
unit = "hour"

def formula(benunit, period, parameters):
"""
Calculate number of free hours the benefit unit is entitled to.

Args:
benunit: The benefit unit
period: The time period
parameters: Policy parameters

Returns:
float: Number of free childcare hours per year
"""
# Get eligibility status
is_eligible = benunit(
"universal_childcare_entitlement_eligibility", period
)

# Use hours directly from parameters file
hours = parameters(
period
).gov.dwp.universal_childcare_entitlement.hours_per_year

# Return hours if eligible, 0 if not
return where(is_eligible, hours, 0)
Loading