-
Notifications
You must be signed in to change notification settings - Fork 33
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
Alberta Infirm Dependants Credit #491
Draft
SirMalamute
wants to merge
18
commits into
PolicyEngine:master
Choose a base branch
from
SirMalamute:albertainfirm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+262
−0
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3859edd
Alberta infirm dependant credit
oliviacaiww 3c1e570
Alberta infirm dependant credit
oliviacaiww d9a9706
changes
oliviacaiww 9fec51e
Alberta infirm dependant credit
oliviacaiww 0233041
fixes
oliviacaiww 87d54df
Alberta infirm dependant credit
oliviacaiww 3432c01
Alberta infirm dependant credit
oliviacaiww 788d13c
Merge branch 'PolicyEngine:master' into oliviacaiww/issue330
oliviacaiww 69e04b7
Alberta infirm dependant credit
oliviacaiww 8ddf52f
Alberta infirm dependant credit
oliviacaiww 572b092
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
PavelMakarchuk b22ce51
minor changes
PavelMakarchuk 0fc4c24
minor
SirMalamute 28a14aa
added 2022 + tests
SirMalamute b62c738
minor
SirMalamute b575d7c
minor
SirMalamute 9ab312d
renamed
SirMalamute 1045898
format
SirMalamute File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- bump: minor | ||
changes: | ||
added: | ||
- Alberta infirm dependant credit. |
16 changes: 16 additions & 0 deletions
16
...canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/age_threshold.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
description: Alberta provides the infirm dependant amount for filers with dependant at or above this age threshold. | ||
|
||
values: | ||
2022-01-01: 18 | ||
metadata: | ||
unit: year | ||
label: Alberta infirm dependant amount minimum dependant age | ||
reference: | ||
- title: Alberta 2023 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 | ||
- title: Alberta 2023 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 | ||
- title: Alberta 2022 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 | ||
- title: Alberta 2022 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 |
19 changes: 19 additions & 0 deletions
19
...cyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
description: Alberta provides this maximum amount under the infirm dependant credit. | ||
values: | ||
2023-01-01: 12_158 | ||
2022-01-01: 11_212 | ||
metadata: | ||
unit: currency-CAD | ||
period: year | ||
label: Alberta infirm dependant credit maximum amount | ||
reference: | ||
- title: Alberta 2023 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 | ||
- title: Alberta 2023 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 | ||
- title: Alberta 2022 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 | ||
- title: Alberta 2022 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
...ada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/income_threshold.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
description: Alberta provides the infirm dependant amount for filers with income of up to this threshold. | ||
values: | ||
2023-01-01: 20_190 | ||
2022-01-01: 18_619 | ||
metadata: | ||
unit: currency-CAD | ||
period: year | ||
label: Alberta infirm dependant credit max income | ||
reference: | ||
- title: Alberta 2023 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 | ||
- title: Alberta 2023 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 | ||
- title: Alberta 2022 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 | ||
- title: Alberta 2022 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 | ||
|
18 changes: 18 additions & 0 deletions
18
...nada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
description: Alberta phases the infirm dependant amount out above this dependant income threshold. | ||
values: | ||
2023-01-01: 8_032 | ||
2022-01-01: 7_407 | ||
metadata: | ||
unit: currency-CAD | ||
period: year | ||
label: Alberta infirm dependant phase out start | ||
reference: | ||
- title: Alberta 2023 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 | ||
- title: Alberta 2023 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 | ||
- title: Alberta 2022 personal tax credits return TD1AB | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 | ||
- title: Alberta 2022 personal tax credits return worksheet TD1AB-WS | ||
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 | ||
|
123 changes: 123 additions & 0 deletions
123
...nada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
- name: Infirm dependant net income below 8_032 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 8_000 | ||
household: | ||
members: p1 | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 12_158 | ||
|
||
- name: Infirm dependant net income below 7_407 | ||
period: 2022 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 7_000 | ||
household: | ||
members: p1 | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 11_212 | ||
|
||
- name: Infirm dependant net income over 8_032 but lower than 20_190 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 20_000 | ||
household: | ||
members: p1 | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 190 | ||
|
||
|
||
- name: Infirm dependant net income over 8_032 but lower than 20_190 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 20_000 | ||
household: | ||
members: p1 | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 190 | ||
|
||
- name: Infirm dependant net income over 20_190 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 30_190 | ||
household: | ||
members: p1 | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 0 | ||
|
||
|
||
- name: Multiple infirm dependants with high income over than 20_190 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: No | ||
infirm_dependant_income: 0 | ||
p2: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 30_190 | ||
p3: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 30_190 | ||
household: | ||
members: [p1, p2, p3] | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 0 | ||
|
||
- name: Multiple infirm dependants with low income less than 8_032 | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: No | ||
infirm_dependant_income: 0 | ||
p2: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 800 | ||
p3: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 300 | ||
household: | ||
members: [p1, p2, p3] | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 24_316 | ||
|
||
- name: Multiple infirm dependants with high income and low income | ||
period: 2023 | ||
input: | ||
people: | ||
p1: | ||
is_infirm_dependant: No | ||
infirm_dependant_income: 0 | ||
p2: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 20_000 | ||
p3: | ||
is_infirm_dependant: true | ||
infirm_dependant_income: 800 | ||
household: | ||
members: [p1, p2, p3] | ||
province_code: AB | ||
output: | ||
ab_infirm_dependant_credit: 12_348 |
36 changes: 36 additions & 0 deletions
36
...iables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from policyengine_canada.model_api import * | ||
|
||
|
||
class ab_infirm_dependant_credit(Variable): | ||
value_type = float | ||
entity = Household | ||
label = "Alberta infirm dependant credit" | ||
definition_period = YEAR | ||
defined_for = ProvinceCode.AB | ||
|
||
def formula(household, period, parameters): | ||
person = household.members | ||
p = parameters( | ||
period | ||
).gov.provinces.ab.tax.income.credits.infirm_dependant | ||
|
||
eligible = person("is_infirm_dependant", period) | ||
|
||
infirm_dependant_income = person("infirm_dependant_income", period) | ||
|
||
income_level_condition = infirm_dependant_income > p.phase_out_start | ||
|
||
max_credit = eligible * p.base | ||
|
||
reduced_threshold = max_( | ||
0, p.income_threshold - infirm_dependant_income | ||
) | ||
|
||
partial_credit = eligible * reduced_threshold | ||
|
||
capped_credit = where( | ||
income_level_condition, | ||
partial_credit, | ||
max_credit, | ||
) | ||
return household.sum(capped_credit) |
13 changes: 13 additions & 0 deletions
13
policyengine_canada/variables/household/person/infirm_dependant_income.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from policyengine_canada.model_api import * | ||
|
||
|
||
class infirm_dependant_income(Variable): | ||
value_type = float | ||
entity = Person | ||
label = "Infirm dependant income" | ||
definition_period = YEAR | ||
|
||
def formula(person, period, parameters): | ||
infirm_dependant = person("is_infirm_dependant", period) | ||
income = person("individual_net_income", period) | ||
return infirm_dependant * income |
15 changes: 15 additions & 0 deletions
15
policyengine_canada/variables/household/person/is_infirm_dependant.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from policyengine_canada.model_api import * | ||
|
||
|
||
class is_infirm_dependant(Variable): | ||
value_type = bool | ||
entity = Person | ||
label = "Is an infirm dependant" | ||
definition_period = YEAR | ||
|
||
# Impute dependant status on age. | ||
def formula(person, period, parameters): | ||
p = parameters( | ||
period | ||
).gov.provinces.ab.tax.income.credits.infirm_dependant | ||
return person("age", period) >= p.age_threshold |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
rename to match the variable