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

Issue:
Redefine `is_dependant`
Redefine `is_dependant` to someone who is financially/behavior supported by someone else instead of age based


Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb..a34fefbc2 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: patch
+  changes:
+    changed:
+    - Redefine `is_dependant`.
diff --git a/policyengine_canada/variables/household/person/is_dependant.py b/policyengine_canada/variables/household/person/is_dependant.py
index c15c5c8bd..b5fb422a8 100644
--- a/policyengine_canada/variables/household/person/is_dependant.py
+++ b/policyengine_canada/variables/household/person/is_dependant.py
@@ -7,6 +7,7 @@ class is_dependant(Variable):
     label = "Is a dependant"
     definition_period = YEAR
 
-    # Impute dependant status on age.
     def formula(person, period, parameters):
-        return person("age", period) < 18
+        head = person("is_head", period)
+        spouse = person("is_spouse", period)
+        return ~head & ~spouse


Test patch:
diff --git a/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/low_income_tax_reduction/ns_low_income_tax_reduction_base.yaml b/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/low_income_tax_reduction/ns_low_income_tax_reduction_base.yaml
index 48ce1a3f1..46b773d8b 100644
--- a/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/low_income_tax_reduction/ns_low_income_tax_reduction_base.yaml
+++ b/policyengine_canada/tests/gov/provinces/ns/tax/income/credits/low_income_tax_reduction/ns_low_income_tax_reduction_base.yaml
@@ -4,11 +4,15 @@
     people:
       head:
         age: 30
+        is_spouse: false
+        is_dependant: false
       spouse:
         age: 30
         is_spouse: true
+        is_dependant: false
       dependent:
         age: 19
+        is_spouse: false
         is_dependant: true
     household:
       members: [head, spouse, dependent]
@@ -22,6 +26,8 @@
     people:
       head:
         age: 30
+        is_spouse: false
+        is_dependant: false
     household:
       members: [head]
       province_code: NS
@@ -34,9 +40,12 @@
     people:
       head:
         age: 30
+        is_spouse: false
+        is_dependant: false
       spouse:
         age: 30
         is_spouse: true
+        is_dependant: false
     household:
       members: [head, spouse]
       province_code: NS
diff --git a/policyengine_canada/tests/household/person/is_dependant.yaml b/policyengine_canada/tests/household/person/is_dependant.yaml
new file mode 100644
index 000000000..2d79e72bc
--- /dev/null
+++ b/policyengine_canada/tests/household/person/is_dependant.yaml
@@ -0,0 +1,23 @@
+- name: Ineligible dependant who is head
+  period: 2023
+  input:
+    is_head: true
+    is_spouse: false
+  output:
+    is_dependant: false
+
+- name: Ineligible dependant who is spouse
+  period: 2023
+  input:
+    is_head: false
+    is_spouse: true
+  output:
+    is_dependant: false
+
+- name: Eligible dependant
+  period: 2023
+  input:
+    is_head: false
+    is_spouse: false
+  output:
+    is_dependant: true