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

Issue:
British Columbia Disability Credit



Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb..5cae0d451 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: minor
+  changes:
+    added:
+    - British Columbia disability credit.
diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/base.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/base.yaml
new file mode 100644
index 000000000..0d7cc5bd3
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/base.yaml
@@ -0,0 +1,25 @@
+description: British Columbia provides an additional disability credit of this amount, based on age.
+brackets: 
+  - threshold:
+      2022-01-01: 0
+    amount:
+      2022-01-01: 4_946
+      2023-01-01: 5_242  
+      2024-01-01: 5_505
+  - threshold:
+      2022-01-01: 18
+    amount: 
+      2022-01-01: 0
+metadata:
+  type: single_amount
+  threshold_unit: year
+  amount_unit: currency-CAD
+  period: year
+  label: British Columbia disability credit additional amount base 
+  reference:
+  - title: B.C. basic personal income tax credits
+    href: https://www2.gov.bc.ca/gov/content/taxes/income-taxes/personal/credits/basic
+  - title: British Columbia Income Tax Act (4.51)
+    href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.51
+  - title: British Columbia disability amount worksheet 2022
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1
diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/childcare_expense_threshold.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/childcare_expense_threshold.yaml
new file mode 100644
index 000000000..6a20e9b5a
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/additional_amount/childcare_expense_threshold.yaml
@@ -0,0 +1,17 @@
+description: British Columbia reduces the additional disability credit amount by the excess of childcare expenses over this threshold.  
+values:
+  2022-01-01: 2_871
+  2023-01-01: 3_044  
+  2024-01-01: 3_196  
+
+metadata:
+  unit: currency-CAD
+  period: year
+  label: British Columbia disability credit additional amount childcare expense threshold
+  reference:
+  - title: B.C. basic personal income tax credits
+    href: https://www2.gov.bc.ca/gov/content/taxes/income-taxes/personal/credits/basic
+  - title: British Columbia Income Tax Act (4.51)
+    href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.51
+  - title: British Columbia disability amount worksheet 2022
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1
diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/base.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/base.yaml
new file mode 100644
index 000000000..18ca93fad
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/disability/base.yaml
@@ -0,0 +1,16 @@
+description: British Columbia provides this disability credit base amount.
+values:
+  2022-01-01: 8_477
+  2023-01-01: 8_986  
+  2024-01-01: 9_435
+metadata:
+  unit: currency-CAD
+  period: year
+  label: British Columbia disability credit base amount
+  reference:
+  - title: B.C. basic personal income tax credits
+    href: https://www2.gov.bc.ca/gov/content/taxes/income-taxes/personal/credits/basic
+  - title: British Columbia Income Tax Act (4.51)
+    href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.51
+  - title: British Columbia disability amount worksheet 2022
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1
diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/non_refundable.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/non_refundable.yaml
index c1f16fa6e..c182c5af9 100644
--- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/non_refundable.yaml
+++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/non_refundable.yaml
@@ -5,8 +5,16 @@ values:
     - bc_age_credit
     - bc_basic_personal_amount
     - bc_pension_income_amount
+    - bc_disability_credit
 
 metadata:
-  unit: list
+  unit: program
   period: year
   label: British Columbia non-refundable tax credits
+  reference:
+  - title: B.C. basic personal income tax credits
+    href: https://www2.gov.bc.ca/gov/content/taxes/income-taxes/personal/credits/basic
+  - title: British Columbia Income Tax Act (4.51)
+    href: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/96215_00_multi#section4.51
+  - title: British Columbia disability amount worksheet 2022
+    href: https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1
diff --git a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/refundable.yaml b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/refundable.yaml
index e5fb34eec..ce313c801 100644
--- a/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/refundable.yaml
+++ b/policyengine_canada/parameters/gov/provinces/bc/tax/income/credits/refundable.yaml
@@ -1,7 +1,10 @@
-description: British Columbia list of refundable tax credits.
+description: British Columbia provides ty of refundable tax credits.
 values:
   2022-01-01:
     - bc_climate_action_tax_credit
+    - bc_disability_credit
 
 metadata:
-  unit: program
+  unit: list
+  period: year
+  label: British Columbia refundable tax credits
diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.py
new file mode 100644
index 000000000..00444f428
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.py
@@ -0,0 +1,18 @@
+from policyengine_canada.model_api import *
+
+
+class bc_disability_credit(Variable):
+    value_type = float
+    entity = Person
+    label = "British Columbia disability tax credit"
+    unit = CAD
+    definition_period = YEAR
+    reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1"
+    defined_for = "bc_disability_credit_eligible"
+
+    def formula(person, period, parameters):
+        p = parameters(period).gov.provinces.bc.tax.income.credits.disability
+        additional_amount = person(
+            "bc_disability_credit_additional_amount", period
+        )
+        return p.base + additional_amount
diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.py
new file mode 100644
index 000000000..2393f126e
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.py
@@ -0,0 +1,26 @@
+from policyengine_canada.model_api import *
+
+
+class bc_disability_credit_additional_amount(Variable):
+    value_type = float
+    entity = Person
+    label = "British Columbia additional disability tax credit"
+    unit = CAD
+    definition_period = YEAR
+    reference = "https://www.canada.ca/content/dam/cra-arc/formspubs/pbg/5010-d/5010-d-22e.pdf#page=1"
+    defined_for = ProvinceCode.BC
+
+    def formula(person, period, parameters):
+        p = parameters(period).gov.provinces.bc.tax.income.credits.disability
+        childcare_expenses = person("care_expenses", period)
+        reduced_childcare_expenses = (
+            childcare_expenses
+            - p.additional_amount.childcare_expense_threshold
+        )
+        excess_childcare_expenses = max_(
+            0,
+            reduced_childcare_expenses,
+        )
+        age = person("age", period)
+        additional_amount_base = p.additional_amount.base.calc(age)
+        return max_(0, additional_amount_base - excess_childcare_expenses)
diff --git a/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.py b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.py
new file mode 100644
index 000000000..ba6199620
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.py
@@ -0,0 +1,12 @@
+from policyengine_canada.model_api import *
+
+
+class bc_disability_credit_eligible(Variable):
+    value_type = bool
+    entity = Person
+    label = "Eligible for the British Columbia disability tax credit"
+    definition_period = YEAR
+    defined_for = ProvinceCode.BC
+
+    def formula(person, period):
+        return person("is_disabled", period)


Test patch:
diff --git a/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.yaml b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.yaml
new file mode 100644
index 000000000..9991860f2
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit.yaml
@@ -0,0 +1,35 @@
+- name: Eligible person with disability credit less than limit 2023
+  period: 2023
+  input:
+    province_code: BC
+    bc_disability_credit_eligible: true
+    bc_disability_credit_additional_amount: 0
+  output:
+    bc_disability_credit: 8_986
+
+- name: Ineligible person 2023
+  period: 2023
+  input:
+    province_code: BC
+    bc_disability_credit_eligible: false
+    bc_disability_credit_additional_amount: 5_242
+  output:
+    bc_disability_credit: 0
+
+- name: Eligible person with disability credit less than limit 2022
+  period: 2022
+  input:
+    province_code: BC
+    bc_disability_credit_eligible: true
+    bc_disability_credit_additional_amount: 0
+  output:
+    bc_disability_credit: 8_477
+
+- name: Ineligible person 2022
+  period: 2022
+  input:
+    province_code: BC
+    bc_disability_credit_eligible: false
+    bc_disability_credit_additional_amount: 4_946
+  output:
+    bc_disability_credit: 0
diff --git a/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.yaml b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.yaml
new file mode 100644
index 000000000..f8d500c52
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_additional_amount.yaml
@@ -0,0 +1,71 @@
+- name: Eligible person under 18 with childcare_received less than threshold 2023
+  period: 2023
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 3_000
+  output:
+    bc_disability_credit_additional_amount: 5_242
+
+- name: Eligible person under 18 with childcare_received greater than threshold, less than max_amount_child 2023
+  period: 2023
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 3_500
+  output:
+    bc_disability_credit_additional_amount: 4_786
+
+- name: Eligible person under 18 with childcare_received greater than max_amount_child 2023
+  period: 2023
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 15_000
+  output:
+    bc_disability_credit_additional_amount: 0
+
+- name: Ineligible person 2023
+  period: 2023
+  input:
+    province_code: BC
+    age: 18
+    care_expenses: 15_000
+  output:
+    bc_disability_credit_additional_amount: 0
+
+- name: Eligible person under 18 with childcare_received less than threshold 2022
+  period: 2022
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 2_800
+  output:
+    bc_disability_credit_additional_amount: 4_946
+
+- name: Eligible person under 18 with childcare_received greater than threshold, less than max_amount_child 2022
+  period: 2022
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 3_000
+  output:
+    bc_disability_credit_additional_amount: 4_817
+
+- name: Eligible person under 18 with childcare_received greater than max_amount_child 2022
+  period: 2022
+  input:
+    province_code: BC
+    age: 17
+    care_expenses: 15_000
+  output:
+    bc_disability_credit_additional_amount: 0
+
+- name: Ineligible person 2022
+  period: 2022
+  input:
+    province_code: BC
+    age: 18
+    care_expenses: 15_000
+  output:
+    bc_disability_credit_additional_amount: 0
diff --git a/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.yaml b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.yaml
new file mode 100644
index 000000000..ec29f18fe
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/bc/tax/income/credits/bc_disability_credit/bc_disability_credit_eligible.yaml
@@ -0,0 +1,31 @@
+- name: Eligible person with disability 2023
+  period: 2023
+  input:
+    is_disabled: true
+    province_code: BC
+  output:
+    bc_disability_credit_eligible: true
+
+- name: Ineligible person without disability 2023
+  period: 2023
+  input:
+    is_disabled: false
+    province_code: BC
+  output:
+    bc_disability_credit_eligible: false
+
+- name: Eligible person with disability 2022
+  period: 2022
+  input:
+    is_disabled: true
+    province_code: BC
+  output:
+    bc_disability_credit_eligible: true
+
+- name: Ineligible person without disability 2022
+  period: 2022
+  input:
+    is_disabled: false
+    province_code: BC
+  output:
+    bc_disability_credit_eligible: false