-
Notifications
You must be signed in to change notification settings - Fork 27
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
Tax free childcare #1004
base: master
Are you sure you want to change the base?
Tax free childcare #1004
Conversation
@PavelMakarchuk could you please meet with @vahid-ahmadi on this? Probably easier than text review for getting the parameters and vectorization in for the first time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come initial comments but will meet to discuss in detail
basic_age_condition = (age < 12) | ||
age_under_17 = (age < 17) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to parameterize values such as "12" and "17" - in general we try to avoid hard coding any values that could be adjusted through a parameter reform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
# Combine conditions | ||
eligible = basic_age_condition | (age_under_17 & is_disabled) | ||
|
||
return benunit.any(eligible) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is a person level variable we do not need to add the benunit.any
condition
we want to return basic_age_condition | (age_under_17 & is_disabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a class
Use underscores when naming files instead of "-"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
class childcare_work_condition(Variable): | ||
value_type = bool | ||
entity = Person |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question for each of the files - do we want to compute this for each person or for the entire Benefit Unit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: Age thresholds for tax-free childcare eligibility, including standard and disability-related limits. | ||
metadata: | ||
unit: years | ||
name: childcare_age_limits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: childcare_age_limits |
@@ -0,0 +1,14 @@ | |||
description: Age thresholds for tax-free childcare eligibility, including standard and disability-related limits. | |||
metadata: | |||
unit: years |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit: years | |
unit: year |
metadata: | ||
unit: years | ||
name: childcare_age_limits | ||
label: Age limits for tax-free childcare eligibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label: Age limits for tax-free childcare eligibility | |
label: Age limits for tax-free childcare eligibility | |
period: year |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split this into three files:
folder: contributions
gc = parameters(period).gov.dwp.pension_credit.guarantee_credit | ||
standard_disability_benefits = gc.child.disability.eligibility | ||
severe_disability_benefits = gc.child.disability.severe.eligibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gc = parameters(period).gov.dwp.pension_credit.guarantee_credit | |
standard_disability_benefits = gc.child.disability.eligibility | |
severe_disability_benefits = gc.child.disability.severe.eligibility | |
gc = parameters(period).gov.dwp.pension_credit.guarantee_credit.child.disability | |
standard_disability_benefits = gc.eligibility | |
severe_disability_benefits = gc.severe.eligibility |
eligible = basic_age_condition | ( | ||
age_under_disability_limit & is_disabled | ||
) | ||
|
||
return eligible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eligible = basic_age_condition | ( | |
age_under_disability_limit & is_disabled | |
) | |
return eligible | |
return basic_age_condition | ( | |
age_under_disability_limit & is_disabled | |
) |
], | ||
) | ||
|
||
yearly_eligible_income = total_income - investment_income |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yearly_eligible_income = total_income - investment_income | |
yearly_eligible_income = max_(total_income - investment_income, 0) |
If the value cant be negative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can consolidate the adult and young adult files as follows:
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the .py file we can use it then as
age = person("age", period)
file_name.calc(age)
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of if, else
statements lets use where
conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We then want to create unit tests to check the formulas
Example test:
in a new incompatibilities_childcare_eligible.yaml
file:
- name: Ineligible due to all credits being 0
period: 2025
input:
working_tax_credit: 0
child_tax_credit: 0
universal_credit: 0
output:
incompatibilities_childcare_eligible: false
- name: Eligible due to universal credit
period: 2025
input:
working_tax_credit: 0
child_tax_credit: 0
universal_credit: 1
output:
incompatibilities_childcare_eligible: true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run:
policyengine-core test ./policyengine_uk/tests/policy/baseline.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the specific name of this program? Lets preface all variable class names with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
label = "Child age eligibility requirements" | ||
documentation = "Whether this person meets the age and disability requirements for eligibility" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be program specific in label and description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
from policyengine_uk.model_api import * | ||
|
||
|
||
class child_age_eligible(Variable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class child_age_eligible(Variable): | |
class tax_free_childcare_child_age_eligible(Variable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use in all variable classes and file names should match the class name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
).astype(bool) | ||
|
||
# Combine conditions using logical AND | ||
is_eligible = np.logical_and.reduce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets make a separate tax_free_childcare_eligible.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just make this for the BenefitUnit? Not sure if we need to examine each individual person here if all of the credits are computed for the benefit unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar question for all person level vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand, both parents can claim tax-free childcare. So, I think we need to check for each person here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a statutory reference for this case here, just to confirm
Overview
This PR implements the Tax-Free Childcare (TFC) scheme calculation in PolicyEngine UK. The scheme provides government contributions towards childcare costs for eligible families. (Documentation link)
Key Features
Fixes #1002