Skip to content

Commit 4b2de17

Browse files
authored
Handle looked-after children in Tax-Free Childcare (#1599)
1 parent 6aab317 commit 4b2de17

11 files changed

Lines changed: 124 additions & 23 deletions

File tree

changelog.d/1048.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added Tax-Free Childcare looked-after-child eligibility handling.

policyengine_uk/tests/policy/baseline/gov/hmrc/tax_free_childcare/is_child_receiving_tax_free_childcare.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,14 @@
5656
tax_free_childcare_child_age_eligible: true
5757
tax_free_childcare: 900
5858
output:
59-
is_child_receiving_tax_free_childcare: true
59+
is_child_receiving_tax_free_childcare: true
60+
61+
- name: Looked-after child with positive TFC amount - ineligible
62+
period: 2025
63+
input:
64+
person:
65+
tax_free_childcare_child_age_eligible: true
66+
is_looked_after_by_local_authority: true
67+
tax_free_childcare: 2_000
68+
output:
69+
is_child_receiving_tax_free_childcare: false

policyengine_uk/tests/policy/baseline/gov/hmrc/tax_free_childcare/tax_free_childcare.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
period: 2025
44
input:
55
tax_free_childcare_eligible: true
6-
is_parent: false
6+
tax_free_childcare_qualifying_child: true
77
is_disabled_for_benefits: false
88
childcare_expenses: 8_000
99
output:
@@ -13,7 +13,7 @@
1313
period: 2025
1414
input:
1515
tax_free_childcare_eligible: true
16-
is_parent: false
16+
tax_free_childcare_qualifying_child: true
1717
is_disabled_for_benefits: false
1818
childcare_expenses: 10_000
1919
output:
@@ -23,7 +23,7 @@
2323
period: 2025
2424
input:
2525
tax_free_childcare_eligible: true
26-
is_parent: false
26+
tax_free_childcare_qualifying_child: true
2727
is_disabled_for_benefits: true
2828
childcare_expenses: 16_000
2929
output:
@@ -33,7 +33,7 @@
3333
period: 2025
3434
input:
3535
tax_free_childcare_eligible: true
36-
is_parent: false
36+
tax_free_childcare_qualifying_child: true
3737
is_disabled_for_benefits: true
3838
childcare_expenses: 25_000
3939
output:
@@ -63,7 +63,7 @@
6363
period: 2025
6464
input:
6565
tax_free_childcare_eligible: true
66-
is_parent: false
66+
tax_free_childcare_qualifying_child: true
6767
is_disabled_for_benefits: false
6868
childcare_expenses: 1_000
6969
output:
@@ -73,9 +73,19 @@
7373
period: 2025
7474
input:
7575
tax_free_childcare_eligible: true
76-
is_parent: false
76+
tax_free_childcare_qualifying_child: true
7777
is_disabled_for_benefits: false
7878
childcare_expenses: 10_000
7979
tax_free_childcare_uses_qualifying_provider: false
8080
output:
8181
tax_free_childcare: 0
82+
83+
- name: Looked-after child gets no support
84+
period: 2025
85+
input:
86+
tax_free_childcare_eligible: true
87+
tax_free_childcare_child_age_eligible: true
88+
is_looked_after_by_local_authority: true
89+
childcare_expenses: 8_000
90+
output:
91+
tax_free_childcare: 0

policyengine_uk/tests/policy/baseline/gov/hmrc/tax_free_childcare/tax_free_childcare_eligibility.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
- name: All conditions met
33
period: 2025
44
input:
5-
tax_free_childcare_child_age_eligible: true
5+
tax_free_childcare_qualifying_child: true
66
tax_free_childcare_meets_income_requirements: true
77
tax_free_childcare_program_eligible: true
88
tax_free_childcare_work_condition: true
99
output:
1010
tax_free_childcare_eligible: true
1111

12-
- name: Fails age condition only
12+
- name: Fails qualifying child condition only
1313
period: 2025
1414
input:
15-
tax_free_childcare_child_age_eligible: false
15+
tax_free_childcare_qualifying_child: false
1616
tax_free_childcare_meets_income_requirements: true
1717
tax_free_childcare_program_eligible: true
1818
tax_free_childcare_work_condition: true
@@ -22,7 +22,7 @@
2222
- name: Fails income condition only
2323
period: 2025
2424
input:
25-
tax_free_childcare_child_age_eligible: true
25+
tax_free_childcare_qualifying_child: true
2626
tax_free_childcare_meets_income_requirements: false
2727
tax_free_childcare_program_eligible: true
2828
tax_free_childcare_work_condition: true
@@ -33,7 +33,7 @@
3333
- name: Fails work condition only
3434
period: 2025
3535
input:
36-
tax_free_childcare_child_age_eligible: true
36+
tax_free_childcare_qualifying_child: true
3737
tax_free_childcare_meets_income_requirements: true
3838
tax_free_childcare_program_eligible: true
3939
tax_free_childcare_work_condition: false
@@ -43,9 +43,20 @@
4343
- name: Fails all conditions
4444
period: 2025
4545
input:
46-
tax_free_childcare_child_age_eligible: false
46+
tax_free_childcare_qualifying_child: false
4747
tax_free_childcare_meets_income_requirements: false
4848
tax_free_childcare_program_eligible: false
4949
tax_free_childcare_work_condition: false
5050
output:
5151
tax_free_childcare_eligible: false
52+
53+
- name: Fails because child is looked after by a local authority
54+
period: 2025
55+
input:
56+
tax_free_childcare_child_age_eligible: true
57+
is_looked_after_by_local_authority: true
58+
tax_free_childcare_meets_income_requirements: true
59+
tax_free_childcare_program_eligible: true
60+
tax_free_childcare_work_condition: true
61+
output:
62+
tax_free_childcare_eligible: false
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
- name: Age-eligible non-parent child is qualifying
2+
period: 2025
3+
input:
4+
tax_free_childcare_child_age_eligible: true
5+
is_parent: false
6+
is_looked_after_by_local_authority: false
7+
output:
8+
tax_free_childcare_qualifying_child: true
9+
10+
- name: Parent is not a qualifying child
11+
period: 2025
12+
input:
13+
tax_free_childcare_child_age_eligible: true
14+
is_parent: true
15+
is_looked_after_by_local_authority: false
16+
output:
17+
tax_free_childcare_qualifying_child: false
18+
19+
- name: Looked-after child is not qualifying
20+
period: 2025
21+
input:
22+
tax_free_childcare_child_age_eligible: true
23+
is_parent: false
24+
is_looked_after_by_local_authority: true
25+
output:
26+
tax_free_childcare_qualifying_child: false
27+
28+
- name: Age-ineligible child is not qualifying
29+
period: 2025
30+
input:
31+
tax_free_childcare_child_age_eligible: false
32+
is_parent: false
33+
is_looked_after_by_local_authority: false
34+
output:
35+
tax_free_childcare_qualifying_child: false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from policyengine_uk.model_api import *
2+
3+
4+
class tax_free_childcare_qualifying_child(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = "qualifying child for tax-free childcare"
8+
definition_period = YEAR
9+
reference = [
10+
"https://www.legislation.gov.uk/uksi/2015/448/regulation/4",
11+
"https://www.legislation.gov.uk/uksi/2015/448/regulation/5",
12+
]
13+
14+
def formula(person, period, parameters):
15+
meets_age_condition = person(
16+
"tax_free_childcare_child_age_eligible",
17+
period,
18+
)
19+
is_parent = person("is_parent", period)
20+
looked_after_by_local_authority = person(
21+
"is_looked_after_by_local_authority",
22+
period,
23+
)
24+
return meets_age_condition & ~is_parent & ~looked_after_by_local_authority

policyengine_uk/variables/gov/hmrc/tax_free_childcare/is_child_receiving_tax_free_childcare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class is_child_receiving_tax_free_childcare(Variable):
88
definition_period = YEAR
99

1010
def formula(person, period, parameters):
11-
# Check if child meets the age condition
12-
meets_age_condition = person("tax_free_childcare_child_age_eligible", period)
11+
# Check if child is qualifying for tax-free childcare
12+
is_qualifying_child = person("tax_free_childcare_qualifying_child", period)
1313

1414
# Check if tax-free childcare contribution is greater than 0
1515
tfc_amount = person("tax_free_childcare", period)
1616

1717
# Child is eligible if:
18-
# 1. Meets the age condition AND
18+
# 1. Child is qualifying AND
1919
# 2. Tax-free childcare amount > 0
20-
return meets_age_condition & (tfc_amount > 0)
20+
return is_qualifying_child & (tfc_amount > 0)

policyengine_uk/variables/gov/hmrc/tax_free_childcare/tax_free_childcare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def formula(person, period, parameters):
1515
p = parameters(period).gov.hmrc.tax_free_childcare.contribution
1616

1717
# Calculate per-person amounts
18-
is_parent = person("is_parent", period)
1918
is_disabled = person("is_disabled_for_benefits", period)
2019
is_blind = person("is_blind", period)
20+
is_qualifying_child = person("tax_free_childcare_qualifying_child", period)
2121

2222
# Person gets higher amount if either disabled or blind
2323
qualifies_for_higher_amount = is_disabled | is_blind
@@ -35,7 +35,7 @@ def formula(person, period, parameters):
3535
# Cap the contribution at the maximum amounts
3636
max_amount = (
3737
where(qualifies_for_higher_amount, p.disabled_child, p.standard_child)
38-
* ~is_parent
38+
* is_qualifying_child
3939
)
4040

4141
return min_(contribution, max_amount)

policyengine_uk/variables/gov/hmrc/tax_free_childcare/tax_free_childcare_eligibility.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class tax_free_childcare_eligible(Variable):
99
defined_for = "would_claim_tfc"
1010

1111
def formula(benunit, period, parameters):
12-
meets_age_condition = benunit.any(
13-
benunit.members("tax_free_childcare_child_age_eligible", period),
12+
has_qualifying_child = benunit.any(
13+
benunit.members("tax_free_childcare_qualifying_child", period),
1414
)
1515

1616
meets_income_condition = benunit.all(
@@ -24,7 +24,7 @@ def formula(benunit, period, parameters):
2424

2525
return np.logical_and.reduce(
2626
[
27-
meets_age_condition,
27+
has_qualifying_child,
2828
meets_income_condition,
2929
childcare_eligible,
3030
work_eligible,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from policyengine_uk.model_api import *
2+
3+
4+
class is_looked_after_by_local_authority(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = "looked after by a local authority"
8+
definition_period = YEAR
9+
default_value = False
10+
reference = "https://www.legislation.gov.uk/uksi/2015/448/regulation/4"

0 commit comments

Comments
 (0)