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

Targeted childcare entitlement #1013

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
46 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
10bfdb3
Create targeted childcare entitlement files
vahid-ahmadi Jan 24, 2025
3bc607d
Add eligibility conditions
vahid-ahmadi Jan 24, 2025
4353765
Add unit tests and improve the code
vahid-ahmadi Jan 29, 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
Prev Previous commit
Next Next commit
Replace if with where
vahid-ahmadi committed Jan 13, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5c6d359cd1942a194b00a831147625274f1bcd01
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
description: Income thresholds for tax-free childcare eligibility - adult category
description: Income thresholds for tax-free childcare eligibility
metadata:
period: year
label: Adult income thresholds for tax-free childcare eligibility
label: Income thresholds for tax-free childcare eligibility
reference:
- title: Childcare Payments Act
href: https://www.legislation.gov.uk/ukdsi/2015/9780111127063
- title: Tax-Free Childcare Guidance
href: https://www.gov.uk/tax-free-childcare?step-by-step-nav=d78aeaf6-1747-4d72-9619-f16efb4dd89d

quarterly_income:
values:
2015-01-01: 2379
metadata:
unit: currency-GBP

min_age:
values:
2015-01-01: 21
metadata:
unit: year
period: year
brackets:
- threshold:
2015-01-01: 0
amount:
2015-01-01: 0
- threshold:
2015-01-01: 18
amount:
2015-01-01: 1_788
- threshold:
2015-01-01: 21
amount:
2015-01-01: 2_379

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from policyengine_uk.model_api import *


class child_age_eligible(Variable):
value_type = bool
entity = Person
@@ -22,8 +21,8 @@ def formula(person, period, parameters):
age_limits = parameters(
period
).gov.hmrc.childcare_subsidies.tax_free_childcare.age
standard_age_limit = age_limits.standard.values
disability_age_limit = age_limits.disability.values
standard_age_limit = age_limits.standard
disability_age_limit = age_limits.disability

# Check disability conditions
gc = parameters(
@@ -42,4 +41,4 @@ def formula(person, period, parameters):
age_under_disability_limit = age < disability_age_limit

# Combine conditions
return basic_age_condition | (age_under_disability_limit & is_disabled)
return basic_age_condition | (age_under_disability_limit & is_disabled)
Original file line number Diff line number Diff line change
@@ -33,36 +33,14 @@ def formula(person, period, parameters):
)

yearly_eligible_income = max_(total_income - investment_income, 0)
quarterly_income = yearly_eligible_income / 4

# Get income thresholds from parameters
# Get required income threshold based on age
income_limits = parameters(
period
).gov.hmrc.childcare_subsidies.tax_free_childcare.income_thresholds
quarterly_income = yearly_eligible_income / 4

# Age >= 21
meets_adult_condition = (age >= income_limits.adult.min_age.values) & (
quarterly_income >= income_limits.adult.quarterly_income.values
)

# Age 18-20
meets_young_adult_condition = (
(age >= income_limits.young_adult.min_age.values)
& (age <= income_limits.young_adult.max_age.values)
& (
quarterly_income
>= income_limits.young_adult.quarterly_income.values
)
)

# Age < 18
meets_youth_condition = (
age < income_limits.young_adult.min_age.values
) & (quarterly_income >= income_limits.youth.quarterly_income.values)

# Combine all conditions
return (
meets_adult_condition
| meets_young_adult_condition
| meets_youth_condition
)

required_threshold = income_limits.calc(age)

# Compare quarterly income to required threshold
return quarterly_income >= required_threshold
Original file line number Diff line number Diff line change
@@ -40,10 +40,14 @@ def formula(benunit, period, parameters):
# Determine the maximum eligible childcare cost for a single child
max_amount = 0
for child in benunit.members("is_child", period):
if is_eligible[child]:
if child("is_disabled", period):
max_amount = p.disabled_child.values
else:
max_amount = p.standard_child.values

return where(is_eligible, max_amount, 0)
max_amount = where(
is_eligible[child],
where(
child("is_disabled", period),
p.disabled_child.values,
p.standard_child.values
),
max_amount
)

return where(is_eligible, max_amount, 0)