From 3859edd60e545c042f0e30ef4bcec6ae6ebf7524 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Mon, 12 Jun 2023 18:19:38 +0800 Subject: [PATCH 01/16] Alberta infirm dependant credit --- .../income/credits/infirm_dependant/base.yaml | 12 ++++++++++++ .../dependant_eligibility.yaml | 9 +++++++++ .../ab_infirm_dependant_credit.py | 18 ++++++++++++++++++ .../person/infirm_dependant_income.py | 13 +++++++++++++ .../household/person/is_infirm_dependant.py | 12 ++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml create mode 100644 policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py create mode 100644 policyengine_canada/variables/household/person/infirm_dependant_income.py create mode 100644 policyengine_canada/variables/household/person/is_infirm_dependant.py diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml new file mode 100644 index 000000000..d43756c33 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -0,0 +1,12 @@ + + 2023-01-01: 12_158 +metadata: + unit: currency-CAD + period: year + label: Alberta infirm dependant credit maximum amount. + reference: + - title: Alberta infirm dependant credit amount + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + - title: Alberta infirm dependant credit amount + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml new file mode 100644 index 000000000..41472675e --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml @@ -0,0 +1,9 @@ +description: Alberta limits its infirm dependant credit to this age. +values: + 2022-01-01: 18 +metadata: + unit: year + label: Alberta infirm dependant age eligibility + reference: + - title: Alberta infirm dependant age eligibility + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py new file mode 100644 index 000000000..63569fbf8 --- /dev/null +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -0,0 +1,18 @@ +from policyengine_canada.model_api import * + + +class ab_infirm_dependant_credit(Variable): + value_type = float + entity = Household + label = "Alberta infirm dependant credit" + definition_period = YEAR + defined_for = ProvinceCode.AB + + def formula(household, period, parameters): + person = household.members + p = parameters(period).gov.provinces.ab.tax.income.credits.infirm_dependant + eligible = person("is_infirm_dependant", period) + infirm_dependant_income = person("infirm_dependant_income",period) + per_credit = max_(0, eligible * (20_190 - infirm_dependant_income), eligible * p.base) + total = household.sum(per_credit) + return total \ No newline at end of file diff --git a/policyengine_canada/variables/household/person/infirm_dependant_income.py b/policyengine_canada/variables/household/person/infirm_dependant_income.py new file mode 100644 index 000000000..ebd1e497a --- /dev/null +++ b/policyengine_canada/variables/household/person/infirm_dependant_income.py @@ -0,0 +1,13 @@ +from policyengine_canada.model_api import * + + +class infirm_dependant_income(Variable): + value_type = float + entity = Person + label = "Infirm dependant income" + definition_period = YEAR + + def formula(person, period, parameters): + infirm_dependant = person("is_infirm_dependant", period) + income = person("individual_net_income", period) + return infirm_dependant * income diff --git a/policyengine_canada/variables/household/person/is_infirm_dependant.py b/policyengine_canada/variables/household/person/is_infirm_dependant.py new file mode 100644 index 000000000..9dd03e64f --- /dev/null +++ b/policyengine_canada/variables/household/person/is_infirm_dependant.py @@ -0,0 +1,12 @@ +from policyengine_canada.model_api import * + + +class is_infirm_dependant(Variable): + value_type = bool + entity = Person + label = "Is a infirm dependant" + definition_period = YEAR + + # Impute dependant status on age. + def formula(person, period, parameters): + return person("age", period) >= 18 From 3c1e570f415d3bfc17e6a1552badde81b30e49d2 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Mon, 12 Jun 2023 19:41:13 +0800 Subject: [PATCH 02/16] Alberta infirm dependant credit Fixes #330 --- .../income/credits/infirm_dependant/base.yaml | 3 +- .../dependant_eligibility.yaml | 9 -- .../credits/infirm_dependant/low_income.yaml | 13 +++ .../ab_infirm_dependant.yaml | 96 +++++++++++++++++++ .../ab_infirm_dependant_credit.py | 3 +- 5 files changed, 113 insertions(+), 11 deletions(-) delete mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml create mode 100644 policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index d43756c33..e8acb1e12 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -1,4 +1,5 @@ - +description: Alberta provides this maximum infirm dependant credit. +values: 2023-01-01: 12_158 metadata: unit: currency-CAD diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml deleted file mode 100644 index 41472675e..000000000 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/dependant_eligibility.yaml +++ /dev/null @@ -1,9 +0,0 @@ -description: Alberta limits its infirm dependant credit to this age. -values: - 2022-01-01: 18 -metadata: - unit: year - label: Alberta infirm dependant age eligibility - reference: - - title: Alberta infirm dependant age eligibility - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml new file mode 100644 index 000000000..8cf305980 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml @@ -0,0 +1,13 @@ +description: Alberta provides this infirm dependant low income threshold. +values: + 2023-01-01: 8_032 +metadata: + unit: currency-CAD + period: year + label: Alberta infirm dependant low income threshold. + reference: + - title: Alberta infirm dependant low income threshold + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + - title: Alberta infirm dependant low income threshold + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + \ No newline at end of file diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml new file mode 100644 index 000000000..257a62b81 --- /dev/null +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml @@ -0,0 +1,96 @@ +- name: Infirm dependant net income below 8_032 + period: 2023 + input: + people: + p1: + is_infirm_dependant: true + infirm_dependant_income: 8_000 + household: + members: p1 + province_code: AB + output: + ab_infirm_dependant_credit: 12_158 + +- name: Infirm dependant net income over 8_032 but lower than 20_190 + period: 2023 + input: + people: + p1: + is_infirm_dependant: true + infirm_dependant_income: 20_000 + household: + members: p1 + province_code: AB + output: + ab_infirm_dependant_credit: 190 + +- name: Infirm dependant net income over 20_190 + period: 2023 + input: + people: + p1: + is_infirm_dependant: true + infirm_dependant_income: 30_190 + household: + members: p1 + province_code: AB + output: + ab_infirm_dependant_credit: 0 + + +- name: Multiple infirm dependants with high income over than 20_190 + period: 2023 + input: + people: + p1: + is_infirm_dependant: No + infirm_dependant_income: 0 + p2: + is_infirm_dependant: true + infirm_dependant_income: 30_190 + p3: + is_infirm_dependant: true + infirm_dependant_income: 30_190 + household: + members: [p1, p2, p3] + province_code: AB + output: + ab_infirm_dependant_credit: 0 + +- name: Multiple infirm dependants with low income less than 8_032 + period: 2023 + input: + people: + p1: + is_infirm_dependant: No + infirm_dependant_income: 0 + p2: + is_infirm_dependant: true + infirm_dependant_income: 800 + p3: + is_infirm_dependant: true + infirm_dependant_income: 300 + household: + members: [p1, p2, p3] + province_code: AB + output: + ab_infirm_dependant_credit: 24_316 + +- name: Multiple infirm dependants with high income and low income + period: 2023 + input: + people: + p1: + is_infirm_dependant: No + infirm_dependant_income: 0 + p2: + is_infirm_dependant: true + infirm_dependant_income: 20_000 + p3: + is_infirm_dependant: true + infirm_dependant_income: 800 + household: + members: [p1, p2, p3] + province_code: AB + output: + ab_infirm_dependant_credit: 12_348 \ No newline at end of file diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 63569fbf8..290d64e12 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -13,6 +13,7 @@ def formula(household, period, parameters): p = parameters(period).gov.provinces.ab.tax.income.credits.infirm_dependant eligible = person("is_infirm_dependant", period) infirm_dependant_income = person("infirm_dependant_income",period) - per_credit = max_(0, eligible * (20_190 - infirm_dependant_income), eligible * p.base) + income_level = infirm_dependant_income > p.low_income + per_credit = where(income_level, max_(0, eligible * (20_190 - infirm_dependant_income)), eligible * p.base) total = household.sum(per_credit) return total \ No newline at end of file From d9a9706bf814c24eaafe11feae82c32c63210694 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Mon, 12 Jun 2023 19:43:01 +0800 Subject: [PATCH 03/16] changes --- changelog_entry.yaml | 5 +++++ .../credits/infirm_dependant/low_income.yaml | 2 +- .../infirm_dependants/ab_infirm_dependant.yaml | 2 +- .../credits/sa/qc_sa_married_both_eligible.yaml | 2 +- .../credits/sa/qc_sa_married_one_eligible.yaml | 2 +- .../infirm_dependant/ab_infirm_dependant_credit.py | 14 ++++++++++---- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..801b16fde 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,5 @@ + +- bump: minor + changes: + added: + - Alberta infirm dependant credit. diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml index 8cf305980..be285f6ff 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml @@ -10,4 +10,4 @@ metadata: href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - title: Alberta infirm dependant low income threshold href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf - \ No newline at end of file + diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml index 257a62b81..6798f1c78 100644 --- a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml @@ -93,4 +93,4 @@ members: [p1, p2, p3] province_code: AB output: - ab_infirm_dependant_credit: 12_348 \ No newline at end of file + ab_infirm_dependant_credit: 12_348 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/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 290d64e12..efa5775f5 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -10,10 +10,16 @@ class ab_infirm_dependant_credit(Variable): def formula(household, period, parameters): person = household.members - p = parameters(period).gov.provinces.ab.tax.income.credits.infirm_dependant + p = parameters( + period + ).gov.provinces.ab.tax.income.credits.infirm_dependant eligible = person("is_infirm_dependant", period) - infirm_dependant_income = person("infirm_dependant_income",period) + infirm_dependant_income = person("infirm_dependant_income", period) income_level = infirm_dependant_income > p.low_income - per_credit = where(income_level, max_(0, eligible * (20_190 - infirm_dependant_income)), eligible * p.base) + per_credit = where( + income_level, + max_(0, eligible * (20_190 - infirm_dependant_income)), + eligible * p.base, + ) total = household.sum(per_credit) - return total \ No newline at end of file + return total From 9fec51ea4d9b23e4b0f242393101e40fe6884e26 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Tue, 27 Jun 2023 23:04:04 +0800 Subject: [PATCH 04/16] Alberta infirm dependant credit Fixes #330 --- .../tax/income/credits/infirm_dependant/base.yaml | 4 ++-- .../infirm_dependant/infirm_dependant_age.yaml | 13 +++++++++++++ .../credits/infirm_dependant/max_net_income.yaml | 13 +++++++++++++ .../{low_income.yaml => phase_out_start.yaml} | 4 ++-- .../infirm_dependant/ab_infirm_dependant_credit.py | 4 ++-- .../household/person/is_infirm_dependant.py | 7 +++++-- 6 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml create mode 100644 policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml rename policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/{low_income.yaml => phase_out_start.yaml} (73%) diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index e8acb1e12..b031beb3f 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -1,10 +1,10 @@ -description: Alberta provides this maximum infirm dependant credit. +description: Alberta provides this maximum amount under the infirm dependant credit. values: 2023-01-01: 12_158 metadata: unit: currency-CAD period: year - label: Alberta infirm dependant credit maximum amount. + label: Alberta infirm dependant credit maximum amount reference: - title: Alberta infirm dependant credit amount href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml new file mode 100644 index 000000000..a7c9176b9 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -0,0 +1,13 @@ +description: Alberta use this age theshold for infirm dependant. +values: + 2023-01-01: 18 +metadata: + unit: year + label: Alberta require this age theshold for infirm dependant + reference: + - title: Alberta infirm dependant age requirement + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + - title: Alberta infirm dependant age requirement + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + + diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml new file mode 100644 index 000000000..afb703c01 --- /dev/null +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -0,0 +1,13 @@ +description: Alberta use this infirm dependant credit net income as maximum therhold. +values: + 2023-01-01: 20_190 +metadata: + unit: currency-CAD + period: year + label: Alberta infirm dependant credit maximum net incomes + reference: + - title: Alberta infirm dependant credit amount + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + - title: Alberta infirm dependant credit amount + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml similarity index 73% rename from policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml rename to policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml index be285f6ff..5b9a25501 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/low_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml @@ -1,10 +1,10 @@ -description: Alberta provides this infirm dependant low income threshold. +description: Alberta phases out the infirm dependant credit above this income threshold. values: 2023-01-01: 8_032 metadata: unit: currency-CAD period: year - label: Alberta infirm dependant low income threshold. + label: Alberta infirm dependant phase out start reference: - title: Alberta infirm dependant low income threshold href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index efa5775f5..176abcef3 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -15,10 +15,10 @@ def formula(household, period, parameters): ).gov.provinces.ab.tax.income.credits.infirm_dependant eligible = person("is_infirm_dependant", period) infirm_dependant_income = person("infirm_dependant_income", period) - income_level = infirm_dependant_income > p.low_income + income_level = infirm_dependant_income > p.phase_out_start per_credit = where( income_level, - max_(0, eligible * (20_190 - infirm_dependant_income)), + max_(0, eligible * (p.max_net_income - infirm_dependant_income)), eligible * p.base, ) total = household.sum(per_credit) diff --git a/policyengine_canada/variables/household/person/is_infirm_dependant.py b/policyengine_canada/variables/household/person/is_infirm_dependant.py index 9dd03e64f..36e3ae2dd 100644 --- a/policyengine_canada/variables/household/person/is_infirm_dependant.py +++ b/policyengine_canada/variables/household/person/is_infirm_dependant.py @@ -4,9 +4,12 @@ class is_infirm_dependant(Variable): value_type = bool entity = Person - label = "Is a infirm dependant" + label = "Is an infirm dependant" definition_period = YEAR # Impute dependant status on age. def formula(person, period, parameters): - return person("age", period) >= 18 + p = parameters( + period + ).gov.provinces.ab.tax.income.credits.infirm_dependant + return person("age", period) >= p.infirm_dependant_age From 02330418f2818bc687fcae021dda2de6a9ce62ac Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Tue, 27 Jun 2023 23:05:01 +0800 Subject: [PATCH 05/16] fixes --- changelog_entry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 801b16fde..00c398c8c 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -2,4 +2,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit. + - Alberta infirm dependant credit fixes. From 87d54df332b0de0fc12edaaae05e259b5e03bf6b Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Wed, 12 Jul 2023 09:14:57 +0800 Subject: [PATCH 06/16] Alberta infirm dependant credit Fixes #330 --- changelog_entry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 00c398c8c..57bb04355 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -2,4 +2,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit fixes. + - Alberta infirm dependant credit fixes. \ No newline at end of file From 3432c01e1e240666cc586c711340715693a37bf7 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Wed, 19 Jul 2023 23:02:44 +0800 Subject: [PATCH 07/16] Alberta infirm dependant credit Fixes #330 --- changelog_entry.yaml | 2 +- .../income/credits/infirm_dependant/infirm_dependant_age.yaml | 4 ++-- .../tax/income/credits/infirm_dependant/max_net_income.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 57bb04355..00c398c8c 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -2,4 +2,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit fixes. \ No newline at end of file + - Alberta infirm dependant credit fixes. diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml index a7c9176b9..b4bf2aa94 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -1,9 +1,9 @@ -description: Alberta use this age theshold for infirm dependant. +description: Alberta use this age threshold for infirm dependant. values: 2023-01-01: 18 metadata: unit: year - label: Alberta require this age theshold for infirm dependant + label: Alberta require this age thrsseshold for infirm dependant reference: - title: Alberta infirm dependant age requirement href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml index afb703c01..ebd16511e 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -4,7 +4,7 @@ values: metadata: unit: currency-CAD period: year - label: Alberta infirm dependant credit maximum net incomes + label: Alberta infirm dependant credit maximum net income reference: - title: Alberta infirm dependant credit amount href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf From 69e04b7ef7fd1f5de6577494f3793e8b3d184ade Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Thu, 27 Jul 2023 21:21:43 +0800 Subject: [PATCH 08/16] Alberta infirm dependant credit Fixes #330 --- changelog_entry.yaml | 1 - .../tax/income/credits/infirm_dependant/base.yaml | 4 ++-- .../infirm_dependant/infirm_dependant_age.yaml | 9 +++++---- .../credits/infirm_dependant/max_net_income.yaml | 8 ++++---- .../credits/infirm_dependant/phase_out_start.yaml | 6 +++--- .../ab_infirm_dependant_credit.py | 15 +++++++++------ 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 00c398c8c..4a513856e 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,3 @@ - - bump: minor changes: added: diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index b031beb3f..a341eb898 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -6,8 +6,8 @@ metadata: period: year label: Alberta infirm dependant credit maximum amount reference: - - title: Alberta infirm dependant credit amount + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta infirm dependant credit amount + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml index b4bf2aa94..5ff8f1651 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -1,13 +1,14 @@ -description: Alberta use this age threshold for infirm dependant. +description: Alberta provides the infirm dependant amount for filers with dependant at or above this age threshold. + values: 2023-01-01: 18 metadata: unit: year - label: Alberta require this age thrsseshold for infirm dependant + label: Alberta infirm dependant amount minimum dependant age reference: - - title: Alberta infirm dependant age requirement + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta infirm dependant age requirement + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml index ebd16511e..50d0e90e3 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -1,13 +1,13 @@ -description: Alberta use this infirm dependant credit net income as maximum therhold. +description: Alberta provides the infirm dependant amount for filers with income of up to this threshold. values: 2023-01-01: 20_190 metadata: unit: currency-CAD period: year - label: Alberta infirm dependant credit maximum net income + label: Alberta infirm dependant credit max income reference: - - title: Alberta infirm dependant credit amount + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta infirm dependant credit amount + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml index 5b9a25501..4ba8caa8e 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml @@ -1,4 +1,4 @@ -description: Alberta phases out the infirm dependant credit above this income threshold. +description: lberta phases the infirm dependant amount out above this income threshold. values: 2023-01-01: 8_032 metadata: @@ -6,8 +6,8 @@ metadata: period: year label: Alberta infirm dependant phase out start reference: - - title: Alberta infirm dependant low income threshold + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta infirm dependant low income threshold + - title: Alberta personal tax credits return href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 176abcef3..507b799f0 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -15,11 +15,14 @@ def formula(household, period, parameters): ).gov.provinces.ab.tax.income.credits.infirm_dependant eligible = person("is_infirm_dependant", period) infirm_dependant_income = person("infirm_dependant_income", period) - income_level = infirm_dependant_income > p.phase_out_start + income_level_condition = infirm_dependant_income > p.phase_out_start + max_credit = eligible * p.base + partial_credit = eligible * ( + p.max_net_income - infirm_dependant_income + ) per_credit = where( - income_level, - max_(0, eligible * (p.max_net_income - infirm_dependant_income)), - eligible * p.base, + income_level_condition, + max_(0, partial_credit), + max_credit, ) - total = household.sum(per_credit) - return total + return household.sum(per_credit) From 8ddf52f616f46f764c41efac607ff5e42310b276 Mon Sep 17 00:00:00 2001 From: oliviacaiww Date: Thu, 27 Jul 2023 22:29:28 +0800 Subject: [PATCH 09/16] Alberta infirm dependant credit Fixes #330 --- changelog_entry.yaml | 2 +- .../ab/tax/income/credits/infirm_dependant/base.yaml | 4 ++-- .../income/credits/infirm_dependant/infirm_dependant_age.yaml | 4 ++-- .../tax/income/credits/infirm_dependant/max_net_income.yaml | 4 ++-- .../tax/income/credits/infirm_dependant/phase_out_start.yaml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 4a513856e..6fc9080fc 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit fixes. + - Alberta infirm dependant credit. diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index a341eb898..7e87cc09e 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -6,8 +6,8 @@ metadata: period: year label: Alberta infirm dependant credit maximum amount reference: - - title: Alberta personal tax credits return + - title: Alberta 2023 personal tax credits return TD1AB href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta personal tax credits return + - title: Alberta personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml index 5ff8f1651..61a6f2cc0 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -6,9 +6,9 @@ metadata: unit: year label: Alberta infirm dependant amount minimum dependant age reference: - - title: Alberta personal tax credits return + - title: Alberta 2023 personal tax credits return TD1AB href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta personal tax credits return + - title: Alberta personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml index 50d0e90e3..e3e0ddd90 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -6,8 +6,8 @@ metadata: period: year label: Alberta infirm dependant credit max income reference: - - title: Alberta personal tax credits return + - title: Alberta 2023 personal tax credits return TD1AB href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta personal tax credits return + - title: Alberta personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml index 4ba8caa8e..7116a27ad 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml @@ -6,8 +6,8 @@ metadata: period: year label: Alberta infirm dependant phase out start reference: - - title: Alberta personal tax credits return + - title: Alberta 2023 personal tax credits return TD1AB href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf - - title: Alberta personal tax credits return + - title: Alberta personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf From b22ce512b6690fecca9fb65ce8d35084f4960ed0 Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Thu, 17 Aug 2023 02:29:44 +0300 Subject: [PATCH 10/16] minor changes --- .../ab/tax/income/credits/infirm_dependant/base.yaml | 4 ++-- .../credits/infirm_dependant/infirm_dependant_age.yaml | 4 ++-- .../tax/income/credits/infirm_dependant/max_net_income.yaml | 4 ++-- .../income/credits/infirm_dependant/phase_out_start.yaml | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index 7e87cc09e..96cd00ce4 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -7,7 +7,7 @@ metadata: label: Alberta infirm dependant credit maximum amount reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 - title: Alberta personal tax credits return worksheet TD1AB-WS - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml index 61a6f2cc0..0e79b0d23 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -7,8 +7,8 @@ metadata: label: Alberta infirm dependant amount minimum dependant age reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - title: Alberta personal tax credits return worksheet TD1AB-WS - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml index e3e0ddd90..16f7aaf32 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -7,7 +7,7 @@ metadata: label: Alberta infirm dependant credit max income reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - title: Alberta personal tax credits return worksheet TD1AB-WS - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml index 7116a27ad..0e05ead68 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml @@ -1,4 +1,4 @@ -description: lberta phases the infirm dependant amount out above this income threshold. +description: Alberta phases the infirm dependant amount out above this dependant income threshold. values: 2023-01-01: 8_032 metadata: @@ -7,7 +7,7 @@ metadata: label: Alberta infirm dependant phase out start reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - title: Alberta personal tax credits return worksheet TD1AB-WS - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 From 0fc4c24cc46a6ce66eb86bb3d3c85e6a25e2d8c0 Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 27 May 2024 04:51:53 +0000 Subject: [PATCH 11/16] minor --- changelog_entry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 6fc9080fc..2bde079c1 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit. + - Alberta infirm dependant credit From 28a14aaa9531baccf22438631687f96b42136e85 Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 27 May 2024 19:18:07 +0000 Subject: [PATCH 12/16] added 2022 + tests --- changelog_entry.yaml | 2 +- .../income/credits/infirm_dependant/base.yaml | 8 +++++- .../infirm_dependant_age.yaml | 12 +++++---- .../infirm_dependant/max_net_income.yaml | 9 +++++-- .../infirm_dependant/phase_out_start.yaml | 9 +++++-- .../ab_infirm_dependant.yaml | 27 +++++++++++++++++++ 6 files changed, 56 insertions(+), 11 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 2bde079c1..6fc9080fc 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,4 @@ - bump: minor changes: added: - - Alberta infirm dependant credit + - Alberta infirm dependant credit. diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml index 96cd00ce4..3d884833b 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/base.yaml @@ -1,6 +1,7 @@ description: Alberta provides this maximum amount under the infirm dependant credit. values: 2023-01-01: 12_158 + 2022-01-01: 11_212 metadata: unit: currency-CAD period: year @@ -8,6 +9,11 @@ metadata: reference: - title: Alberta 2023 personal tax credits return TD1AB href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 - - title: Alberta personal tax credits return worksheet TD1AB-WS + - title: Alberta 2023 personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 + - title: Alberta 2022 personal tax credits return TD1AB + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 + - title: Alberta 2022 personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 + diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml index 0e79b0d23..0bdbb74b7 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml @@ -1,14 +1,16 @@ description: Alberta provides the infirm dependant amount for filers with dependant at or above this age threshold. values: - 2023-01-01: 18 + 2022-01-01: 18 metadata: unit: year label: Alberta infirm dependant amount minimum dependant age reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - - title: Alberta personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 + - title: Alberta 2023 personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 - - + - title: Alberta 2022 personal tax credits return TD1AB + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 + - title: Alberta 2022 personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml index 16f7aaf32..ac2a9a85f 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml @@ -1,13 +1,18 @@ description: Alberta provides the infirm dependant amount for filers with income of up to this threshold. values: 2023-01-01: 20_190 + 2022-01-01: 18_619 metadata: unit: currency-CAD period: year label: Alberta infirm dependant credit max income reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - - title: Alberta personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 + - title: Alberta 2023 personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 + - title: Alberta 2022 personal tax credits return TD1AB + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 + - title: Alberta 2022 personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml index 0e05ead68..0bdec0dda 100644 --- a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml +++ b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/phase_out_start.yaml @@ -1,13 +1,18 @@ description: Alberta phases the infirm dependant amount out above this dependant income threshold. values: 2023-01-01: 8_032 + 2022-01-01: 7_407 metadata: unit: currency-CAD period: year label: Alberta infirm dependant phase out start reference: - title: Alberta 2023 personal tax credits return TD1AB - href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.pdf#page=1 - - title: Alberta personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-23e.#page=1 + - title: Alberta 2023 personal tax credits return worksheet TD1AB-WS href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-23e.pdf#page=1 + - title: Alberta 2022 personal tax credits return TD1AB + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab/td1ab-22e.#page=1 + - title: Alberta 2022 personal tax credits return worksheet TD1AB-WS + href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/td1ab-ws/td1ab-ws-22e.pdf#page=1 diff --git a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml index 6798f1c78..dce8117df 100644 --- a/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml +++ b/policyengine_canada/tests/gov/provinces/ab/tax/income/credits/infirm_dependants/ab_infirm_dependant.yaml @@ -11,6 +11,33 @@ output: ab_infirm_dependant_credit: 12_158 +- name: Infirm dependant net income below 7_407 + period: 2022 + input: + people: + p1: + is_infirm_dependant: true + infirm_dependant_income: 7_000 + household: + members: p1 + province_code: AB + output: + ab_infirm_dependant_credit: 11_212 + +- name: Infirm dependant net income over 8_032 but lower than 20_190 + period: 2023 + input: + people: + p1: + is_infirm_dependant: true + infirm_dependant_income: 20_000 + household: + members: p1 + province_code: AB + output: + ab_infirm_dependant_credit: 190 + + - name: Infirm dependant net income over 8_032 but lower than 20_190 period: 2023 input: From b62c738050ffb3d1cf24bd57a13111e32005160b Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 27 May 2024 20:10:07 +0000 Subject: [PATCH 13/16] minor --- .../credits/infirm_dependant/ab_infirm_dependant_credit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 507b799f0..76e687a2e 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -20,9 +20,10 @@ def formula(household, period, parameters): partial_credit = eligible * ( p.max_net_income - infirm_dependant_income ) - per_credit = where( + + capped_credit = where( income_level_condition, - max_(0, partial_credit), + partial_credit, max_credit, ) - return household.sum(per_credit) + return household.sum(capped_credit) From b575d7cb14e424c65c120a7b38519c8c99a754e5 Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 27 May 2024 20:11:25 +0000 Subject: [PATCH 14/16] minor --- .../infirm_dependant/ab_infirm_dependant_credit.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 76e687a2e..c5ea81c4a 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -13,13 +13,18 @@ def formula(household, period, parameters): p = parameters( period ).gov.provinces.ab.tax.income.credits.infirm_dependant + eligible = person("is_infirm_dependant", period) + infirm_dependant_income = person("infirm_dependant_income", period) + income_level_condition = infirm_dependant_income > p.phase_out_start + max_credit = eligible * p.base - partial_credit = eligible * ( - p.max_net_income - infirm_dependant_income - ) + + reduced_threshold = max_(0, p.max_net_income - infirm_dependant_income) + + partial_credit = eligible * reduced_threshold capped_credit = where( income_level_condition, From 9ab312d3b33871b90df099c3b2d9ead7ec0ef725 Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 3 Jun 2024 19:52:17 +0000 Subject: [PATCH 15/16] renamed --- .../{infirm_dependant_age.yaml => age_threshold.yaml} | 0 .../{max_net_income.yaml => income_threshold.yaml} | 0 .../credits/infirm_dependant/ab_infirm_dependant_credit.py | 2 +- .../variables/household/person/is_infirm_dependant.py | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/{infirm_dependant_age.yaml => age_threshold.yaml} (100%) rename policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/{max_net_income.yaml => income_threshold.yaml} (100%) diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/age_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/infirm_dependant_age.yaml rename to policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/age_threshold.yaml diff --git a/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml b/policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/income_threshold.yaml similarity index 100% rename from policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/max_net_income.yaml rename to policyengine_canada/parameters/gov/provinces/ab/tax/income/credits/infirm_dependant/income_threshold.yaml diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index c5ea81c4a..248fc8021 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -22,7 +22,7 @@ def formula(household, period, parameters): max_credit = eligible * p.base - reduced_threshold = max_(0, p.max_net_income - infirm_dependant_income) + reduced_threshold = max_(0, p.income_threshold - infirm_dependant_income) partial_credit = eligible * reduced_threshold diff --git a/policyengine_canada/variables/household/person/is_infirm_dependant.py b/policyengine_canada/variables/household/person/is_infirm_dependant.py index 36e3ae2dd..448faaf57 100644 --- a/policyengine_canada/variables/household/person/is_infirm_dependant.py +++ b/policyengine_canada/variables/household/person/is_infirm_dependant.py @@ -12,4 +12,4 @@ def formula(person, period, parameters): p = parameters( period ).gov.provinces.ab.tax.income.credits.infirm_dependant - return person("age", period) >= p.infirm_dependant_age + return person("age", period) >= p.age_threshold From 10458988639bd161894bc7a97c0538cebf3288eb Mon Sep 17 00:00:00 2001 From: SirMalamute Date: Mon, 10 Jun 2024 00:05:29 +0000 Subject: [PATCH 16/16] format --- .../credits/infirm_dependant/ab_infirm_dependant_credit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py index 248fc8021..3326c0bf3 100644 --- a/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py +++ b/policyengine_canada/variables/gov/provinces/ab/tax/income/credits/infirm_dependant/ab_infirm_dependant_credit.py @@ -22,10 +22,12 @@ def formula(household, period, parameters): max_credit = eligible * p.base - reduced_threshold = max_(0, p.income_threshold - infirm_dependant_income) + reduced_threshold = max_( + 0, p.income_threshold - infirm_dependant_income + ) partial_credit = eligible * reduced_threshold - + capped_credit = where( income_level_condition, partial_credit,