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

Nova Scotia Basic personal amount #407

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c00d35d
Add parameters
okeyiii Jul 13, 2023
bc34af8
Add Variables and Partial Tests
okeyiii Jul 13, 2023
0f71af7
Nova Scotia Basic Personal Amount
okeyiii Jul 17, 2023
c9a2626
Complete
okeyiii Jul 17, 2023
cafa9ed
Nova Scotia Basic Personal Amount
okeyiii Jul 24, 2023
f13d546
Nova Scotia Basic Personal Amount
okeyiii Jul 31, 2023
ce10cc0
Nova Scotia Basic Personal Amount
okeyiii Jul 31, 2023
a8f1e15
Nova Scotia Basic Personal Amount
okeyiii Aug 8, 2023
02b51c5
Nova Scotia Basic Personal Amount
okeyiii Aug 10, 2023
c526ad9
Nova Scotia Basic Personal Amount
okeyiii Aug 15, 2023
e11e19b
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
okeyiii Aug 16, 2023
18136a1
Nova Scotia Basic Personal Amount
okeyiii Aug 16, 2023
948dce7
Nova Scotia Basic Personal Amount
okeyiii Aug 29, 2023
7bbcf3a
Nova Scotia Basic Personal Amount
okeyiii Aug 30, 2023
219e0ed
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
okeyiii Aug 30, 2023
b58867b
rename parameters
PavelMakarchuk Aug 30, 2023
dec4499
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
okeyiii Sep 6, 2023
92d4e06
Nova Scotia Basic Personal Amount
okeyiii Sep 6, 2023
dc95143
Merge branch 'okeyiii/issue395' of https://github.com/okeyiii/policye…
okeyiii Sep 6, 2023
36bb813
Update policyengine_canada/variables/gov/provinces/ns/tax/income/cred…
PavelMakarchuk Sep 9, 2023
e122967
Update changelog_entry.yaml
PavelMakarchuk Sep 9, 2023
a4e1df7
remove additional variable
PavelMakarchuk Sep 10, 2023
6d0a860
unit
PavelMakarchuk Sep 10, 2023
496cbea
Nova Scotia Basic Personal Amount
okeyiii Oct 6, 2023
c28e4d3
Merge branch 'okeyiii/issue395' of https://github.com/okeyiii/policye…
okeyiii Oct 6, 2023
793adca
Nova Scotia Basic Personal Amount
okeyiii Oct 6, 2023
4919431
Nova Scotia Basic Personal Amount
okeyiii Oct 8, 2023
3576b40
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
okeyiii Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- bump: patch
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
changes:
added:
- Chage names to proper expressions for title, label, reference and folder.
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
- Make format.
okeyiii marked this conversation as resolved.
Show resolved Hide resolved

okeyiii marked this conversation as resolved.
Show resolved Hide resolved
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Nova Scotia provides this additional amount under the basic personal amount.
values:
2022-01-01: 3_000
metadata:
unit: currency-CAD
label: Nova Scotia Additional Personal Amount
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
reference:
- title: 2022 Nova Scotia Personal Tax Credits Return
href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf
- title: Worksheet NS428
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
description: Nova Scotia employs this applicable rate for calculating partial basic personal amounts.
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
values:
2022-01-01: 0.06
metadata:
unit: currency-CAD
period: year
rate_unit: /1
label: Nova Scotia Basic Personal Amount Applicable Rate
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
reference:
- title: 2022 Nova Scotia Personal Tax Credits Return
href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf
- title: Worksheet NS428
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
PavelMakarchuk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Nova Scotia provides this basic amount under basic personal amount.
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
values:
2022-01-01: 8_481
metadata:
unit: currency-CAD
label: Nova Scotia Basic Personal Amount
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
reference:
- title: 2022 Nova Scotia Personal Tax Credits Return
href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf
- title: Worksheet NS428
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Nova Scotia limits this higher income threshold under the basic personal amount eligibility.
values:
2022-01-01: 75_000
metadata:
unit: currency-CAD
label: Nova Scotia Basic Personal Amount Higher Income Threshold
reference:
- title: 2022 Nova Scotia Personal Tax Credits Return
href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf
- title: Worksheet NS428
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Nova Scotia limits this lower income threshold under the basic personal amount eligibility.
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
values:
2022-01-01: 25_000
metadata:
unit: currency-CAD
label: Nova Scotia Basic Personal Amount Lower Income Threshold
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
reference:
- title: 2022 Nova Scotia Personal Tax Credits Return
href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf
- title: Worksheet NS428
href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
pension_and_savings_plan_income: 0
province_code: AB
output:
ab_pension_credit: 0
ab_pension_credit: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- name: Person has taxable income lower than 25_000
period: 2023
input:
province_code: NS
total_individual_pre_tax_income: 24_999
output:
ns_basic_personal_credits: 11_481

- name: Person has taxable income between 25_000 and 75_000
period: 2023
input:
province_code: NS
total_individual_pre_tax_income: 27_000
output:
ns_basic_personal_credits: 11_361

- name: Person has taxable income between 25_000 and 75_000
period: 2023
input:
province_code: NS
total_individual_pre_tax_income: 70_000
output:
ns_basic_personal_credits: 8_781

- name: Person has taxable income higher than 75_000
period: 2023
input:
province_code: NS
total_individual_pre_tax_income: 76_000
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
output:
ns_basic_personal_credits: 8_481
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from policyengine_canada.model_api import *


class ns_basic_personal_credits(Variable):
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
value_type = float
entity = Person
label = "Nova Scotia Basic Personal Amount"
definition_period = YEAR
defined_for = ProvinceCode.NS
reference = (
"https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf",
"https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf",
)

def formula(person, period, parameters):
p = parameters(
period
).gov.provinces.ns.tax.income.credits.ns_basic_personal_amount
taxable_income = person("total_individual_pre_tax_income", period)

# Income Condition
lower_income_condition = taxable_income <= p.lower_income_threshold
okeyiii marked this conversation as resolved.
Show resolved Hide resolved
medium_income_condition = (
p.lower_income_threshold
< taxable_income
< p.higher_income_threshold
)
higher_income_condition = taxable_income >= p.higher_income_threshold
okeyiii marked this conversation as resolved.
Show resolved Hide resolved

# Basic Personal Amount
lower_basic_personal_amount = p.additional_amount + p.basic_amount
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to follow the worksheet as a step by step -> take base, take add. amount, take income, check for threshold, multiply by rate cap at max amount

medium_basic_personal_amount = (
p.basic_amount
+ 3000
- p.applicable_rate * (taxable_income - p.lower_income_threshold)
)
higher_basic_personal_amount = p.basic_amount

return select(
[
lower_income_condition,
medium_income_condition,
higher_income_condition,
],
[
lower_basic_personal_amount,
medium_basic_personal_amount,
higher_basic_personal_amount,
],
)