Repository: PolicyEngine/policyengine-canada (language: python)

Issue:
Yukon Personal Basic Amount
Reference 1: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf
Reference 2: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf
Yukon basic personal amount
reference:
https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf


Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb..3e5f099cc 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: minor
+  changes:
+    added:
+    - Yukon basic personal amount.
diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/applicable_amount.yaml
new file mode 100644
index 000000000..2a24623a7
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/applicable_amount.yaml
@@ -0,0 +1,16 @@
+description: Yukon reduces the basic personal amount for high income filers by this amount.
+
+values:
+  2022-01-01: 1_679
+  2023-01-01: 1_479
+metadata:
+  unit: currency-CAD
+  period: year
+  label: Yukon basic personal amount applicable amount
+  reference:
+  - title: Worksheet for the Yukon 2023 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf#page=1
+  - title: Worksheet for the Yukon 2022 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-22e.pdf#page=1
+  - title: Yukon Income Tax Act, line (15)
+    href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf#page=18
diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/divisor.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/divisor.yaml
new file mode 100644
index 000000000..cea0f855d
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/divisor.yaml
@@ -0,0 +1,15 @@
+description: Yukon divides the basic personal amount by this amount.
+values:
+  2022-01-01: 66_083
+  2023-01-01: 70_245
+metadata:
+  unit: currency-CAD
+  period: year
+  label: Yukon income basic personal divisor
+  reference:
+  - title: Worksheet for the Yukon 2023 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf#page=1
+  - title: Worksheet for the Yukon 2022 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-22e.pdf#page=1
+  - title: Yukon Income Tax Act, line (15)
+    href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf#page=18
diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/income_threshold.yaml
new file mode 100644
index 000000000..de4a07293
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/income_threshold.yaml
@@ -0,0 +1,15 @@
+description: Yukon reduces the basic personal amount for filers with income above this threshold.
+values:
+  2022-01-01: 155_625
+  2023-01-01: 165_430
+metadata:
+  unit: currency-CAD
+  period: year
+  label: Yukon basic personal amount reduction income threshold
+  reference:
+  - title: Worksheet for the Yukon 2023 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf#page=1
+  - title: Worksheet for the Yukon 2022 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-22e.pdf#page=1
+  - title: Yukon Income Tax Act, line (15)
+    href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf#page=18
diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml
new file mode 100644
index 000000000..feea7a2a2
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml
@@ -0,0 +1,15 @@
+description: Yukon provides this base basic personal amount.
+values:
+  2022-01-01: 12_719
+  2023-01-01: 13_521
+metadata:
+  unit: currency-CAD
+  period: year
+  label: Yukon income basic personal base amount
+  reference:
+  - title: Worksheet for the Yukon 2023 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf#page=1
+  - title: Worksheet for the Yukon 2022 Personal Tax Credits Return
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-22e.pdf#page=1
+  - title: Yukon Income Tax Act, line (15)
+    href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf#page=18
diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py
new file mode 100644
index 000000000..47b5b5fb1
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py
@@ -0,0 +1,13 @@
+from policyengine_canada.model_api import *
+
+
+class yt_basic_personal_amount(Variable):
+    value_type = float
+    entity = Person
+    label = "Yukon basic personal amount"
+    definition_period = YEAR
+    defined_for = ProvinceCode.YT
+    adds = [
+        "yt_basic_personal_amount_base",
+        "yt_basic_personal_amount_additional",
+    ]
diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py
new file mode 100644
index 000000000..999f8f8ea
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py
@@ -0,0 +1,24 @@
+from policyengine_canada.model_api import *
+
+
+class yt_additional_basic_personal_amount(Variable):
+    value_type = float
+    entity = Person
+    label = "Yukon additional basic personal amount"
+    definition_period = YEAR
+    defined_for = ProvinceCode.YT
+
+    def formula(person, period, parameters):
+        p = parameters(
+            period
+        ).gov.provinces.yt.tax.income.credits.basic_personal_amount.additional
+
+        individual_net_income = person("individual_net_income", period)
+        additional_amount = p.divisor - (
+            individual_net_income - p.income_threshold
+        )
+        additional_amount_eligible = additional_amount > 0
+        yt_additional_amount = additional_amount_eligible * additional_amount
+        yt_additional_amount = yt_additional_amount / p.divisor
+
+        return yt_additional_amount * p.applicable_amount
diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_base.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_base.py
new file mode 100644
index 000000000..4481d69b8
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_base.py
@@ -0,0 +1,12 @@
+from policyengine_canada.model_api import *
+
+
+class yt_basic_personal_amount_base(Variable):
+    value_type = float
+    entity = Person
+    label = "Yukon basic personal amount base"
+    definition_period = YEAR
+    defined_for = ProvinceCode.YT
+    adds = (
+        "gov.provinces.yt.tax.income.credits.basic_personal_amount.base_amount"
+    )


Test patch:
diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml
new file mode 100644
index 000000000..4a523536e
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml
@@ -0,0 +1,51 @@
+- name: Income above the income threshold but additional amount below 0 in 2023
+  period: 2023
+  input:
+    province_code: YT
+    individual_net_income: 250_000
+  output:
+    yt_additional_basic_personal_amount: 0
+
+- name: Income below the income threshold and additional amount equals 0 in 2023 (edge case)
+  period: 2023
+  absolute_error_margin: 0.2
+  input:
+    province_code: YT
+    individual_net_income: 235_675
+  output:
+    yt_additional_basic_personal_amount: 0
+
+- name: Income below the income threshold and additional amount above 0 in 2023
+  period: 2023
+  absolute_error_margin: 0.2
+  input:
+    province_code: YT
+    individual_net_income: 200_000
+  output:
+    yt_additional_basic_personal_amount: 751
+
+- name: Income above the income threshold but additional amount below 0 in 2022
+  period: 2022
+  input:
+    province_code: YT
+    individual_net_income: 250_000
+  output:
+    yt_additional_basic_personal_amount: 0
+
+- name: Income below the income threshold and additional amount equals 0 in 2022 (edge case)
+  period: 2022
+  absolute_error_margin: 0.2
+  input:
+    province_code: YT
+    individual_net_income: 221_708
+  output:
+    yt_additional_basic_personal_amount: 0
+
+- name: Income below the income threshold and additional amount above 0 in 2022
+  period: 2022
+  absolute_error_margin: 0.2
+  input:
+    province_code: YT
+    individual_net_income: 200_000
+  output:
+    yt_additional_basic_personal_amount: 551.5