From 6aa263858c68ba60f8d52cc3465a3308bd0aec85 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 29 May 2023 22:25:58 +0000 Subject: [PATCH 01/22] changelog --- changelog_entry.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..084ea8fed 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Yukon basic personal amount. \ No newline at end of file From 960344a9d1567f97803312a8072bda8c9d1b0f34 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:15:48 +0000 Subject: [PATCH 02/22] parameter & variables --- .../applicable_amount.yaml | 9 ++++++++ .../basic_personal_amount/base_amount.yaml | 9 ++++++++ .../income_threshold.yaml | 9 ++++++++ .../basic_personal_amount/scale_value.yaml | 9 ++++++++ .../credits/yt_basic_personal_amount.yaml | 23 +++++++++++++++++++ .../credits/yt_basic_personal_amount.py | 19 +++++++++++++++ 6 files changed, 78 insertions(+) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml create mode 100644 policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml new file mode 100644 index 000000000..e1af5acc9 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -0,0 +1,9 @@ +description: Yukon uses this applicable amount for the basic personal amount. +values: + 2023-01-01: 1_479 +metadata: + unit: currency-CAD + 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 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..0c25702e2 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml @@ -0,0 +1,9 @@ +description: Yukon uses this base amount for the basic personal amount. +values: + 2023-01-01: 13_521 +metadata: + unit: currency-CAD + label: Yukon basic personal amount 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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml new file mode 100644 index 000000000..8e083678c --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml @@ -0,0 +1,9 @@ +description: Yukon uses this income threshold for the basic personal amount. +values: + 2023-01-01: 165_430 +metadata: + unit: currency-CAD + label: Yukon basic personal amount 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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml new file mode 100644 index 000000000..587f08481 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml @@ -0,0 +1,9 @@ +description: Yukon uses this scale value for the basic personal amount. +values: + 2023-01-01: 70_245 +metadata: + unit: currency-CAD + label: Yukon basic personal amount scale value + 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 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml new file mode 100644 index 000000000..b95d25c17 --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -0,0 +1,23 @@ +- name: Not Eligible + period: 2023 + input: + province_code: YT + individual_net_income: 160_000 + output: + yt_first_nations_tax: 0 + +- name: Eligible + period: 2023 + input: + province_code: YT + individual_net_income: 165_430 + output: + yt_first_nations_tax: 15_000 + +- name: Eligible & Exceeding + period: 2023 + input: + province_code: YT + individual_net_income: 300_000 + output: + yt_first_nations_tax: 13_521 \ No newline at end of file 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..d2bf33234 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py @@ -0,0 +1,19 @@ +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 + + def formula(person, period, parameters): + income = person("individual_net_income", period) + p = parameters( + period + ).gov.provinces.yt.tax.income.credits.basic_personal_amount + exceedance = income - p.income_threshold + eligible = (exceedance >= 0) + percent = max_(0, (p.scale_value - exceedance)/p.scale_value) + return (percent * p.applicable_amount + p.base_amount) * eligible \ No newline at end of file From 84e520b6e074aba15cab469bd696c3efdb7b0310 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 26 Jun 2023 22:15:06 +0000 Subject: [PATCH 03/22] test passed --- changelog_entry.yaml | 2 +- .../tax/income/credits/sa/qc_sa_married_both_eligible.yaml | 2 +- .../tax/income/credits/sa/qc_sa_married_one_eligible.yaml | 2 +- .../yt/tax/income/credits/yt_basic_personal_amount.yaml | 6 +++--- .../yt/tax/income/credits/yt_basic_personal_amount.py | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 084ea8fed..3e5f099cc 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Yukon basic personal amount. \ No newline at end of file + - Yukon basic personal amount. diff --git a/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_both_eligible.yaml b/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_both_eligible.yaml index fcfcb7cb6..8f78cb520 100644 --- a/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_both_eligible.yaml +++ b/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_both_eligible.yaml @@ -29,4 +29,4 @@ members: [c1, c2] province_code: QC output: - qc_sa_married_both_eligible: 1 \ No newline at end of file + qc_sa_married_both_eligible: 1 diff --git a/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_one_eligible.yaml b/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_one_eligible.yaml index 6ce860c0e..fd8414b26 100644 --- a/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_one_eligible.yaml +++ b/policyengine_canada/tests/gov/provinces/qc/tax/income/credits/sa/qc_sa_married_one_eligible.yaml @@ -28,4 +28,4 @@ members: [c1, c2] province_code: QC output: - qc_sa_married_one_eligible: 1 \ No newline at end of file + qc_sa_married_one_eligible: 1 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index b95d25c17..ae8eb705b 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -4,7 +4,7 @@ province_code: YT individual_net_income: 160_000 output: - yt_first_nations_tax: 0 + yt_basic_personal_amount: 0 - name: Eligible period: 2023 @@ -12,7 +12,7 @@ province_code: YT individual_net_income: 165_430 output: - yt_first_nations_tax: 15_000 + yt_basic_personal_amount: 15_000 - name: Eligible & Exceeding period: 2023 @@ -20,4 +20,4 @@ province_code: YT individual_net_income: 300_000 output: - yt_first_nations_tax: 13_521 \ No newline at end of file + yt_basic_personal_amount: 13_521 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 index d2bf33234..7c5406f76 100644 --- 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 @@ -14,6 +14,6 @@ def formula(person, period, parameters): period ).gov.provinces.yt.tax.income.credits.basic_personal_amount exceedance = income - p.income_threshold - eligible = (exceedance >= 0) - percent = max_(0, (p.scale_value - exceedance)/p.scale_value) - return (percent * p.applicable_amount + p.base_amount) * eligible \ No newline at end of file + eligible = exceedance >= 0 + percent = max_(0, (p.scale_value - exceedance) / p.scale_value) + return (percent * p.applicable_amount + p.base_amount) * eligible From 6d5baec4e093f28b6acd1d98b6625f6a584e2f43 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:26:54 +0000 Subject: [PATCH 04/22] Yukon basic personal amount Fixes #312 --- .../tax/income/credits/basic_personal_amount/base_amount.yaml | 2 +- .../income/credits/basic_personal_amount/income_threshold.yaml | 2 +- .../yt/tax/income/credits/yt_basic_personal_amount.yaml | 2 +- .../provinces/yt/tax/income/credits/yt_basic_personal_amount.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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 index 0c25702e2..3f25d97d7 100644 --- 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 @@ -1,4 +1,4 @@ -description: Yukon uses this base amount for the basic personal amount. +description: Yukon provides this base amount under the basic personal amount. values: 2023-01-01: 13_521 metadata: diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml index 8e083678c..2fcbcfe36 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml @@ -1,4 +1,4 @@ -description: Yukon uses this income threshold for the basic personal amount. +description: Yukon provides a calculation for the basic personal amount for filer with income above this threshold. values: 2023-01-01: 165_430 metadata: diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index ae8eb705b..0e2a7a36f 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -4,7 +4,7 @@ province_code: YT individual_net_income: 160_000 output: - yt_basic_personal_amount: 0 + yt_basic_personal_amount: 13_521 - name: Eligible period: 2023 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 index 7c5406f76..2e27c2610 100644 --- 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 @@ -16,4 +16,4 @@ def formula(person, period, parameters): exceedance = income - p.income_threshold eligible = exceedance >= 0 percent = max_(0, (p.scale_value - exceedance) / p.scale_value) - return (percent * p.applicable_amount + p.base_amount) * eligible + return (percent * p.applicable_amount) * eligible + p.base_amount From a8a41a3f55a81259d53132433543e93f486166ce Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:31:06 +0000 Subject: [PATCH 05/22] add BPA --- .../credits/basic_personal_amount/applicable_amount.yaml | 2 ++ .../credits/basic_personal_amount/base_amount.yaml | 1 + .../basic_personal_amount/basic_personal_amount.yaml | 9 +++++++++ .../yt/tax/income/credits/yt_basic_personal_amount.yaml | 4 ++-- .../yt/tax/income/credits/yt_basic_personal_amount.py | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index e1af5acc9..dae254f89 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -7,3 +7,5 @@ metadata: 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 + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf \ No newline at end of file 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 index 3f25d97d7..2250bfb1c 100644 --- 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 @@ -7,3 +7,4 @@ metadata: 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 + \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml new file mode 100644 index 000000000..40156a4cf --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml @@ -0,0 +1,9 @@ +description: Yukon provides this basic personal amount for people with net income less than income threshold. +values: + 2023-01-01: 15_000 +metadata: + unit: currency-CAD + label: Yukon basic personal amount for people with net income less than income threshold + reference: + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index 0e2a7a36f..ed2cc45cc 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -1,10 +1,10 @@ -- name: Not Eligible +- name: Income below the income threshold period: 2023 input: province_code: YT individual_net_income: 160_000 output: - yt_basic_personal_amount: 13_521 + yt_basic_personal_amount: 15_000 - name: Eligible period: 2023 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 index 2e27c2610..731071c23 100644 --- 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 @@ -16,4 +16,4 @@ def formula(person, period, parameters): exceedance = income - p.income_threshold eligible = exceedance >= 0 percent = max_(0, (p.scale_value - exceedance) / p.scale_value) - return (percent * p.applicable_amount) * eligible + p.base_amount + return (percent * p.applicable_amount) * eligible + p.base_amount + p.applicable_amount * ~eligible From 85ce3396ed0646c7712902512a0fd661c0592186 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:37:08 +0000 Subject: [PATCH 06/22] format --- .../credits/basic_personal_amount/applicable_amount.yaml | 2 +- .../income/credits/basic_personal_amount/base_amount.yaml | 2 +- .../basic_personal_amount/basic_personal_amount.yaml | 2 +- .../ab/tax/income/credits/pension/ab_pension_credit.yaml | 2 +- .../yt/tax/income/credits/yt_basic_personal_amount.py | 6 +++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index dae254f89..c98e19d22 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -8,4 +8,4 @@ metadata: - 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 - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf \ No newline at end of file + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf 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 index 2250bfb1c..798c56e43 100644 --- 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 @@ -7,4 +7,4 @@ metadata: 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 - \ No newline at end of file + diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml index 40156a4cf..01854f877 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml @@ -6,4 +6,4 @@ metadata: label: Yukon basic personal amount for people with net income less than income threshold reference: - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml index e3c23fabd..a9faa8c92 100644 --- a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/pension/ab_pension_credit.yaml @@ -20,4 +20,4 @@ pension_and_savings_plan_income: 0 province_code: AB output: - ab_pension_credit: 0 \ No newline at end of file + ab_pension_credit: 0 diff --git a/policyengine_canada/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 index 731071c23..28f60d96a 100644 --- 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 @@ -16,4 +16,8 @@ def formula(person, period, parameters): exceedance = income - p.income_threshold eligible = exceedance >= 0 percent = max_(0, (p.scale_value - exceedance) / p.scale_value) - return (percent * p.applicable_amount) * eligible + p.base_amount + p.applicable_amount * ~eligible + return ( + (percent * p.applicable_amount) * eligible + + p.base_amount + + p.applicable_amount * ~eligible + ) From ec4e0711dc17f6dc22ed0450c6c77d11d6ec2376 Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 17 Jul 2023 22:48:39 +0000 Subject: [PATCH 07/22] changes --- .../{ => reduction}/applicable_amount.yaml | 5 ++++- .../yt/tax/income/credits/yt_basic_personal_amount.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => reduction}/applicable_amount.yaml (65%) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml similarity index 65% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml index c98e19d22..895d6e678 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml @@ -1,4 +1,4 @@ -description: Yukon uses this applicable amount for the basic personal amount. +description: Yukon provides this applicable amount for the basic personal amount. values: 2023-01-01: 1_479 metadata: @@ -9,3 +9,6 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-23e.pdf - title: Income Tax Act href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf + 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 index 28f60d96a..e07f02b10 100644 --- 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 @@ -15,7 +15,8 @@ def formula(person, period, parameters): ).gov.provinces.yt.tax.income.credits.basic_personal_amount exceedance = income - p.income_threshold eligible = exceedance >= 0 - percent = max_(0, (p.scale_value - exceedance) / p.scale_value) + pct = (p.scale_value - exceedance) / p.scale_value + percent = max_(0, pct) return ( (percent * p.applicable_amount) * eligible + p.base_amount From b14a171e5d25efdfe7015f449feea31d3396832b Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Mon, 17 Jul 2023 22:58:46 +0000 Subject: [PATCH 08/22] create folder reduction --- .../{ => reduction}/basic_personal_amount.yaml | 0 .../{ => reduction}/income_threshold.yaml | 0 .../{ => reduction}/scale_value.yaml | 0 .../yt/tax/income/credits/yt_basic_personal_amount.py | 8 ++++---- 4 files changed, 4 insertions(+), 4 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => reduction}/basic_personal_amount.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => reduction}/income_threshold.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => reduction}/scale_value.yaml (100%) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/basic_personal_amount.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/basic_personal_amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/scale_value.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml 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 index e07f02b10..fe63a7930 100644 --- 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 @@ -13,12 +13,12 @@ def formula(person, period, parameters): p = parameters( period ).gov.provinces.yt.tax.income.credits.basic_personal_amount - exceedance = income - p.income_threshold + exceedance = income - p.reduction.income_threshold eligible = exceedance >= 0 - pct = (p.scale_value - exceedance) / p.scale_value + pct = (p.reduction.scale_value - exceedance) / p.reduction.scale_value percent = max_(0, pct) return ( - (percent * p.applicable_amount) * eligible + (percent * p.reduction.applicable_amount) * eligible + p.base_amount - + p.applicable_amount * ~eligible + + p.reduction.applicable_amount * ~eligible ) From 4f15b14531cbb5bf532259c73290eb92c52e4e8e Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Sat, 22 Jul 2023 08:44:27 +0000 Subject: [PATCH 09/22] formula --- .../yt/tax/income/credits/yt_basic_personal_amount.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 index fe63a7930..9081c104c 100644 --- 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 @@ -14,11 +14,10 @@ def formula(person, period, parameters): period ).gov.provinces.yt.tax.income.credits.basic_personal_amount exceedance = income - p.reduction.income_threshold - eligible = exceedance >= 0 pct = (p.reduction.scale_value - exceedance) / p.reduction.scale_value percent = max_(0, pct) + percent = min_(pct, 1) return ( - (percent * p.reduction.applicable_amount) * eligible + (percent * p.reduction.applicable_amount) + p.base_amount - + p.reduction.applicable_amount * ~eligible ) From a62cef6da2087e1dc3bde38dd7c2ffa3c958dabe Mon Sep 17 00:00:00 2001 From: RuoqiTan <97366958+RuoqiTan@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:07:13 +0000 Subject: [PATCH 10/22] Yukon basic personal amount Fixes #312 --- .../basic_personal_amount/base_amount.yaml | 10 ------- .../basic_personal_amount.yaml | 2 +- .../reduction/applicable_amount.yaml | 14 ---------- .../reduction/income_threshold.yaml | 9 ------- .../reduction/scale_value.yaml | 9 ------- .../basic_personal_amount/reduction_rate.yaml | 27 +++++++++++++++++++ .../credits/yt_basic_personal_amount.yaml | 12 +++++++++ .../credits/yt_basic_personal_amount.py | 12 +++------ 8 files changed, 44 insertions(+), 51 deletions(-) delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{reduction => }/basic_personal_amount.yaml (93%) delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml 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 deleted file mode 100644 index 798c56e43..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml +++ /dev/null @@ -1,10 +0,0 @@ -description: Yukon provides this base amount under the basic personal amount. -values: - 2023-01-01: 13_521 -metadata: - unit: currency-CAD - label: Yukon basic personal amount 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 - diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/basic_personal_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml similarity index 93% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/basic_personal_amount.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml index 01854f877..c789d1fd1 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/basic_personal_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml @@ -6,4 +6,4 @@ metadata: label: Yukon basic personal amount for people with net income less than income threshold reference: - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml deleted file mode 100644 index 895d6e678..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/applicable_amount.yaml +++ /dev/null @@ -1,14 +0,0 @@ -description: Yukon provides this applicable amount for the basic personal amount. -values: - 2023-01-01: 1_479 -metadata: - unit: currency-CAD - 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 - - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf - diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml deleted file mode 100644 index 2fcbcfe36..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/income_threshold.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Yukon provides a calculation for the basic personal amount for filer with income above this threshold. -values: - 2023-01-01: 165_430 -metadata: - unit: currency-CAD - label: Yukon basic personal amount 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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml deleted file mode 100644 index 587f08481..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction/scale_value.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Yukon uses this scale value for the basic personal amount. -values: - 2023-01-01: 70_245 -metadata: - unit: currency-CAD - label: Yukon basic personal amount scale value - 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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml new file mode 100644 index 000000000..93076fbfd --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml @@ -0,0 +1,27 @@ +description: Yukon provides this reduction rate for the basic personal amount. +brackets: + - threshold: + 2023-01-01: 0 + rate: + 2023-01-01: 0 + - threshold: + 2023-01-01: 165_430 + rate: + 2023-01-01: -0.02105488 + - threshold: + 2023-01-01: 235_675 + rate: + 2023-01-01: 0 + +metadata: + type: marginal_rate + threshold_unit: currency-CAD + rate_unit: /1 + label: Yukon basic personal amount reduction rate + 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: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index ed2cc45cc..c562bc27c 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -3,6 +3,7 @@ input: province_code: YT individual_net_income: 160_000 + is_head: true output: yt_basic_personal_amount: 15_000 @@ -11,6 +12,7 @@ input: province_code: YT individual_net_income: 165_430 + is_head: true output: yt_basic_personal_amount: 15_000 @@ -19,5 +21,15 @@ input: province_code: YT individual_net_income: 300_000 + is_head: true output: yt_basic_personal_amount: 13_521 + +- name: Not head + period: 2023 + input: + province_code: YT + individual_net_income: 300_000 + is_head: false + output: + yt_basic_personal_amount: 0 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 index 9081c104c..f58c1171b 100644 --- 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 @@ -10,14 +10,10 @@ class yt_basic_personal_amount(Variable): def formula(person, period, parameters): income = person("individual_net_income", period) + head = person("is_head", period) p = parameters( period ).gov.provinces.yt.tax.income.credits.basic_personal_amount - exceedance = income - p.reduction.income_threshold - pct = (p.reduction.scale_value - exceedance) / p.reduction.scale_value - percent = max_(0, pct) - percent = min_(pct, 1) - return ( - (percent * p.reduction.applicable_amount) - + p.base_amount - ) + reduction = p.reduction_rate.calc(income) + base = p.basic_personal_amount + return (base + reduction) * head From b0cf36e8a26a07e2373708595c05d18ce6c6a5d8 Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 28 Aug 2023 23:08:17 +0300 Subject: [PATCH 11/22] partial fixes --- .../credits/basic_personal_amount/amount.yaml | 35 +++++++++++++++++++ .../basic_personal_amount.yaml | 9 ----- .../basic_personal_amount/reduction_rate.yaml | 27 -------------- .../credits/yt_basic_personal_amount.yaml | 4 --- .../credits/yt_basic_personal_amount.py | 5 +-- 5 files changed, 36 insertions(+), 44 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml new file mode 100644 index 000000000..8dd9dae3e --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml @@ -0,0 +1,35 @@ +description: Yukon credits basic personal amount, based on the filers income. +brackets: + - threshold: + 2022-01-01: 0 + rate: + 2022-01-01: 14_398 + 2023-01-01: 15_000 + - threshold: + 2022-01-01: 155_625 + 2023-01-01: 165_430 + rate: + 2023-01-01: 0.02105488 # 1_479 / 70_245 + - threshold: + 2022-01-01: 221_708 # 155_625 + 66_083 + 2023-01-01: 235_675 # 165_430 + 70_245 + rate: + 2022-01-01: 0 + +metadata: + type: marginal_rate + threshold_unit: currency-CAD + rate_unit: /1 + label: Yukon basic personal 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 + # Basic Personal Amount does not appear in the Yukon income tax act + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 + - title: 2022 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 \ No newline at end of file diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml deleted file mode 100644 index c789d1fd1..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/basic_personal_amount.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Yukon provides this basic personal amount for people with net income less than income threshold. -values: - 2023-01-01: 15_000 -metadata: - unit: currency-CAD - label: Yukon basic personal amount for people with net income less than income threshold - reference: - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml deleted file mode 100644 index 93076fbfd..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/reduction_rate.yaml +++ /dev/null @@ -1,27 +0,0 @@ -description: Yukon provides this reduction rate for the basic personal amount. -brackets: - - threshold: - 2023-01-01: 0 - rate: - 2023-01-01: 0 - - threshold: - 2023-01-01: 165_430 - rate: - 2023-01-01: -0.02105488 - - threshold: - 2023-01-01: 235_675 - rate: - 2023-01-01: 0 - -metadata: - type: marginal_rate - threshold_unit: currency-CAD - rate_unit: /1 - label: Yukon basic personal amount reduction rate - 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: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index c562bc27c..710482ba5 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -3,7 +3,6 @@ input: province_code: YT individual_net_income: 160_000 - is_head: true output: yt_basic_personal_amount: 15_000 @@ -12,7 +11,6 @@ input: province_code: YT individual_net_income: 165_430 - is_head: true output: yt_basic_personal_amount: 15_000 @@ -21,7 +19,6 @@ input: province_code: YT individual_net_income: 300_000 - is_head: true output: yt_basic_personal_amount: 13_521 @@ -30,6 +27,5 @@ input: province_code: YT individual_net_income: 300_000 - is_head: false output: yt_basic_personal_amount: 0 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 index f58c1171b..1df52f774 100644 --- 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 @@ -10,10 +10,7 @@ class yt_basic_personal_amount(Variable): def formula(person, period, parameters): income = person("individual_net_income", period) - head = person("is_head", period) p = parameters( period ).gov.provinces.yt.tax.income.credits.basic_personal_amount - reduction = p.reduction_rate.calc(income) - base = p.basic_personal_amount - return (base + reduction) * head + return p.amount.calc(income) From fb9579670bb2adab7414af75e226fc41a23faea2 Mon Sep 17 00:00:00 2001 From: sqw0418 <97478242+sqw0418@users.noreply.github.com> Date: Fri, 15 Sep 2023 13:21:40 -0400 Subject: [PATCH 12/22] Update policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml Co-authored-by: Pavel Makarchuk <110687043+PavelMakarchuk@users.noreply.github.com> --- .../yt/tax/income/credits/basic_personal_amount/amount.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml index 8dd9dae3e..b1b009d1f 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml @@ -1,4 +1,4 @@ -description: Yukon credits basic personal amount, based on the filers income. +description: Yukon credits this basic personal amount, based on the filers income. brackets: - threshold: 2022-01-01: 0 From e5388f2e17b742616b237d1789b77af53f7dc8bc Mon Sep 17 00:00:00 2001 From: sqw0418 <97478242+sqw0418@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:22:13 +0000 Subject: [PATCH 13/22] modify --- .../{amount.yaml => applicable_amount.yaml} | 29 ++++------------- .../basic_personal_amount/base_amount.yaml | 18 +++++++++++ .../basic_personal_amount/division.yaml | 18 +++++++++++ .../income_threshold.yaml | 18 +++++++++++ .../credits/yt_basic_personal_amount.yaml | 32 +++++++------------ .../credits/yt_basic_personal_amount.py | 16 ---------- .../yt/tax/income/yt_basic_personal_amount.py | 29 +++++++++++++++++ 7 files changed, 100 insertions(+), 60 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{amount.yaml => applicable_amount.yaml} (57%) create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml delete mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml similarity index 57% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index 8dd9dae3e..4a732f49f 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -1,26 +1,9 @@ -description: Yukon credits basic personal amount, based on the filers income. -brackets: - - threshold: - 2022-01-01: 0 - rate: - 2022-01-01: 14_398 - 2023-01-01: 15_000 - - threshold: - 2022-01-01: 155_625 - 2023-01-01: 165_430 - rate: - 2023-01-01: 0.02105488 # 1_479 / 70_245 - - threshold: - 2022-01-01: 221_708 # 155_625 + 66_083 - 2023-01-01: 235_675 # 165_430 + 70_245 - rate: - 2022-01-01: 0 - +description: Yukon credits this basic personal amount, based on the base amount +values: + 2022-01-01: 1_479 metadata: - type: marginal_rate - threshold_unit: currency-CAD - rate_unit: /1 - label: Yukon basic personal amount + unit: currency-CAD + 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 @@ -32,4 +15,4 @@ metadata: - title: 2022 Yukon Personal Tax Credits Return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 \ No newline at end of file + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt-ws/td1yt-ws-22e.pdf#page=1 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..de9274bdc --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/base_amount.yaml @@ -0,0 +1,18 @@ +description: Yukon credits this basic personal amount, based on the base amount +values: + 2022-01-01: 13_521 +metadata: + unit: currency-CAD + 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 + # Basic Personal Amount does not appear in the Yukon income tax act + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 + - title: 2022 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml new file mode 100644 index 000000000..dc61b1434 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml @@ -0,0 +1,18 @@ +description: Yukon credits this basic personal amount, based on the base amount +values: + 2022-01-01: 70_245 +metadata: + unit: currency-CAD + 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 + # Basic Personal Amount does not appear in the Yukon income tax act + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 + - title: 2022 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml new file mode 100644 index 000000000..82af753cc --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml @@ -0,0 +1,18 @@ +description: Yukon credits this basic personal amount, based on the income threshold +values: + 2022-01-01: 165_430 +metadata: + unit: currency-CAD + label: Yukon income threshold of basic personal 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 + # Basic Personal Amount does not appear in the Yukon income tax act + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 + - title: 2022 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index 710482ba5..da255afe2 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -1,31 +1,21 @@ -- name: Income below the income threshold - period: 2023 - input: - province_code: YT - individual_net_income: 160_000 - output: - yt_basic_personal_amount: 15_000 - -- name: Eligible - period: 2023 - input: - province_code: YT - individual_net_income: 165_430 - output: - yt_basic_personal_amount: 15_000 - -- name: Eligible & Exceeding +- name: Income above the income threshold period: 2023 input: province_code: YT - individual_net_income: 300_000 + individual_net_income: 250_000 output: yt_basic_personal_amount: 13_521 -- name: Not head +- name: Income below the income threshold period: 2023 + absolute_error_margin: 0.2 input: province_code: YT - individual_net_income: 300_000 + individual_net_income: 200_000 output: - yt_basic_personal_amount: 0 + yt_basic_personal_amount: 14_272 + + + + + 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 deleted file mode 100644 index 1df52f774..000000000 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py +++ /dev/null @@ -1,16 +0,0 @@ -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 - - def formula(person, period, parameters): - income = person("individual_net_income", period) - p = parameters( - period - ).gov.provinces.yt.tax.income.credits.basic_personal_amount - return p.amount.calc(income) diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py new file mode 100644 index 000000000..9f0451a84 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py @@ -0,0 +1,29 @@ +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 + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.yt.tax.income.credits.basic_personal_amount + + applicable_amount = p.applicable_amount + base_amount = p.base_amount + division = p.division + income_threshold = p.income_threshold + individual_net_income = person("individual_net_income", period) + + eligible = (division - (individual_net_income - income_threshold)) <= 0 + eligible_amount = division - (individual_net_income - income_threshold) + + return where( + eligible, + base_amount, + eligible_amount / division * applicable_amount + base_amount, + ) From 43b217290b638d656abe10d58ac75faa475cae41 Mon Sep 17 00:00:00 2001 From: sqw0418 <97478242+sqw0418@users.noreply.github.com> Date: Wed, 4 Oct 2023 22:46:53 +0000 Subject: [PATCH 14/22] modify --- .../applicable_amount.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index e69de29bb..4a732f49f 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -0,0 +1,18 @@ +description: Yukon credits this basic personal amount, based on the base amount +values: + 2022-01-01: 1_479 +metadata: + unit: currency-CAD + 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 + # Basic Personal Amount does not appear in the Yukon income tax act + - title: Income Tax Act + href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - title: 2023 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 + - title: 2022 Yukon Personal Tax Credits Return + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 From 2a0de5d4b27c35d5372e3cc03e15bdfe02a3a503 Mon Sep 17 00:00:00 2001 From: sqw0418 <97478242+sqw0418@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:09:09 +0000 Subject: [PATCH 15/22] modify --- .../applicable_amount.yaml | 13 ++----------- .../basic_personal_amount/base_amount.yaml | 11 +---------- .../basic_personal_amount/division.yaml | 18 ------------------ .../credits/basic_personal_amount/divisor.yaml | 9 +++++++++ .../income_threshold.yaml | 9 --------- .../credits/yt_basic_personal_amount.yaml | 5 ----- .../yt/tax/income/yt_basic_personal_amount.py | 14 ++++++++------ 7 files changed, 20 insertions(+), 59 deletions(-) delete mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index 4a732f49f..ec1942937 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -1,18 +1,9 @@ -description: Yukon credits this basic personal amount, based on the base amount +description: Yukon credits this basic personal amount, based on this applicable amount values: 2022-01-01: 1_479 metadata: unit: currency-CAD - label: Yukon income basic personal base amount + label: Yukon income 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 - # Basic Personal Amount does not appear in the Yukon income tax act - - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 - - title: 2022 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 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 index de9274bdc..b28c77bb4 100644 --- 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 @@ -1,4 +1,4 @@ -description: Yukon credits this basic personal amount, based on the base amount +description: Yukon credits this basic personal amount, based on this base amount values: 2022-01-01: 13_521 metadata: @@ -7,12 +7,3 @@ metadata: 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 - # Basic Personal Amount does not appear in the Yukon income tax act - - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 - - title: 2022 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml deleted file mode 100644 index dc61b1434..000000000 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/division.yaml +++ /dev/null @@ -1,18 +0,0 @@ -description: Yukon credits this basic personal amount, based on the base amount -values: - 2022-01-01: 70_245 -metadata: - unit: currency-CAD - 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 - # Basic Personal Amount does not appear in the Yukon income tax act - - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 - - title: 2022 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml new file mode 100644 index 000000000..2105fb498 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml @@ -0,0 +1,9 @@ +description: Yukon credits basic personal amount, this is divisor for the calculation +values: + 2022-01-01: 70_245 +metadata: + unit: currency-CAD + label: Yukon income basic personal divisor 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 diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml index 82af753cc..4fd1b67c0 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml @@ -7,12 +7,3 @@ metadata: 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 - # Basic Personal Amount does not appear in the Yukon income tax act - - title: Income Tax Act - href: https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf - - title: 2023 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-23e.pdf#page=1 - - title: 2022 Yukon Personal Tax Credits Return - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1yt/td1yt-22e.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 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index da255afe2..f2bb9e1e1 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -14,8 +14,3 @@ individual_net_income: 200_000 output: yt_basic_personal_amount: 14_272 - - - - - diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py index 9f0451a84..4b42e0c37 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py @@ -15,15 +15,17 @@ def formula(person, period, parameters): applicable_amount = p.applicable_amount base_amount = p.base_amount - division = p.division + divisor = p.divisor income_threshold = p.income_threshold - individual_net_income = person("individual_net_income", period) - eligible = (division - (individual_net_income - income_threshold)) <= 0 - eligible_amount = division - (individual_net_income - income_threshold) + individual_net_income = person("individual_net_income", period) + additional_amount = divisor - ( + individual_net_income - income_threshold + ) + additional_amount_eligible = additional_amount <= 0 return where( - eligible, + additional_amount_eligible, base_amount, - eligible_amount / division * applicable_amount + base_amount, + additional_amount / divisor * applicable_amount + base_amount, ) From 088f163559ba564d7335fc0c0dcd17dfe6213251 Mon Sep 17 00:00:00 2001 From: sqw0418 <97478242+sqw0418@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:39:02 +0000 Subject: [PATCH 16/22] modify --- .../basic_personal_amount/applicable_amount.yaml | 12 +++++++++--- .../credits/basic_personal_amount/base_amount.yaml | 9 +++++++-- .../credits/basic_personal_amount/divisor.yaml | 11 ++++++++--- .../basic_personal_amount/income_threshold.yaml | 11 ++++++++--- .../tax/income/credits/yt_basic_personal_amount.yaml | 12 ++++++++++-- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml index ec1942937..164754ed0 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml @@ -1,9 +1,15 @@ -description: Yukon credits this basic personal amount, based on this applicable amount +description: Yukon reduces this basic personal amount, for high income filers. + values: - 2022-01-01: 1_479 + 2022-01-01: 1_679 + 2023-01-01: 1_479 metadata: unit: currency-CAD - label: Yukon income applicable amount + 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 + # The credit amount is not mentioned in the Yukon income tax act + # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf 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 index b28c77bb4..65e1dc2ca 100644 --- 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 @@ -1,9 +1,14 @@ -description: Yukon credits this basic personal amount, based on this base amount +description: Yukon credits this base basic personal amount. values: - 2022-01-01: 13_521 + 2022-01-01: 12_719 + 2023-01-01: 13_521 metadata: unit: currency-CAD 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 + # The credit amount is not mentioned in the Yukon income tax act + # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml index 2105fb498..5410b6e5a 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml @@ -1,9 +1,14 @@ -description: Yukon credits basic personal amount, this is divisor for the calculation +description: Yukon divides the basic personal amount by this amount. values: - 2022-01-01: 70_245 + 2022-01-01: 66_083 + 2023-01-01: 70_245 metadata: unit: currency-CAD - label: Yukon income basic personal divisor amount + 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 + # The credit amount is not mentioned in the Yukon income tax act + # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml index 4fd1b67c0..e742261b2 100644 --- a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml +++ b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml @@ -1,9 +1,14 @@ -description: Yukon credits this basic personal amount, based on the income threshold +description: Yukon reduces the basic personal amount for filers with income above this threshold. values: - 2022-01-01: 165_430 + 2022-01-01: 155_625 + 2023-01-01: 165_430 metadata: unit: currency-CAD - label: Yukon income threshold of basic personal amount + 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 + # The credit amount is not mentioned in the Yukon income tax act + # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml index f2bb9e1e1..5c5a401a1 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml @@ -1,4 +1,4 @@ -- name: Income above the income threshold +- name: Income above the income threshold in 2023 period: 2023 input: province_code: YT @@ -6,7 +6,7 @@ output: yt_basic_personal_amount: 13_521 -- name: Income below the income threshold +- name: Income below the income threshold in 2023 period: 2023 absolute_error_margin: 0.2 input: @@ -14,3 +14,11 @@ individual_net_income: 200_000 output: yt_basic_personal_amount: 14_272 + +- name: Income above the income threshold in 2022 + period: 2022 + input: + province_code: YT + individual_net_income: 250_000 + output: + yt_basic_personal_amount: 12_719 From 203b6d1dc23161fee4ce61368ad9f17394041fd5 Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Mon, 13 May 2024 15:30:09 +0000 Subject: [PATCH 17/22] update variables --- .../yt/tax/income/yt_basic_personal_amount.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py index 4b42e0c37..159c134ef 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py @@ -13,19 +13,14 @@ def formula(person, period, parameters): period ).gov.provinces.yt.tax.income.credits.basic_personal_amount - applicable_amount = p.applicable_amount - base_amount = p.base_amount - divisor = p.divisor - income_threshold = p.income_threshold - individual_net_income = person("individual_net_income", period) - additional_amount = divisor - ( - individual_net_income - income_threshold + additional_amount = p.divisor - ( + individual_net_income - p.income_threshold ) additional_amount_eligible = additional_amount <= 0 return where( additional_amount_eligible, - base_amount, - additional_amount / divisor * applicable_amount + base_amount, + p.base_amount, + additional_amount / p.divisor * p.applicable_amount + p.base_amount, ) From 7e6c15548535583d2f902a924118c9175eb8276f Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Mon, 13 May 2024 15:49:23 +0000 Subject: [PATCH 18/22] update variables and parameters --- .../{ => additional}/applicable_amount.yaml | 0 .../{ => additional}/divisor.yaml | 0 .../{ => additional}/income_threshold.yaml | 0 .../income/credits/yt_basic_personal_amount.py | 13 +++++++++++++ .../yt_basic_personal_amount_additional.py} | 12 ++++-------- .../credits/yt_basic_personal_amount_base.py | 16 ++++++++++++++++ 6 files changed, 33 insertions(+), 8 deletions(-) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => additional}/applicable_amount.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => additional}/divisor.yaml (100%) rename policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/{ => additional}/income_threshold.yaml (100%) create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.py rename policyengine_canada/variables/gov/provinces/yt/tax/income/{yt_basic_personal_amount.py => credits/yt_basic_personal_amount_additional.py} (67%) create mode 100644 policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_base.py diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/applicable_amount.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/applicable_amount.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/applicable_amount.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/divisor.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/divisor.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/divisor.yaml diff --git a/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml b/policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/income_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/income_threshold.yaml rename to policyengine_canada/parameters/gov/provinces/yt/tax/income/credits/basic_personal_amount/additional/income_threshold.yaml 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/yt_basic_personal_amount.py b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py similarity index 67% rename from policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py rename to policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py index 159c134ef..94db9ce49 100644 --- a/policyengine_canada/variables/gov/provinces/yt/tax/income/yt_basic_personal_amount.py +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.py @@ -1,17 +1,17 @@ from policyengine_canada.model_api import * -class yt_basic_personal_amount(Variable): +class yt_basic_personal_amount_additional(Variable): value_type = float entity = Person - label = "Yukon basic personal amount" + 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 + ).gov.provinces.yt.tax.income.credits.basic_personal_amount.additional individual_net_income = person("individual_net_income", period) additional_amount = p.divisor - ( @@ -19,8 +19,4 @@ def formula(person, period, parameters): ) additional_amount_eligible = additional_amount <= 0 - return where( - additional_amount_eligible, - p.base_amount, - additional_amount / p.divisor * p.applicable_amount + p.base_amount, - ) + return additional_amount_eligible * additional_amount / p.divisor * p.applicable_amount \ No newline at end of file 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..71bfcd2a7 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_base.py @@ -0,0 +1,16 @@ +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 + + def formula(person, period, parameters): + p = parameters( + period + ).gov.provinces.yt.tax.income.credits.basic_personal_amount + + return p.base_amount \ No newline at end of file From a1b2aa9044e1925185359cc5bb402a5e1d46049c Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Tue, 14 May 2024 04:28:36 +0000 Subject: [PATCH 19/22] make format --- .../income/credits/yt_basic_personal_amount_additional.py | 7 ++++++- .../yt/tax/income/credits/yt_basic_personal_amount_base.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) 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 index 94db9ce49..6dfbddc65 100644 --- 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 @@ -19,4 +19,9 @@ def formula(person, period, parameters): ) additional_amount_eligible = additional_amount <= 0 - return additional_amount_eligible * additional_amount / p.divisor * p.applicable_amount \ No newline at end of file + return ( + additional_amount_eligible + * additional_amount + / p.divisor + * 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 index 71bfcd2a7..263326e1e 100644 --- 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 @@ -13,4 +13,4 @@ def formula(person, period, parameters): period ).gov.provinces.yt.tax.income.credits.basic_personal_amount - return p.base_amount \ No newline at end of file + return p.base_amount From e09eec90af0df0cfe11b6f1b949e5d6ce88febd1 Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Fri, 17 May 2024 09:51:26 +0000 Subject: [PATCH 20/22] update variables and test cases --- .../credits/basic_personal_amount/base_amount.yaml | 2 +- ....yaml => yt_basic_personal_amount_additional.yaml} | 7 ++++--- .../credits/yt_basic_personal_amount_additional.py | 11 ++++------- .../income/credits/yt_basic_personal_amount_base.py | 10 +++------- 4 files changed, 12 insertions(+), 18 deletions(-) rename policyengine_canada/tests/gov/provinces/yt/tax/income/credits/{yt_basic_personal_amount.yaml => yt_basic_personal_amount_additional.yaml} (77%) 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 index 65e1dc2ca..dd0877169 100644 --- 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 @@ -1,4 +1,4 @@ -description: Yukon credits this base basic personal amount. +description: Yukon provides this base basic personal amount. values: 2022-01-01: 12_719 2023-01-01: 13_521 diff --git a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml similarity index 77% rename from policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml rename to policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml index 5c5a401a1..f0bd3932c 100644 --- a/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount.yaml +++ b/policyengine_canada/tests/gov/provinces/yt/tax/income/credits/yt_basic_personal_amount_additional.yaml @@ -4,7 +4,7 @@ province_code: YT individual_net_income: 250_000 output: - yt_basic_personal_amount: 13_521 + yt_basic_personal_amount_additional: 0 - name: Income below the income threshold in 2023 period: 2023 @@ -13,7 +13,7 @@ province_code: YT individual_net_income: 200_000 output: - yt_basic_personal_amount: 14_272 + yt_basic_personal_amount_additional: 751 - name: Income above the income threshold in 2022 period: 2022 @@ -21,4 +21,5 @@ province_code: YT individual_net_income: 250_000 output: - yt_basic_personal_amount: 12_719 + yt_basic_personal_amount_additional: 0 + 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 index 6dfbddc65..e0df2bed9 100644 --- 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 @@ -17,11 +17,8 @@ def formula(person, period, parameters): additional_amount = p.divisor - ( individual_net_income - p.income_threshold ) - additional_amount_eligible = additional_amount <= 0 + additional_amount_eligible = additional_amount > 0 + yt_additional_amount = additional_amount_eligible * additional_amount + yt_additional_amount = yt_additional_amount / p.divisor - return ( - additional_amount_eligible - * additional_amount - / p.divisor - * p.applicable_amount - ) + 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 index 263326e1e..4481d69b8 100644 --- 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 @@ -7,10 +7,6 @@ class yt_basic_personal_amount_base(Variable): label = "Yukon basic personal amount base" definition_period = YEAR defined_for = ProvinceCode.YT - - def formula(person, period, parameters): - p = parameters( - period - ).gov.provinces.yt.tax.income.credits.basic_personal_amount - - return p.base_amount + adds = ( + "gov.provinces.yt.tax.income.credits.basic_personal_amount.base_amount" + ) From 8084e8750597b672c14131527de74b04e00ba84a Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Tue, 28 May 2024 12:19:37 +0000 Subject: [PATCH 21/22] add test cases --- .../additional/applicable_amount.yaml | 3 +- .../additional/divisor.yaml | 1 + .../additional/income_threshold.yaml | 1 + .../basic_personal_amount/base_amount.yaml | 1 + .../yt_basic_personal_amount_additional.yaml | 32 +++++++++++++++++-- 5 files changed, 34 insertions(+), 4 deletions(-) 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 index 164754ed0..c95d10f0d 100644 --- 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 @@ -1,10 +1,11 @@ -description: Yukon reduces this basic personal amount, for high income filers. +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 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 index 5410b6e5a..1e23b845f 100644 --- 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 @@ -4,6 +4,7 @@ values: 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 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 index e742261b2..506656feb 100644 --- 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 @@ -4,6 +4,7 @@ values: 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 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 index dd0877169..d77fd3f15 100644 --- 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 @@ -4,6 +4,7 @@ values: 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 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 index f0bd3932c..e0e653c6c 100644 --- 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 @@ -1,4 +1,4 @@ -- name: Income above the income threshold in 2023 +- name: Income above the income threshold but additional amount below 0 in 2023 period: 2023 input: province_code: YT @@ -6,7 +6,16 @@ output: yt_basic_personal_amount_additional: 0 -- name: Income below the income threshold in 2023 +- 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_basic_personal_amount_additional: 0 + +- name: Income below the income threshold and additional amount above 0 in 2023 period: 2023 absolute_error_margin: 0.2 input: @@ -15,7 +24,7 @@ output: yt_basic_personal_amount_additional: 751 -- name: Income above the income threshold in 2022 +- name: Income above the income threshold but additional amount below 0 in 2022 period: 2022 input: province_code: YT @@ -23,3 +32,20 @@ output: yt_basic_personal_amount_additional: 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_basic_personal_amount_additional: 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_basic_personal_amount_additional: 551.5 From 6f5126983348943d13e5272c3bd6a8ab2fda1631 Mon Sep 17 00:00:00 2001 From: yy3187 <129118329+yy3187@users.noreply.github.com> Date: Thu, 30 May 2024 09:34:33 +0000 Subject: [PATCH 22/22] update references --- .../additional/applicable_amount.yaml | 4 ++-- .../basic_personal_amount/additional/divisor.yaml | 4 ++-- .../additional/income_threshold.yaml | 4 ++-- .../credits/basic_personal_amount/base_amount.yaml | 4 ++-- .../credits/yt_basic_personal_amount_additional.yaml | 12 ++++++------ .../credits/yt_basic_personal_amount_additional.py | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) 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 index c95d10f0d..2a24623a7 100644 --- 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 @@ -12,5 +12,5 @@ metadata: 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 - # The credit amount is not mentioned in the Yukon income tax act - # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - 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 index 1e23b845f..cea0f855d 100644 --- 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 @@ -11,5 +11,5 @@ metadata: 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 - # The credit amount is not mentioned in the Yukon income tax act - # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - 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 index 506656feb..de4a07293 100644 --- 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 @@ -11,5 +11,5 @@ metadata: 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 - # The credit amount is not mentioned in the Yukon income tax act - # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - 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 index d77fd3f15..feea7a2a2 100644 --- 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 @@ -11,5 +11,5 @@ metadata: 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 - # The credit amount is not mentioned in the Yukon income tax act - # https://laws.yukon.ca/cms/images/LEGISLATION/PRINCIPAL/2002/2002-0118/2002-0118.pdf + - 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/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 index e0e653c6c..4a523536e 100644 --- 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 @@ -4,7 +4,7 @@ province_code: YT individual_net_income: 250_000 output: - yt_basic_personal_amount_additional: 0 + yt_additional_basic_personal_amount: 0 - name: Income below the income threshold and additional amount equals 0 in 2023 (edge case) period: 2023 @@ -13,7 +13,7 @@ province_code: YT individual_net_income: 235_675 output: - yt_basic_personal_amount_additional: 0 + yt_additional_basic_personal_amount: 0 - name: Income below the income threshold and additional amount above 0 in 2023 period: 2023 @@ -22,7 +22,7 @@ province_code: YT individual_net_income: 200_000 output: - yt_basic_personal_amount_additional: 751 + yt_additional_basic_personal_amount: 751 - name: Income above the income threshold but additional amount below 0 in 2022 period: 2022 @@ -30,7 +30,7 @@ province_code: YT individual_net_income: 250_000 output: - yt_basic_personal_amount_additional: 0 + yt_additional_basic_personal_amount: 0 - name: Income below the income threshold and additional amount equals 0 in 2022 (edge case) period: 2022 @@ -39,7 +39,7 @@ province_code: YT individual_net_income: 221_708 output: - yt_basic_personal_amount_additional: 0 + yt_additional_basic_personal_amount: 0 - name: Income below the income threshold and additional amount above 0 in 2022 period: 2022 @@ -48,4 +48,4 @@ province_code: YT individual_net_income: 200_000 output: - yt_basic_personal_amount_additional: 551.5 + yt_additional_basic_personal_amount: 551.5 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 index e0df2bed9..999f8f8ea 100644 --- 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 @@ -1,7 +1,7 @@ from policyengine_canada.model_api import * -class yt_basic_personal_amount_additional(Variable): +class yt_additional_basic_personal_amount(Variable): value_type = float entity = Person label = "Yukon additional basic personal amount"