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

Issue:
Nova Scotia Income Assistance Asset Eligibility
**Reference**: https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC2_4
Nova Scotia Income Assistance Asset Eligibility
**Reference**: https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC2_4


Discussion / hints:

Fix patch:
diff --git a/changelog_entry.yaml b/changelog_entry.yaml
index e69de29bb..864d68603 100644
--- a/changelog_entry.yaml
+++ b/changelog_entry.yaml
@@ -0,0 +1,4 @@
+- bump: minor
+  changes:
+    added:
+    - Nova Scotia income assistance asset eligibility.
diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/applicable_assets.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/applicable_assets.yaml
new file mode 100644
index 000000000..f446fa470
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/applicable_assets.yaml
@@ -0,0 +1,10 @@
+description: Nova Scotia considers these assets when determining eligibility for the Income Assistance.
+values:
+  2021-01-01:
+    - real_and_personal_property
+    - household_liquid_assets
+metadata:
+  unit: list
+  reference:
+    - title: Employment Support and Income Assistance Act, Section 21, Definitions (2)
+      href: https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC3_2
diff --git a/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/limit.yaml b/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/limit.yaml
new file mode 100644
index 000000000..43a5e9002
--- /dev/null
+++ b/policyengine_canada/parameters/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/limit.yaml
@@ -0,0 +1,19 @@
+description: Nova Scotia limits its Income Assistance program to households with assets valued at less than this amount, based on household size.
+brackets:
+  - threshold:
+      2021-01-01: 0
+    amount:
+      2021-01-01: 2_000
+  - threshold:
+      2021-01-01: 2
+    amount:
+      2021-01-01: 4_000
+metadata:
+  type: single_amount
+  threshold_unit: people
+  amount_unit: currency-CAD
+  period: year
+  label: Nova Scotia Income Assistance asset limit 
+  reference:
+    - title: Employment Support and Income Assistance Act, Section 21, Assets (26), (1)
+      href: https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC2_4
diff --git a/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_applicable_assets.py b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_applicable_assets.py
new file mode 100644
index 000000000..5ff8f1f1b
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_applicable_assets.py
@@ -0,0 +1,17 @@
+from policyengine_canada.model_api import *
+
+
+class ns_income_assistance_applicable_assets(Variable):
+    value_type = float
+    entity = Household
+    label = "Nova Scotia income assistance applicable assets"
+    unit = CAD
+    definition_period = YEAR
+    reference = (
+        "https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC2_4"
+    )
+    defined_for = ProvinceCode.NS
+
+    adds = "gov.provinces.ns.tax.income.income_assistance.eligibility.assets.applicable_assets"
+
+    # None of the following is an applicable asset, per https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC3_25
diff --git a/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.py b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.py
new file mode 100644
index 000000000..8b8410de3
--- /dev/null
+++ b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.py
@@ -0,0 +1,18 @@
+from policyengine_canada.model_api import *
+
+
+class ns_income_assistance_asset_eligibility(Variable):
+    value_type = bool
+    entity = Household
+    label = "Nova Scotia income assistance asset eligibility"
+    definition_period = YEAR
+    defined_for = ProvinceCode.NS
+
+    def formula(household, period, parameters):
+        household_size = household("household_size", period)
+        p = parameters(
+            period
+        ).gov.provinces.ns.tax.income.income_assistance.eligibility.assets
+        asset_limit = p.limit.calc(household_size)
+        assets = household("ns_income_assistance_applicable_assets", period)
+        return assets <= asset_limit
diff --git a/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/ns_income_assistance.py b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/ns_income_assistance.py
index 50aa20e6c..a9cff6458 100644
--- a/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/ns_income_assistance.py
+++ b/policyengine_canada/variables/gov/provinces/ns/tax/income/income_assistance/ns_income_assistance.py
@@ -7,5 +7,7 @@ class ns_income_assistance(Variable):
     label = "Nova Scotia Income Assistance"
     unit = CAD
     definition_period = YEAR
-    reference = "https://novascotia.ca/coms/employment/income_assistance/Eligibility.html#19"
+    reference = (
+        "https://novascotia.ca/just/regulations/regs/esiaregs.htm#TOC2_4"
+    )
     defined_for = ProvinceCode.NS
diff --git a/policyengine_canada/variables/household/assets/household/household_liquid_assets.py b/policyengine_canada/variables/household/assets/household/household_liquid_assets.py
new file mode 100644
index 000000000..f22a77fb1
--- /dev/null
+++ b/policyengine_canada/variables/household/assets/household/household_liquid_assets.py
@@ -0,0 +1,10 @@
+from policyengine_canada.model_api import *
+
+
+class household_liquid_assets(Variable):
+    value_type = float
+    entity = Household
+    label = "Household liquid assets"
+    documentation = "Total liquid household assets, including cash on hand, bank accounts, stocks, bonds, non-locked-in retirement savings plans, and other securities."
+    unit = CAD
+    definition_period = YEAR
diff --git a/policyengine_canada/variables/household/assets/household/real_and_personal_property.py b/policyengine_canada/variables/household/assets/household/real_and_personal_property.py
new file mode 100644
index 000000000..7c31747e4
--- /dev/null
+++ b/policyengine_canada/variables/household/assets/household/real_and_personal_property.py
@@ -0,0 +1,10 @@
+from policyengine_canada.model_api import *
+
+
+class real_and_personal_property(Variable):
+    value_type = float
+    entity = Household
+    label = "Property value"
+    documentation = "Total equity in real property (land and attached assets) and personal property (tangible and intangible possessions apart from real estate)."
+    unit = CAD
+    definition_period = YEAR


Test patch:
diff --git a/policyengine_canada/tests/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.yaml b/policyengine_canada/tests/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.yaml
new file mode 100644
index 000000000..874026578
--- /dev/null
+++ b/policyengine_canada/tests/gov/provinces/ns/tax/income/income_assistance/eligibility/assets/ns_income_assistance_asset_eligibility.yaml
@@ -0,0 +1,48 @@
+- name: Nova Scotia Income Assistance asset eligibility; 1-person household and eligible assets
+  period: 2023
+  input:
+    province_code: NS
+    household_size: 1
+    ns_income_assistance_applicable_assets: 1_999
+  output:
+    ns_income_assistance_asset_eligibility: True
+
+
+- name: Nova Scotia Income Assistance asset eligibility; multi-person household and eligible assets
+  period: 2023
+  input:
+    province_code: NS
+    household_size: 2
+    ns_income_assistance_applicable_assets: 3_999
+  output:
+    ns_income_assistance_asset_eligibility: True
+
+
+- name: Nova Scotia Income Assistance asset eligibility; 1-person household and ineligible assets
+  period: 2023
+  input:
+    province_code: NS
+    household_size: 1
+    ns_income_assistance_applicable_assets: 2_001
+  output:
+    ns_income_assistance_asset_eligibility: False
+
+
+- name: Nova Scotia Income Assistance asset eligibility; multi-person household and ineligible assets
+  period: 2023
+  input:
+    province_code: NS
+    household_size: 3
+    ns_income_assistance_applicable_assets: 4_001
+  output:
+    ns_income_assistance_asset_eligibility: False
+
+
+- name: Nova Scotia Income Assistance asset eligibility; 0-person household and ineligible assets
+  period: 2023
+  input:
+    province_code: NS
+    household_size: 0
+    ns_income_assistance_applicable_assets: 4_001
+  output:
+    ns_income_assistance_asset_eligibility: False