Skip to content

Commit 65f2d5a

Browse files
authored
Add child eligible variables for childcare programs (#1112)
* Add child eligible variables * Rename tfc * Rename targeted * Rename universal and extended * Add changelog
1 parent 152af3c commit 65f2d5a

File tree

9 files changed

+337
-0
lines changed

9 files changed

+337
-0
lines changed

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: minor
2+
changes:
3+
added:
4+
- Child eligible variables for childcare programs.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
- name: Child age 2 with positive entitlement - eligible
2+
period: 2025
3+
input:
4+
person:
5+
age: 2
6+
benunit:
7+
members: [person]
8+
extended_childcare_entitlement: 3000
9+
output:
10+
is_child_receiving_extended_childcare: true
11+
12+
- name: Child age 4 with positive entitlement - eligible
13+
period: 2025
14+
input:
15+
person:
16+
age: 4
17+
benunit:
18+
members: [person]
19+
extended_childcare_entitlement: 5000
20+
output:
21+
is_child_receiving_extended_childcare: true
22+
23+
- name: Child age 3 with zero entitlement - ineligible
24+
period: 2025
25+
input:
26+
person:
27+
age: 3
28+
benunit:
29+
members: [person]
30+
extended_childcare_entitlement: 0
31+
output:
32+
is_child_receiving_extended_childcare: false
33+
34+
- name: Child age 5 with positive entitlement - ineligible due to age
35+
period: 2025
36+
input:
37+
person:
38+
age: 5
39+
benunit:
40+
members: [person]
41+
extended_childcare_entitlement: 4000
42+
output:
43+
is_child_receiving_extended_childcare: false
44+
45+
- name: Child age 0 with positive entitlement - ineligible due to age
46+
period: 2025
47+
input:
48+
person:
49+
age: 0
50+
benunit:
51+
members: [person]
52+
extended_childcare_entitlement: 2000
53+
output:
54+
is_child_receiving_extended_childcare: false
55+
56+
- name: Child age 0.75 with positive entitlement - eligible (2025 parameter)
57+
period: 2025
58+
input:
59+
person:
60+
age: 0.75
61+
benunit:
62+
members: [person]
63+
extended_childcare_entitlement: 1500
64+
output:
65+
is_child_receiving_extended_childcare: true
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
- name: Child age 2 with positive entitlement - eligible
2+
period: 2025
3+
input:
4+
person:
5+
age: 2
6+
targeted_childcare_entitlement: 2000
7+
output:
8+
is_child_receiving_targeted_childcare: true
9+
10+
- name: Child age 2.5 with positive entitlement - eligible
11+
period: 2025
12+
input:
13+
person:
14+
age: 2.5
15+
targeted_childcare_entitlement: 1500
16+
output:
17+
is_child_receiving_targeted_childcare: true
18+
19+
- name: Child age 2 with zero entitlement - ineligible
20+
period: 2025
21+
input:
22+
person:
23+
age: 2
24+
targeted_childcare_entitlement: 0
25+
output:
26+
is_child_receiving_targeted_childcare: false
27+
28+
- name: Child age 3 with positive entitlement - ineligible due to age
29+
period: 2025
30+
input:
31+
person:
32+
age: 3
33+
targeted_childcare_entitlement: 2500
34+
output:
35+
is_child_receiving_targeted_childcare: false
36+
37+
- name: Child age 1 with positive entitlement - ineligible due to age
38+
period: 2025
39+
input:
40+
person:
41+
age: 1
42+
targeted_childcare_entitlement: 1800
43+
output:
44+
is_child_receiving_targeted_childcare: false
45+
46+
- name: Child age 2.9 with positive entitlement - eligible
47+
period: 2025
48+
input:
49+
person:
50+
age: 2.9
51+
targeted_childcare_entitlement: 2200
52+
output:
53+
is_child_receiving_targeted_childcare: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
- name: Child age 3 with positive entitlement - eligible
2+
period: 2025
3+
input:
4+
person:
5+
age: 3
6+
universal_childcare_entitlement: 2000
7+
output:
8+
is_child_receiving_universal_childcare: true
9+
10+
- name: Child age 4 with positive entitlement - eligible
11+
period: 2025
12+
input:
13+
person:
14+
age: 4
15+
universal_childcare_entitlement: 3000
16+
output:
17+
is_child_receiving_universal_childcare: true
18+
19+
- name: Child age 3 with zero entitlement - ineligible
20+
period: 2025
21+
input:
22+
person:
23+
age: 3
24+
universal_childcare_entitlement: 0
25+
output:
26+
is_child_receiving_universal_childcare: false
27+
28+
- name: Child age 5 with positive entitlement - ineligible due to age
29+
period: 2025
30+
input:
31+
person:
32+
age: 5
33+
universal_childcare_entitlement: 2500
34+
output:
35+
is_child_receiving_universal_childcare: false
36+
37+
- name: Child age 2 with positive entitlement - ineligible due to age
38+
period: 2025
39+
input:
40+
person:
41+
age: 2
42+
universal_childcare_entitlement: 1500
43+
output:
44+
is_child_receiving_universal_childcare: false
45+
46+
- name: Child age 4.9 with positive entitlement - eligible
47+
period: 2025
48+
input:
49+
person:
50+
age: 4.9
51+
universal_childcare_entitlement: 2800
52+
output:
53+
is_child_receiving_universal_childcare: true
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
- name: Child under 12 with positive TFC amount - eligible
2+
period: 2025
3+
input:
4+
person:
5+
age: 8
6+
tax_free_childcare_child_age_eligible: true
7+
tax_free_childcare: 2000
8+
output:
9+
is_child_receiving_tax_free_childcare: true
10+
11+
- name: Child under 12 with zero TFC amount - ineligible
12+
period: 2025
13+
input:
14+
person:
15+
age: 7
16+
tax_free_childcare_child_age_eligible: true
17+
tax_free_childcare: 0
18+
output:
19+
is_child_receiving_tax_free_childcare: false
20+
21+
- name: Disabled child under 17 with positive TFC amount - eligible
22+
period: 2025
23+
input:
24+
person:
25+
age: 15
26+
tax_free_childcare_child_age_eligible: true
27+
tax_free_childcare: 4000
28+
output:
29+
is_child_receiving_tax_free_childcare: true
30+
31+
- name: Child over age limit with positive TFC amount - ineligible
32+
period: 2025
33+
input:
34+
person:
35+
age: 13
36+
tax_free_childcare_child_age_eligible: false
37+
tax_free_childcare: 2500
38+
output:
39+
is_child_receiving_tax_free_childcare: false
40+
41+
- name: Young child with positive TFC amount - eligible
42+
period: 2025
43+
input:
44+
person:
45+
age: 3
46+
tax_free_childcare_child_age_eligible: true
47+
tax_free_childcare: 1000
48+
output:
49+
is_child_receiving_tax_free_childcare: true
50+
51+
- name: Infant with positive TFC amount - eligible
52+
period: 2025
53+
input:
54+
person:
55+
age: 1
56+
tax_free_childcare_child_age_eligible: true
57+
tax_free_childcare: 900
58+
output:
59+
is_child_receiving_tax_free_childcare: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from policyengine_uk.model_api import *
2+
3+
4+
class is_child_receiving_extended_childcare(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = "child is eligible for extended childcare entitlement"
8+
definition_period = YEAR
9+
10+
def formula(person, period, parameters):
11+
# Get child's age
12+
age = person("age", period)
13+
14+
# Get the parameters for extended childcare entitlement hours by age
15+
p = parameters(period).gov.dfe.extended_childcare_entitlement
16+
17+
# Check if hours > 0 for this age (using the hours parameter)
18+
hours_by_age = p.hours.calc(age)
19+
20+
# Get the benefit unit's extended childcare entitlement amount
21+
benunit = person.benunit
22+
entitlement_amount = benunit("extended_childcare_entitlement", period)
23+
24+
# Child is eligible if:
25+
# 1. Hours > 0 for this age AND
26+
# 2. Benefit unit's entitlement amount > 0
27+
return (hours_by_age > 0) & (entitlement_amount > 0)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from policyengine_uk.model_api import *
2+
3+
4+
class is_child_receiving_targeted_childcare(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = "child is eligible for targeted childcare entitlement based on age and entitlement"
8+
definition_period = YEAR
9+
10+
def formula(person, period, parameters):
11+
# Get child's age
12+
age = person("age", period)
13+
14+
# Get the parameters for targeted childcare entitlement age eligibility
15+
p = parameters(period).gov.dfe.targeted_childcare_entitlement
16+
17+
# Check if age is eligible
18+
age_eligible = p.age_eligibility.calc(age)
19+
20+
# Get the targeted childcare entitlement amount
21+
entitlement_amount = person("targeted_childcare_entitlement", period)
22+
23+
# Child is eligible if:
24+
# 1. Age is eligible AND
25+
# 2. Targeted childcare entitlement amount > 0
26+
return age_eligible & (entitlement_amount > 0)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from policyengine_uk.model_api import *
2+
3+
4+
class is_child_receiving_universal_childcare(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = "child is eligible for universal childcare entitlement based on age and entitlement"
8+
definition_period = YEAR
9+
10+
def formula(person, period, parameters):
11+
# Get child's age
12+
age = person("age", period)
13+
14+
# Get the parameters for universal childcare entitlement
15+
p = parameters(period).gov.dfe.universal_childcare_entitlement
16+
17+
# Check if age is within eligible range
18+
meets_age_condition = (age >= p.min_age) & (age < p.max_age)
19+
20+
# Get the universal childcare entitlement amount
21+
entitlement_amount = person("universal_childcare_entitlement", period)
22+
23+
# Child is eligible if:
24+
# 1. Age meets the condition AND
25+
# 2. Universal childcare entitlement amount > 0
26+
return meets_age_condition & (entitlement_amount > 0)
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 is_child_receiving_tax_free_childcare(Variable):
5+
value_type = bool
6+
entity = Person
7+
label = (
8+
"child is eligible for tax-free childcare based on age and entitlement"
9+
)
10+
definition_period = YEAR
11+
12+
def formula(person, period, parameters):
13+
# Check if child meets the age condition
14+
meets_age_condition = person(
15+
"tax_free_childcare_child_age_eligible", period
16+
)
17+
18+
# Check if tax-free childcare contribution is greater than 0
19+
tfc_amount = person("tax_free_childcare", period)
20+
21+
# Child is eligible if:
22+
# 1. Meets the age condition AND
23+
# 2. Tax-free childcare amount > 0
24+
return meets_age_condition & (tfc_amount > 0)

0 commit comments

Comments
 (0)