From d4bf27654e901f13f515db12dd0a8647e5aabfc2 Mon Sep 17 00:00:00 2001 From: Yiwei Jia Date: Fri, 17 Nov 2023 13:39:18 -0500 Subject: [PATCH 1/3] British Columbia Tuition and Education Credits Fixes #463 --- changelog_entry.yaml | 4 ++ .../credits/tuition_amount/eligible_age.yaml | 9 ++++ .../tuition_amount/lowest_tax_rate.yaml | 13 +++++ .../tuition_amount/tax_bracket_rate.yaml | 44 +++++++++++++++++ .../tuition_amount/tuition_threshold.yaml | 13 +++++ .../tuition_amount/bc_tuition_credit.yaml | 49 +++++++++++++++++++ .../bc_tuition_credit_eligibility.yaml | 35 +++++++++++++ .../bc_comprehensive_tax_credits.py | 27 ++++++++++ .../tuition_amount/bc_tuition_credit.py | 41 ++++++++++++++++ .../bc_tuition_credit_eligibility.py | 22 +++++++++ 10 files changed, 257 insertions(+) create mode 100644 policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tax_bracket_rate.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml create mode 100644 policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.yaml create mode 100644 policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.yaml create mode 100644 policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_comprehensive_tax_credits.py create mode 100644 policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.py create mode 100644 policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..d1b9c99bc 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - British Columbia tuition and education amount. diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml new file mode 100644 index 000000000..ce6e51870 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml @@ -0,0 +1,9 @@ +description: British Columbia qualifies filers for the tuition credit above this age. +values: + 2022-01-01: 16 +metadata: + unit: year + label: British Columbia tuition credit age eligibility + reference: + - title: Eligible tuition fees + - href: https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/deductions-credits-expenses/line-32300-your-tuition-education-textbook-amounts/eligible-tuition-fees.html diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml new file mode 100644 index 000000000..1971a7043 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml @@ -0,0 +1,13 @@ +description: British Columbia divides the tax on taxable income by the lowest tax rate to calculate the tuition credit. +values: + 2022-01-01: 0.0506 +metadata: + unit: currency-CAD + # "appropriate percentage" for a taxation year means the lowest percentage specified in section 4.1 (1) + # that is applicable in determining tax payable under this Act for the year + label: New Brunswick lowest tax rate # appropriate percentage + reference: + - title: 2023 New Brunswick income tax act § 4.6 + href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.6 + - title: 2022 New Brunswick tuition and education amounts, BC(S11) + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tax_bracket_rate.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tax_bracket_rate.yaml new file mode 100644 index 000000000..6d1ac854f --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tax_bracket_rate.yaml @@ -0,0 +1,44 @@ +description: British Columbia taxes individuals based on their income at a progressive rate. +brackets: + - threshold: + 2022-01-01: 0 + rate: + 2022-01-01: 0.0506 + - threshold: + 2022-01-01: 43_070 + rate: + 2022-01-01: 0.077 + - threshold: + 2022-01-01: 86_141 + rate: + 2022-01-01: 0.105 + - threshold: + 2022-01-01: 98_901 + rate: + 2022-01-01: 0.1229 + - threshold: + 2022-01-01: 120_094 + rate: + 2022-01-01: 0.147 + - threshold: + 2022-01-01: 162_832 + rate: + 2022-01-01: 0.168 + - threshold: + 2022-01-01: 227_091 + rate: + 2022-01-01: 0.205 + + +metadata: + type: marginal_rate + threshold_unit: currency-CAD + rate_unit: /1 + label: British Columbia tax brackets rate + reference: + - title: 2023 British Columbia income tax act § 4.1 + href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.1 + - title: 2022 British Columbia tuition and education amounts, Schedule BC(S11) + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-s11/5010-s11-22e.pdf#page=1 + - title: 2022 British Columbia Tax, BC428 + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-c/5010-c-22e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml new file mode 100644 index 000000000..6416b732d --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml @@ -0,0 +1,13 @@ +description: British Columbia qualifies filers for the tuition tax credit with tuition expense above this rate. +values: + 2022-01-01: 100 +metadata: + unit: currency-CAD + period: year + label: British Columbia tuition credit tuition threshold + reference: + - title: 2023 British Columbia Personal Tax Credits Return, TD1BC + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb/td1nb-23e.pdf#page=1 + # The tuition credit section of British Columbia income act refered to section 118.5 of federal act + - title: 2023 Canada Income Tac Act § 118.5(1.1) + href: https://laws-lois.justice.gc.ca/PDF/I-3.3.pdf#page=1566 diff --git a/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.yaml b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.yaml new file mode 100644 index 000000000..773aa302e --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.yaml @@ -0,0 +1,49 @@ +- name: Lowest tax on taxable income threshold + period: 2023 + absolute_error_margin: 0.01 + input: + bc_taxable_income: 44_887 + bc_comprehensive_tax_credits: 20_000 + tuition_expenses: 10_000 + output: + bc_tuition_credit: 10_000 + +- name: Second tax on taxable income threshold + period: 2023 + absolute_error_margin: 0.01 + input: + bc_taxable_income: 54_887 + bc_comprehensive_tax_credits: 20_000 + tuition_expenses: 10_000 + output: + bc_tuition_credit: 10_000 + +- name: Third tax on taxable income threshold + period: 2023 + absolute_error_margin: 0.01 + input: + bc_taxable_income: 139_775 + bc_comprehensive_tax_credits: 20_000 + tuition_expenses: 50_000 + output: + bc_tuition_credit: 50_000 + +- name: Fourth tax on taxable income threshold + period: 2023 + absolute_error_margin: 0.01 + input: + bc_taxable_income: 145_965 + bc_comprehensive_tax_credits: 100_000 + tuition_expenses: 150_000 + output: + bc_tuition_credit: 150_000 + +- name: Highest tax on taxable income threshold + period: 2023 + absolute_error_margin: 0.01 + input: + bc_taxable_income: 167_280 + bc_comprehensive_tax_credits: 100_000 + tuition_expenses: 160_000 + output: + bc_tuition_credit: 160_000 diff --git a/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.yaml b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.yaml new file mode 100644 index 000000000..0d3e7084f --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.yaml @@ -0,0 +1,35 @@ +- name: Age eligible and tuition ineligible + period: 2023 + input: + province_code: BC + age: 17 + tuition_expenses: 50 + output: + bc_tuition_credit_eligibility: false + +- name: Age eligible and tuition eligible + period: 2023 + input: + province_code: BC + age: 16 + tuition_expenses: 101 + output: + bc_tuition_credit_eligibility: true + +- name: Age ineligible and tuition eligible + period: 2023 + input: + province_code: BC + age: 10 + tuition_expenses: 200 + output: + bc_tuition_credit_eligibility: false + +- name: Age ineligible and tuition ineligible + period: 2023 + input: + province_code: BC + age: 10 + tuition_expenses: 30 + output: + bc_tuition_credit_eligibility: false diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_comprehensive_tax_credits.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_comprehensive_tax_credits.py new file mode 100644 index 000000000..0b45e34d6 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_comprehensive_tax_credits.py @@ -0,0 +1,27 @@ +from policyengine_canada.model_api import * + + +class bc_comprehensive_tax_credits(Variable): + value_type = float + entity = Person + label = "British Columbia comprehensive tax credits" + unit = CAD + definition_period = YEAR + reference = ( + # C is the smaller of the value of "B" and the amount that would be the individual's tax payable under + # this Act for the year if the only amounts deductible were the amounts under the following sections: + # (a) section 4.3 [personal credits]; + # (b) section 4.31 [age credit]; + # (c) section 4.32 [pension credit]; + # (c.1) section 4.33 [adoption expense credit]; + # (c.2) and (c.21) [Repealed 2017-12-30.] + # (c.3) [Repealed 2017-12-30.] + # (c.31) [Repealed 2017-12-29.] + # (c.4) section 4.36 [BC education coaching tax credit]; + # (c.5) section 4.37 [tax credit for volunteer firefighters and search and rescue volunteers]; + # (d) section 4.51 [credit for mental or physical impairment]; + # (e) section 4.64 [credit for EI premium and CPP contribution], + "https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.62", # § 4.62 + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-c/5010-c-22e.pdf#page=1", # Line 40 + ) + defined_for = ProvinceCode.BC diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.py new file mode 100644 index 000000000..f05b4fe07 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit.py @@ -0,0 +1,41 @@ +from policyengine_canada.model_api import * + + +class bc_tuition_credit(Variable): + value_type = float + entity = Person + label = "British Columbia tuition credit" + definition_period = YEAR + defined_for: "bc_tuition_credit_eligibility" + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-s11/5010-s11-22e.pdf#page=1", # BC(S11) line 10 + "https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.62", # section 4.62 + ) + + def formula(person, period, parameters): + age = person("age", period) + tuition = person("tuition_expenses", period) + taxable_income = person("bc_taxable_income", period) + comprehensive_tax_credits = person( + "bc_comprehensive_tax_credits", period + ) + p = parameters( + period + ).gov.provinces.bc.tax.income.credits.tuition_amount + net_income = max_(taxable_income - comprehensive_tax_credits, 0) + tax_on_taxable_income = p.tax_bracket_rate.calc(taxable_income) + net_tax = max_( + (tax_on_taxable_income / p.lowest_tax_rate) + - comprehensive_tax_credits, + 0, + ) + return select( + [ + taxable_income <= p.tax_bracket_rate.thresholds[1], + taxable_income > p.tax_bracket_rate.thresholds[1], + ], + [ + min_(net_income, tuition), + min_(net_tax, tuition), + ], + ) diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py new file mode 100644 index 000000000..46e067f63 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py @@ -0,0 +1,22 @@ +from policyengine_canada.model_api import * + + +class bc_tuition_credit_eligibility(Variable): + value_type = bool + entity = Person + label = "Eligible for the British Columbia tuition credit" + definition_period = YEAR + reference = ( + "https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/deductions-credits-expenses/line-32300-your-tuition-education-textbook-amounts/eligible-tuition-fees.html", # Tuition Amount + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1nb/td1nb-23e.pdf#page=1", + "https://laws-lois.justice.gc.ca/PDF/I-3.3.pdf#page=1566", # Line 4 + ) + defined_for = ProvinceCode.BC + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.bc.tax.income.credits.tuition_amount + age = person("age", period) + tuition = person("tuition_expenses", period) + return (age >= p.eligible_age) & (tuition >= p.tuition_threshold) From a7e45bfac3a72ffe7ff37d6353621d5e34196def Mon Sep 17 00:00:00 2001 From: Yiwei Jia Date: Wed, 22 Nov 2023 10:56:37 -0500 Subject: [PATCH 2/3] Resolve typos --- changelog_entry.yaml | 2 +- .../bc/tax/income/credits/tuition_amount/eligible_age.yaml | 2 +- .../bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml | 4 ++-- .../tax/income/credits/tuition_amount/tuition_threshold.yaml | 2 +- .../credits/tuition_amount/bc_tuition_credit_eligibility.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index d1b9c99bc..ef55c3c2e 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - British Columbia tuition and education amount. + - British Columbia tuition and education credits. diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml index ce6e51870..466c1e335 100644 --- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/eligible_age.yaml @@ -5,5 +5,5 @@ metadata: unit: year label: British Columbia tuition credit age eligibility reference: - - title: Eligible tuition fees + - title: British Columbia eligible tuition fees - href: https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/deductions-credits-expenses/line-32300-your-tuition-education-textbook-amounts/eligible-tuition-fees.html diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml index 1971a7043..f4215964f 100644 --- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml @@ -7,7 +7,7 @@ metadata: # that is applicable in determining tax payable under this Act for the year label: New Brunswick lowest tax rate # appropriate percentage reference: - - title: 2023 New Brunswick income tax act § 4.6 + - title: 2023 British Columbia income tax act § 4.6 href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.6 - - title: 2022 New Brunswick tuition and education amounts, BC(S11) + - title: 2022 British Columbia tuition and education amounts, BC(S11) href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5004-s11/5004-s11-22e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml index 6416b732d..92e45f01f 100644 --- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/tuition_threshold.yaml @@ -1,4 +1,4 @@ -description: British Columbia qualifies filers for the tuition tax credit with tuition expense above this rate. +description: British Columbia qualifies filers for the tuition tax credit with tuition expenses above this amount. values: 2022-01-01: 100 metadata: diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py index 46e067f63..71a416685 100644 --- a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py +++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/tuition_amount/bc_tuition_credit_eligibility.py @@ -4,7 +4,7 @@ class bc_tuition_credit_eligibility(Variable): value_type = bool entity = Person - label = "Eligible for the British Columbia tuition credit" + label = "Eligibility for the British Columbia tuition credit" definition_period = YEAR reference = ( "https://www.canada.ca/en/revenue-agency/services/tax/individuals/topics/about-your-tax-return/tax-return/completing-a-tax-return/deductions-credits-expenses/line-32300-your-tuition-education-textbook-amounts/eligible-tuition-fees.html", # Tuition Amount From 9ff9cd81a365fa253fd96299858765da39d6b088 Mon Sep 17 00:00:00 2001 From: Yiwei Jia Date: Mon, 4 Dec 2023 19:30:20 -0500 Subject: [PATCH 3/3] Resolved typos --- .../bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml index f4215964f..975a5274d 100644 --- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml +++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/tuition_amount/lowest_tax_rate.yaml @@ -5,7 +5,7 @@ metadata: unit: currency-CAD # "appropriate percentage" for a taxation year means the lowest percentage specified in section 4.1 (1) # that is applicable in determining tax payable under this Act for the year - label: New Brunswick lowest tax rate # appropriate percentage + label: British Columbia lowest tax rate # appropriate percentage reference: - title: 2023 British Columbia income tax act § 4.6 href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.6