Skip to content

Commit

Permalink
Nova Scotia Basic Personal Amount
Browse files Browse the repository at this point in the history
Fixes PolicyEngine#395
Reformed the varaibles part code in a more mathematical way
  • Loading branch information
okeyiii committed Aug 8, 2023
1 parent ce10cc0 commit a8f1e15
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 75 deletions.
5 changes: 2 additions & 3 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- bump: patch
- bump: minor
changes:
added:
- Chage names to proper expressions for title, label, reference and folder.
- Make format.
- Nova Scotia Basic Personal Amount.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ values:
2022-01-01: 3_000
metadata:
unit: currency-CAD
label: Nova Scotia Additional Personal Amount
label: Nova Scotia basic personal amount additional amount
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
description: Nova Scotia employs this applicable rate for calculating partial basic personal amounts.
description: Nova Scotia reduces its additional basic personal amount out at this rate.
values:
2022-01-01: 0.06
metadata:
unit: currency-CAD
period: year
rate_unit: /1
label: Nova Scotia Basic Personal Amount Applicable Rate
label: Nova Scotia basic personal amount reduction rate

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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
description: Nova Scotia limits this lower income threshold under the basic personal amount eligibility.
description: Nova Scotia phases its additional basic personal amount out for filers with income above this threshold.
values:
2022-01-01: 25_000
metadata:
unit: currency-CAD
label: Nova Scotia Basic Personal Amount Lower Income Threshold
label: Nova Scotia basic personal amount additional amount phase out start
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
description: Nova Scotia provides this basic amount under basic personal amount.
description: Nova Scotia provides this base amount under the basic personal amount.
values:
2022-01-01: 8_481
metadata:
unit: currency-CAD
label: Nova Scotia Basic Personal Amount
label: Nova Scotia basic personal amount base
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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
province_code: NS
total_individual_pre_tax_income: 24_999
output:
ns_basic_personal_credits: 11_481
ns_basic_personal_amount: 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
ns_basic_personal_amount: 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
ns_basic_personal_amount: 8_781

- name: Person has taxable income higher than 75_000
period: 2023
input:
province_code: NS
total_individual_pre_tax_income: 76_000
output:
ns_basic_personal_credits: 8_481
ns_basic_personal_amount: 8_481

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from policyengine_canada.model_api import *


class ns_basic_personal_amount(Variable):
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.basic_personal_amount
taxable_income = person("total_individual_pre_tax_income", period)

# Calculate additional amount added to base amount
exceedance = (
taxable_income - p.additional_amount.lower_income_threshold
)
reduced_additional_amount = (
p.additional_amount.additional_amount
- p.additional_amount.applicable_rate * exceedance
)
additional_amount = max_(0, reduced_additional_amount)
additional_amount = min_(
additional_amount, p.additional_amount.additional_amount
)

return p.base + additional_amount

0 comments on commit a8f1e15

Please sign in to comment.