From 6e8938c7dc05b0ba767166f42b68e330d0939749 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:07:47 +0000 Subject: [PATCH 01/16] Saskatchewan Amount for infirm dependants Fixed #389 --- .../sk/tax/income/credits/infirm_dependent_amount/amount.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml new file mode 100644 index 000000000..e69de29bb From 56b749ec49c493f991a8e5f9c1c7f82a257cf9c0 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 31 Aug 2023 22:54:35 +0000 Subject: [PATCH 02/16] Creat parameters --- .../infirm_dependent_amount/age_threshold.yaml | 17 +++++++++++++++++ .../infirm_dependent_amount/amount.yaml | 18 ++++++++++++++++++ .../higher_income_threshold.yaml | 18 ++++++++++++++++++ .../lower_income_threshold.yaml | 18 ++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml new file mode 100644 index 000000000..7c1a9731b --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml @@ -0,0 +1,17 @@ +description: Saskatchewan provides the infirm tax credit amount for filer with infirm dependants at or above this age threshold. +values: + 2022-01-01: 18 +metadata: + unit: year + label: Saskatchewan Infirm Dependant Age Eligibility + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000 + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml index e69de29bb..6521e0a1c 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml @@ -0,0 +1,18 @@ +description: Saskatchewan provides this amount for filers with infirm dependants age 18 or older. +values: + 2022-01-01: 9_789 + 2023-01-01: 10_405 +metadata: + unit: currency-CAD + label: Saskatchewan Infirm Dependants Tax Credit Maximum Amount + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000 + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml new file mode 100644 index 000000000..3519b69d9 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml @@ -0,0 +1,18 @@ +description: Saskatchewan provides partial infirm dependant tax credit amount for filers with dependants whose net income is below this threshold. +values: + 2022-01-01: 16_734 + 2023-01-01: 17_788 +metadata: + unit: currency-CAD + label: Saskatchewan Infirm Dependants Tax Credit Higher Income Threshold for the Dependant + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000 + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml new file mode 100644 index 000000000..913fddff0 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml @@ -0,0 +1,18 @@ +description: Saskatchewan provides the maximum infirm dependant tax credit amount for filers with dependants whose net income is or below this threshold. +values: + 2022-01-01: 6_945 + 2023-01-01: 7_383 +metadata: + unit: currency-CAD + label: Saskatchewan Infirm Dependants Tax Credit Lower Income Threshold for the Dependant + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000 + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file From c44ebccd16cddafd01d8a051d46c968186e3e8fc Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:57:04 +0000 Subject: [PATCH 03/16] Add variables --- .../infirm_dependant_amount.py | 0 .../infirm_dependant_amount_eligibility.py | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py create mode 100644 policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py new file mode 100644 index 000000000..e69de29bb diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py new file mode 100644 index 000000000..250e2b79a --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py @@ -0,0 +1,30 @@ +from policyengine_canada.model_api import * + + +class infirm_dependant_amount_eligibility(Variable): + value_type = bool + entity = Person + label = "Saskatchewan Infirm Dependant Amount Eligibility" + definition_period = YEAR + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15", + ) + defined_for = ProvinceCode.SK + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount + + dependant = person("is_dependant", period) + age = person("age", period) + age_eligibility = age <= p.age_threshold + + dependants_income = person("individual_net_income", period) + income_eligibility = dependants_income <= p.higher_income_threshold + + return age_eligibility & income_eligibility \ No newline at end of file From facc5d72c33229200457f111d1ad596930e89261 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Tue, 19 Sep 2023 22:32:09 +0000 Subject: [PATCH 04/16] Add parameters, variables, and tests --- .../age_threshold.yaml | 6 +- .../infirm_dependent_amount/amount.yaml | 6 +- .../higher.yaml} | 4 +- .../lower.yaml} | 4 +- .../infirm_dependant_amount.yaml | 98 ++++++++++++++++ ...firm_dependant_amount_eligible_person.yaml | 107 ++++++++++++++++++ ...unt_eligibility.py => dependant_income.py} | 24 ++-- .../infirm_dependant_amount.py | 30 +++++ ...infirm_dependant_amount_eligible_person.py | 38 +++++++ 9 files changed, 291 insertions(+), 26 deletions(-) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/{higher_income_threshold.yaml => income_threshold/higher.yaml} (86%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/{lower_income_threshold.yaml => income_threshold/lower.yaml} (86%) create mode 100644 policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml create mode 100644 policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml rename policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{infirm_dependant_amount_eligibility.py => dependant_income.py} (51%) create mode 100644 policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml index 7c1a9731b..399d961bc 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml @@ -1,9 +1,9 @@ -description: Saskatchewan provides the infirm tax credit amount for filer with infirm dependants at or above this age threshold. +description: Saskatchewan qualifies infirm dependants under the Caregiver Tax Credit Amount for filers' dependants with this age or older. values: 2022-01-01: 18 metadata: unit: year - label: Saskatchewan Infirm Dependant Age Eligibility + label: Saskatchewan Infirm Dependants Tax Credit infirm dependant age eligibility reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -14,4 +14,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml index 6521e0a1c..fcf57ae21 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml @@ -1,10 +1,10 @@ -description: Saskatchewan provides this amount for filers with infirm dependants age 18 or older. +description: Saskatchewan allows for this maximum infirm dependants amount. values: 2022-01-01: 9_789 2023-01-01: 10_405 metadata: unit: currency-CAD - label: Saskatchewan Infirm Dependants Tax Credit Maximum Amount + label: Saskatchewan Infirm Dependants Tax Credit maximum amount reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/higher.yaml similarity index 86% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/higher.yaml index 3519b69d9..978938d6d 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/higher_income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/higher.yaml @@ -1,4 +1,4 @@ -description: Saskatchewan provides partial infirm dependant tax credit amount for filers with dependants whose net income is below this threshold. +description: Saskatchewan reduces the maximum Infirm Dependants Tax Credit amount by the difference of this threshold and the dependants income. values: 2022-01-01: 16_734 2023-01-01: 17_788 @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/lower.yaml similarity index 86% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/lower.yaml index 913fddff0..81eee3288 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/lower_income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/lower.yaml @@ -1,4 +1,4 @@ -description: Saskatchewan provides the maximum infirm dependant tax credit amount for filers with dependants whose net income is or below this threshold. +description: Saskatchewan reduces the maximum Infirm Dependants Tax Credit Amount for dependants with net income is above this threshold. values: 2022-01-01: 6_945 2023-01-01: 7_383 @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml new file mode 100644 index 000000000..e650abfd2 --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml @@ -0,0 +1,98 @@ +- name: Do not have eligible dependants + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: false + dependant_income: 10_000 + output: + sk_caregiver_amount: 0 + +- name: 2023 Have eligible dependants with income at lower income threshold + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 7_383 + output: + sk_caregiver_amount: 10_405 + +- name: 2023 Have eligible dependants with income below lower income threshold + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 7_382 + output: + sk_caregiver_amount: 10_405 + +- name: 2023 Have eligible dependants with income between lower and higher income threshold + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 10_000 + output: + sk_caregiver_amount: 7_788 + +- name: 2023 Have eligible dependants with income at higher income threshold + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 17_788 + output: + sk_caregiver_amount: 0 + +- name: 2023 Have eligible dependants with income above higher income threshold + period: 2023 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 17_789 + output: + sk_caregiver_amount: 0 + +- name: 2022 Have eligible dependants with income at lower income threshold + period: 2022 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 6_945 + output: + sk_caregiver_amount: 9_789 + +- name: 2022 Have eligible dependants with income below lower income threshold + period: 2022 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 6_944 + output: + sk_caregiver_amount: 9_789 + +- name: 2022 Have eligible dependants with income between lower and higher income threshold + period: 2022 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 10_000 + output: + sk_caregiver_amount: 6_734 + +- name: 2022 Have eligible dependants with income at higher income threshold + period: 2022 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 16_734 + output: + sk_caregiver_amount: 0 + +- name: 2022 Have eligible dependants with income above higher income threshold + period: 2022 + input: + province_code: SK + infirm_dependant_amount_eligibile_person: true + dependant_income: 16_735 + output: + sk_caregiver_amount: 0 \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml new file mode 100644 index 000000000..8ab4a80d8 --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml @@ -0,0 +1,107 @@ +- name: 2023 Have duplicate eligible infirm dependants - non eligible + period: 2023 + input: + province_code: SK + age: 19 + is_child_of_filer: true + is_disabled: true + dependant_income: 15_000 + sk_caregiver_amount: 10_405 + output: + infirm_dependant_amount_eligibile_person: false + +- name: 2022 Have duplicate eligible infirm dependants - non eligible + period: 2022 + input: + province_code: SK + age: 19 + is_child_of_filer: true + is_disabled: true + dependant_income: 15_000 + sk_caregiver_amount: 9_789 + output: + infirm_dependant_amount_eligibile_person: false + +- name: Have infirm dependants below the age threshold - non eligible + period: 2023 + input: + province_code: SK + age: 17 + is_child_of_filer: true + is_disabled: true + dependant_income: 15_000 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: false + +- name: Have no dependants - non eligible + period: 2023 + input: + province_code: SK + age: 0 + is_child_of_filer: false + is_disabled: true + dependant_income: 15_000 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: false + +- name: Have non-disabled dependants - non eligible + period: 2023 + input: + province_code: SK + age: 20 + is_child_of_filer: true + is_disabled: false + dependant_income: 15_000 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: false + +- name: 2023 Infirm dependants' income is above higher income threshold - non eligible + period: 2023 + input: + province_code: SK + age: 20 + is_child_of_filer: true + is_disabled: true + dependant_income: 17_789 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: false + +- name: 2022 Infirm dependants' income is above higher income threshold - non eligible + period: 2022 + input: + province_code: SK + age: 20 + is_child_of_filer: true + is_disabled: true + dependant_income: 16_735 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: false + +- name: 2023 Have eligible infirm dependant + period: 2023 + input: + province_code: SK + age: 21 + is_child_of_filer: true + is_disabled: true + dependant_income: 7_382 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: true + +- name: 2022 Have eligible infirm dependant + period: 2022 + input: + province_code: SK + age: 19 + is_child_of_filer: true + is_disabled: true + dependant_income: 6_944 + sk_caregiver_amount: 0 + output: + infirm_dependant_amount_eligibile_person: true \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py similarity index 51% rename from policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py rename to policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py index 250e2b79a..92d17cfe9 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligibility.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py @@ -1,30 +1,22 @@ from policyengine_canada.model_api import * -class infirm_dependant_amount_eligibility(Variable): - value_type = bool +class dependant_income(Variable): + value_type = float entity = Person - label = "Saskatchewan Infirm Dependant Amount Eligibility" + label = "Dependant Income" + unit = CAD definition_period = YEAR reference = ( "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", - "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13,14,15", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", ) defined_for = ProvinceCode.SK def formula(person, period, parameters): - p = parameters( - period - ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount - - dependant = person("is_dependant", period) - age = person("age", period) - age_eligibility = age <= p.age_threshold - - dependants_income = person("individual_net_income", period) - income_eligibility = dependants_income <= p.higher_income_threshold - - return age_eligibility & income_eligibility \ No newline at end of file + dependant = person("is_child_of_filer", period) + income = person("individual_net_income", period) + return dependant * income \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py index e69de29bb..5b8f31a60 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py @@ -0,0 +1,30 @@ +from policyengine_canada.model_api import * + + +class infirm_dependant_amount(Variable): + value_type = float + entity = Person + label = "Saskatchewan Infirm Dependant Amount" + unit = CAD + definition_period = YEAR + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", + ) + defined_for = ProvinceCode.SK + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount + eligible_person = person( + "infirm_dependant_amount_eligibile_person", period + ) + dependant_income = person("dependant_income", period) + + return eligible_person * min( + p.amount, p.income_threshold.higher - dependant_income + ) \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py new file mode 100644 index 000000000..bdec64fcf --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py @@ -0,0 +1,38 @@ +from policyengine_canada.model_api import * + + +class infirm_dependant_amount_eligible_person(Variable): + value_type = bool + entity = Person + label = "Eligible person for the Saskatchewan Infirm Dependants Amount" + definition_period = YEAR + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", + ) + defined_for = ProvinceCode.SK + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount + + age = person("age", period) + dependant = person("is_child_of_filer", period) + disabled = person("is_disabled", period) + + is_infirm_dependant = dependant & disabled + infirm_age_eligibility = age >= p.age_threshold + + infirm_eligibility = is_infirm_dependant & infirm_age_eligibility + + dependants_income = person("dependant_income", period) + income_eligibility = dependants_income <= p.income_threshold.higher + + infirm_dependant_amount_for_line9 = person("sk_caregiver_amount", period) + duplicate_infirm_dependant = where(infirm_dependant_amount_for_line9 == 0, 0, 1) + + return infirm_eligibility & ~duplicate_infirm_dependant & income_eligibility \ No newline at end of file From 11bad93229d9c4f36bd4809a70c1a6135af7b091 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Wed, 20 Sep 2023 01:35:53 +0000 Subject: [PATCH 05/16] Fix codes errors appear --- .../age_threshold.yaml | 0 .../amount.yaml | 0 .../income_threshold/higher.yaml | 0 .../income_threshold/lower.yaml | 0 ...t.yaml => sk_infirm_dependant_amount.yaml} | 44 +++++++++---------- ...irm_dependant_amount_eligible_person.yaml} | 18 ++++---- .../sk_caregiver_amount.py | 17 +++++++ ...mount.py => sk_infirm_dependant_amount.py} | 6 +-- ...nfirm_dependant_amount_eligible_person.py} | 4 +- 9 files changed, 53 insertions(+), 36 deletions(-) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{infirm_dependent_amount => sk_infirm_dependent_amount}/age_threshold.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{infirm_dependent_amount => sk_infirm_dependent_amount}/amount.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{infirm_dependent_amount => sk_infirm_dependent_amount}/income_threshold/higher.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{infirm_dependent_amount => sk_infirm_dependent_amount}/income_threshold/lower.yaml (100%) rename policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{infirm_dependant_amount.yaml => sk_infirm_dependant_amount.yaml} (64%) rename policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{infirm_dependant_amount_eligible_person.yaml => sk_infirm_dependant_amount_eligible_person.yaml} (81%) create mode 100644 policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py rename policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{infirm_dependant_amount.py => sk_infirm_dependant_amount.py} (85%) rename policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{infirm_dependant_amount_eligible_person.py => sk_infirm_dependant_amount_eligible_person.py} (92%) diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/age_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/age_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/age_threshold.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/amount.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/amount.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/higher.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/higher.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/higher.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/lower.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/infirm_dependent_amount/income_threshold/lower.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/lower.yaml diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml similarity index 64% rename from policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml rename to policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml index e650abfd2..90d50b278 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml @@ -2,97 +2,97 @@ period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false dependant_income: 10_000 output: - sk_caregiver_amount: 0 + sk_infirm_dependant_amount: 0 - name: 2023 Have eligible dependants with income at lower income threshold period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_383 output: - sk_caregiver_amount: 10_405 + sk_infirm_dependant_amount: 10_405 - name: 2023 Have eligible dependants with income below lower income threshold period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_382 output: - sk_caregiver_amount: 10_405 + sk_infirm_dependant_amount: 10_405 - name: 2023 Have eligible dependants with income between lower and higher income threshold period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_caregiver_amount: 7_788 + sk_infirm_dependant_amount: 7_788 - name: 2023 Have eligible dependants with income at higher income threshold period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_788 output: - sk_caregiver_amount: 0 + sk_infirm_dependant_amount: 0 - name: 2023 Have eligible dependants with income above higher income threshold period: 2023 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_789 output: - sk_caregiver_amount: 0 + sk_infirm_dependant_amount: 0 - name: 2022 Have eligible dependants with income at lower income threshold period: 2022 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_945 output: - sk_caregiver_amount: 9_789 + sk_infirm_dependant_amount: 9_789 - name: 2022 Have eligible dependants with income below lower income threshold period: 2022 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_944 output: - sk_caregiver_amount: 9_789 + sk_infirm_dependant_amount: 9_789 - name: 2022 Have eligible dependants with income between lower and higher income threshold period: 2022 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_caregiver_amount: 6_734 + sk_infirm_dependant_amount: 6_734 - name: 2022 Have eligible dependants with income at higher income threshold period: 2022 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_734 output: - sk_caregiver_amount: 0 + sk_infirm_dependant_amount: 0 - name: 2022 Have eligible dependants with income above higher income threshold period: 2022 input: province_code: SK - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_735 output: - sk_caregiver_amount: 0 \ No newline at end of file + sk_infirm_dependant_amount: 0 \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml similarity index 81% rename from policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml rename to policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml index 8ab4a80d8..181e3757f 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml @@ -8,7 +8,7 @@ dependant_income: 15_000 sk_caregiver_amount: 10_405 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: 2022 Have duplicate eligible infirm dependants - non eligible period: 2022 @@ -20,7 +20,7 @@ dependant_income: 15_000 sk_caregiver_amount: 9_789 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: Have infirm dependants below the age threshold - non eligible period: 2023 @@ -32,7 +32,7 @@ dependant_income: 15_000 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: Have no dependants - non eligible period: 2023 @@ -44,7 +44,7 @@ dependant_income: 15_000 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: Have non-disabled dependants - non eligible period: 2023 @@ -56,7 +56,7 @@ dependant_income: 15_000 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: 2023 Infirm dependants' income is above higher income threshold - non eligible period: 2023 @@ -68,7 +68,7 @@ dependant_income: 17_789 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: 2022 Infirm dependants' income is above higher income threshold - non eligible period: 2022 @@ -80,7 +80,7 @@ dependant_income: 16_735 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: false + sk_infirm_dependant_amount_eligible_person: false - name: 2023 Have eligible infirm dependant period: 2023 @@ -92,7 +92,7 @@ dependant_income: 7_382 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: true + sk_infirm_dependant_amount_eligible_person: true - name: 2022 Have eligible infirm dependant period: 2022 @@ -104,4 +104,4 @@ dependant_income: 6_944 sk_caregiver_amount: 0 output: - infirm_dependant_amount_eligibile_person: true \ No newline at end of file + sk_infirm_dependant_amount_eligible_person: true \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py new file mode 100644 index 000000000..c1f611460 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py @@ -0,0 +1,17 @@ +from policyengine_canada.model_api import * + + +class sk_caregiver_amount(Variable): + value_type = float + entity = Person + label = "Saskatchewan Caregiver Amount" + unit = CAD + definition_period = YEAR + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=5", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13", # page=14,16,17 + ) + defined_for = ProvinceCode.SK \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py similarity index 85% rename from policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py rename to policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index 5b8f31a60..530f7bbb4 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -1,7 +1,7 @@ from policyengine_canada.model_api import * -class infirm_dependant_amount(Variable): +class sk_infirm_dependant_amount(Variable): value_type = float entity = Person label = "Saskatchewan Infirm Dependant Amount" @@ -19,9 +19,9 @@ class infirm_dependant_amount(Variable): def formula(person, period, parameters): p = parameters( period - ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount + ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount eligible_person = person( - "infirm_dependant_amount_eligibile_person", period + "sk_infirm_dependant_amount_eligible_person", period ) dependant_income = person("dependant_income", period) diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py similarity index 92% rename from policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py rename to policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index bdec64fcf..8d879802b 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -1,7 +1,7 @@ from policyengine_canada.model_api import * -class infirm_dependant_amount_eligible_person(Variable): +class sk_infirm_dependant_amount_eligible_person(Variable): value_type = bool entity = Person label = "Eligible person for the Saskatchewan Infirm Dependants Amount" @@ -18,7 +18,7 @@ class infirm_dependant_amount_eligible_person(Variable): def formula(person, period, parameters): p = parameters( period - ).gov.provinces.sk.tax.income.credits.infirm_dependant_amount + ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount age = person("age", period) dependant = person("is_child_of_filer", period) From 6cb308ba11eab1546c2c7f641e09619740675077 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Wed, 20 Sep 2023 01:50:56 +0000 Subject: [PATCH 06/16] Test passed Co-authored-by: LanxueHe --- .../age_threshold.yaml | 0 .../amount.yaml | 0 .../income_threshold/higher.yaml | 0 .../income_threshold/lower.yaml | 0 .../infirm_dependant_amount/sk_infirm_dependant_amount.py | 5 +++-- 5 files changed, 3 insertions(+), 2 deletions(-) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{sk_infirm_dependent_amount => sk_infirm_dependant_amount}/age_threshold.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{sk_infirm_dependent_amount => sk_infirm_dependant_amount}/amount.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{sk_infirm_dependent_amount => sk_infirm_dependant_amount}/income_threshold/higher.yaml (100%) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/{sk_infirm_dependent_amount => sk_infirm_dependant_amount}/income_threshold/lower.yaml (100%) diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/age_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/amount.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/higher.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependent_amount/income_threshold/lower.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index 530f7bbb4..a68be0fca 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -24,7 +24,8 @@ def formula(person, period, parameters): "sk_infirm_dependant_amount_eligible_person", period ) dependant_income = person("dependant_income", period) + income_differences = max_(0, p.income_threshold.higher - dependant_income) - return eligible_person * min( - p.amount, p.income_threshold.higher - dependant_income + return eligible_person * min_( + p.amount, income_differences ) \ No newline at end of file From 3bf1907a9138d7829c525b277a1d071d2aa4b5e4 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Wed, 20 Sep 2023 01:53:12 +0000 Subject: [PATCH 07/16] Add changelog --- changelog_entry.yaml | 4 ++++ .../age_threshold.yaml | 2 +- .../sk_infirm_dependant_amount/amount.yaml | 2 +- .../income_threshold/higher.yaml | 2 +- .../income_threshold/lower.yaml | 2 +- .../sk_infirm_dependant_amount.yaml | 2 +- ..._infirm_dependant_amount_eligible_person.yaml | 2 +- .../infirm_dependant_amount/dependant_income.py | 2 +- .../sk_caregiver_amount.py | 2 +- .../sk_infirm_dependant_amount.py | 8 ++++---- ...sk_infirm_dependant_amount_eligible_person.py | 16 ++++++++++++---- 11 files changed, 28 insertions(+), 16 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..5d75d4403 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Saskatchewan Amount for infirm dependants diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml index 399d961bc..a6d00bd4d 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml @@ -14,4 +14,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml index fcf57ae21..7906d62c7 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml index 978938d6d..49cb76d08 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml index 81eee3288..934ce47d3 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml @@ -15,4 +15,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000 - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml index 90d50b278..2f0cf2304 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml @@ -95,4 +95,4 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_735 output: - sk_infirm_dependant_amount: 0 \ No newline at end of file + sk_infirm_dependant_amount: 0 diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml index 181e3757f..925107b2a 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml @@ -104,4 +104,4 @@ dependant_income: 6_944 sk_caregiver_amount: 0 output: - sk_infirm_dependant_amount_eligible_person: true \ No newline at end of file + sk_infirm_dependant_amount_eligible_person: true diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py index 92d17cfe9..dc9bb769c 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py @@ -19,4 +19,4 @@ class dependant_income(Variable): def formula(person, period, parameters): dependant = person("is_child_of_filer", period) income = person("individual_net_income", period) - return dependant * income \ No newline at end of file + return dependant * income diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py index c1f611460..ab6904f6c 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_caregiver_amount.py @@ -14,4 +14,4 @@ class sk_caregiver_amount(Variable): "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=5", "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13", # page=14,16,17 ) - defined_for = ProvinceCode.SK \ No newline at end of file + defined_for = ProvinceCode.SK diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index a68be0fca..b82eb25de 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -24,8 +24,8 @@ def formula(person, period, parameters): "sk_infirm_dependant_amount_eligible_person", period ) dependant_income = person("dependant_income", period) - income_differences = max_(0, p.income_threshold.higher - dependant_income) + income_differences = max_( + 0, p.income_threshold.higher - dependant_income + ) - return eligible_person * min_( - p.amount, income_differences - ) \ No newline at end of file + return eligible_person * min_(p.amount, income_differences) diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 8d879802b..d20e648a0 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -32,7 +32,15 @@ def formula(person, period, parameters): dependants_income = person("dependant_income", period) income_eligibility = dependants_income <= p.income_threshold.higher - infirm_dependant_amount_for_line9 = person("sk_caregiver_amount", period) - duplicate_infirm_dependant = where(infirm_dependant_amount_for_line9 == 0, 0, 1) - - return infirm_eligibility & ~duplicate_infirm_dependant & income_eligibility \ No newline at end of file + infirm_dependant_amount_for_line9 = person( + "sk_caregiver_amount", period + ) + duplicate_infirm_dependant = where( + infirm_dependant_amount_for_line9 == 0, 0, 1 + ) + + return ( + infirm_eligibility + & ~duplicate_infirm_dependant + & income_eligibility + ) From 21fe234816232fa229de72d55d0fa55c9c153e9f Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Wed, 27 Sep 2023 03:19:22 +0000 Subject: [PATCH 08/16] Fix parameters and part of variables --- changelog_entry.yaml | 2 +- .../credits/sk_infirm_dependant_amount/age_threshold.yaml | 4 ++-- .../tax/income/credits/sk_infirm_dependant_amount/amount.yaml | 4 ++-- .../sk_infirm_dependant_amount/income_threshold/higher.yaml | 4 ++-- .../sk_infirm_dependant_amount/income_threshold/lower.yaml | 4 ++-- .../sk_infirm_dependant_amount_eligible_person.py | 4 ++-- .../income/individual}/dependant_income.py | 0 7 files changed, 11 insertions(+), 11 deletions(-) rename policyengine_canada/variables/{gov/provinces/sk/tax/income/credits/infirm_dependant_amount => household/income/individual}/dependant_income.py (100%) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 5d75d4403..4515db819 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Saskatchewan Amount for infirm dependants + - Saskatchewan infirm dependant amount. \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml index a6d00bd4d..c8587d2b8 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml @@ -1,9 +1,9 @@ -description: Saskatchewan qualifies infirm dependants under the Caregiver Tax Credit Amount for filers' dependants with this age or older. +description: Saskatchewan qualifies dependant for the infirm dependant tax credit above this age. values: 2022-01-01: 18 metadata: unit: year - label: Saskatchewan Infirm Dependants Tax Credit infirm dependant age eligibility + label: Saskatchewan infirm dependants tax credit age eligibility reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml index 7906d62c7..f3301b748 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml @@ -1,10 +1,10 @@ -description: Saskatchewan allows for this maximum infirm dependants amount. +description: Saskatchewan allows for this maximum infirm dependant tax credit amount. values: 2022-01-01: 9_789 2023-01-01: 10_405 metadata: unit: currency-CAD - label: Saskatchewan Infirm Dependants Tax Credit maximum amount + label: Saskatchewan infirm dependants tax credit maximum amount reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml index 49cb76d08..6e20094c6 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml @@ -1,10 +1,10 @@ -description: Saskatchewan reduces the maximum Infirm Dependants Tax Credit amount by the difference of this threshold and the dependants income. +description: Saskatchewan reduces the maximum infirm dependants tax credit amount by the difference of this threshold and the dependants income. values: 2022-01-01: 16_734 2023-01-01: 17_788 metadata: unit: currency-CAD - label: Saskatchewan Infirm Dependants Tax Credit Higher Income Threshold for the Dependant + label: Saskatchewan infirm dependants tax credit higher income threshold reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml index 934ce47d3..5f41739a2 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml @@ -1,10 +1,10 @@ -description: Saskatchewan reduces the maximum Infirm Dependants Tax Credit Amount for dependants with net income is above this threshold. +description: Saskatchewan reduces the infirm dependants tax credit amount for dependants with net income above this threshold. values: 2022-01-01: 6_945 2023-01-01: 7_383 metadata: unit: currency-CAD - label: Saskatchewan Infirm Dependants Tax Credit Lower Income Threshold for the Dependant + label: Saskatchewan infirm dependants tax credit lower income threshold reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index d20e648a0..7497f8416 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -32,11 +32,11 @@ def formula(person, period, parameters): dependants_income = person("dependant_income", period) income_eligibility = dependants_income <= p.income_threshold.higher - infirm_dependant_amount_for_line9 = person( + caregiver_amount = person( "sk_caregiver_amount", period ) duplicate_infirm_dependant = where( - infirm_dependant_amount_for_line9 == 0, 0, 1 + caregiver_amount == 0, 0, 1 ) return ( diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py b/policyengine_canada/variables/household/income/individual/dependant_income.py similarity index 100% rename from policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/dependant_income.py rename to policyengine_canada/variables/household/income/individual/dependant_income.py From fab8580e733abc66d454f7da54cd159969eb3816 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 28 Sep 2023 22:36:18 +0000 Subject: [PATCH 09/16] Improve variables --- changelog_entry.yaml | 2 +- .../sk_infirm_dependant_amount.py | 5 +++-- ..._infirm_dependant_amount_eligible_person.py | 18 ++++++------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 4515db819..0612eedda 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Saskatchewan infirm dependant amount. \ No newline at end of file + - Saskatchewan infirm dependant amount. diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index b82eb25de..3ad3b2703 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -14,7 +14,7 @@ class sk_infirm_dependant_amount(Variable): "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", ) - defined_for = ProvinceCode.SK + defined_for = "sk_infirm_dependant_amount_eligible_person" def formula(person, period, parameters): p = parameters( @@ -23,9 +23,10 @@ def formula(person, period, parameters): eligible_person = person( "sk_infirm_dependant_amount_eligible_person", period ) + dependant_income = person("dependant_income", period) income_differences = max_( 0, p.income_threshold.higher - dependant_income ) - return eligible_person * min_(p.amount, income_differences) + return min_(p.amount, income_differences) diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 7497f8416..2935b4ec3 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -32,15 +32,9 @@ def formula(person, period, parameters): dependants_income = person("dependant_income", period) income_eligibility = dependants_income <= p.income_threshold.higher - caregiver_amount = person( - "sk_caregiver_amount", period - ) - duplicate_infirm_dependant = where( - caregiver_amount == 0, 0, 1 - ) - - return ( - infirm_eligibility - & ~duplicate_infirm_dependant - & income_eligibility - ) + caregiver_amount = person("sk_caregiver_amount", period) + duplicate_infirm_dependant = where(caregiver_amount == 0, 0, 1) + + eligible = infirm_eligibility & income_eligibility + + return where(caregiver_amount == 0, eligible, 0) From ef88dde3d8321951d22e02817c706e4a3ca8d656 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 28 Sep 2023 22:48:31 +0000 Subject: [PATCH 10/16] Merge --- .../infirm_dependant_amount/sk_infirm_dependant_amount.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index 3ad3b2703..f1e789cb1 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -20,9 +20,6 @@ def formula(person, period, parameters): p = parameters( period ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount - eligible_person = person( - "sk_infirm_dependant_amount_eligible_person", period - ) dependant_income = person("dependant_income", period) income_differences = max_( From 062fcd562d554d0eb241de47feda5d214978d215 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:27:15 +0000 Subject: [PATCH 11/16] Improve Codes --- .../sk_infirm_dependant_amount/age_threshold.yaml | 7 ++++--- .../credits/sk_infirm_dependant_amount/amount.yaml | 3 ++- .../income_threshold/higher.yaml | 3 ++- .../income_threshold/lower.yaml | 3 ++- .../sk_infirm_dependant_amount_eligible_person.py | 9 ++++----- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml index c8587d2b8..4babf8272 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/age_threshold.yaml @@ -1,9 +1,10 @@ -description: Saskatchewan qualifies dependant for the infirm dependant tax credit above this age. +description: Saskatchewan qualifies dependants for the infirm dependant tax credit above this age. values: 2022-01-01: 18 metadata: unit: year - label: Saskatchewan infirm dependants tax credit age eligibility + label: Saskatchewan infirm dependants tax credit age threshold + period: year reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -13,5 +14,5 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml index f3301b748..385851e76 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml @@ -5,6 +5,7 @@ values: metadata: unit: currency-CAD label: Saskatchewan infirm dependants tax credit maximum amount + period: year reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -14,5 +15,5 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml index 6e20094c6..a383dedf9 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml @@ -5,6 +5,7 @@ values: metadata: unit: currency-CAD label: Saskatchewan infirm dependants tax credit higher income threshold + period: year reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -14,5 +15,5 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml index 5f41739a2..eb5185f4f 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml @@ -5,6 +5,7 @@ values: metadata: unit: currency-CAD label: Saskatchewan infirm dependants tax credit lower income threshold + period: year reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 @@ -14,5 +15,5 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 2935b4ec3..636391961 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -32,9 +32,8 @@ def formula(person, period, parameters): dependants_income = person("dependant_income", period) income_eligibility = dependants_income <= p.income_threshold.higher - caregiver_amount = person("sk_caregiver_amount", period) - duplicate_infirm_dependant = where(caregiver_amount == 0, 0, 1) + caregiver_amount_eligible = person("sk_caregiver_amount", period) == 0 - eligible = infirm_eligibility & income_eligibility - - return where(caregiver_amount == 0, eligible, 0) + return ( + infirm_eligibility & income_eligibility & caregiver_amount_eligible + ) From bba0043a9a05b130d803896ad370a0361d5d3821 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Sun, 3 Dec 2023 04:26:39 +0000 Subject: [PATCH 12/16] Change parameters to be bracket structure --- .../income_threshold/higher.yaml | 19 ---------- .../income_threshold/lower.yaml | 19 ---------- ...unt.yaml => income_threshold_bracket.yaml} | 37 ++++++++++++++----- ...firm_dependant_amount_eligible_person.yaml | 31 ---------------- .../sk_infirm_dependant_amount.py | 5 +-- ...infirm_dependant_amount_eligible_person.py | 5 +-- 6 files changed, 30 insertions(+), 86 deletions(-) delete mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml delete mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/{amount.yaml => income_threshold_bracket.yaml} (57%) diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml deleted file mode 100644 index a383dedf9..000000000 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Saskatchewan reduces the maximum infirm dependants tax credit amount by the difference of this threshold and the dependants income. -values: - 2022-01-01: 16_734 - 2023-01-01: 17_788 -metadata: - unit: currency-CAD - label: Saskatchewan infirm dependants tax credit higher income threshold - period: year - reference: - - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 - - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 - - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml deleted file mode 100644 index eb5185f4f..000000000 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Saskatchewan reduces the infirm dependants tax credit amount for dependants with net income above this threshold. -values: - 2022-01-01: 6_945 - 2023-01-01: 7_383 -metadata: - unit: currency-CAD - label: Saskatchewan infirm dependants tax credit lower income threshold - period: year - reference: - - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 - - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 - - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 - - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml similarity index 57% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml index 385851e76..23901daa5 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml @@ -1,12 +1,31 @@ -description: Saskatchewan allows for this maximum infirm dependant tax credit amount. -values: - 2022-01-01: 9_789 - 2023-01-01: 10_405 +description: Saskatchewan infirm dependants credit amount phases out by income thresholds. +brackets: + - amount: + 2022-01-01: 9_789 + 2023-01-01: 10_405 + threshold: + 2022-01-01: 0 + 2023-01-01: 0 + - amount: + 2022-01-01: 9_789 + 2023-01-01: 10_405 + threshold: + 2022-01-01: 6_945 + 2023-01-01: 7_383 + - amount: + 2022-01-01: 0 + 2023-01-01: 0 + threshold: + 2022-01-01: 16_734 + 2023-01-01: 17_788 metadata: - unit: currency-CAD - label: Saskatchewan infirm dependants tax credit maximum amount - period: year - reference: + type: single_amount + threshold_unit: currency-CAD + amount_unit: currency-CAD + period: year + name: Saskatchewan_infirm_dependants_credit_income_thresholds + label: Saskatchewan infirm dependants credit income thresholds + reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older @@ -16,4 +35,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml index 925107b2a..5e6de5289 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml @@ -5,7 +5,6 @@ age: 19 is_child_of_filer: true is_disabled: true - dependant_income: 15_000 sk_caregiver_amount: 10_405 output: sk_infirm_dependant_amount_eligible_person: false @@ -17,7 +16,6 @@ age: 19 is_child_of_filer: true is_disabled: true - dependant_income: 15_000 sk_caregiver_amount: 9_789 output: sk_infirm_dependant_amount_eligible_person: false @@ -29,7 +27,6 @@ age: 17 is_child_of_filer: true is_disabled: true - dependant_income: 15_000 sk_caregiver_amount: 0 output: sk_infirm_dependant_amount_eligible_person: false @@ -41,7 +38,6 @@ age: 0 is_child_of_filer: false is_disabled: true - dependant_income: 15_000 sk_caregiver_amount: 0 output: sk_infirm_dependant_amount_eligible_person: false @@ -53,31 +49,6 @@ age: 20 is_child_of_filer: true is_disabled: false - dependant_income: 15_000 - sk_caregiver_amount: 0 - output: - sk_infirm_dependant_amount_eligible_person: false - -- name: 2023 Infirm dependants' income is above higher income threshold - non eligible - period: 2023 - input: - province_code: SK - age: 20 - is_child_of_filer: true - is_disabled: true - dependant_income: 17_789 - sk_caregiver_amount: 0 - output: - sk_infirm_dependant_amount_eligible_person: false - -- name: 2022 Infirm dependants' income is above higher income threshold - non eligible - period: 2022 - input: - province_code: SK - age: 20 - is_child_of_filer: true - is_disabled: true - dependant_income: 16_735 sk_caregiver_amount: 0 output: sk_infirm_dependant_amount_eligible_person: false @@ -89,7 +60,6 @@ age: 21 is_child_of_filer: true is_disabled: true - dependant_income: 7_382 sk_caregiver_amount: 0 output: sk_infirm_dependant_amount_eligible_person: true @@ -101,7 +71,6 @@ age: 19 is_child_of_filer: true is_disabled: true - dependant_income: 6_944 sk_caregiver_amount: 0 output: sk_infirm_dependant_amount_eligible_person: true diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index f1e789cb1..f46cf2ff5 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -22,8 +22,5 @@ def formula(person, period, parameters): ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount dependant_income = person("dependant_income", period) - income_differences = max_( - 0, p.income_threshold.higher - dependant_income - ) - return min_(p.amount, income_differences) + return p.income_threshold_bracket.calc(dependant_income) diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 636391961..4b7705ac6 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -29,11 +29,8 @@ def formula(person, period, parameters): infirm_eligibility = is_infirm_dependant & infirm_age_eligibility - dependants_income = person("dependant_income", period) - income_eligibility = dependants_income <= p.income_threshold.higher - caregiver_amount_eligible = person("sk_caregiver_amount", period) == 0 return ( - infirm_eligibility & income_eligibility & caregiver_amount_eligible + infirm_eligibility & caregiver_amount_eligible ) From 9fa38bd7b65c5efd927410d107ad6abd5ac0a640 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:26:12 +0000 Subject: [PATCH 13/16] Improve codes --- ...ome_threshold_bracket.yaml => amount.yaml} | 37 +++++-------------- .../income_threshold/higher.yaml | 19 ++++++++++ .../income_threshold/lower.yaml | 19 ++++++++++ ...firm_dependant_amount_eligible_person.yaml | 31 ++++++++++++++++ .../sk_infirm_dependant_amount.py | 10 ++++- ...infirm_dependant_amount_eligible_person.py | 5 ++- 6 files changed, 91 insertions(+), 30 deletions(-) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/{income_threshold_bracket.yaml => amount.yaml} (57%) create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml similarity index 57% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml index 23901daa5..94abeb0c5 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold_bracket.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml @@ -1,31 +1,12 @@ -description: Saskatchewan infirm dependants credit amount phases out by income thresholds. -brackets: - - amount: - 2022-01-01: 9_789 - 2023-01-01: 10_405 - threshold: - 2022-01-01: 0 - 2023-01-01: 0 - - amount: - 2022-01-01: 9_789 - 2023-01-01: 10_405 - threshold: - 2022-01-01: 6_945 - 2023-01-01: 7_383 - - amount: - 2022-01-01: 0 - 2023-01-01: 0 - threshold: - 2022-01-01: 16_734 - 2023-01-01: 17_788 +description: Saskatchewan allows for this maximum infirm dependant credit amount. +values: + 2022-01-01: 9_789 + 2023-01-01: 10_405 metadata: - type: single_amount - threshold_unit: currency-CAD - amount_unit: currency-CAD - period: year - name: Saskatchewan_infirm_dependants_credit_income_thresholds - label: Saskatchewan infirm dependants credit income thresholds - reference: + unit: currency-CAD + label: Saskatchewan infirm dependants tax credit maximum amount + period: year + reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older @@ -35,4 +16,4 @@ metadata: - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. - href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 \ No newline at end of file + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml new file mode 100644 index 000000000..b06dcb55e --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/higher.yaml @@ -0,0 +1,19 @@ +description: Saskatchewan reduces the maximum infirm dependants tax credit amount by the difference of this threshold and the dependants income. +values: + 2022-01-01: 16_734 + 2023-01-01: 17_788 +metadata: + unit: currency-CAD + label: Saskatchewan infirm dependants tax credit higher income threshold + period: year + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml new file mode 100644 index 000000000..97dec3b3b --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/income_threshold/lower.yaml @@ -0,0 +1,19 @@ +description: Saskatchewan reduces the infirm dependants tax credit amount for dependants wuth net income above this threshold. +values: + 2022-01-01: 6_945 + 2023-01-01: 7_383 +metadata: + unit: currency-CAD + label: Saskatchewan infirm dependants tax credit lower income threshold + period: year + reference: + - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1 + - title: 2023 Sasktachewan Personal Tax Credits Return Calculation Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1 + - title: 2022 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1 + - title: 2022 Sasktachewan Sasktachewan Personal Tax Credits Return Calculation Form Line10 Amount for infirm dependants age 18 or older + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6 + - title: Sasktachewan The Income Tax Act, 2000#2020, c25, s.5. + href: https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15 diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml index 5e6de5289..f443b64d9 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.yaml @@ -6,6 +6,7 @@ is_child_of_filer: true is_disabled: true sk_caregiver_amount: 10_405 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: false @@ -17,6 +18,7 @@ is_child_of_filer: true is_disabled: true sk_caregiver_amount: 9_789 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: false @@ -28,6 +30,7 @@ is_child_of_filer: true is_disabled: true sk_caregiver_amount: 0 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: false @@ -39,6 +42,7 @@ is_child_of_filer: false is_disabled: true sk_caregiver_amount: 0 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: false @@ -50,6 +54,7 @@ is_child_of_filer: true is_disabled: false sk_caregiver_amount: 0 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: false @@ -61,6 +66,7 @@ is_child_of_filer: true is_disabled: true sk_caregiver_amount: 0 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: true @@ -72,5 +78,30 @@ is_child_of_filer: true is_disabled: true sk_caregiver_amount: 0 + dependant_income: 16_734 output: sk_infirm_dependant_amount_eligible_person: true + +- name: 2022 Income higher than the higher income threshold + period: 2022 + input: + province_code: SK + age: 19 + is_child_of_filer: true + is_disabled: true + sk_caregiver_amount: 0 + dependant_income: 17_789 + output: + sk_infirm_dependant_amount_eligible_person: false + +- name: 2023 Income higher than the higher income threshold + period: 2023 + input: + province_code: SK + age: 19 + is_child_of_filer: true + is_disabled: true + sk_caregiver_amount: 0 + dependant_income: 17_789 + output: + sk_infirm_dependant_amount_eligible_person: false diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index f46cf2ff5..c0f45aa71 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -22,5 +22,13 @@ def formula(person, period, parameters): ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount dependant_income = person("dependant_income", period) + income_differences = max_( + 0, p.income_threshold.higher - dependant_income + ) + infirm_credit_amount = select( + dependant_income > p.income_threshold.lower, + min_(income_differences, p.amount), + p.amount, + ) - return p.income_threshold_bracket.calc(dependant_income) + return infirm_credit_amount diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 4b7705ac6..149a75154 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -31,6 +31,9 @@ def formula(person, period, parameters): caregiver_amount_eligible = person("sk_caregiver_amount", period) == 0 + dependants_income = person("dependant_income", period) + income_eligibility = dependants_income <= p.income_threshold.higher + return ( - infirm_eligibility & caregiver_amount_eligible + infirm_eligibility & caregiver_amount_eligible & income_eligibility ) From 34cb5e821279c85f89fb837486226e1c581fca63 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Fri, 8 Dec 2023 00:00:39 +0000 Subject: [PATCH 14/16] Improve codes --- .../{amount.yaml => max_amount.yaml} | 2 +- .../sk_infirm_dependant_amount.py | 13 +++++-------- .../sk_infirm_dependant_amount_eligible_person.py | 10 ++++++---- 3 files changed, 12 insertions(+), 13 deletions(-) rename policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/{amount.yaml => max_amount.yaml} (94%) diff --git a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/max_amount.yaml similarity index 94% rename from policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml rename to policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/max_amount.yaml index 94abeb0c5..32a99a7dd 100644 --- a/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/sk/tax/income/credits/sk_infirm_dependant_amount/max_amount.yaml @@ -4,7 +4,7 @@ values: 2023-01-01: 10_405 metadata: unit: currency-CAD - label: Saskatchewan infirm dependants tax credit maximum amount + label: Saskatchewan infirm dependants tax credit max amount period: year reference: - title: 2023 Sasktachewan Personal Tax Credits Return Line10 Amount for infirm dependants age 18 or older diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index c0f45aa71..cae0a0245 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -22,13 +22,10 @@ def formula(person, period, parameters): ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount dependant_income = person("dependant_income", period) - income_differences = max_( - 0, p.income_threshold.higher - dependant_income - ) - infirm_credit_amount = select( + reduced_income = max_(0, p.income_threshold.higher - dependant_income) + + return select( dependant_income > p.income_threshold.lower, - min_(income_differences, p.amount), - p.amount, + min_(reduced_income, p.max_amount), + p.max_amount, ) - - return infirm_credit_amount diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py index 149a75154..92ae44073 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_eligible_person.py @@ -25,15 +25,17 @@ def formula(person, period, parameters): disabled = person("is_disabled", period) is_infirm_dependant = dependant & disabled - infirm_age_eligibility = age >= p.age_threshold + age_eligibility = age >= p.age_threshold - infirm_eligibility = is_infirm_dependant & infirm_age_eligibility + infirm_and_age_eligibility = is_infirm_dependant & age_eligibility - caregiver_amount_eligible = person("sk_caregiver_amount", period) == 0 + receives_caregiver_amount = person("sk_caregiver_amount", period) > 0 dependants_income = person("dependant_income", period) income_eligibility = dependants_income <= p.income_threshold.higher return ( - infirm_eligibility & caregiver_amount_eligible & income_eligibility + infirm_and_age_eligibility + & ~receives_caregiver_amount + & income_eligibility ) From 9453841781d83dbbb7d8062035356debc3b3cf25 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:51:21 +0000 Subject: [PATCH 15/16] Make some adjustments on the variable entity. --- .../sk_infirm_dependant_amount.yaml | 22 ++++++------- .../sk_infirm_dependant_amount.py | 21 ++----------- .../sk_infirm_dependant_individual_amount.py | 31 +++++++++++++++++++ 3 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml index 2f0cf2304..b164edbca 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml @@ -5,7 +5,7 @@ sk_infirm_dependant_amount_eligible_person: false dependant_income: 10_000 output: - sk_infirm_dependant_amount: 0 + sk_infirm_dependant_individual_amount: 0 - name: 2023 Have eligible dependants with income at lower income threshold period: 2023 @@ -14,7 +14,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_383 output: - sk_infirm_dependant_amount: 10_405 + sk_infirm_dependant_individual_amount: 10_405 - name: 2023 Have eligible dependants with income below lower income threshold period: 2023 @@ -23,7 +23,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_382 output: - sk_infirm_dependant_amount: 10_405 + sk_infirm_dependant_individual_amount: 10_405 - name: 2023 Have eligible dependants with income between lower and higher income threshold period: 2023 @@ -32,7 +32,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_infirm_dependant_amount: 7_788 + sk_infirm_dependant_individual_amount: 7_788 - name: 2023 Have eligible dependants with income at higher income threshold period: 2023 @@ -41,7 +41,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_788 output: - sk_infirm_dependant_amount: 0 + sk_infirm_dependant_individual_amount: 0 - name: 2023 Have eligible dependants with income above higher income threshold period: 2023 @@ -50,7 +50,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_789 output: - sk_infirm_dependant_amount: 0 + sk_infirm_dependant_individual_amount: 0 - name: 2022 Have eligible dependants with income at lower income threshold period: 2022 @@ -59,7 +59,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_945 output: - sk_infirm_dependant_amount: 9_789 + sk_infirm_dependant_individual_amount: 9_789 - name: 2022 Have eligible dependants with income below lower income threshold period: 2022 @@ -68,7 +68,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_944 output: - sk_infirm_dependant_amount: 9_789 + sk_infirm_dependant_individual_amount: 9_789 - name: 2022 Have eligible dependants with income between lower and higher income threshold period: 2022 @@ -77,7 +77,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_infirm_dependant_amount: 6_734 + sk_infirm_dependant_individual_amount: 6_734 - name: 2022 Have eligible dependants with income at higher income threshold period: 2022 @@ -86,7 +86,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_734 output: - sk_infirm_dependant_amount: 0 + sk_infirm_dependant_individual_amount: 0 - name: 2022 Have eligible dependants with income above higher income threshold period: 2022 @@ -95,4 +95,4 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_735 output: - sk_infirm_dependant_amount: 0 + sk_infirm_dependant_individual_amount: 0 diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index cae0a0245..c62cc0cfb 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -1,11 +1,9 @@ from policyengine_canada.model_api import * - class sk_infirm_dependant_amount(Variable): value_type = float - entity = Person - label = "Saskatchewan Infirm Dependant Amount" - unit = CAD + entity = Household + label = "Saskatchewan Infirm Dependant Amount for Household" definition_period = YEAR reference = ( "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", @@ -14,18 +12,5 @@ class sk_infirm_dependant_amount(Variable): "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", ) - defined_for = "sk_infirm_dependant_amount_eligible_person" - - def formula(person, period, parameters): - p = parameters( - period - ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount - - dependant_income = person("dependant_income", period) - reduced_income = max_(0, p.income_threshold.higher - dependant_income) - return select( - dependant_income > p.income_threshold.lower, - min_(reduced_income, p.max_amount), - p.max_amount, - ) + adds = ['sk_infirm_dependant_individual_amount"] \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py new file mode 100644 index 000000000..0f285573f --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py @@ -0,0 +1,31 @@ +from policyengine_canada.model_api import * + + +class sk_infirm_dependant_individual_amount(Variable): + value_type = float + entity = Person + label = "Saskatchewan Infirm Dependant Amount for Each Eligible Dependant" + unit = CAD + definition_period = YEAR + reference = ( + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-23e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk/td1sk-22e.pdf#page=1", + "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1sk-ws/td1sk-ws-lp-22e.pdf#page=6", + "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", + ) + defined_for = "sk_infirm_dependant_amount_eligible_person" + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.sk.tax.income.credits.sk_infirm_dependant_amount + + dependant_income = person("dependant_income", period) + reduced_income = max_(0, p.income_threshold.higher - dependant_income) + + return select( + dependant_income > p.income_threshold.lower, + min_(reduced_income, p.max_amount), + p.max_amount, + ) From bd38669142624e698f5a82e403fa3c555e01c872 Mon Sep 17 00:00:00 2001 From: Yaohhhh <128541260+Yaohhhh@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:43:38 +0000 Subject: [PATCH 16/16] Improve --- .../sk_infirm_dependant_amount.yaml | 22 +++++++++---------- .../sk_infirm_dependant_amount.py | 3 ++- ...y => sk_infirm_dependant_amount_person.py} | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) rename policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/{sk_infirm_dependant_individual_amount.py => sk_infirm_dependant_amount_person.py} (95%) diff --git a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml index b164edbca..4fcbd5657 100644 --- a/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.yaml @@ -5,7 +5,7 @@ sk_infirm_dependant_amount_eligible_person: false dependant_income: 10_000 output: - sk_infirm_dependant_individual_amount: 0 + sk_infirm_dependant_amount_person: 0 - name: 2023 Have eligible dependants with income at lower income threshold period: 2023 @@ -14,7 +14,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_383 output: - sk_infirm_dependant_individual_amount: 10_405 + sk_infirm_dependant_amount_person: 10_405 - name: 2023 Have eligible dependants with income below lower income threshold period: 2023 @@ -23,7 +23,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 7_382 output: - sk_infirm_dependant_individual_amount: 10_405 + sk_infirm_dependant_amount_person: 10_405 - name: 2023 Have eligible dependants with income between lower and higher income threshold period: 2023 @@ -32,7 +32,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_infirm_dependant_individual_amount: 7_788 + sk_infirm_dependant_amount_person: 7_788 - name: 2023 Have eligible dependants with income at higher income threshold period: 2023 @@ -41,7 +41,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_788 output: - sk_infirm_dependant_individual_amount: 0 + sk_infirm_dependant_amount_person: 0 - name: 2023 Have eligible dependants with income above higher income threshold period: 2023 @@ -50,7 +50,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 17_789 output: - sk_infirm_dependant_individual_amount: 0 + sk_infirm_dependant_amount_person: 0 - name: 2022 Have eligible dependants with income at lower income threshold period: 2022 @@ -59,7 +59,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_945 output: - sk_infirm_dependant_individual_amount: 9_789 + sk_infirm_dependant_amount_person: 9_789 - name: 2022 Have eligible dependants with income below lower income threshold period: 2022 @@ -68,7 +68,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 6_944 output: - sk_infirm_dependant_individual_amount: 9_789 + sk_infirm_dependant_amount_person: 9_789 - name: 2022 Have eligible dependants with income between lower and higher income threshold period: 2022 @@ -77,7 +77,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 10_000 output: - sk_infirm_dependant_individual_amount: 6_734 + sk_infirm_dependant_amount_person: 6_734 - name: 2022 Have eligible dependants with income at higher income threshold period: 2022 @@ -86,7 +86,7 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_734 output: - sk_infirm_dependant_individual_amount: 0 + sk_infirm_dependant_amount_person: 0 - name: 2022 Have eligible dependants with income above higher income threshold period: 2022 @@ -95,4 +95,4 @@ sk_infirm_dependant_amount_eligible_person: true dependant_income: 16_735 output: - sk_infirm_dependant_individual_amount: 0 + sk_infirm_dependant_amount_person: 0 diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py index c62cc0cfb..52b347d5b 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount.py @@ -1,5 +1,6 @@ from policyengine_canada.model_api import * + class sk_infirm_dependant_amount(Variable): value_type = float entity = Household @@ -13,4 +14,4 @@ class sk_infirm_dependant_amount(Variable): "https://pubsaskdev.blob.core.windows.net/pubsask-prod/806/I2-01.pdf#page=13 #page=14,15", ) - adds = ['sk_infirm_dependant_individual_amount"] \ No newline at end of file + adds = ["sk_infirm_dependant_amount_person"] diff --git a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_person.py similarity index 95% rename from policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py rename to policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_person.py index 0f285573f..32ac55344 100644 --- a/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_individual_amount.py +++ b/policyengine_canada/variables/gov/provinces/sk/tax/income/credits/infirm_dependant_amount/sk_infirm_dependant_amount_person.py @@ -1,7 +1,7 @@ from policyengine_canada.model_api import * -class sk_infirm_dependant_individual_amount(Variable): +class sk_infirm_dependant_amount_person(Variable): value_type = float entity = Person label = "Saskatchewan Infirm Dependant Amount for Each Eligible Dependant"