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

New Brunswick Tuition and Education Amount #445

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
added:
- New Brunswick tuition and education amount.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: New Brunswick provides tuition credit amount for person above this age.
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
values:
2022-01-01: 16
metadata:
unit: year
label: New Brunswick tuition credit age eligibility
reference:
- title: Students and income tax
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pub/p105/p105-22e.pdf#page=11
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: New Brunswick phases tuition credit amount for tax on taxable income at this rate.
values:
2022-01-01: 0.094
metadata:
unit: currency-CAD
label: New Brunswick tax on taxable income rate
reference:
- title: New Brunswick tuition and education amounts
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
description: New Brunswick phases taxable income out for tuition amount at this rate.
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
brackets:
- threshold:
2022-01-01: 0
rate:
2022-01-01: 0.094
- threshold:
2022-01-01: 44_887
rate:
2022-01-01: 0.1482
- threshold:
2022-01-01: 89_775
rate:
2022-01-01: 0.1652
- threshold:
2022-01-01: 145_955
rate:
2022-01-01: 0.1784
- threshold:
2022-01-01: 166_280
rate:
2022-01-01: 0.203

metadata:
type: marginal_rate
threshold_unit: currency-CAD
rate_unit: /1
label: New Brunswick taxable income phase out rate
reference:
- title: New Brunswick tuition and education amounts
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1
- title: New Brunswick tax and credits
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-c/5004-c-22e.pdf#page=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description: New Brunswick provides tuition credit amount for tuition expense above this amount.
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
values:
2022-01-01: 100
metadata:
unit: currency-CAD
period: year
label: New Brunswick tuition threshold
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
reference:
- title: 2023 New Brunswick Personal Tax Credits Return
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb/td1nb-23e.pdf#page=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Age Ineligible
period: 2023
input:
province_code: NB
age: 15
output:
nb_age_eligible: false

- name: Age eligible
period: 2023
input:
province_code: NB
age: 16
output:
nb_age_eligible: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- name: Lowest tax on taxable income threshold
period: 2023
absolute_error_margin: 0.01
input:
nb_taxable_income: 44_887
nb_tuition_credit_amount_income: 20_000
tuition_expenses: 10_000
output:
nb_tuition_credit_amount: 10_000

- name: Second tax on taxable income threshold
period: 2023
absolute_error_margin: 0.01
input:
nb_taxable_income: 54_887
nb_tuition_credit_amount_income: 20_000
tuition_expenses: 10_000
output:
nb_tuition_credit_amount: 10_000

- name: Third tax on taxable income threshold
period: 2023
absolute_error_margin: 0.01
input:
nb_taxable_income: 139_775
nb_tuition_credit_amount_income: 20_000
tuition_expenses: 50_000
output:
nb_tuition_credit_amount: 50_000

- name: Fourth tax on taxable income threshold
period: 2023
absolute_error_margin: 0.01
input:
nb_taxable_income: 145_965
nb_tuition_credit_amount_income: 100_000
tuition_expenses: 150_000
output:
nb_tuition_credit_amount: 114_409.57

- name: Highest tax on taxable income threshold
period: 2023
absolute_error_margin: 0.01
input:
nb_taxable_income: 167_280
nb_tuition_credit_amount_income: 100_000
tuition_expenses: 160_000
output:
nb_tuition_credit_amount: 155_124.42
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Tuition Ineligible
period: 2022
input:
province_code: NB
tuition_expenses: 50
output:
nb_tuition_eligible: false

- name: Tuition eligible
period: 2023
input:
province_code: NB
tuition_expenses: 101
output:
nb_tuition_eligible: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_canada.model_api import *


class nb_age_eligible(Variable):
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
value_type = bool
entity = Person
label = "New Brunswick age eligibility"
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
definition_period = YEAR
reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pub/p105/p105-22e.pdf#page=11"
defined_for = ProvinceCode.NB

def formula(person, period, parameters):
p = parameters(
period
).gov.provinces.nb.tax.income.credits.tuition_amount
age = person("age", period)
return age >= p.eligible_age
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from policyengine_canada.model_api import *


class nb_tuition_credit_amount(Variable):
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
value_type = float
entity = Person
label = "New Brunswick tuition credit amount"
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
definition_period = YEAR
defined_for: "nb_tuition_eligible"
reference = (
"https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1",
"https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-c/5004-c-22e.pdf#page=1",
)

def formula(person, period, parameters):
age = person("age", period)
tuition = person("tuition_expenses", period) # line 2
taxable_income = person("nb_taxable_income", period) # line 4
tuition_income = person(
"nb_tuition_credit_amount_income", period
) # line 5
p = parameters(
period
).gov.provinces.nb.tax.income.credits.tuition_amount
return select(
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
[
taxable_income
<= p.nb_tax_on_taxable_income_threshold.thresholds[1],
taxable_income
> p.nb_tax_on_taxable_income_threshold.thresholds[1],
],
[
min_(max_(taxable_income - tuition_income, 0), tuition),
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
min_(
max_(
(
p.nb_tax_on_taxable_income_threshold.calc(
taxable_income
)
/ p.nb_tax_on_taxable_income_rate
)
- tuition_income,
0,
),
tuition,
),
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from policyengine_canada.model_api import *


class nb_tuition_credit_amount_income(Variable):
value_type = float
entity = Person
label = "New Brunswick income pre tax income for tuition credit amount"
unit = CAD
definition_period = YEAR
reference = (
"https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-c/5004-c-22e.pdf#page=2",
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
"https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1",
)
defined_for = ProvinceCode.NB
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_canada.model_api import *


class nb_tuition_eligible(Variable):
YiweiJ marked this conversation as resolved.
Show resolved Hide resolved
value_type = bool
entity = Person
label = "New Brunswick tuiton eligibility"
definition_period = YEAR
reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb/td1nb-23e.pdf#page=1"
defined_for = "nb_age_eligible"

def formula(person, period, parameters):
p = parameters(
period
).gov.provinces.nb.tax.income.credits.tuition_amount
tuition = person("tuition_expenses", period)
return tuition >= p.tuition_threshold