Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
998c96b
Add fix to is_parent
nikhilwoodruff Apr 3, 2025
ab37356
Add total targets for universal childcare
vahid-ahmadi Apr 4, 2025
3420504
Add a pytest
vahid-ahmadi Apr 4, 2025
b0af312
Edit pytest
vahid-ahmadi Apr 4, 2025
339e8b9
Edit pytest
vahid-ahmadi Apr 4, 2025
2efbca4
Edit year
vahid-ahmadi Apr 4, 2025
acfa394
Edit bounds
vahid-ahmadi Apr 4, 2025
50b3a9b
Hard code takeup rate
vahid-ahmadi Apr 4, 2025
47c04cf
Black
vahid-ahmadi Apr 4, 2025
7dd14d8
Add no TFC condition
vahid-ahmadi Apr 4, 2025
2f273b3
Format
vahid-ahmadi Apr 4, 2025
6d55de2
Replace <= 0 with ==0
vahid-ahmadi Apr 4, 2025
4eb683d
Edit condition
vahid-ahmadi Apr 4, 2025
bb0e7ac
Edit changes
vahid-ahmadi Apr 4, 2025
2ae0560
Merge branch 'care-to-learn' into universal-free-childcare
vahid-ahmadi Apr 7, 2025
2199f71
Add other pytests
vahid-ahmadi Apr 7, 2025
721530c
Format
vahid-ahmadi Apr 7, 2025
e7ce93c
Merge branch 'master' of https://github.com/policyengine/policyengine…
vahid-ahmadi Apr 7, 2025
a18277b
Rename variable
vahid-ahmadi Apr 7, 2025
2e053dd
Add intractions
vahid-ahmadi Apr 7, 2025
07bb018
Edit test
vahid-ahmadi Apr 7, 2025
bc87988
Add TFC
vahid-ahmadi Apr 7, 2025
8a0839e
Edit
vahid-ahmadi Apr 7, 2025
c9771f3
Add number of eligible children
vahid-ahmadi Apr 7, 2025
1dd716a
Remove test_childcare.py to be excluded from PR
vahid-ahmadi Apr 8, 2025
87146df
Remove test_childcare.py to be excluded from PR
vahid-ahmadi Apr 8, 2025
963a6f5
Merge branch 'universal-free-childcare-without-tests' of https://gith…
vahid-ahmadi Apr 8, 2025
06e1cf6
add changelog
vahid-ahmadi Apr 8, 2025
8750641
Edit changelog
vahid-ahmadi Apr 8, 2025
c8b64c0
Add comments
vahid-ahmadi Apr 8, 2025
ced9dd4
Black
vahid-ahmadi Apr 8, 2025
03b6ece
Add would claim variable
vahid-ahmadi Apr 8, 2025
da5393b
Add max_free_entitlement_hours_used
vahid-ahmadi Apr 14, 2025
058c166
Edit py file
vahid-ahmadi Apr 14, 2025
ed99735
Format
vahid-ahmadi Apr 14, 2025
95dbe12
edit definition_period
vahid-ahmadi Apr 14, 2025
475a2b1
edit definition_period
vahid-ahmadi Apr 14, 2025
1eb4943
Add weeks_per_year
vahid-ahmadi Apr 14, 2025
c1ca65e
Add hours condition
vahid-ahmadi Apr 15, 2025
d79745e
Format
vahid-ahmadi Apr 15, 2025
a2bdba2
Add unit tests
vahid-ahmadi Apr 15, 2025
76ad702
Edit unit tests
vahid-ahmadi Apr 15, 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
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: patch
changes:
fixed:
- Corrected the is_parent variable to properly identify parents.
- Fixed logic in childcare programs to ensure accurate calculations.
14 changes: 14 additions & 0 deletions policyengine_uk/parameters/gov/dfe/weeks_per_year.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
description: The Department for Education provides targeted, extended, and universal childcare entitlement for these weeks per year.
metadata:
period: year
unit: week
label: childcare entitlement weeks per year
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: Childcare Choices document - 15 and 30 hours childcare support
href: https://www.childcarechoices.gov.uk/15-and-30-hours-childcare-support/working-families/eligibility
- title: Childcare (Early Years Provision Free of Charge) (Extended Entitlement) Regulations 2016 - Regulation 35(3)
href: https://www.legislation.gov.uk/uksi/2016/1257/part/4/made
values:
2016-01-01: 38
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,37 @@
members: [child1]
extended_childcare_entitlement_eligible: false
output:
extended_childcare_entitlement: 0 # Not eligible
extended_childcare_entitlement: 0 # Not eligible

- name: Child using fewer hours than maximum entitlement
period: 2025
absolute_error_margin: 1
input:
people:
child1:
age: 3
max_free_entitlement_hours_used: 20
benunits:
benunit1:
members: [child1]
extended_childcare_entitlement_eligible: true
output:
extended_childcare_entitlement: 4611.457 # 20 hours * 38 weeks * £6.07 per hour (2025 rate)

- name: Child using fewer hours than maximum entitlement - multiple children
period: 2025
absolute_error_margin: 100
input:
people:
child1:
age: 2
max_free_entitlement_hours_used: 10
child2:
age: 3
max_free_entitlement_hours_used: 15
benunits:
benunit1:
members: [child1, child2]
extended_childcare_entitlement_eligible: true
output:
extended_childcare_entitlement: 6705.43 # (10 hours * 38 weeks * £8.58 per hour) + (15 hours * 38 weeks * £6.07 per hour) for 2025 rates
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
- name: Child under 2 (ineligible)
period: 2024
input:
people:
child:
age: 1
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: False
output:
targeted_childcare_entitlement: 0.0

- name: Child aged 2 (eligible)
period: 2024
input:
people:
child:
age: 2
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: True
output:
targeted_childcare_entitlement: 4_719.60 # 15 hours * 38 weeks * £8.28 per hour

- name: Child aged 3 (not eligible by age, but has targeting)
period: 2024
input:
people:
child:
age: 3
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: True
output:
targeted_childcare_entitlement: 0.0 # Not eligible by age even if targeting criteria met

- name: Child using fewer hours than maximum entitlement
period: 2024
input:
people:
child:
age: 2
max_free_entitlement_hours_used: 10
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: True
output:
targeted_childcare_entitlement: 3_146.4 # 10 hours * 38 weeks * £8.28 per hour

- name: Child using exactly maximum entitlement
period: 2024
input:
people:
child:
age: 2
max_free_entitlement_hours_used: 15
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: True
output:
targeted_childcare_entitlement: 4_719.6 # 15 hours * 38 weeks * £8.28 per hour

- name: Child using more than maximum entitlement (capped)
period: 2024
input:
people:
child:
age: 2
max_free_entitlement_hours_used: 20
benunits:
benunit:
members: [child]
targeted_childcare_entitlement_eligible: True
output:
targeted_childcare_entitlement: 4_719.6 # Capped at 15 hours * 38 weeks * £8.28 per hour
Original file line number Diff line number Diff line change
@@ -1,63 +1,123 @@
- name: Child under 3 isn't eligible (person-level)
period: 2024
input:
age: 2
universal_childcare_entitlement_eligible: False
people:
child:
age: 2
universal_childcare_entitlement_eligible: False
output:
universal_childcare_entitlement: 0.0

- name: Child aged 3 is eligible (person-level)
period: 2024
input:
age: 3
universal_childcare_entitlement_eligible: True
people:
child:
age: 3
universal_childcare_entitlement_eligible: True
output:
universal_childcare_entitlement: 3351.60
universal_childcare_entitlement: 3_351.60

- name: Child aged 4 is eligible (person-level)
period: 2024
input:
age: 4
universal_childcare_entitlement_eligible: True
people:
child:
age: 4
universal_childcare_entitlement_eligible: True
output:
universal_childcare_entitlement: 3351.60
universal_childcare_entitlement: 3_351.60

- name: Parent (ineligible)
period: 2024
input:
age: 35
universal_childcare_entitlement_eligible: False
people:
parent:
age: 35
universal_childcare_entitlement_eligible: False
output:
universal_childcare_entitlement: 0.0

- name: Child aged 2 (ineligible)
period: 2024
input:
age: 2
universal_childcare_entitlement_eligible: False
people:
child:
age: 2
universal_childcare_entitlement_eligible: False
output:
universal_childcare_entitlement: 0.0

- name: Child aged 3 (eligible)
period: 2024
input:
age: 3
universal_childcare_entitlement_eligible: True
people:
child:
age: 3
universal_childcare_entitlement_eligible: True
output:
universal_childcare_entitlement: 3351.60
universal_childcare_entitlement: 3_351.60

- name: Child aged 4 (eligible)
period: 2024
input:
age: 4
universal_childcare_entitlement_eligible: True
people:
child:
age: 4
universal_childcare_entitlement_eligible: True
output:
universal_childcare_entitlement: 3351.60
universal_childcare_entitlement: 3_351.60

- name: Child aged 5 (ineligible)
period: 2024
input:
age: 5
universal_childcare_entitlement_eligible: False
people:
child:
age: 5
universal_childcare_entitlement_eligible: False
output:
universal_childcare_entitlement: 0.0
universal_childcare_entitlement: 0.0

- name: Child using fewer hours than maximum entitlement
period: 2024
input:
people:
child:
age: 3
universal_childcare_entitlement_eligible: True
max_free_entitlement_hours_used: 10
output:
universal_childcare_entitlement: 2_234.4 # 10 hours * 38 weeks * £5.88 per hour

- name: Child using half of maximum entitlement
period: 2024
input:
people:
child:
age: 3
universal_childcare_entitlement_eligible: True
max_free_entitlement_hours_used: 15
output:
universal_childcare_entitlement: 3_351.6 # 15 hours * 38 weeks * £5.88 per hour

- name: Child using exactly maximum entitlement
period: 2024
input:
people:
child:
age: 4
universal_childcare_entitlement_eligible: True
max_free_entitlement_hours_used: 15
output:
universal_childcare_entitlement: 3_351.6 # 15 hours * 38 weeks * £5.88 per hour

- name: Child using more than maximum entitlement (capped)
period: 2024
input:
people:
child:
age: 3
universal_childcare_entitlement_eligible: True
max_free_entitlement_hours_used: 20
output:
universal_childcare_entitlement: 3_351.6 # Capped at 15 hours * 38 weeks * £5.88 per hour
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class care_to_learn_eligible(Variable):
entity = Person
label = "eligible for Care to Learn childcare support"
definition_period = YEAR
defined_for = "would_claim_care_to_learn"

def formula(person, period, parameters):
# Link for instruction: https://www.gov.uk/care-to-learn/eligibility
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from policyengine_uk.model_api import *


class would_claim_care_to_learn(Variable):
value_type = bool
entity = BenUnit
label = "would claim Care to Learn"
documentation = (
"Whether this BenUnit would claim Care to Learn if eligible"
)
definition_period = YEAR
default_value = True
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ def formula(benunit, period, parameters):
age
)

# Get max hours used per child
max_hours_used = benunit.members(
"max_free_entitlement_hours_used", period
)

# Use the appropriate hours based on the condition
weekly_hours_to_use = min_(max_hours_used, weekly_hours_per_child)

# Compute weekly subsidy per child
weekly_subsidy_per_child = (
weekly_hours_per_child * p.childcare_funding_rate.calc(age)
weekly_hours_to_use * p.childcare_funding_rate.calc(age)
)

# Compute total annual expenses
return (
benunit.sum(weekly_subsidy_per_child)
* p.extended_childcare_entitlement.weeks_per_year
)
weeks = p.weeks_per_year
return benunit.sum(weekly_subsidy_per_child) * weeks
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class extended_childcare_entitlement_eligible(Variable):
entity = BenUnit
label = "eligibility for extended childcare entitlement"
definition_period = YEAR
defined_for = "would_claim_extended_childcare"

def formula(benunit, period, parameters):
# Check if household is in England
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from policyengine_uk.model_api import *


class would_claim_extended_childcare(Variable):
value_type = bool
entity = BenUnit
label = "would claim extended childcare entitlement"
documentation = "Whether this family would claim extended childcare entitlement if eligible"
definition_period = YEAR
default_value = True
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from policyengine_uk.model_api import *


class max_free_entitlement_hours_used(Variable):
value_type = float
entity = Person
label = "maximum hours of free childcare entitlement used"
documentation = "The maximum weekly hours of free childcare entitlement used by the person"
definition_period = YEAR
default_value = 30
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ def formula(person, period, parameters):
p.targeted_childcare_entitlement.hours_entitlement
* eligible_by_age
)
return hours * p.childcare_funding_rate.calc(age)
max_hours_used = person("max_free_entitlement_hours_used", period)
weeks = p.weeks_per_year
total_hours_used = max_hours_used * weeks

hours_to_use = min_(total_hours_used, hours)
return hours_to_use * p.childcare_funding_rate.calc(age)
Loading
Loading