From 949d624d5f328647e832efc9e6a6609ffb83ab83 Mon Sep 17 00:00:00 2001 From: karenlilr <167912915+karenlilr@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:21:03 +0000 Subject: [PATCH] Fixes #352 --- changelog_entry.yaml | 3 +-- .../base_amount.yaml | 2 +- .../{max_credit.yaml => max_amount.yaml} | 4 ++-- ...use_and_common_law_partner_amount_credit.yaml | 16 +--------------- ...pouse_and_common_law_partner_amount_credit.py | 8 +++----- 5 files changed, 8 insertions(+), 25 deletions(-) rename policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/{max_credit.yaml => max_amount.yaml} (68%) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 96ca407de..673fb484b 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,3 @@ - bump: minor changes: - added: - - New Brunswick Spouse or Common-law Partner base amount for the years 2022, 2023, and 2024; nb_spouse_and_common_law_partner_amount_credit to calculate the credit dynamically based on parameters; test cases; parameter configurations for base_amount and max_credit in the parameters file. \ No newline at end of file + added: New Brunswick Spouse or Common-law Partner base amount. \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/base_amount.yaml b/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/base_amount.yaml index 8461f366c..dd8e66ec3 100644 --- a/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/base_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/base_amount.yaml @@ -6,7 +6,7 @@ values: metadata: unit: currency-CAD period: year - label: New Brunswick Spouse or Common-law Partner Base Amount + label: New Brunswick Spouse or Common-law Partner base Amount reference: - title: Worksheet for the 2022 New Brunswick Personal Tax Credits Return href: https://www.cchwebsites.com/content/pdf/tax_forms/ca/en/td1nbws_en.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_credit.yaml b/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_amount.yaml similarity index 68% rename from policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_credit.yaml rename to policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_amount.yaml index 07b47f064..4e17ef1c1 100644 --- a/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_credit.yaml +++ b/policyengine_canada/parameters/gov/provinces/nb/tax/income/credits/spouse_or_common_law_partner_amount/max_amount.yaml @@ -1,4 +1,4 @@ -description: The New Brunswick spouse or common-law partner amount credit is calculated by taking into account the spouse's net income and comparing it to a base amount. The maximum credit is the highest amount that can be claimed as a credit. +description: New Brunswick provides the following maximum spouse or common-law partner amount. values: 2022-01-01: 9_186 2023-01-01: 9_764 @@ -6,7 +6,7 @@ values: metadata: unit: currency-CAD period: year - label: New Brunswick Spouse or Common-law Partner Max Credit + label: New Brunswick Spouse or Common-law Partner max Credit reference: - title: Worksheet for the 2022 New Brunswick Personal Tax Credits Return href: https://www.cchwebsites.com/content/pdf/tax_forms/ca/en/td1nbws_en.pdf#page=1 diff --git a/policyengine_canada/tests/gov/provinces/nb/tax/income/credits/nb_spouse_and_common_law_partner_amount_credit.yaml b/policyengine_canada/tests/gov/provinces/nb/tax/income/credits/nb_spouse_and_common_law_partner_amount_credit.yaml index 8e58e83a7..9dd73769d 100644 --- a/policyengine_canada/tests/gov/provinces/nb/tax/income/credits/nb_spouse_and_common_law_partner_amount_credit.yaml +++ b/policyengine_canada/tests/gov/provinces/nb/tax/income/credits/nb_spouse_and_common_law_partner_amount_credit.yaml @@ -61,19 +61,5 @@ parameters: - gov: - provinces: - nb: - tax: - income: - credits: - spouse_or_common_law_partner_amount: - base_amount: - 2022-01-01: 10_105 - 2023-01-01: 10_741 - 2024-01-01: 11_246 - max_credit: - 2022-01-01: 9_186 - 2023-01-01: 9_764 - 2024-01-01: 10_223 + diff --git a/policyengine_canada/variables/gov/provinces/nb/tax/income/nb_spouse_and_common_law_partner_amount_credit.py b/policyengine_canada/variables/gov/provinces/nb/tax/income/nb_spouse_and_common_law_partner_amount_credit.py index 7bb6ed75d..b10a1a42a 100644 --- a/policyengine_canada/variables/gov/provinces/nb/tax/income/nb_spouse_and_common_law_partner_amount_credit.py +++ b/policyengine_canada/variables/gov/provinces/nb/tax/income/nb_spouse_and_common_law_partner_amount_credit.py @@ -10,10 +10,8 @@ class nb_spouse_and_common_law_partner_amount_credit(Variable): def formula(household, period, parameters): p = parameters(period).gov.provinces.nb.tax.income.credits.spouse_or_common_law_partner_amount - base_amount = p.base_amount - max_credit = p.max_credit - + spouse_income = add(household, period, ["spouse_income"]) - reduced_amount = max_(base_amount - spouse_income, 0) - return min(max_credit, reduced_amount) + reduced_amount = max_(p.base_amount - spouse_income, 0) + return min(p.max_credit, reduced_amount)