From c9a2626ca11e41f8dde4ff464d67650edba2beca Mon Sep 17 00:00:00 2001 From: okeyiii <96802936+okeyiii@users.noreply.github.com> Date: Mon, 17 Jul 2023 22:03:07 +0000 Subject: [PATCH] Complete --- changelog_entry.yaml | 5 ++++ .../additional_amount.yaml | 2 +- .../applicable_rate.yaml | 2 +- .../basic_amount.yaml | 2 +- .../higher_income_threshold.yaml | 2 +- .../lower_income_threshold.yaml | 2 +- .../credits/pension/ab_pension_credit.yaml | 2 +- .../credits/ns_basic_personal_amount.yaml | 2 +- .../credits/ns_basic_personal_credits.py | 30 +++++++++++++------ 9 files changed, 33 insertions(+), 16 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..cb6917d8d 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,5 @@ +- bump: minor + changes: + added: + - Nova Scotia Basic personal amount. + diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/additional_amount.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/additional_amount.yaml index 735cffb14..9f6a60f12 100644 --- a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/additional_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/additional_amount.yaml @@ -8,4 +8,4 @@ metadata: - title: Nova Scotia Basic Personal Amount href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf - title: Nova Scotia Basic Personal Amount - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/applicable_rate.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/applicable_rate.yaml index c9eeab014..565fc47bf 100644 --- a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/applicable_rate.yaml +++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/applicable_rate.yaml @@ -8,4 +8,4 @@ metadata: - title: Nova Scotia Basic Personal Amount href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf - title: Nova Scotia Basic Personal Amount - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/basic_amount.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/basic_amount.yaml index 1f063d7dd..938ee6829 100644 --- a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/basic_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/basic_amount.yaml @@ -8,4 +8,4 @@ metadata: - title: Nova Scotia Basic Personal Amount href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf - title: Nova Scotia Basic Personal Amount - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/higher_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/higher_income_threshold.yaml index 1f4383a4b..f3869efe8 100644 --- a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/higher_income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/higher_income_threshold.yaml @@ -8,4 +8,4 @@ metadata: - title: Nova Scotia Basic Personal Amount href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf - title: Nova Scotia Basic Personal Amount - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/lower_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/lower_income_threshold.yaml index fc57c40ad..f2707cb88 100644 --- a/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/lower_income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount/lower_income_threshold.yaml @@ -8,4 +8,4 @@ metadata: - title: Nova Scotia Basic Personal Amount href: https://hr.acadiau.ca/files/sites/hr/Payroll/Pensions%20&%20Benefits/NS_TD1_2022.pdf - title: Nova Scotia Basic Personal Amount - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5003-d/5003-d-22e.pdf diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml index e3c23fabd..a9faa8c92 100644 --- a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml @@ -20,4 +20,4 @@ pension_and_savings_plan_income: 0 province_code: AB output: - ab_pension_credit: 0 \ No newline at end of file + ab_pension_credit: 0 diff --git a/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount.yaml index 580d7994d..5df8f1a88 100644 --- a/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/ns_basic_personal_amount.yaml @@ -28,4 +28,4 @@ province_code: NS total_individual_pre_tax_income: 76_000 output: - ns_basic_personal_credits: 8_481 \ No newline at end of file + ns_basic_personal_credits: 8_481 diff --git a/policyengine_canada/variables/gov/provinces/ns/tax/income/credits/ns_basic_personal_credits.py b/policyengine_canada/variables/gov/provinces/ns/tax/income/credits/ns_basic_personal_credits.py index a8f706a8b..1f2064b2d 100644 --- a/policyengine_canada/variables/gov/provinces/ns/tax/income/credits/ns_basic_personal_credits.py +++ b/policyengine_canada/variables/gov/provinces/ns/tax/income/credits/ns_basic_personal_credits.py @@ -9,13 +9,25 @@ class ns_basic_personal_credits(Variable): defined_for = ProvinceCode.NS 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) + p = parameters( + period + ).gov.provinces.ns.tax.income.credits.ns_basic_personal_amount + taxable_income = person("total_individual_pre_tax_income", period) - return select([taxable_income <= p.lower_income_threshold, - p.lower_income_threshold < taxable_income < p.higher_income_threshold, - taxable_income >= p.higher_income_threshold], - - [p.additional_amount + p.basic_amount, - p.basic_amount + 3000 - p.applicable_rate*(taxable_income - p.lower_income_threshold), - p.basic_amount]) + return select( + [ + taxable_income <= p.lower_income_threshold, + p.lower_income_threshold + < taxable_income + < p.higher_income_threshold, + taxable_income >= p.higher_income_threshold, + ], + [ + p.additional_amount + p.basic_amount, + p.basic_amount + + 3000 + - p.applicable_rate + * (taxable_income - p.lower_income_threshold), + p.basic_amount, + ], + )