Skip to content

Commit

Permalink
Edit py files
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-ahmadi committed Feb 13, 2025
1 parent 2ddcb4b commit 53d7db2
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
description: The Department for Education converts childcare hours into expenses for targeted childcare entitlement at these rates.
metadata:
type: single_amount
threshold_unit: year
amount_unit: currency-GBP
label: Targeted childcare entitlement hourly rates
reference:
- title: Different rates for targeted childcare entitlement
href:
- https://www.nurseryworld.co.uk/content/news/dfe-confirms-extended-30-hours-funding-rates-but-sector-says-they-dont-reflect-the-real-delivery-cost/
- https://www.gov.uk/government/news/childcare-settings-receive-cash-boost-as-funding-rates-increase
- title: Commons Library
href: https://commonslibrary.parliament.uk/research-briefings/cbp-8052/
values:
2015-01-01: 8.28
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
description: The Department for Education provides targeted childcare entitlement in England for specific age brackets
description: The Department for Education provides targeted childcare entitlement in England.
metadata:
type: single_amount
type: scale
threshold_unit: year
label: "Age eligibility for targeted 2-year-old childcare entitlement"
reference:
- title: The Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014 - regulation 3
- 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: Document for 15 hours free education and childcare for 2-year old
- 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: Document for 15 hours free education and childcare for 2-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-2-year-olds-claim-benefits?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b

brackets:
- threshold:
2015-01-01: 0
amount:
values:
2015-01-01: false
2015-01-01: 0
- threshold:
2015-01-01: 2
amount:
values:
2015-01-01: true
2015-01-01: 570
- threshold:
2015-01-01: 3
amount:
values:
2015-01-01: false
2015-01-01: 0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
description: The Department for Education sets an income threshold for Tax Credits recipients to be eligible for 15 hours free education and childcare for 2-year old.
description: The Department for Education sets an income threshold for Tax Credit recipients to be eligible for targeted childcare entitlement.
metadata:
unit: GBP
period: year
label: Income threshold for tax Credits recipients
label: Income threshold for Tax Credit recipients
reference:
- title: The Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014, part 1.2.b
href: https://www.legislation.gov.uk/uksi/2014/2147/regulation/1/made
- title: Document for 15 hours free education and childcare for 2-year old
- title: Document for 15 hours free education and childcare for 2-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-2-year-olds-claim-benefits?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b
values:
2015-01-01: 16_190

2015-01-01: 16_190
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
description: The Department for Education sets an income threshold for Universal Credit recipients to be eligible 15 hours free education and childcare for 2-year old.
# The threshold is set by statutory guidance, not legislation. A 2018 Department for Education response introduced this net earnings limit for free childcare eligibility.
description: The Department for Education sets an income threshold for Universal Credit recipients to be eligible for targeted childcare entitlement.
metadata:
unit: GBP
period: year
label: Income threshold for Universal Credit recipients
reference:
- title: Document for Eligibility for free school meals, the early years pupil premium and the free early education entitlement for two-year-olds under Universal Credit - page 5
href: https://assets.publishing.service.gov.uk/media/5ab270baed915d4f2d097124/Government_response_FSM_and_EY_entitlements_under_Universal_Credit.pdf?utm_source=chatgpt.com
- title: Document for 15 hours free education and childcare for 2-year old
- title: Document for Eligibility for free school meals, the early years pupil premium and the free early education entitlement for two-year-olds under Universal Credit (Page 5)
href: https://assets.publishing.service.gov.uk/media/5ab270baed915d4f2d097124/Government_response_FSM_and_EY_entitlements_under_Universal_Credit.pdf
- title: Document for 15 hours free education and childcare for 2-year-olds
href: https://www.gov.uk/help-with-childcare-costs/free-childcare-2-year-olds-claim-benefits?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b
values:
2015-01-01: 15_400
2015-01-01: 15_400
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
description: List of qualifying benefits for targeted childcare entitlement eligibility assessment
description: The Department for Education designates these programs as qualifying benefits for the targeted childcare entitlement eligibility.
metadata:
reference:
- title: Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014 - 1.a to 1.g
- title: Local Authority (Duty to Secure Early Years Provision Free of Charge) Regulations 2014 - paragraphs 1.a to 1.g
href: https://www.legislation.gov.uk/uksi/2014/2147/regulation/1/made#f00009
period: year
unit: program
label: Qualifying benefits for targeted childcare entitlement (childcare for 2 year olds)
label: Qualifying benefits for targeted childcare entitlement
values:
2015-01-01:
- jsa_income
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class targeted_childcare_entitlement_combine_benefits(Variable):
value_type = bool
entity = BenUnit
label = "Eligible for Targeted childcare entitlement based on benefits"
label = "Eligible for targeted childcare entitlement based on benefits"
definition_period = YEAR
# details for implementation: https://www.gov.uk/help-with-childcare-costs/free-childcare-2-year-olds-claim-benefits?step-by-step-nav=f237ec8e-e82c-4ffa-8fba-2a88a739783b

Expand All @@ -27,25 +27,25 @@ def formula(benunit, period, parameters):
p.qualifying_benefits,
)

# Get universal credit receipt specifically for income test
receives_universal_credit = benunit("universal_credit", period) > 0
# Combine CTC + WTC
ctc_wtc = add(benunit, period, ["child_tax_credit", "working_tax_credit"])
receives_ctc_wtc = ctc_wtc > 0

# Get tax credits receipt specifically for income test
receives_child_tax_credit = benunit("child_tax_credit", period) > 0
receives_working_tax_credit = benunit("working_tax_credit", period) > 0
# Universal credit receipt specifically for income test
receives_universal_credit = benunit("universal_credit", period) > 0

# Check Universal Credit with income threshold
meets_universal_credit_income = receives_universal_credit & (
adjusted_income <= p.income_threshold_with_universal_credit
)

# Check Tax Credits with income threshold
meets_tax_credits_income = (
receives_child_tax_credit | receives_working_tax_credit
) & (benunit_income <= p.income_threshold_with_tax_credits)
meets_tax_credits_income = (receives_ctc_wtc) & (
benunit_income <= p.income_threshold_with_tax_credits
)

return (
(qualifying_benefits > 0) # Any qualifying benefit
| meets_universal_credit_income # Universal Credit with income threshold
| meets_tax_credits_income # Tax Credits with income threshold
| meets_tax_credits_income # Tax Credits with income threshold
)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,20 @@

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

def formula(benunit, period, parameters):
# Get age eligibility status for targeted entitlement
targeted_eligible_age = benunit(
"targeted_childcare_entitlement_eligibility", period
)
def formula(person, period, parameters):
p = parameters(period).gov.dwp.targeted_childcare_entitlement

# Get eligibility status for targeted entitlement
targeted_eligible = benunit(
"targeted_childcare_entitlement_combine_benefits", # Changed this line
period,
)
# 1) Does the person's benefit unit meet targeted childcare entitlement criteria?
targeted_eligible = person.benunit("targeted_childcare_entitlement_combine_benefits", period)

# Use hours directly from parameters file
p = parameters(period).gov.dwp.targeted_childcare_entitlement
# 2) Calculate hours based on age using your bracket structure
age = person("age", period)
hours_by_age = p.hours_by_age.calc(age) # rename as needed if your YAML's param is different

# Return hours if either eligible, 0 if not
return where(
targeted_eligible_age | targeted_eligible, p.hours_per_year, 0
)
# 3) If the benefit unit is eligible, return hours_by_age; otherwise 0
return where(targeted_eligible, hours_by_age, 0)

0 comments on commit 53d7db2

Please sign in to comment.