From 2cf0bad2626f596727805dc1f5da8a2f50a1d202 Mon Sep 17 00:00:00 2001 From: Dana Sherson Date: Mon, 22 Apr 2024 15:45:09 +1000 Subject: [PATCH 1/9] Supported Living Payment Eligibility --- .../supported_living_payment.yaml | 104 +++++++++++------- .../social_security/interpretation/child.py | 1 + .../supported_living_payment.py | 56 ++++++++-- 3 files changed, 113 insertions(+), 48 deletions(-) diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml index 181f13c8..708c1189 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml @@ -1,81 +1,105 @@ --- - name: Supported Living Payment - default false - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 + "2019-01-01": 16 citizenship__citizen: true output: supported_living_payment__entitled: false - name: Supported Living Payment - totally blind - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 - citizenship__citizen: true - totally_blind: true - supported_living_payment__below_income_threshold: true - social_security__residential_requirement: true + "2019-01-01": [16, 15] + citizenship__citizen: [true, true] + totally_blind: [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, true] output: - supported_living_payment__entitled: - 2018-10: - - true + supported_living_payment__entitled: [true, false] - name: Supported Living Payment - "severely" disabled - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 - citizenship__citizen: true - supported_living_payment__restricted_work_capacity: true - supported_living_payment__below_income_threshold: true - social_security__residential_requirement: true + "2019-01-01": [16, 15] + citizenship__citizen: [true, true] + supported_living_payment__restricted_work_capacity: + "2019-W01": [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, true] output: - supported_living_payment__entitled: true + supported_living_payment__entitled: [true, false] - name: Supported Living Payment - self inflicted injury - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 - citizenship__citizen: true - supported_living_payment__restricted_work_capacity: true - supported_living_payment__below_income_threshold: true - supported_living_payment__disability_self_inflicted: true - social_security__residential_requirement: true + "2019-01-01": [16, 16] + citizenship__citizen: [true, true] + supported_living_payment__restricted_work_capacity: + "2019-W01": [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, true] + supported_living_payment__disability_self_inflicted: [false, true] output: - supported_living_payment__entitled: false + supported_living_payment__entitled: [true, false] - name: Supported Living Payment - Carer looking after another person - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 - citizenship__citizen: true - supported_living_payment__caring_for_another_person: true - supported_living_payment__below_income_threshold: true - social_security__residential_requirement: true + "2019-01-01": [17, 18] + citizenship__citizen: [true, true] + supported_living_payment__caring_for_another_person: + "2019-W01": [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, true] + output: + supported_living_payment__entitled: [false, true] + +- name: Supported Living Payment - Carer looking after another person, with child + period: 2019-01 + absolute_error_margin: 0 + input: + age: + "2019-01-01": [19, 20] + citizenship__citizen: [true, true] + supported_living_payment__caring_for_another_person: + "2019-W01": [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, true] + social_security__dependent_children: + "2019-W01": [1, 1] output: - supported_living_payment__entitled: true + supported_living_payment__entitled: [false, true] - name: Supported Living Payment - Carer looking after another person, not in NZ - period: 2018-10 + period: 2019-01 absolute_error_margin: 0 input: age: - "2018-10-01": 25 - citizenship__citizen: true - supported_living_payment__caring_for_another_person: true - supported_living_payment__below_income_threshold: true - social_security__residential_requirement: false + "2019-01-01": [20, 20] + citizenship__citizen: [true, true] + supported_living_payment__caring_for_another_person: + "2019-W01": [true, true] + supported_living_payment__below_income_threshold: [true, true] + social_security__residential_requirement: + "2019-W01": [true, false] output: - supported_living_payment__entitled: false + supported_living_payment__entitled: [true, false] diff --git a/openfisca_aotearoa/variables/acts/social_security/interpretation/child.py b/openfisca_aotearoa/variables/acts/social_security/interpretation/child.py index c5894d14..b5cd03cf 100644 --- a/openfisca_aotearoa/variables/acts/social_security/interpretation/child.py +++ b/openfisca_aotearoa/variables/acts/social_security/interpretation/child.py @@ -41,6 +41,7 @@ def formula(persons, period, parameters): class social_security__dependent_children(variables.Variable): + default_value = 0 value_type = int entity = entities.Person label = "number a dependent child (or children)" diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index 1755f7d0..f2416c65 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -6,7 +6,6 @@ from openfisca_aotearoa import entities - # Benefit: Part 1E Supported Living Payment (eligible self applicant): # If applicant.isNZResident # and 16 <= applicant.Age @@ -14,6 +13,12 @@ # and applicant.hasSeriousDisability # and threshold.income.SupportedLivingPayment # then benefit.isSupportedLivingPayment is PERMITTED + +# rates +# listed in "Schedule 4 Part 3": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861 +# reduced using "Schedule 2 Income Test 1": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784553 +# reduced using "Schedule 2 Income Test 2": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784555 + class supported_living_payment__granted(variables.Variable): value_type = bool default_value = False @@ -54,18 +59,55 @@ class supported_living_payment__restricted_work_capacity(variables.Variable): entity = entities.Person definition_period = periods.WEEK label = "Is incapable of regularly working 15 or more hours a week in open employment" - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176", "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176", + "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + ] set_input = holders.set_input_dispatch_by_period -# TODO: Review against the new 2018 act class supported_living_payment__entitled(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.MONTH label = "Eligible for Supported Living Payment." - reference = """ - http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367 + reference = [ + "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175", + "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + ] + + def formula_2018_11_26(persons, period, parameters): + """ + 34 Supported living payment: on ground of restricted work capacity or total blindness: requirements + A person is entitled to the supported living payment if the person— + (a) has restricted work capacity or is totally blind; and + (b) meets the residential requirement; and + (c) is aged 16 years or over. + """ + disabled = persons("supported_living_payment__restricted_work_capacity", period.first_week) + blind = persons("totally_blind", period.start) + carer = persons("supported_living_payment__caring_for_another_person", period.first_week) + + no_child = persons("social_security__dependent_children", period.first_week) == 0 + gte_16 = persons("age", period.start) >= 16 + gte_18 = persons("age", period.start) >= 18 + gte_20 = persons("age", period.start) >= 20 + is_old_enough = carer * ( ( gte_18 * no_child ) + gte_20 ) + ( disabled + blind ) * gte_16 + + not_self_inflicted = not_(persons("supported_living_payment__disability_self_inflicted", period)) + + # 34 (b) meets the residential requirement + immigration__resident_or_citizen = persons("immigration__citizen_or_resident", period) + + resides_in_nz = persons("social_security__residential_requirement", period.first_week) + + # # income low enough? + income = persons("supported_living_payment__below_income_threshold", period) + + return resides_in_nz * (disabled + blind + carer) * not_self_inflicted * is_old_enough * immigration__resident_or_citizen * income + + def formula(persons, period, parameters): + """ 40A Supported living payment: purpose (1) The purpose of the supported living payment is to provide income support to people because they are people who fall within any one of the following 3 categories: @@ -74,9 +116,7 @@ class supported_living_payment__entitled(variables.Variable): (b) people who are totally blind: (c) people who are required to give full-time care and attention at home to some other person (other than their spouse or partner) who is a patient requiring care. - """ - - def formula(persons, period, parameters): + """ # The 3 ways of being eligible disabled = persons("supported_living_payment__restricted_work_capacity", period.first_week) blind = persons("totally_blind", period) From 36d6fc9f6a3accd1aac666c9972d821cef05c3dd Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Wed, 1 May 2024 13:48:39 +1000 Subject: [PATCH 2/9] split supported living payment into two --- .../supported_living_payment.yaml | 6 - .../supported_living_payment.py | 264 +++++++++++------- .../student_allowance/interpretation.py | 1 + 3 files changed, 171 insertions(+), 100 deletions(-) diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml index 708c1189..d6fd4317 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml @@ -18,7 +18,6 @@ "2019-01-01": [16, 15] citizenship__citizen: [true, true] totally_blind: [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, true] output: @@ -33,7 +32,6 @@ citizenship__citizen: [true, true] supported_living_payment__restricted_work_capacity: "2019-W01": [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, true] output: @@ -49,7 +47,6 @@ citizenship__citizen: [true, true] supported_living_payment__restricted_work_capacity: "2019-W01": [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, true] supported_living_payment__disability_self_inflicted: [false, true] @@ -65,7 +62,6 @@ citizenship__citizen: [true, true] supported_living_payment__caring_for_another_person: "2019-W01": [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, true] output: @@ -80,7 +76,6 @@ citizenship__citizen: [true, true] supported_living_payment__caring_for_another_person: "2019-W01": [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, true] social_security__dependent_children: @@ -98,7 +93,6 @@ citizenship__citizen: [true, true] supported_living_payment__caring_for_another_person: "2019-W01": [true, true] - supported_living_payment__below_income_threshold: [true, true] social_security__residential_requirement: "2019-W01": [true, false] output: diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index f2416c65..a1e3742d 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -19,141 +19,207 @@ # reduced using "Schedule 2 Income Test 1": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784553 # reduced using "Schedule 2 Income Test 2": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784555 -class supported_living_payment__granted(variables.Variable): + +class supported_living_payment__entitled(variables.Variable): value_type = bool - default_value = False entity = entities.Person - label = "Person is currently granted the supported living benefit" - definition_period = periods.WEEK - reference = "Reference is unclear, but variable is utilised by the phrase: 'granted a main benefit'" + definition_period = periods.MONTH + label = "Eligible for Supported Living Payment." + reference = [ + "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175", + "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + ] + def formula_2018_11_26(persons, period, parameters): + """ + For the 2018 version of the act, this is split into two sections: + 34 - 39 on ground of restricted work capacity or total blindness + 40 - 42 on ground of caring for another person + """ + ssa34 = persons("supported_living_payment__disabled_or_blind__entitled", period) + ssa40 = persons("supported_living_payment__carer__entitled", period) -class supported_living_payment__receiving(variables.Variable): - value_type = bool - default_value = False - entity = entities.Person - label = "Person is currently recieving/being paid the supported living payment" - definition_period = periods.WEEK - reference = "Reference is unclear, but concept underpinning the variable assumes it covers both: 'being paid a main benefit' or 'recieving a benefit'" + # ssa116 - must undergo work ability assessment + # ssa117 - unless they are terminally ill or their condition will not "improve" -class supported_living_payment__caring_for_another_person(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.WEEK - label = "Eligible for Supported Living Payment." - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187" - set_input = holders.set_input_dispatch_by_period + # ssa121_e - spouse must undertake work-preparation obligations + # ssa128 - children must atend school & healthcare, person required to attend interviews -class supported_living_payment__below_income_threshold(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.MONTH - label = "Income below threshold for supported living payment" - reference = "TODO" + # ssa140 - spouse must be available to work + # ssa170 - person or spouse must work with service providers -class supported_living_payment__restricted_work_capacity(variables.Variable): + return ssa34 + ssa40 + + def formula(persons, period, parameters): + """ + For the 1964 version of the act (final version), this is split into two sections: + 40B on ground of sickness, injury, disability, or total blindness + 40D on ground of caring for patient requiring care + """ + ssa40B = persons("supported_living_payment__disabled_or_blind__entitled", period) + ssa40D = persons("supported_living_payment__carer__entitled", period) + return ssa40B + ssa40D + + +class supported_living_payment__disabled_or_blind__entitled(variables.Variable): value_type = bool entity = entities.Person - definition_period = periods.WEEK - label = "Is incapable of regularly working 15 or more hours a week in open employment" + definition_period = periods.MONTH + label = "Eligible for Supported Living Payment, on ground of restricted work capacity or total blindness." reference = [ - "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176", - "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783174", ] - set_input = holders.set_input_dispatch_by_period + def formula_2018_11_26(persons, period, parameters): + # person P has restricted work capacity or is totally blind + ssa34_a = persons("supported_living_payment__restricted_work_capacity", period.first_week) + persons("totally_blind", period.start) -class supported_living_payment__entitled(variables.Variable): + # person P meets the residential requirement + ssa34_b = persons("social_security__residential_requirement", period.first_week) + + # person P is 16 or older + ssa34_c = persons("age", period.start) >= 16 + + # ssa35 specifies requirements for restricted work capacity status + + # person P is ineligible if the disability was self-inflicted to gain benefits + ssa36 = not_(persons("supported_living_payment__disability_self_inflicted", period)) + + # ssa37 specifies medical examination for reassessment of work capacity + + # ssa38 specifies payment rates for person P and partner / spouse S if applicable + + # ssa39 specifies open employment is permitted for reassessment of work capacity + + return ssa34_a * ssa34_b * ssa34_c * ssa36 + + def formula(persons, period, parameters): + # person P has restricted work capacity + ssa40B_1_a = persons("supported_living_payment__restricted_work_capacity", period.first_week) + + # person P is totally blind + ssa40B_1_b = persons("totally_blind", period) + + # person P is 16 or older + ssa40B_1A = persons("age", period.start) >= 16 + + # person P meets the residential requirement + ssa40B_1B = persons("social_security__residential_requirement", period.first_week) + + ssa40B_1 = ssa40B_1A * ssa40B_1B * (ssa40B_1_a + ssa40B_1_b) + + # 40B_2 specifies requirements for restricted work capacity status + + # 40B_3 specifies requirements for restricted work capacity status + + # 40B_4 (redundantly?) states that person P must be either totally blind or permanently disabled + + # person P is ineligible if the disability was self-inflicted to gain benefits + ssa40B_5 = not_(persons("supported_living_payment__disability_self_inflicted", period)) + + return ssa40B_1 * ssa40B_5 + + +class supported_living_payment__carer__entitled(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.MONTH - label = "Eligible for Supported Living Payment." + label = "Eligible for Supported Living Payment, on grounds of caring for another person." reference = [ - "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175", - "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187", ] def formula_2018_11_26(persons, period, parameters): - """ - 34 Supported living payment: on ground of restricted work capacity or total blindness: requirements - A person is entitled to the supported living payment if the person— - (a) has restricted work capacity or is totally blind; and - (b) meets the residential requirement; and - (c) is aged 16 years or over. - """ - disabled = persons("supported_living_payment__restricted_work_capacity", period.first_week) - blind = persons("totally_blind", period.start) - carer = persons("supported_living_payment__caring_for_another_person", period.first_week) + # person C is caring for person P + ssa40_1_a = persons("supported_living_payment__caring_for_another_person", period.first_week) + + # person C meets the residential requirement + ssa40_1_b = persons("social_security__residential_requirement", period.first_week) + + # person C is at least 18 years old if they have no dependent children + ssa40_1_c_i = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) + + # person C is at least 20 years old otherwise (i.e.: they have dependent children) + ssa40_1_c_ii = persons("age", period.start) >= 20 - no_child = persons("social_security__dependent_children", period.first_week) == 0 - gte_16 = persons("age", period.start) >= 16 - gte_18 = persons("age", period.start) >= 18 - gte_20 = persons("age", period.start) >= 20 - is_old_enough = carer * ( ( gte_18 * no_child ) + gte_20 ) + ( disabled + blind ) * gte_16 + ssa40_1_c = ssa40_1_c_i + ssa40_1_c_ii - not_self_inflicted = not_(persons("supported_living_payment__disability_self_inflicted", period)) + # ssa40_2 allows for payment to continue if not caring for 28 days - # 34 (b) meets the residential requirement - immigration__resident_or_citizen = persons("immigration__citizen_or_resident", period) + # ssa40_3 defines "institutional care" - resides_in_nz = persons("social_security__residential_requirement", period.first_week) + # ssa41 requires a certificate when applying for supported living payment as a carer - # # income low enough? - income = persons("supported_living_payment__below_income_threshold", period) + # ssa42 specifies requirements for medical examination - return resides_in_nz * (disabled + blind + carer) * not_self_inflicted * is_old_enough * immigration__resident_or_citizen * income + # ssa54_5_d person C is ineligible if receiving youth payment + + # ssa61_5_d person C is ineligible if receiving young parent payment + + return ssa40_1_a * ssa40_1_b * ssa40_1_c def formula(persons, period, parameters): - """ - 40A Supported living payment: purpose - (1) The purpose of the supported living payment is to provide income support - to people because they are people who fall within any one of the following 3 categories: - (a) people who have, and are likely to have in the future, a severely restricted - capacity to support themselves through open employment because of sickness, injury, or disability: - (b) people who are totally blind: - (c) people who are required to give full-time care and attention at home to some - other person (other than their spouse or partner) who is a patient requiring care. - """ - # The 3 ways of being eligible - disabled = persons("supported_living_payment__restricted_work_capacity", period.first_week) - blind = persons("totally_blind", period) - carer = persons("supported_living_payment__caring_for_another_person", period.first_week) + # person C is caring for person P + ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) - # 40B (4) A person who is not both permanently and severely restricted in his or her capacity for - # work must not be granted a supported living payment under this section, unless he or she is totally blind. + # person C is at least 18 years old if they have no dependent children + ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) - # 40B (5) A person must not be granted a supported living payment under this section if the chief - # executive is satisfied that the person's restricted capacity for work, or total blindness, was - # self-inflicted and brought about by the person with a view to qualifying for a benefit. - not_self_inflicted = not_(persons("supported_living_payment__disability_self_inflicted", period)) + # person C is at least 20 years old otherwise (i.e.: they have dependent children) + ssa40D_2_b = persons("age", period.start) >= 20 - # 40B (1A) An applicant for the supported living payment under - # this section must be aged at least 16 years. - is_old_enough = persons("age", period.start) >= 16 + ssa40D_2 = ssa40D_2_a + ssa40D_2_b - # 40B (1B) An applicant for the supported living payment under - # this section must meet the residential requirements in section 74AA. - immigration__resident_or_citizen = persons("immigration__citizen_or_resident", period) + # person C meets the residential requirement + ssa40D_3 = persons("social_security__residential_requirement", period.first_week) - resides_in_nz = persons("social_security__residential_requirement", period.first_week) + # ssa40D_4 allows for payment to continue if not caring for 28 days - # # income low enough? - income = persons("supported_living_payment__below_income_threshold", period) + return ssa40D_1 * ssa40D_2 * ssa40D_3 - return resides_in_nz * (disabled + blind + carer) * not_self_inflicted * is_old_enough * immigration__resident_or_citizen * income + +class supported_living_payment__restricted_work_capacity(variables.Variable): + value_type = bool + default_value = False + entity = entities.Person + definition_period = periods.WEEK + label = "Is incapable of regularly working 15 or more hours a week in open employment" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176", + "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", + ] + set_input = holders.set_input_dispatch_by_period -class supported_living_payment__base(variables.Variable): - label = "TODO" - reference = "TODO" - documentation = """TODO""" +class supported_living_payment__granted(variables.Variable): + value_type = bool + default_value = False entity = entities.Person - value_type = float - default_value = 0 - definition_period = periods.DateUnit.WEEK + label = "Person is currently granted the supported living benefit" + definition_period = periods.WEEK + reference = "Reference is unclear, but variable is utilised by the phrase: 'granted a main benefit'" + + +class supported_living_payment__receiving(variables.Variable): + value_type = bool + default_value = False + entity = entities.Person + label = "Person is currently recieving/being paid the supported living payment" + definition_period = periods.WEEK + reference = "Reference is unclear, but concept underpinning the variable assumes it covers both: 'being paid a main benefit' or 'recieving a benefit'" + + +class supported_living_payment__caring_for_another_person(variables.Variable): + value_type = bool + default_value = False + entity = entities.Person + definition_period = periods.WEEK + label = "Eligible for Supported Living Payment." + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187" + set_input = holders.set_input_dispatch_by_period class supported_living_payment__disability_self_inflicted(variables.Variable): @@ -162,3 +228,13 @@ class supported_living_payment__disability_self_inflicted(variables.Variable): definition_period = periods.ETERNITY label = "The person's restricted capacity for work, or total blindness, was self-inflicted and brought about by the person with a view to qualifying for a benefit" reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783178", "s36" + + +class supported_living_payment__base(variables.Variable): + label = "TODO" + reference = "TODO" + documentation = """TODO""" + entity = entities.Person + value_type = float + default_value = 0 + definition_period = periods.DateUnit.WEEK diff --git a/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py b/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py index 75c390b3..1510f763 100644 --- a/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py +++ b/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py @@ -90,6 +90,7 @@ class student_allowance__person_has_spouse(Variable): label = "Has spouse as per Student Allowances Regulations 1998" reference = "http://legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM259958" set_input = holders.set_input_dispatch_by_period + def formula(persons, period, parameters): # NOTE: using the age at the start of the month # Age changes on a DAY, but this calculation only has a granularity of MONTH From 53bc605dfe7fe5da785fd9c6c7cead03abe60613 Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Mon, 13 May 2024 12:23:41 +1000 Subject: [PATCH 3/9] adds rates and calculations (part 1) --- .../supported_living_payment/base.yaml | 827 ++++++++++++++++++ .../acts/social_security/schedule_4/part3.py | 253 ++++++ .../supported_living_payment.py | 105 +-- .../supported_living_payment__benefit.py | 177 ++++ 4 files changed, 1313 insertions(+), 49 deletions(-) create mode 100644 openfisca_aotearoa/parameters/supported_living_payment/base.yaml create mode 100644 openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py create mode 100644 openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py diff --git a/openfisca_aotearoa/parameters/supported_living_payment/base.yaml b/openfisca_aotearoa/parameters/supported_living_payment/base.yaml new file mode 100644 index 00000000..5220d76e --- /dev/null +++ b/openfisca_aotearoa/parameters/supported_living_payment/base.yaml @@ -0,0 +1,827 @@ +description: Supported Living Payment cut-out points +metadata: + unit: currency + type: value + reference: + 2018-11-26: + title: Social Security Act 2018 (As Enacted) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-02-25: + title: Social Security (Rates of Benefits and Allowances) Order 2019 + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/LMS156275.html + 2020-02-24: + title: Social Security (Rates of Benefits and Allowances) Order 2020 (Note - altered by the next amendment order) + href: https://www.legislation.govt.nz/regulation/public/2020/0013/latest/whole.html + 2020-03-23: + title: Social Security (Rates of Benefits and Allowances) (COVID-19 Recovery Package) Amendment Order 2020 + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-02-22: + title: Social Security (Rates of Benefits and Allowances) Order 2021 + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-05-24: + title: Social Security (Rates of Main Benefits) Order 2021 + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-02-21: + title: Social Security (Rates of Benefits and Allowances) Order 2022 + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-02-20: + title: Social Security (Rates of Benefits and Allowances) Order 2023 + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-02-26: + title: Social Security (Rates of Benefits and Allowances) Order 2024 + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html +clauses: + clause_1_a: + values: + 2018-11-26: + value: 217.80 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 221.48 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 253.31 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 261.15 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 281.15 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 322.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 250.63 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 337.63 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(a) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_b: + values: + 2018-11-26: + value: 269.15 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 273.70 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 307.14 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 316.65 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 336.65 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 359.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 384.92 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + + 2024-04-01: + value: 402.84 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(b) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_c: + values: + 2018-11-26: + value: 379.19 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 385.60 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 422.50 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 435.58 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 455.58 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 492.06 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 527.58 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 552.14 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(c) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_d_i: + values: + 2018-11-26: + value: 224.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 228.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 247.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 255.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 275.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 305.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 327.02 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 342.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(i) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_d_ii: + values: + 2018-11-26: + value: 237.09 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 241.10 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 261.04 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 269.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 289.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 320.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 343.10 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 359.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(d)(ii) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_e_i: + values: + 2018-11-26: + value: 224.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 228.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 247.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 255.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 275.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 305.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 327.02 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 342.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(i) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_e_ii: + values: + 2018-11-26: + value: 249.90 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 254.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 274.46 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 282.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 302.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 332.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 356.23 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 372.81 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(e)(ii) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_f_i: + # removed in 2021 + values: + 2018-11-26: + value: 224.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(i) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 228.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(i) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 247.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(i) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + clause_1_f_ii: + # removed in 2021 + values: + 2018-11-26: + value: 249.90 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(ii) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 254.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(ii) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 274.46 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(f)(ii) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + clause_1_g_i: + values: + 2018-11-26: + value: 448.56 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 456.14 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 495.22 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 510.54 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 550.54 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 610.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 654.04 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 684.48 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(i) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_g_ii: + values: + 2018-11-26: + value: 474.18 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 482.20 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 522.08 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 538.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 578.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 640.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 686.20 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 718.14 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(g)(ii) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_h_i: + values: + 2018-11-26: + value: 224.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 228.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 247.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 255.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 275.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 305.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 327.02 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 342.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(i) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_h_ii: + values: + 2018-11-26: + value: 249.90 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 254.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 274.46 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 282.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 302.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 332.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 356.23 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 372.81 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_2: + values: + 2018-11-26: + value: 354.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 358.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 392.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 442.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 462.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 492.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 527.52 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 552.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_2s: + # increase to clause 2 for single persons + values: + 2018-11-26: + value: 44.87 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 45.63 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 59.53 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 61.38 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 61.38 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 64.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 68.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 71.46 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 2 + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_7_a: + values: + 2018-11-26: + value: 224.28 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 228.07 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 247.61 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 255.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 275.27 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 305.00 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 327.02 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 342.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(a) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_7_b: + values: + 2018-11-26: + value: 249.90 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html + 2019-04-01: + value: 254.12 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 274.46 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2020/0049/latest/whole.html + 2021-04-01: + value: 282.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2021-07-01: + value: 302.96 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2021/0120/latest/whole.html + 2022-04-01: + value: 332.24 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 356.23 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + 2024-04-01: + value: 372.81 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 7(b) + href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py new file mode 100644 index 00000000..13a869df --- /dev/null +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -0,0 +1,253 @@ +"""This module provides amounts for Supported Living Payment.""" +import numpy + +from openfisca_core import periods, variables + +from openfisca_aotearoa import entities + + +class schedule_4__part3_1_a(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(a)" + + def formula_2018_11_26(persons, period, parameters): + single = numpy.logical_not(persons("social_security__in_a_relationship", period)) + under_18 = persons("age", period.first_day) < 18 + no_children = persons("social_security__dependent_children", period.first_week) == 0 + return single * under_18 * no_children + + +class schedule_4__part3_1_b(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(b)" + + def formula_2018_11_26(persons, period, parameters): + single = numpy.logical_not(persons("social_security__in_a_relationship", period)) + no_children = persons("social_security__dependent_children", period.first_week) == 0 + not_1a = numpy.logical_not(persons("schedule_4__part3_1_a", period)) + return single * no_children * not_1a + + +class schedule_4__part3_1_c(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(c)" + + def formula_2018_11_26(persons, period, parameters): + single = numpy.logical_not(persons("social_security__in_a_relationship", period)) + has_children = persons("social_security__dependent_children", period.first_week) > 0 + return single * has_children + + +class schedule_4__part3_1_d(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(d)" + + def formula_2018_11_26(people, period, parameters): + return people("social_security__in_a_relationship", period) * \ + people.family.any(people.family.members("social_security__granted_main_benefit", period), role=entities.Family.PARTNER) + + +class schedule_4__part3_1_d_i(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(d)(i)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_g", period) * \ + (people("social_security__dependent_children", period) < 1) + + +class schedule_4__part3_1_d_ii(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(d)(ii)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_g", period) * \ + (people("social_security__dependent_children", period) > 0) + + +class schedule_4__part3_1_e(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(e)" + + def formula_2018_11_26(people, period, parameters): + return people("social_security__in_a_relationship", period) * \ + people.family.any(people.family.members("super__being_paid_nz_superannuation", period.first_month), role=entities.Family.PARTNER) + + def formula_2020_11_09(people, period, parameters): + return people("social_security__in_a_relationship", period) * \ + people.family.any(people.family.members("super__being_paid_nz_superannuation", period.first_month), role=entities.Family.PARTNER) + \ + people.family.any(people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), role=entities.Family.PARTNER) + + +class schedule_4__part3_1_e_i(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(e)(i)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_e", period) * \ + (people("social_security__dependent_children", period) < 1) + + +class schedule_4__part3_1_e_ii(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(e)(ii)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_e", period) * \ + (people("social_security__dependent_children", period) > 0) + + +# n.b.: this clause was repealed 2020-11-09 & folded into part3_1_e. +class schedule_4__part3_1_f(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(f)" + end = "2020-11-09" + + def formula_2018_11_26(people, period, parameters): + return people("social_security__in_a_relationship", period) * people.family.any(people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), role=entities.Family.PARTNER) + + +class schedule_4__part3_1_f_i(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(f)(i)" + end = "2020-11-09" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_f", period) * \ + (people("social_security__dependent_children", period) < 1) + + +class schedule_4__part3_1_f_ii(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(f)(ii)" + end = "2020-11-09" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_f", period) * \ + (people("social_security__dependent_children", period) > 0) + + +class schedule_4__part3_1_g(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(g)" + + def formula_2018_11_26(people, period, parameters): + return people("supported_living_payment__disabled_or_blind__entitled", period) * \ + people("social_security__in_a_relationship", period) * \ + numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_e", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_f", period)) + + def formula_2020_11_09(people, period, parameters): + return people("supported_living_payment__disabled_or_blind__entitled", period) * \ + people("social_security__in_a_relationship", period) * \ + numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_e", period)) + + +class schedule_4__part3_1_g_i(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(g)(i)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_g", period) * \ + (people("social_security__dependent_children", period) < 1) + + +class schedule_4__part3_1_g_ii(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_g", period) * \ + (people("social_security__dependent_children", period) > 0) + + +class schedule_4__part3_1_h(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(h)" + + def formula_2018_11_26(people, period, parameters): + return people("supported_living_payment__carer__entitled", period) * \ + people("social_security__in_a_relationship", period) * \ + numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_e", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_f", period)) + + def formula_2020_11_09(people, period, parameters): + return people("supported_living_payment__carer__entitled", period) * \ + people("social_security__in_a_relationship", period) * \ + numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ + numpy.logical_not(people("schedule_4__part3_1_e", period)) + + +class schedule_4__part3_1_h_i(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(h)(i)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_g", period) * \ + (people("social_security__dependent_children", period) < 1) + + +class schedule_4__part3_1_h_ii(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" + label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" + + def formula_2018_11_26(people, period, parameters): + return people("schedule_4__part3_1_h", period) * \ + (people("social_security__dependent_children", period) > 0) diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index a1e3742d..c0c6152d 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -1,43 +1,41 @@ -"""TODO: Add missing doctring.""" +"""This module provides eligibility and amount for Supported Living Payment.""" -from numpy import logical_not as not_ +import numpy from openfisca_core import holders, periods, variables from openfisca_aotearoa import entities -# Benefit: Part 1E Supported Living Payment (eligible self applicant): -# If applicant.isNZResident -# and 16 <= applicant.Age -# and applicant.hasMedicalCertificate -# and applicant.hasSeriousDisability -# and threshold.income.SupportedLivingPayment -# then benefit.isSupportedLivingPayment is PERMITTED - -# rates -# listed in "Schedule 4 Part 3": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861 -# reduced using "Schedule 2 Income Test 1": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784553 -# reduced using "Schedule 2 Income Test 2": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784555 - class supported_living_payment__entitled(variables.Variable): value_type = bool entity = entities.Person - definition_period = periods.MONTH + definition_period = periods.WEEK + set_input = holders.set_input_dispatch_by_period label = "Eligible for Supported Living Payment." reference = [ "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175", "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", ] + def formula_2013_07_15(persons, period, parameters): + """ + For the 1964 version of the act (final version), this is split into two sections: + 40B on ground of sickness, injury, disability, or total blindness + 40D on ground of caring for patient requiring care + """ + ssa40B = persons("supported_living_payment__disabled_or_blind__entitled", period, parameters) + ssa40D = persons("supported_living_payment__carer__entitled", period, parameters) + return ssa40B + ssa40D + def formula_2018_11_26(persons, period, parameters): """ For the 2018 version of the act, this is split into two sections: 34 - 39 on ground of restricted work capacity or total blindness 40 - 42 on ground of caring for another person """ - ssa34 = persons("supported_living_payment__disabled_or_blind__entitled", period) - ssa40 = persons("supported_living_payment__carer__entitled", period) + ssa34 = persons("supported_living_payment__disabled_or_blind__entitled", period, parameters) + ssa40 = persons("supported_living_payment__carer__entitled", period, parameters) # ssa116 - must undergo work ability assessment @@ -53,16 +51,6 @@ def formula_2018_11_26(persons, period, parameters): return ssa34 + ssa40 - def formula(persons, period, parameters): - """ - For the 1964 version of the act (final version), this is split into two sections: - 40B on ground of sickness, injury, disability, or total blindness - 40D on ground of caring for patient requiring care - """ - ssa40B = persons("supported_living_payment__disabled_or_blind__entitled", period) - ssa40D = persons("supported_living_payment__carer__entitled", period) - return ssa40B + ssa40D - class supported_living_payment__disabled_or_blind__entitled(variables.Variable): value_type = bool @@ -86,7 +74,7 @@ def formula_2018_11_26(persons, period, parameters): # ssa35 specifies requirements for restricted work capacity status # person P is ineligible if the disability was self-inflicted to gain benefits - ssa36 = not_(persons("supported_living_payment__disability_self_inflicted", period)) + ssa36 = numpy.logical_not(persons("supported_living_payment__disability_self_inflicted", period)) # ssa37 specifies medical examination for reassessment of work capacity @@ -118,7 +106,7 @@ def formula(persons, period, parameters): # 40B_4 (redundantly?) states that person P must be either totally blind or permanently disabled # person P is ineligible if the disability was self-inflicted to gain benefits - ssa40B_5 = not_(persons("supported_living_payment__disability_self_inflicted", period)) + ssa40B_5 = numpy.logical_not(persons("supported_living_payment__disability_self_inflicted", period)) return ssa40B_1 * ssa40B_5 @@ -132,6 +120,44 @@ class supported_living_payment__carer__entitled(variables.Variable): "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187", ] + def formula_2013_07_15(persons, period, parameters): + # person C is caring for person P + ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) + + # person C is at least 18 years old if they have no dependent children + ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) + + # person C is at least 19 years old otherwise (i.e.: they have dependent children) + ssa40D_2_b = persons("age", period.start) >= 19 + + ssa40D_2 = ssa40D_2_a + ssa40D_2_b + + # person C meets the residential requirement + ssa40D_3 = persons("social_security__residential_requirement", period.first_week) + + # ssa40D_4 allows for payment to continue if not caring for 28 days + + return ssa40D_1 * ssa40D_2 * ssa40D_3 + + def formula_2016_10_25(persons, period, parameters): + # person C is caring for person P + ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) + + # person C is at least 18 years old if they have no dependent children + ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) + + # person C is at least 20 years old otherwise (i.e.: they have dependent children) + ssa40D_2_b = persons("age", period.start) >= 20 + + ssa40D_2 = ssa40D_2_a + ssa40D_2_b + + # person C meets the residential requirement + ssa40D_3 = persons("social_security__residential_requirement", period.first_week) + + # ssa40D_4 allows for payment to continue if not caring for 28 days + + return ssa40D_1 * ssa40D_2 * ssa40D_3 + def formula_2018_11_26(persons, period, parameters): # person C is caring for person P ssa40_1_a = persons("supported_living_payment__caring_for_another_person", period.first_week) @@ -161,25 +187,6 @@ def formula_2018_11_26(persons, period, parameters): return ssa40_1_a * ssa40_1_b * ssa40_1_c - def formula(persons, period, parameters): - # person C is caring for person P - ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) - - # person C is at least 18 years old if they have no dependent children - ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) - - # person C is at least 20 years old otherwise (i.e.: they have dependent children) - ssa40D_2_b = persons("age", period.start) >= 20 - - ssa40D_2 = ssa40D_2_a + ssa40D_2_b - - # person C meets the residential requirement - ssa40D_3 = persons("social_security__residential_requirement", period.first_week) - - # ssa40D_4 allows for payment to continue if not caring for 28 days - - return ssa40D_1 * ssa40D_2 * ssa40D_3 - class supported_living_payment__restricted_work_capacity(variables.Variable): value_type = bool diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py new file mode 100644 index 00000000..c09c921e --- /dev/null +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -0,0 +1,177 @@ +"""This module provides eligibility and amount for Supported Living Payment.""" +import numpy + +from openfisca_core import periods, variables + +from openfisca_aotearoa import entities + +# rates +# reduced using "Schedule 2 Income Test 1": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784553 +# reduced using "Schedule 2 Income Test 2": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784555 + + +class supported_living_payment__benefit(variables.Variable): + value_type = float + entity = entities.Person + definition_period = periods.WEEK + label = "The final net benefit entitlement" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" + + def formula_2018_11_26(people, period, parameters): + return people("supported_living_payment__entitled", period) * numpy.clip( + people("supported_living_payment__base", period) - people("supported_living_payment__reduction", period), + 0, + people("supported_living_payment__base", period) + ) + + +class supported_living_payment__reduction(variables.Variable): + value_type = float + entity = entities.Person + definition_period = periods.WEEK + label = "The amount the base benefit is reduced base on the appropriate Income Test and the person & their partners income" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" + + def formula_2018_11_26(people, period, parameters): + family_income = people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PARTNER) + people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PRINCIPAL) + + # numpy.floor required for income tests as it's "35c for every $1" + family_income = numpy.floor(family_income) + + test_1 = people("schedule_4__part1_1_c", period) + \ + people("schedule_4__part1_1_e", period) + \ + people("schedule_4__part1_1_f", period) + + test_3 = people("schedule_4__part1_1_a", period) + \ + people("schedule_4__part1_1_b", period) + \ + people("schedule_4__part1_1_d", period) + \ + people("schedule_4__part1_1_i", period) + \ + people("schedule_4__part1_1_j", period) + + test_4 = people("schedule_4__part1_1_g", period) + \ + people("schedule_4__part1_1_h", period) + + scale_1 = parameters(period).social_security.income_test_1 + scale_3 = parameters(period).social_security.income_test_3b + scale_4 = parameters(period).social_security.income_test_4 + return people("supported_living_payment__entitled", period) * \ + ( + (scale_1.calc(family_income) * test_1) + (scale_3.calc(family_income) * test_3) + (scale_4.calc(family_income) * test_4) + ) + + def formula_2020_11_09(people, period, parameters): + family_income = people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PARTNER) + people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PRINCIPAL) + + # numpy.floor required for income tests as it's "35c for every $1" + family_income = numpy.floor(family_income) + + test_1 = people("schedule_4__part1_1_c", period) + \ + people("schedule_4__part1_1_e", period) + \ + people("schedule_4__part1_1_f", period) + + test_3 = people("schedule_4__part1_1_a", period) + \ + people("schedule_4__part1_1_b", period) + \ + people("schedule_4__part1_1_d", period) + \ + people("schedule_4__part1_1_j", period) + + test_4 = people("schedule_4__part1_1_g", period) + \ + people("schedule_4__part1_1_h", period) + + scale_1 = parameters(period).social_security.income_test_1 + scale_3 = parameters(period).social_security.income_test_3b + scale_4 = parameters(period).social_security.income_test_4 + return people("supported_living_payment__entitled", period) * \ + ( + (scale_1.calc(family_income) * test_1) + (scale_3.calc(family_income) * test_3) + (scale_4.calc(family_income) * test_4) + ) + + +class supported_living_payment__base(variables.Variable): + value_type = float + entity = entities.Person + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" + label = "Jobseeker Support - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" + + def formula_2018_11_26(people, period, parameters): + clause_1_a_net_weekly_benefit = people("schedule_4__part1_1_a", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_a"]) + clause_1_b_net_weekly_benefit = people("schedule_4__part1_1_b", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_b"]) + clause_1_c_net_weekly_benefit = people("schedule_4__part1_1_c", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_c"]) + clause_1_d_i_net_weekly_benefit = people("schedule_4__part1_1_d_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d_i"]) + clause_1_d_ii_net_weekly_benefit = people("schedule_4__part1_1_d_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d_i"]) + clause_1_e_i_net_weekly_benefit = people("schedule_4__part1_1_e_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e_i"]) + clause_1_e_ii_net_weekly_benefit = people("schedule_4__part1_1_e_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e_ii"]) + clause_1_f_i_net_weekly_benefit = people("schedule_4__part1_1_f_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f_i"]) + clause_1_f_ii_net_weekly_benefit = people("schedule_4__part1_1_f_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f_ii"]) + clause_1_g_i_net_weekly_benefit = people("schedule_4__part1_1_g_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_i"]) + clause_1_g_ii_net_weekly_benefit = people("schedule_4__part1_1_g_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_ii"]) + clause_1_h_i_net_weekly_benefit = people("schedule_4__part1_1_h_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_i"]) + clause_1_h_ii_net_weekly_benefit = people("schedule_4__part1_1_h_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_ii"]) + + # part2 Housekeeper increases + # part3 exceptions relating to person who spouse or partner is ineligible for a benefit for a period because + # part3_i + # part3_ii + # part3_a voluntary unemployment or loss of employment through misconduct + # part3_b failures to comply with work test etc + # part3_c strike action + # part4 relates to clause_1_e and is a number of exceptions relating to the 14th/15th of July 2013 + # part4_a + # part4_b + # part4_c + # part5 MSD may disregard up to $20 a week of the beneficiary's personal earnings used to meet the cost of childcare for any of the beneficiary's dependent children + # part6 lose regular support of spouse, partner who is subject to sentence of imprisonment + # part7 dependent child can not be counted if receiving orphans benefit or unsupported child's benefit + # Calculate the gross amount (before benefit reductions). + # + # Note: we're not calculating eligibility here, so the result of this + # calculation is a "theoretical amount". + base = clause_1_a_net_weekly_benefit + clause_1_b_net_weekly_benefit + clause_1_c_net_weekly_benefit + clause_1_d_net_weekly_benefit + clause_1_e_net_weekly_benefit + clause_1_f_net_weekly_benefit + \ + clause_1_d_i_net_weekly_benefit + clause_1_d_ii_net_weekly_benefit + \ + clause_1_e_i_net_weekly_benefit + clause_1_e_ii_net_weekly_benefit + \ + clause_1_f_i_net_weekly_benefit + clause_1_f_ii_net_weekly_benefit + clause_1_g_i_net_weekly_benefit + clause_1_g_ii_net_weekly_benefit + \ + clause_1_h_i_net_weekly_benefit + clause_1_h_ii_net_weekly_benefit + + return base + + def formula_2020_11_09(people, period, parameters): + clause_1_a_net_weekly_benefit = people("schedule_4__part1_1_a", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_a"]) + clause_1_b_net_weekly_benefit = people("schedule_4__part1_1_b", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_b"]) + clause_1_c_net_weekly_benefit = people("schedule_4__part1_1_c", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_c"]) + clause_1_d_net_weekly_benefit = people("schedule_4__part1_1_d", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d"]) + clause_1_e_net_weekly_benefit = people("schedule_4__part1_1_e", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e"]) + clause_1_f_net_weekly_benefit = people("schedule_4__part1_1_f", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f"]) + clause_1_g_i_net_weekly_benefit = people("schedule_4__part1_1_g_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_i"]) + clause_1_g_ii_net_weekly_benefit = people("schedule_4__part1_1_g_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_ii"]) + clause_1_h_i_net_weekly_benefit = people("schedule_4__part1_1_h_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_i"]) + clause_1_h_ii_net_weekly_benefit = people("schedule_4__part1_1_h_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_ii"]) + clause_1_j_i_net_weekly_benefit = people("schedule_4__part1_1_j_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_j_i"]) + clause_1_j_ii_net_weekly_benefit = people("schedule_4__part1_1_j_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_j_ii"]) + + # Calculate the gross amount (before benefit reductions). + # + # Note: we're not calculating eligibility here, so the result of this + # calculation is a "theoretical amount". + base = clause_1_a_net_weekly_benefit + clause_1_b_net_weekly_benefit + clause_1_c_net_weekly_benefit + clause_1_d_net_weekly_benefit + clause_1_e_net_weekly_benefit + clause_1_f_net_weekly_benefit + \ + clause_1_g_i_net_weekly_benefit + clause_1_g_ii_net_weekly_benefit + \ + clause_1_h_i_net_weekly_benefit + clause_1_h_ii_net_weekly_benefit + \ + clause_1_j_i_net_weekly_benefit + clause_1_j_ii_net_weekly_benefit + + return base + + +class supported_living_payment__living_with_parent(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "As defined in Part 1 of Schedule 4 of the Social Security Act, Part 1, 8" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" + + +class supported_living_payment__transferred_15_july_2013(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.ETERNITY + label = "As defined in Part 1 of Schedule 4 of the Social Security Act, Part 1, 1(c)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" From be92548c4792f66a0cb7f92da3fbe977ec1842bc Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Tue, 14 May 2024 16:21:49 +1000 Subject: [PATCH 4/9] Implement base SLP rate functionality --- .../acts/social_security/schedule_4/part3.py | 142 ++++++---- .../supported_living_payment.py | 11 - .../supported_living_payment__benefit.py | 253 +++++++++--------- 3 files changed, 222 insertions(+), 184 deletions(-) diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py index 13a869df..49ceed0c 100644 --- a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -55,8 +55,12 @@ class schedule_4__part3_1_d(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(d)" def formula_2018_11_26(people, period, parameters): - return people("social_security__in_a_relationship", period) * \ - people.family.any(people.family.members("social_security__granted_main_benefit", period), role=entities.Family.PARTNER) + in_relationship = people("social_security__in_a_relationship", period) + partner_granted_main_benefit = people.family.any( + people.family.members("social_security__granted_main_benefit", period), + role=entities.Family.PARTNER) + return in_relationship * partner_granted_main_benefit + class schedule_4__part3_1_d_i(variables.Variable): @@ -67,8 +71,9 @@ class schedule_4__part3_1_d_i(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(d)(i)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_g", period) * \ - (people("social_security__dependent_children", period) < 1) + base = people("schedule_4__part3_1_d", period) + no_children = people("social_security__dependent_children", period) < 1 + return base * no_children class schedule_4__part3_1_d_ii(variables.Variable): @@ -79,8 +84,9 @@ class schedule_4__part3_1_d_ii(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(d)(ii)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_g", period) * \ - (people("social_security__dependent_children", period) > 0) + base = people("schedule_4__part3_1_d", period) + has_children = people("social_security__dependent_children", period) < 1 + return base * has_children class schedule_4__part3_1_e(variables.Variable): @@ -91,13 +97,21 @@ class schedule_4__part3_1_e(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(e)" def formula_2018_11_26(people, period, parameters): - return people("social_security__in_a_relationship", period) * \ - people.family.any(people.family.members("super__being_paid_nz_superannuation", period.first_month), role=entities.Family.PARTNER) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + return in_relationship * partner_has_super def formula_2020_11_09(people, period, parameters): - return people("social_security__in_a_relationship", period) * \ - people.family.any(people.family.members("super__being_paid_nz_superannuation", period.first_month), role=entities.Family.PARTNER) + \ - people.family.any(people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), role=entities.Family.PARTNER) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + partner_has_veterans_pension = people.family.any( + people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), + role=entities.Family.PARTNER) + return in_relationship * (partner_has_super + partner_has_veterans_pension) class schedule_4__part3_1_e_i(variables.Variable): @@ -108,8 +122,9 @@ class schedule_4__part3_1_e_i(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(e)(i)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_e", period) * \ - (people("social_security__dependent_children", period) < 1) + base = people("schedule_4__part3_1_e", period) + no_children = people("social_security__dependent_children", period) < 1 + return base * no_children class schedule_4__part3_1_e_ii(variables.Variable): @@ -120,8 +135,9 @@ class schedule_4__part3_1_e_ii(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(e)(ii)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_e", period) * \ - (people("social_security__dependent_children", period) > 0) + base = people("schedule_4__part3_1_e", period) + has_children = people("social_security__dependent_children", period) > 0 + return base * has_children # n.b.: this clause was repealed 2020-11-09 & folded into part3_1_e. @@ -134,7 +150,11 @@ class schedule_4__part3_1_f(variables.Variable): end = "2020-11-09" def formula_2018_11_26(people, period, parameters): - return people("social_security__in_a_relationship", period) * people.family.any(people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), role=entities.Family.PARTNER) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_veterans_pension = people.family.any( + people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), + role=entities.Family.PARTNER) + return in_relationship * partner_has_veterans_pension class schedule_4__part3_1_f_i(variables.Variable): @@ -146,8 +166,9 @@ class schedule_4__part3_1_f_i(variables.Variable): end = "2020-11-09" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_f", period) * \ - (people("social_security__dependent_children", period) < 1) + base = people("schedule_4__part3_1_f", period) + no_children = people("social_security__dependent_children", period) < 1 + return base * no_children class schedule_4__part3_1_f_ii(variables.Variable): @@ -159,8 +180,9 @@ class schedule_4__part3_1_f_ii(variables.Variable): end = "2020-11-09" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_f", period) * \ - (people("social_security__dependent_children", period) > 0) + base = people("schedule_4__part3_1_f", period) + has_children = people("social_security__dependent_children", period) > 0 + return base * has_children class schedule_4__part3_1_g(variables.Variable): @@ -171,17 +193,29 @@ class schedule_4__part3_1_g(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(g)" def formula_2018_11_26(people, period, parameters): - return people("supported_living_payment__disabled_or_blind__entitled", period) * \ - people("social_security__in_a_relationship", period) * \ - numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_e", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_f", period)) + disabled_or_blind = people("supported_living_payment__disabled_or_blind__entitled", period) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_benefit = people.family.any( + people.family.members("social_security__granted_main_benefit", period), + role=entities.Family.PARTNER) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + return disabled_or_blind * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super) def formula_2020_11_09(people, period, parameters): - return people("supported_living_payment__disabled_or_blind__entitled", period) * \ - people("social_security__in_a_relationship", period) * \ - numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_e", period)) + disabled_or_blind__entitled = people("supported_living_payment__disabled_or_blind__entitled", period) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_benefit = people.family.any( + people.family.members("social_security__granted_main_benefit", period), + role=entities.Family.PARTNER) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + partner_has_veterans_pension = people.family.any( + people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), + role=entities.Family.PARTNER) + return disabled_or_blind__entitled * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super + partner_has_veterans_pension) class schedule_4__part3_1_g_i(variables.Variable): @@ -192,8 +226,9 @@ class schedule_4__part3_1_g_i(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(g)(i)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_g", period) * \ - (people("social_security__dependent_children", period) < 1) + base = people("schedule_4__part3_1_g", period) + no_children = people("social_security__dependent_children", period) < 1 + return base * no_children class schedule_4__part3_1_g_ii(variables.Variable): @@ -204,8 +239,9 @@ class schedule_4__part3_1_g_ii(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_g", period) * \ - (people("social_security__dependent_children", period) > 0) + base = people("schedule_4__part3_1_g", period) + has_children = people("social_security__dependent_children", period) > 0 + return base * has_children class schedule_4__part3_1_h(variables.Variable): @@ -216,17 +252,29 @@ class schedule_4__part3_1_h(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(h)" def formula_2018_11_26(people, period, parameters): - return people("supported_living_payment__carer__entitled", period) * \ - people("social_security__in_a_relationship", period) * \ - numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_e", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_f", period)) + carer__entitled = people("supported_living_payment__carer__entitled", period) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_benefit = people.family.any( + people.family.members("social_security__granted_main_benefit", period), + role=entities.Family.PARTNER) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + return carer__entitled * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super) def formula_2020_11_09(people, period, parameters): - return people("supported_living_payment__carer__entitled", period) * \ - people("social_security__in_a_relationship", period) * \ - numpy.logical_not(people("schedule_4__part3_1_d", period)) * \ - numpy.logical_not(people("schedule_4__part3_1_e", period)) + carer__entitled = people("supported_living_payment__carer__entitled", period) + in_relationship = people("social_security__in_a_relationship", period) + partner_has_benefit = people.family.any( + people.family.members("social_security__granted_main_benefit", period), + role=entities.Family.PARTNER) + partner_has_super = people.family.any( + people.family.members("super__being_paid_nz_superannuation", period.first_month), + role=entities.Family.PARTNER) + partner_has_veterans_pension = people.family.any( + people.family.members("veterans_support__being_paid_a_veterans_pension", period.first_month), + role=entities.Family.PARTNER) + return carer__entitled * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super + partner_has_veterans_pension) class schedule_4__part3_1_h_i(variables.Variable): @@ -237,8 +285,9 @@ class schedule_4__part3_1_h_i(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(h)(i)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_g", period) * \ - (people("social_security__dependent_children", period) < 1) + base = people("schedule_4__part3_1_g", period) + no_children = people("social_security__dependent_children", period) < 1 + return base * no_children class schedule_4__part3_1_h_ii(variables.Variable): @@ -249,5 +298,6 @@ class schedule_4__part3_1_h_ii(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" def formula_2018_11_26(people, period, parameters): - return people("schedule_4__part3_1_h", period) * \ - (people("social_security__dependent_children", period) > 0) + base = people("schedule_4__part3_1_h", period) + has_children = people("social_security__dependent_children", period) > 0 + return base * has_children diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index c0c6152d..32511be2 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -1,5 +1,4 @@ """This module provides eligibility and amount for Supported Living Payment.""" - import numpy from openfisca_core import holders, periods, variables @@ -235,13 +234,3 @@ class supported_living_payment__disability_self_inflicted(variables.Variable): definition_period = periods.ETERNITY label = "The person's restricted capacity for work, or total blindness, was self-inflicted and brought about by the person with a view to qualifying for a benefit" reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783178", "s36" - - -class supported_living_payment__base(variables.Variable): - label = "TODO" - reference = "TODO" - documentation = """TODO""" - entity = entities.Person - value_type = float - default_value = 0 - definition_period = periods.DateUnit.WEEK diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index c09c921e..008a9559 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -1,14 +1,13 @@ """This module provides eligibility and amount for Supported Living Payment.""" +from functools import reduce +from operator import add, mul + import numpy from openfisca_core import periods, variables from openfisca_aotearoa import entities -# rates -# reduced using "Schedule 2 Income Test 1": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784553 -# reduced using "Schedule 2 Income Test 2": https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784555 - class supported_living_payment__benefit(variables.Variable): value_type = float @@ -18,11 +17,11 @@ class supported_living_payment__benefit(variables.Variable): reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" def formula_2018_11_26(people, period, parameters): - return people("supported_living_payment__entitled", period) * numpy.clip( - people("supported_living_payment__base", period) - people("supported_living_payment__reduction", period), - 0, - people("supported_living_payment__base", period) - ) + base_rate = people("supported_living_payment__base", period) + abatement_rate = people("supported_living_payment__reduction", period) + rate = numpy.clip(base_rate - abatement_rate, 0, base_rate) + entitled = people("supported_living_payment__entitled", period) + return entitled * rate class supported_living_payment__reduction(variables.Variable): @@ -30,60 +29,85 @@ class supported_living_payment__reduction(variables.Variable): entity = entities.Person definition_period = periods.WEEK label = "The amount the base benefit is reduced base on the appropriate Income Test and the person & their partners income" - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" def formula_2018_11_26(people, period, parameters): - family_income = people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PARTNER) + people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PRINCIPAL) + family_income = add( + people.family.sum( + people.family.members("social_security__income", period), + role=entities.Family.PARTNER), + people.family.sum( + people.family.members("social_security__income", period), + role=entities.Family.PRINCIPAL)) # numpy.floor required for income tests as it's "35c for every $1" family_income = numpy.floor(family_income) - test_1 = people("schedule_4__part1_1_c", period) + \ - people("schedule_4__part1_1_e", period) + \ - people("schedule_4__part1_1_f", period) - - test_3 = people("schedule_4__part1_1_a", period) + \ - people("schedule_4__part1_1_b", period) + \ - people("schedule_4__part1_1_d", period) + \ - people("schedule_4__part1_1_i", period) + \ - people("schedule_4__part1_1_j", period) - - test_4 = people("schedule_4__part1_1_g", period) + \ - people("schedule_4__part1_1_h", period) + # test 1 is used if any of these clauses apply + test_1 = reduce(add, [ + people("schedule_4__part3_1_a", period), + people("schedule_4__part3_1_b", period), + people("schedule_4__part3_1_c", period), + people("schedule_4__part3_1_g_i", period), + people("schedule_4__part3_1_g_ii", period), + people("schedule_4__part3_1_h_i", period), + people("schedule_4__part3_1_h_ii", period)]) + + # test 2 is used if any of these clauses apply + test_2 = reduce(add, [ + people("schedule_4__part3_1_d_i", period), + people("schedule_4__part3_1_d_ii", period), + people("schedule_4__part3_1_e_i", period), + people("schedule_4__part3_1_e_ii", period), + people("schedule_4__part3_1_f_i", period), + people("schedule_4__part3_1_f_ii", period)]) scale_1 = parameters(period).social_security.income_test_1 - scale_3 = parameters(period).social_security.income_test_3b - scale_4 = parameters(period).social_security.income_test_4 - return people("supported_living_payment__entitled", period) * \ - ( - (scale_1.calc(family_income) * test_1) + (scale_3.calc(family_income) * test_3) + (scale_4.calc(family_income) * test_4) - ) + scale_2 = parameters(period).social_security.income_test_2 + + return mul( + people("supported_living_payment__entitled", period), + add( + (scale_1.calc(family_income) * test_1), + (scale_2.calc(family_income) * test_2))) def formula_2020_11_09(people, period, parameters): - family_income = people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PARTNER) + people.family.sum(people.family.members("social_security__income", period), role=entities.Family.PRINCIPAL) + family_income = add( + people.family.sum( + people.family.members("social_security__income", period), + role=entities.Family.PARTNER), + people.family.sum( + people.family.members("social_security__income", period), + role=entities.Family.PRINCIPAL)) # numpy.floor required for income tests as it's "35c for every $1" family_income = numpy.floor(family_income) - test_1 = people("schedule_4__part1_1_c", period) + \ - people("schedule_4__part1_1_e", period) + \ - people("schedule_4__part1_1_f", period) - - test_3 = people("schedule_4__part1_1_a", period) + \ - people("schedule_4__part1_1_b", period) + \ - people("schedule_4__part1_1_d", period) + \ - people("schedule_4__part1_1_j", period) - - test_4 = people("schedule_4__part1_1_g", period) + \ - people("schedule_4__part1_1_h", period) + # test 1 is used if any of these clauses apply + test_1 = reduce(add, [ + people("schedule_4__part3_1_a", period), + people("schedule_4__part3_1_b", period), + people("schedule_4__part3_1_c", period), + people("schedule_4__part3_1_g_i", period), + people("schedule_4__part3_1_g_ii", period), + people("schedule_4__part3_1_h_i", period), + people("schedule_4__part3_1_h_ii", period)]) + + # test 2 is used if any of these clauses apply + test_2 = reduce(add, [ + people("schedule_4__part3_1_d_i", period), + people("schedule_4__part3_1_d_ii", period), + people("schedule_4__part3_1_e_i", period), + people("schedule_4__part3_1_e_ii", period)]) scale_1 = parameters(period).social_security.income_test_1 - scale_3 = parameters(period).social_security.income_test_3b - scale_4 = parameters(period).social_security.income_test_4 - return people("supported_living_payment__entitled", period) * \ - ( - (scale_1.calc(family_income) * test_1) + (scale_3.calc(family_income) * test_3) + (scale_4.calc(family_income) * test_4) - ) + scale_2 = parameters(period).social_security.income_test_2 + + return mul( + people("supported_living_payment__entitled", period), + add( + (scale_1.calc(family_income) * test_1), + (scale_2.calc(family_income) * test_2))) class supported_living_payment__base(variables.Variable): @@ -91,87 +115,62 @@ class supported_living_payment__base(variables.Variable): entity = entities.Person definition_period = periods.WEEK reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" - label = "Jobseeker Support - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" + label = "Supported Living Payment - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" def formula_2018_11_26(people, period, parameters): - clause_1_a_net_weekly_benefit = people("schedule_4__part1_1_a", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_a"]) - clause_1_b_net_weekly_benefit = people("schedule_4__part1_1_b", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_b"]) - clause_1_c_net_weekly_benefit = people("schedule_4__part1_1_c", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_c"]) - clause_1_d_i_net_weekly_benefit = people("schedule_4__part1_1_d_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d_i"]) - clause_1_d_ii_net_weekly_benefit = people("schedule_4__part1_1_d_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d_i"]) - clause_1_e_i_net_weekly_benefit = people("schedule_4__part1_1_e_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e_i"]) - clause_1_e_ii_net_weekly_benefit = people("schedule_4__part1_1_e_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e_ii"]) - clause_1_f_i_net_weekly_benefit = people("schedule_4__part1_1_f_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f_i"]) - clause_1_f_ii_net_weekly_benefit = people("schedule_4__part1_1_f_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f_ii"]) - clause_1_g_i_net_weekly_benefit = people("schedule_4__part1_1_g_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_i"]) - clause_1_g_ii_net_weekly_benefit = people("schedule_4__part1_1_g_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_ii"]) - clause_1_h_i_net_weekly_benefit = people("schedule_4__part1_1_h_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_i"]) - clause_1_h_ii_net_weekly_benefit = people("schedule_4__part1_1_h_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_ii"]) - - # part2 Housekeeper increases - # part3 exceptions relating to person who spouse or partner is ineligible for a benefit for a period because - # part3_i - # part3_ii - # part3_a voluntary unemployment or loss of employment through misconduct - # part3_b failures to comply with work test etc - # part3_c strike action - # part4 relates to clause_1_e and is a number of exceptions relating to the 14th/15th of July 2013 - # part4_a - # part4_b - # part4_c - # part5 MSD may disregard up to $20 a week of the beneficiary's personal earnings used to meet the cost of childcare for any of the beneficiary's dependent children - # part6 lose regular support of spouse, partner who is subject to sentence of imprisonment - # part7 dependent child can not be counted if receiving orphans benefit or unsupported child's benefit - # Calculate the gross amount (before benefit reductions). - # - # Note: we're not calculating eligibility here, so the result of this - # calculation is a "theoretical amount". - base = clause_1_a_net_weekly_benefit + clause_1_b_net_weekly_benefit + clause_1_c_net_weekly_benefit + clause_1_d_net_weekly_benefit + clause_1_e_net_weekly_benefit + clause_1_f_net_weekly_benefit + \ - clause_1_d_i_net_weekly_benefit + clause_1_d_ii_net_weekly_benefit + \ - clause_1_e_i_net_weekly_benefit + clause_1_e_ii_net_weekly_benefit + \ - clause_1_f_i_net_weekly_benefit + clause_1_f_ii_net_weekly_benefit - clause_1_g_i_net_weekly_benefit + clause_1_g_ii_net_weekly_benefit + \ - clause_1_h_i_net_weekly_benefit + clause_1_h_ii_net_weekly_benefit - - return base + clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses + # benefit = eligibility (boolean) * rate (float) + clause_1_a_net_weekly_benefit = people("schedule_4__part3_1_a", period) * clauses["clause_1_a"] + clause_1_b_net_weekly_benefit = people("schedule_4__part3_1_b", period) * clauses["clause_1_b"] + clause_1_c_net_weekly_benefit = people("schedule_4__part3_1_c", period) * clauses["clause_1_c"] + clause_1_d_i_net_weekly_benefit = people("schedule_4__part3_1_d_i", period) * clauses["clause_1_d_i"] + clause_1_d_ii_net_weekly_benefit = people("schedule_4__part3_1_d_ii", period) * clauses["clause_1_d_i"] + clause_1_e_i_net_weekly_benefit = people("schedule_4__part3_1_e_i", period) * clauses["clause_1_e_i"] + clause_1_e_ii_net_weekly_benefit = people("schedule_4__part3_1_e_ii", period) * clauses["clause_1_e_ii"] + clause_1_f_i_net_weekly_benefit = people("schedule_4__part3_1_f_i", period) * clauses["clause_1_f_i"] + clause_1_f_ii_net_weekly_benefit = people("schedule_4__part3_1_f_ii", period) * clauses["clause_1_f_ii"] + clause_1_g_i_net_weekly_benefit = people("schedule_4__part3_1_g_i", period) * clauses["clause_1_g_i"] + clause_1_g_ii_net_weekly_benefit = people("schedule_4__part3_1_g_ii", period) * clauses["clause_1_g_ii"] + clause_1_h_i_net_weekly_benefit = people("schedule_4__part3_1_h_i", period) * clauses["clause_1_h_i"] + clause_1_h_ii_net_weekly_benefit = people("schedule_4__part3_1_h_ii", period) * clauses["clause_1_h_ii"] + return reduce(add, [ + clause_1_a_net_weekly_benefit, + clause_1_b_net_weekly_benefit, + clause_1_c_net_weekly_benefit, + clause_1_d_i_net_weekly_benefit, + clause_1_d_ii_net_weekly_benefit, + clause_1_e_i_net_weekly_benefit, + clause_1_e_ii_net_weekly_benefit, + clause_1_f_i_net_weekly_benefit, + clause_1_f_ii_net_weekly_benefit, + clause_1_g_i_net_weekly_benefit, + clause_1_g_ii_net_weekly_benefit, + clause_1_h_i_net_weekly_benefit, + clause_1_h_ii_net_weekly_benefit]) def formula_2020_11_09(people, period, parameters): - clause_1_a_net_weekly_benefit = people("schedule_4__part1_1_a", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_a"]) - clause_1_b_net_weekly_benefit = people("schedule_4__part1_1_b", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_b"]) - clause_1_c_net_weekly_benefit = people("schedule_4__part1_1_c", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_c"]) - clause_1_d_net_weekly_benefit = people("schedule_4__part1_1_d", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_d"]) - clause_1_e_net_weekly_benefit = people("schedule_4__part1_1_e", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_e"]) - clause_1_f_net_weekly_benefit = people("schedule_4__part1_1_f", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_f"]) - clause_1_g_i_net_weekly_benefit = people("schedule_4__part1_1_g_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_i"]) - clause_1_g_ii_net_weekly_benefit = people("schedule_4__part1_1_g_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_g_ii"]) - clause_1_h_i_net_weekly_benefit = people("schedule_4__part1_1_h_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_i"]) - clause_1_h_ii_net_weekly_benefit = people("schedule_4__part1_1_h_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_h_ii"]) - clause_1_j_i_net_weekly_benefit = people("schedule_4__part1_1_j_i", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_j_i"]) - clause_1_j_ii_net_weekly_benefit = people("schedule_4__part1_1_j_ii", period) * (parameters(period.first_day).social_security.supported_living_payment.base.clauses["clause_1_j_ii"]) - - # Calculate the gross amount (before benefit reductions). - # - # Note: we're not calculating eligibility here, so the result of this - # calculation is a "theoretical amount". - base = clause_1_a_net_weekly_benefit + clause_1_b_net_weekly_benefit + clause_1_c_net_weekly_benefit + clause_1_d_net_weekly_benefit + clause_1_e_net_weekly_benefit + clause_1_f_net_weekly_benefit + \ - clause_1_g_i_net_weekly_benefit + clause_1_g_ii_net_weekly_benefit + \ - clause_1_h_i_net_weekly_benefit + clause_1_h_ii_net_weekly_benefit + \ - clause_1_j_i_net_weekly_benefit + clause_1_j_ii_net_weekly_benefit - - return base - - -class supported_living_payment__living_with_parent(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.WEEK - label = "As defined in Part 1 of Schedule 4 of the Social Security Act, Part 1, 8" - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" - - -class supported_living_payment__transferred_15_july_2013(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.ETERNITY - label = "As defined in Part 1 of Schedule 4 of the Social Security Act, Part 1, 1(c)" - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" + clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses + # benefit = eligibility (boolean) * rate (float) + clause_1_a_net_weekly_benefit = people("schedule_4__part3_1_a", period) * clauses["clause_1_a"] + clause_1_b_net_weekly_benefit = people("schedule_4__part3_1_b", period) * clauses["clause_1_b"] + clause_1_c_net_weekly_benefit = people("schedule_4__part3_1_c", period) * clauses["clause_1_c"] + clause_1_d_i_net_weekly_benefit = people("schedule_4__part3_1_d_i", period) * clauses["clause_1_d_i"] + clause_1_d_ii_net_weekly_benefit = people("schedule_4__part3_1_d_ii", period) * clauses["clause_1_d_i"] + clause_1_e_i_net_weekly_benefit = people("schedule_4__part3_1_e_i", period) * clauses["clause_1_e_i"] + clause_1_e_ii_net_weekly_benefit = people("schedule_4__part3_1_e_ii", period) * clauses["clause_1_e_ii"] + clause_1_g_i_net_weekly_benefit = people("schedule_4__part3_1_g_i", period) * clauses["clause_1_g_i"] + clause_1_g_ii_net_weekly_benefit = people("schedule_4__part3_1_g_ii", period) * clauses["clause_1_g_ii"] + clause_1_h_i_net_weekly_benefit = people("schedule_4__part3_1_h_i", period) * clauses["clause_1_h_i"] + clause_1_h_ii_net_weekly_benefit = people("schedule_4__part3_1_h_ii", period) * clauses["clause_1_h_ii"] + return reduce(add, [ + clause_1_a_net_weekly_benefit, + clause_1_b_net_weekly_benefit, + clause_1_c_net_weekly_benefit, + clause_1_d_i_net_weekly_benefit, + clause_1_d_ii_net_weekly_benefit, + clause_1_e_i_net_weekly_benefit, + clause_1_e_ii_net_weekly_benefit, + clause_1_g_i_net_weekly_benefit, + clause_1_g_ii_net_weekly_benefit, + clause_1_h_i_net_weekly_benefit, + clause_1_h_ii_net_weekly_benefit]) From 932acbfc907e857fbf0b4d053b7439070049f6fc Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Tue, 21 May 2024 12:20:48 +1000 Subject: [PATCH 5/9] add all but cl7 --- .../supported_living_payment/base.yaml | 0 .../acts/social_security/schedule_4/part3.py | 22 + .../supported_living_payment.py | 2 +- .../supported_living_payment__benefit.py | 375 ++++++++++++------ 4 files changed, 269 insertions(+), 130 deletions(-) rename openfisca_aotearoa/parameters/{ => social_security}/supported_living_payment/base.yaml (100%) diff --git a/openfisca_aotearoa/parameters/supported_living_payment/base.yaml b/openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml similarity index 100% rename from openfisca_aotearoa/parameters/supported_living_payment/base.yaml rename to openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py index 49ceed0c..2db343ce 100644 --- a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -301,3 +301,25 @@ def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_h", period) has_children = people("social_security__dependent_children", period) > 0 return base * has_children + + +class schedule_4__part3_5(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = """Shortcut to indicate beneficiary meets the following from clause 5: + (a) has a psychiatric, intellectual, physical, or mental disability; and + (b) is receiving long-term residential care in a hospital or rest home because of that disability; and + (c) has not been means assessed under Part 6 of the Residential Care and Disability Support Services Act 2018. + """ + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" + + +class schedule_4__part3_6(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = """Shortcut to indicate beneficiary meets the following from clause 6: + if that spouse or partner is not receiving long-term residential care in a hospital or rest home. + """ + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index 32511be2..813890bf 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -233,4 +233,4 @@ class supported_living_payment__disability_self_inflicted(variables.Variable): entity = entities.Person definition_period = periods.ETERNITY label = "The person's restricted capacity for work, or total blindness, was self-inflicted and brought about by the person with a view to qualifying for a benefit" - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783178", "s36" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783178" diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index 008a9559..801b3171 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -1,6 +1,6 @@ """This module provides eligibility and amount for Supported Living Payment.""" + from functools import reduce -from operator import add, mul import numpy @@ -16,12 +16,113 @@ class supported_living_payment__benefit(variables.Variable): label = "The final net benefit entitlement" reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - def formula_2018_11_26(people, period, parameters): - base_rate = people("supported_living_payment__base", period) - abatement_rate = people("supported_living_payment__reduction", period) - rate = numpy.clip(base_rate - abatement_rate, 0, base_rate) - entitled = people("supported_living_payment__entitled", period) - return entitled * rate + @staticmethod + def formula_2018_11_26(population, period, parameters): + # Note: the clauses in this act unfortunately apply out of order + base_rate = population("supported_living_payment__base", period) + abatement_rate = population("supported_living_payment__reduction", period) + + # 5. Halves benefit & abatement if in a relationship & meets these requirements + in_relationship = population("social_security__in_a_relationship", period) + ssa_s4_p3_5_applies = in_relationship * population("schedule_4__part3_5", period) + base_rate = numpy.where( + ssa_s4_p3_5_applies, + base_rate * 0.5, + base_rate) + abatement_rate = numpy.where( + ssa_s4_p3_5_applies, + abatement_rate * 0.5, + abatement_rate) + + # ensure the reduction does not result in a negative benefit + benefit_post_c1 = numpy.clip(base_rate - abatement_rate, 0) + + # 2. Maximum amount from all sources + clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses + couple_cap = clauses["clause_2"] + single_cap = clauses["clause_2s"] + couple_cap + + # 3. Additional 25% of income subsidy if beneficiary is blind + is_blind = population("totally_blind", period) + net_income = population("social_security__income", period) + benefit_post_s3 = benefit_post_c1 + numpy.where(is_blind, 0.25, * net_income, 0 * net_income) + + # 4. Benefit must not exceed cap from clause 2 + benefit_post_c4 = numpy.where( + in_relationship, + numpy.clip(benefit_post_s3, couple_cap), + numpy.clip(benefit_post_s3, single_cap)) + + # 6. If clause 5 applies, partner is entitled to payment 1b or 1c + ssa_s4_6_applies = ssa_s4_p3_5_applies * population("schedule_4__part3_6", period) + no_children = population("social_security__dependent_children", period.first_week) < 1 + has_children = population("social_security__dependent_children", period.first_week) > 0 + clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses + ssa_s4_6 = numpy.select( + [ssa_s4_6_applies * no_children, ssa_s4_6_applies * has_children], + [clauses["clause_1_b"], clauses["clause_1_c"]], + default=0) + benefit_post_c6 = benefit_post_c4 + ssa_s4_6 + + # 7. Despite paragraphs (d), (e), and (g) of clause 1, the rate of a supported living payment on the ground of caring for another person under any of those paragraphs must not be less than the rates that would be payable if the beneficiary and the spouse or partner of the beneficiary were both entitled to receive the benefit on those grounds; but the rate of benefit payable by virtue of this clause must not exceed— + # (a) $342.24 a week if the beneficiary and the spouse or partner of the beneficiary have no dependent children; or + # (b) $372.81 a week if the beneficiary and the spouse or partner of the beneficiary have 1 or more dependent children. + + # 8. A dependent child is one who is not earning orphans' or unsupported child benefits + + is_entitled = population("supported_living_payment__entitled", period) + + return is_entitled * benefit_post_c6 + + +# note: this does not calculate exemptions as under: +# * SSA 2018, clause 422: +# https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783992 +# * SSR 2018, schedule 10 clause 44: +# https://www.legislation.govt.nz/regulation/public/2018/0202/latest/whole.html#LMS97179 +# therefore only *non-exempt* income should be entered into social_security__income +class supported_living_payment__assessable_income(variables.Variable): + value_type = float + entity = entities.Person + definition_period = periods.WEEK + label = "The assessable income of the principle & partner for the purposes of income tests." + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" + + @staticmethod + def formula_2018_11_26(population, period): + # 1. Income for SLP on the basis of blindness or disability: + # (a) disregard that part of the beneficiary’s income (not exceeding $20 a week) earned by the beneficiary’s own efforts; and + # (b) disregard all of the income of a totally blind beneficiary earned by the beneficiary’s own efforts. + gross_principal_income = population("social_security__income", period) + principal_blind = population("totally_blind", period) + principal_disabled = population("supported_living_payment__restricted_work_capacity", period) + principal_abled = numpy.logical_not(numpy.logical_or(principal_blind, principal_disabled)) + principal_limits = { + # if a beneficiary is receiving SLP for blindness, disregard all income + principal_blind: numpy.clip(gross_principal_income, a_max=0), + # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 + principal_disabled: numpy.clip(gross_principal_income - (20 * period.size_in_weeks), a_min=0), + # otherwise, use the gross principal income + principal_abled: gross_principal_income} + # income based on whether principal population members are blind, disabled, or neither + assessable_principal_income = numpy.select(*principal_limits.keys(), *principal_limits.values()) + + gross_partner_income = population.partner("social_security__income", period) + partner_blind = population.partner("totally_blind", period) + partner_disabled = population.partner("supported_living_payment__restricted_work_capacity", period) + partner_abled = numpy.logical_not(numpy.logical_or(partner_blind, partner_disabled)) + partner_limits = { + # if a beneficiary is receiving SLP for blindness, disregard all income + partner_blind: numpy.clip(gross_partner_income, a_max=0), + # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 + partner_disabled: numpy.clip(gross_partner_income - (20 * period.size_in_weeks), a_min=0), + # otherwise, use the gross principal income + partner_abled: gross_partner_income} + # income based on whether partner population members are blind, disabled, or neither + assessable_partner_income = numpy.select(*partner_limits.keys(), *partner_limits.values()) + + # numpy.floor required for income tests; reductions are per whole dollar + return numpy.floor(assessable_principal_income + assessable_partner_income) class supported_living_payment__reduction(variables.Variable): @@ -31,83 +132,79 @@ class supported_living_payment__reduction(variables.Variable): label = "The amount the base benefit is reduced base on the appropriate Income Test and the person & their partners income" reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - def formula_2018_11_26(people, period, parameters): - family_income = add( - people.family.sum( - people.family.members("social_security__income", period), - role=entities.Family.PARTNER), - people.family.sum( - people.family.members("social_security__income", period), - role=entities.Family.PRINCIPAL)) - - # numpy.floor required for income tests as it's "35c for every $1" - family_income = numpy.floor(family_income) + @staticmethod + def formula_2018_11_26(population, period, parameters): + family_income = population("supported_living_payment__assessable_income", period) # test 1 is used if any of these clauses apply - test_1 = reduce(add, [ - people("schedule_4__part3_1_a", period), - people("schedule_4__part3_1_b", period), - people("schedule_4__part3_1_c", period), - people("schedule_4__part3_1_g_i", period), - people("schedule_4__part3_1_g_ii", period), - people("schedule_4__part3_1_h_i", period), - people("schedule_4__part3_1_h_ii", period)]) + test_1_applies = reduce(numpy.logical_or, [ + population("schedule_4__part3_1_a", period), + population("schedule_4__part3_1_b", period), + population("schedule_4__part3_1_c", period), + population("schedule_4__part3_1_g_i", period), + population("schedule_4__part3_1_g_ii", period), + population("schedule_4__part3_1_h_i", period), + population("schedule_4__part3_1_h_ii", period)]) # test 2 is used if any of these clauses apply - test_2 = reduce(add, [ - people("schedule_4__part3_1_d_i", period), - people("schedule_4__part3_1_d_ii", period), - people("schedule_4__part3_1_e_i", period), - people("schedule_4__part3_1_e_ii", period), - people("schedule_4__part3_1_f_i", period), - people("schedule_4__part3_1_f_ii", period)]) - - scale_1 = parameters(period).social_security.income_test_1 - scale_2 = parameters(period).social_security.income_test_2 - - return mul( - people("supported_living_payment__entitled", period), - add( - (scale_1.calc(family_income) * test_1), - (scale_2.calc(family_income) * test_2))) - - def formula_2020_11_09(people, period, parameters): - family_income = add( - people.family.sum( - people.family.members("social_security__income", period), - role=entities.Family.PARTNER), - people.family.sum( - people.family.members("social_security__income", period), - role=entities.Family.PRINCIPAL)) - - # numpy.floor required for income tests as it's "35c for every $1" - family_income = numpy.floor(family_income) + test_2_applies = reduce(numpy.logical_or, [ + population("schedule_4__part3_1_d_i", period), + population("schedule_4__part3_1_d_ii", period), + population("schedule_4__part3_1_e_i", period), + population("schedule_4__part3_1_e_ii", period), + population("schedule_4__part3_1_f_i", period), + population("schedule_4__part3_1_f_ii", period)]) + + income_test_1 = parameters(period).social_security.income_test_1 + income_test_2 = parameters(period).social_security.income_test_2 + + abatement = numpy.select( + [test_1_applies, test_2_applies], + [income_test_1.calc(family_income), income_test_2.calc(family_income)]) + + # 5. Halves benefit & abatement if in a relationship & meets these requirements + in_relationship = population("social_security__in_a_relationship", period) + ssa_s4_5_applies = population("schedule_4__part3_5", period) + return numpy.where( + in_relationship * ssa_s4_5_applies, + abatement * 0.5, + abatement) + + @staticmethod + def formula_2020_11_09(population, period, parameters): + family_income = population("supported_living_payment__assessable_income", period) # test 1 is used if any of these clauses apply - test_1 = reduce(add, [ - people("schedule_4__part3_1_a", period), - people("schedule_4__part3_1_b", period), - people("schedule_4__part3_1_c", period), - people("schedule_4__part3_1_g_i", period), - people("schedule_4__part3_1_g_ii", period), - people("schedule_4__part3_1_h_i", period), - people("schedule_4__part3_1_h_ii", period)]) + test_1_applies = reduce(numpy.logical_or, [ + population("schedule_4__part3_1_a", period), + population("schedule_4__part3_1_b", period), + population("schedule_4__part3_1_c", period), + population("schedule_4__part3_1_g_i", period), + population("schedule_4__part3_1_g_ii", period), + population("schedule_4__part3_1_h_i", period), + population("schedule_4__part3_1_h_ii", period)]) # test 2 is used if any of these clauses apply - test_2 = reduce(add, [ - people("schedule_4__part3_1_d_i", period), - people("schedule_4__part3_1_d_ii", period), - people("schedule_4__part3_1_e_i", period), - people("schedule_4__part3_1_e_ii", period)]) + test_2_applies = reduce(numpy.logical_or, [ + population("schedule_4__part3_1_d_i", period), + population("schedule_4__part3_1_d_ii", period), + population("schedule_4__part3_1_e_i", period), + population("schedule_4__part3_1_e_ii", period)]) + + income_test_1 = parameters(period).social_security.income_test_1 + income_test_2 = parameters(period).social_security.income_test_2 - scale_1 = parameters(period).social_security.income_test_1 - scale_2 = parameters(period).social_security.income_test_2 + abatement = numpy.select( + [test_1_applies, test_2_applies], + [income_test_1.calc(family_income), income_test_2.calc(family_income)]) - return mul( - people("supported_living_payment__entitled", period), - add( - (scale_1.calc(family_income) * test_1), - (scale_2.calc(family_income) * test_2))) + # 5. Halves benefit & abatement if in a relationship & meets these requirements + in_relationship = population("social_security__in_a_relationship", period) + ssa_s4_5_applies = population("schedule_4__part3_5", period) + return numpy.where( + in_relationship * ssa_s4_5_applies, + abatement * 0.5, + abatement) class supported_living_payment__base(variables.Variable): @@ -117,60 +214,80 @@ class supported_living_payment__base(variables.Variable): reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" label = "Supported Living Payment - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" - def formula_2018_11_26(people, period, parameters): + @staticmethod + def formula_2018_11_26(population, period, parameters): clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses - # benefit = eligibility (boolean) * rate (float) - clause_1_a_net_weekly_benefit = people("schedule_4__part3_1_a", period) * clauses["clause_1_a"] - clause_1_b_net_weekly_benefit = people("schedule_4__part3_1_b", period) * clauses["clause_1_b"] - clause_1_c_net_weekly_benefit = people("schedule_4__part3_1_c", period) * clauses["clause_1_c"] - clause_1_d_i_net_weekly_benefit = people("schedule_4__part3_1_d_i", period) * clauses["clause_1_d_i"] - clause_1_d_ii_net_weekly_benefit = people("schedule_4__part3_1_d_ii", period) * clauses["clause_1_d_i"] - clause_1_e_i_net_weekly_benefit = people("schedule_4__part3_1_e_i", period) * clauses["clause_1_e_i"] - clause_1_e_ii_net_weekly_benefit = people("schedule_4__part3_1_e_ii", period) * clauses["clause_1_e_ii"] - clause_1_f_i_net_weekly_benefit = people("schedule_4__part3_1_f_i", period) * clauses["clause_1_f_i"] - clause_1_f_ii_net_weekly_benefit = people("schedule_4__part3_1_f_ii", period) * clauses["clause_1_f_ii"] - clause_1_g_i_net_weekly_benefit = people("schedule_4__part3_1_g_i", period) * clauses["clause_1_g_i"] - clause_1_g_ii_net_weekly_benefit = people("schedule_4__part3_1_g_ii", period) * clauses["clause_1_g_ii"] - clause_1_h_i_net_weekly_benefit = people("schedule_4__part3_1_h_i", period) * clauses["clause_1_h_i"] - clause_1_h_ii_net_weekly_benefit = people("schedule_4__part3_1_h_ii", period) * clauses["clause_1_h_ii"] - return reduce(add, [ - clause_1_a_net_weekly_benefit, - clause_1_b_net_weekly_benefit, - clause_1_c_net_weekly_benefit, - clause_1_d_i_net_weekly_benefit, - clause_1_d_ii_net_weekly_benefit, - clause_1_e_i_net_weekly_benefit, - clause_1_e_ii_net_weekly_benefit, - clause_1_f_i_net_weekly_benefit, - clause_1_f_ii_net_weekly_benefit, - clause_1_g_i_net_weekly_benefit, - clause_1_g_ii_net_weekly_benefit, - clause_1_h_i_net_weekly_benefit, - clause_1_h_ii_net_weekly_benefit]) - - def formula_2020_11_09(people, period, parameters): + base_rate = numpy.select([ + population("schedule_4__part3_1_a", period), + population("schedule_4__part3_1_b", period), + population("schedule_4__part3_1_c", period), + population("schedule_4__part3_1_d_i", period), + population("schedule_4__part3_1_d_ii", period), + population("schedule_4__part3_1_e_i", period), + population("schedule_4__part3_1_e_ii", period), + population("schedule_4__part3_1_f_i", period), + population("schedule_4__part3_1_f_ii", period), + population("schedule_4__part3_1_g_i", period), + population("schedule_4__part3_1_g_ii", period), + population("schedule_4__part3_1_h_i", period), + population("schedule_4__part3_1_h_ii", period), + ], [ + clauses["clause_1_a"], + clauses["clause_1_b"], + clauses["clause_1_c"], + clauses["clause_1_d_i"], + clauses["clause_1_d_i"], + clauses["clause_1_e_i"], + clauses["clause_1_e_ii"], + clauses["clause_1_f_i"], + clauses["clause_1_f_ii"], + clauses["clause_1_g_i"], + clauses["clause_1_g_ii"], + clauses["clause_1_h_i"], + clauses["clause_1_h_ii"], + ]) + + # 5. Halves benefit & abatement if in a relationship & meets these requirements + in_relationship = population("social_security__in_a_relationship", period) + ssa_s4_5_applies = population("schedule_4__part3_5", period) + return numpy.where( + in_relationship * ssa_s4_5_applies, + base_rate * 0.5, + base_rate) + + @staticmethod + def formula_2020_11_09(population, period, parameters): clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses - # benefit = eligibility (boolean) * rate (float) - clause_1_a_net_weekly_benefit = people("schedule_4__part3_1_a", period) * clauses["clause_1_a"] - clause_1_b_net_weekly_benefit = people("schedule_4__part3_1_b", period) * clauses["clause_1_b"] - clause_1_c_net_weekly_benefit = people("schedule_4__part3_1_c", period) * clauses["clause_1_c"] - clause_1_d_i_net_weekly_benefit = people("schedule_4__part3_1_d_i", period) * clauses["clause_1_d_i"] - clause_1_d_ii_net_weekly_benefit = people("schedule_4__part3_1_d_ii", period) * clauses["clause_1_d_i"] - clause_1_e_i_net_weekly_benefit = people("schedule_4__part3_1_e_i", period) * clauses["clause_1_e_i"] - clause_1_e_ii_net_weekly_benefit = people("schedule_4__part3_1_e_ii", period) * clauses["clause_1_e_ii"] - clause_1_g_i_net_weekly_benefit = people("schedule_4__part3_1_g_i", period) * clauses["clause_1_g_i"] - clause_1_g_ii_net_weekly_benefit = people("schedule_4__part3_1_g_ii", period) * clauses["clause_1_g_ii"] - clause_1_h_i_net_weekly_benefit = people("schedule_4__part3_1_h_i", period) * clauses["clause_1_h_i"] - clause_1_h_ii_net_weekly_benefit = people("schedule_4__part3_1_h_ii", period) * clauses["clause_1_h_ii"] - return reduce(add, [ - clause_1_a_net_weekly_benefit, - clause_1_b_net_weekly_benefit, - clause_1_c_net_weekly_benefit, - clause_1_d_i_net_weekly_benefit, - clause_1_d_ii_net_weekly_benefit, - clause_1_e_i_net_weekly_benefit, - clause_1_e_ii_net_weekly_benefit, - clause_1_g_i_net_weekly_benefit, - clause_1_g_ii_net_weekly_benefit, - clause_1_h_i_net_weekly_benefit, - clause_1_h_ii_net_weekly_benefit]) + base_rate = numpy.select([ + population("schedule_4__part3_1_a", period), + population("schedule_4__part3_1_b", period), + population("schedule_4__part3_1_c", period), + population("schedule_4__part3_1_d_i", period), + population("schedule_4__part3_1_d_ii", period), + population("schedule_4__part3_1_e_i", period), + population("schedule_4__part3_1_e_ii", period), + population("schedule_4__part3_1_g_i", period), + population("schedule_4__part3_1_g_ii", period), + population("schedule_4__part3_1_h_i", period), + population("schedule_4__part3_1_h_ii", period), + ], [ + clauses["clause_1_a"], + clauses["clause_1_b"], + clauses["clause_1_c"], + clauses["clause_1_d_i"], + clauses["clause_1_d_i"], + clauses["clause_1_e_i"], + clauses["clause_1_e_ii"], + clauses["clause_1_g_i"], + clauses["clause_1_g_ii"], + clauses["clause_1_h_i"], + clauses["clause_1_h_ii"], + ]) + + # 5. Halves benefit & abatement if in a relationship & meets these requirements + in_relationship = population("social_security__in_a_relationship", period) + ssa_s4_5_applies = population("schedule_4__part3_5", period) + return numpy.where( + in_relationship * ssa_s4_5_applies, + base_rate * 0.5, + base_rate) From 5bcbf224b6f68d014ee31d636e3fdcc8d34613d5 Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Tue, 21 May 2024 12:44:56 +1000 Subject: [PATCH 6/9] Clause 7 entitlements --- .../supported_living_payment__benefit.py | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index 801b3171..ec064902 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -64,15 +64,30 @@ def formula_2018_11_26(population, period, parameters): default=0) benefit_post_c6 = benefit_post_c4 + ssa_s4_6 - # 7. Despite paragraphs (d), (e), and (g) of clause 1, the rate of a supported living payment on the ground of caring for another person under any of those paragraphs must not be less than the rates that would be payable if the beneficiary and the spouse or partner of the beneficiary were both entitled to receive the benefit on those grounds; but the rate of benefit payable by virtue of this clause must not exceed— - # (a) $342.24 a week if the beneficiary and the spouse or partner of the beneficiary have no dependent children; or - # (b) $372.81 a week if the beneficiary and the spouse or partner of the beneficiary have 1 or more dependent children. + # 7. If entitled as carer & in a couple, both are entitled as carers with a separate cap + ssa_s4_7_rate = numpy.where( + no_children, + clauses["clause_1_hi"], + clauses["clause_1_hii"]) + ssa_s4_7_gross_benefit = 2 * numpy.clip(ssa_s4_7_rate - abatement_rate, 0) + ssa_s4_7_benefit = numpy.where( + no_children, + numpy.clip(ssa_s4_7_gross_benefit, clauses["clause_7_a"]), + numpy.clip(ssa_s4_7_gross_benefit, clauses["clause_7_b"])) + + carer_entitled = population("supported_living_payment__carer__entitled", period, parameters) + + # if the population is entitled as a carer, use the larger of c7 or other clauses + benefit_post_c7 = numpy.where( + carer_entitled, + numpy.maximum(benefit_post_c6, ssa_s4_7_benefit), + benefit_post_c6) # 8. A dependent child is one who is not earning orphans' or unsupported child benefits is_entitled = population("supported_living_payment__entitled", period) - return is_entitled * benefit_post_c6 + return is_entitled * benefit_post_c7 # note: this does not calculate exemptions as under: From 9736445e6493a343355277fac48102b1de596a50 Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Tue, 21 May 2024 13:46:28 +1000 Subject: [PATCH 7/9] Fixes issues with benefit calculation --- .../supported_living_payment.yaml | 71 +++++++------------ .../acts/social_security/schedule_4/part3.py | 1 - .../supported_living_payment.py | 4 +- .../supported_living_payment__benefit.py | 32 ++++----- 4 files changed, 42 insertions(+), 66 deletions(-) diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml index d6fd4317..da89fe5a 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml @@ -1,99 +1,80 @@ --- - name: Supported Living Payment - default false - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": 16 + age: 16 citizenship__citizen: true output: supported_living_payment__entitled: false - name: Supported Living Payment - totally blind - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [16, 15] + age: [16, 15] citizenship__citizen: [true, true] totally_blind: [true, true] - social_security__residential_requirement: - "2019-W01": [true, true] + social_security__residential_requirement: [true, true] output: supported_living_payment__entitled: [true, false] - name: Supported Living Payment - "severely" disabled - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [16, 15] + age: [16, 15] citizenship__citizen: [true, true] - supported_living_payment__restricted_work_capacity: - "2019-W01": [true, true] - social_security__residential_requirement: - "2019-W01": [true, true] + supported_living_payment__restricted_work_capacity: [true, true] + social_security__residential_requirement: [true, true] output: supported_living_payment__entitled: [true, false] - name: Supported Living Payment - self inflicted injury - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [16, 16] + age: [16, 16] citizenship__citizen: [true, true] - supported_living_payment__restricted_work_capacity: - "2019-W01": [true, true] - social_security__residential_requirement: - "2019-W01": [true, true] + supported_living_payment__restricted_work_capacity: [true, true] + social_security__residential_requirement: [true, true] supported_living_payment__disability_self_inflicted: [false, true] output: supported_living_payment__entitled: [true, false] - name: Supported Living Payment - Carer looking after another person - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [17, 18] + age: [17, 18] citizenship__citizen: [true, true] - supported_living_payment__caring_for_another_person: - "2019-W01": [true, true] - social_security__residential_requirement: - "2019-W01": [true, true] + supported_living_payment__caring_for_another_person: [true, true] + social_security__residential_requirement: [true, true] output: supported_living_payment__entitled: [false, true] - name: Supported Living Payment - Carer looking after another person, with child - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [19, 20] + age: [19, 20] citizenship__citizen: [true, true] - supported_living_payment__caring_for_another_person: - "2019-W01": [true, true] - social_security__residential_requirement: - "2019-W01": [true, true] - social_security__dependent_children: - "2019-W01": [1, 1] + supported_living_payment__caring_for_another_person: [true, true] + social_security__residential_requirement: [true, true] + social_security__dependent_children: [1, 1] output: supported_living_payment__entitled: [false, true] - name: Supported Living Payment - Carer looking after another person, not in NZ - period: 2019-01 + period: 2019-W01 absolute_error_margin: 0 input: - age: - "2019-01-01": [20, 20] + age: [20, 20] citizenship__citizen: [true, true] - supported_living_payment__caring_for_another_person: - "2019-W01": [true, true] - social_security__residential_requirement: - "2019-W01": [true, false] + supported_living_payment__caring_for_another_person: [true, true] + social_security__residential_requirement: [true, false] output: supported_living_payment__entitled: [true, false] diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py index 2db343ce..fffd78d4 100644 --- a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -62,7 +62,6 @@ def formula_2018_11_26(people, period, parameters): return in_relationship * partner_granted_main_benefit - class schedule_4__part3_1_d_i(variables.Variable): value_type = bool entity = entities.Person diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index 813890bf..e3267f8f 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -54,7 +54,7 @@ def formula_2018_11_26(persons, period, parameters): class supported_living_payment__disabled_or_blind__entitled(variables.Variable): value_type = bool entity = entities.Person - definition_period = periods.MONTH + definition_period = periods.WEEK label = "Eligible for Supported Living Payment, on ground of restricted work capacity or total blindness." reference = [ "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783174", @@ -113,7 +113,7 @@ def formula(persons, period, parameters): class supported_living_payment__carer__entitled(variables.Variable): value_type = bool entity = entities.Person - definition_period = periods.MONTH + definition_period = periods.WEEK label = "Eligible for Supported Living Payment, on grounds of caring for another person." reference = [ "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187", diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index ec064902..08e57dd2 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -16,7 +16,6 @@ class supported_living_payment__benefit(variables.Variable): label = "The final net benefit entitlement" reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - @staticmethod def formula_2018_11_26(population, period, parameters): # Note: the clauses in this act unfortunately apply out of order base_rate = population("supported_living_payment__base", period) @@ -35,7 +34,7 @@ def formula_2018_11_26(population, period, parameters): abatement_rate) # ensure the reduction does not result in a negative benefit - benefit_post_c1 = numpy.clip(base_rate - abatement_rate, 0) + benefit_post_c1 = numpy.clip(base_rate - abatement_rate, 0, base_rate) # 2. Maximum amount from all sources clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses @@ -50,8 +49,8 @@ def formula_2018_11_26(population, period, parameters): # 4. Benefit must not exceed cap from clause 2 benefit_post_c4 = numpy.where( in_relationship, - numpy.clip(benefit_post_s3, couple_cap), - numpy.clip(benefit_post_s3, single_cap)) + numpy.clip(benefit_post_s3, 0, couple_cap), + numpy.clip(benefit_post_s3, 0, single_cap)) # 6. If clause 5 applies, partner is entitled to payment 1b or 1c ssa_s4_6_applies = ssa_s4_p3_5_applies * population("schedule_4__part3_6", period) @@ -69,11 +68,11 @@ def formula_2018_11_26(population, period, parameters): no_children, clauses["clause_1_hi"], clauses["clause_1_hii"]) - ssa_s4_7_gross_benefit = 2 * numpy.clip(ssa_s4_7_rate - abatement_rate, 0) + ssa_s4_7_gross_benefit = 2 * numpy.clip(ssa_s4_7_rate - abatement_rate, 0, ssa_s4_7_rate) ssa_s4_7_benefit = numpy.where( no_children, - numpy.clip(ssa_s4_7_gross_benefit, clauses["clause_7_a"]), - numpy.clip(ssa_s4_7_gross_benefit, clauses["clause_7_b"])) + numpy.clip(ssa_s4_7_gross_benefit, 0, clauses["clause_7_a"]), + numpy.clip(ssa_s4_7_gross_benefit, 0, clauses["clause_7_b"])) carer_entitled = population("supported_living_payment__carer__entitled", period, parameters) @@ -103,7 +102,6 @@ class supported_living_payment__assessable_income(variables.Variable): label = "The assessable income of the principle & partner for the purposes of income tests." reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - @staticmethod def formula_2018_11_26(population, period): # 1. Income for SLP on the basis of blindness or disability: # (a) disregard that part of the beneficiary’s income (not exceeding $20 a week) earned by the beneficiary’s own efforts; and @@ -112,29 +110,31 @@ def formula_2018_11_26(population, period): principal_blind = population("totally_blind", period) principal_disabled = population("supported_living_payment__restricted_work_capacity", period) principal_abled = numpy.logical_not(numpy.logical_or(principal_blind, principal_disabled)) + principal_disabled_income = gross_principal_income - (20 * period.size_in_weeks) principal_limits = { # if a beneficiary is receiving SLP for blindness, disregard all income - principal_blind: numpy.clip(gross_principal_income, a_max=0), + principal_blind: numpy.clip(gross_principal_income, 0, 0), # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 - principal_disabled: numpy.clip(gross_principal_income - (20 * period.size_in_weeks), a_min=0), + principal_disabled: numpy.clip(principal_disabled_income, 0, principal_disabled_income), # otherwise, use the gross principal income principal_abled: gross_principal_income} # income based on whether principal population members are blind, disabled, or neither - assessable_principal_income = numpy.select(*principal_limits.keys(), *principal_limits.values()) + assessable_principal_income = numpy.select(list(principal_limits.keys()), list(principal_limits.values())) gross_partner_income = population.partner("social_security__income", period) partner_blind = population.partner("totally_blind", period) partner_disabled = population.partner("supported_living_payment__restricted_work_capacity", period) partner_abled = numpy.logical_not(numpy.logical_or(partner_blind, partner_disabled)) + partner_disabled_income = gross_partner_income - (20 * period.size_in_weeks) partner_limits = { # if a beneficiary is receiving SLP for blindness, disregard all income - partner_blind: numpy.clip(gross_partner_income, a_max=0), + partner_blind: numpy.clip(gross_partner_income, 0, 0), # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 - partner_disabled: numpy.clip(gross_partner_income - (20 * period.size_in_weeks), a_min=0), + partner_disabled: numpy.clip(partner_disabled_income, 0, partner_disabled_income), # otherwise, use the gross principal income partner_abled: gross_partner_income} # income based on whether partner population members are blind, disabled, or neither - assessable_partner_income = numpy.select(*partner_limits.keys(), *partner_limits.values()) + assessable_partner_income = numpy.select(list(partner_limits.keys()), list(partner_limits.values())) # numpy.floor required for income tests; reductions are per whole dollar return numpy.floor(assessable_principal_income + assessable_partner_income) @@ -147,7 +147,6 @@ class supported_living_payment__reduction(variables.Variable): label = "The amount the base benefit is reduced base on the appropriate Income Test and the person & their partners income" reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - @staticmethod def formula_2018_11_26(population, period, parameters): family_income = population("supported_living_payment__assessable_income", period) @@ -185,7 +184,6 @@ def formula_2018_11_26(population, period, parameters): abatement * 0.5, abatement) - @staticmethod def formula_2020_11_09(population, period, parameters): family_income = population("supported_living_payment__assessable_income", period) @@ -229,7 +227,6 @@ class supported_living_payment__base(variables.Variable): reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" label = "Supported Living Payment - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" - @staticmethod def formula_2018_11_26(population, period, parameters): clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses base_rate = numpy.select([ @@ -270,7 +267,6 @@ def formula_2018_11_26(population, period, parameters): base_rate * 0.5, base_rate) - @staticmethod def formula_2020_11_09(population, period, parameters): clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses base_rate = numpy.select([ From 2858ade15280914e2b7be1f6bed512f6d7ae1d10 Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Fri, 31 May 2024 17:00:16 +1000 Subject: [PATCH 8/9] Adds simple single tests --- .../supported_living_payment/base.yaml | 1329 +++++++++++++++++ .../entitled.yaml} | 2 - .../acts/social_security/schedule_4/part3.py | 4 +- .../supported_living_payment__benefit.py | 104 +- 4 files changed, 1394 insertions(+), 45 deletions(-) create mode 100644 openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml rename openfisca_aotearoa/tests/social_security/{supported_living_payment.yaml => supported_living_payment/entitled.yaml} (99%) diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml new file mode 100644 index 00000000..99337b85 --- /dev/null +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml @@ -0,0 +1,1329 @@ +- name: > + Social Security Act 2018 + Supported Living Payment + Single, under 18, without Children (Schedule 4, Part 3, Clause 1a) + period: 2024-W15 # 1 week after 2024 act took effect + input: + supported_living_payment__entitled: [true, true, true, true] + social_security__in_a_relationship: [false, false, false, false] + age: [17, 17, 17, 17] + social_security__dependent_children: [0, 0, 0, 0] + social_security__income: + 2024-W15: [0, 355, 693, 694] + output: + supported_living_payment__base: + 2024-W15: [337.63, 337.63, 337.63, 337.63] + supported_living_payment__reduction: + 2024-W15: [0, 100.50, 337.10, 337.80] + supported_living_payment__benefit: + 2024-W15: [337.63, 237.13, 0.53, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Single, over 18, without Children (Schedule 4, Part 3, Clause 1b) + period: 2024-W15 # 1 week after 2024 act took effect + input: + supported_living_payment__entitled: [true, true, true, true] + social_security__in_a_relationship: [false, false, false, false] + age: [18, 18, 18, 18] + social_security__dependent_children: [0, 0, 0, 0] + social_security__income: + 2024-W15: [0, 355, 786, 787] + output: + supported_living_payment__base: + 2024-W15: [402.84, 402.84, 402.84, 402.84] + supported_living_payment__reduction: + 2024-W15: [0, 100.50, 402.20, 402.90] + supported_living_payment__benefit: + 2024-W15: [402.84, 302.34, 0.64, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Single, with Children (Schedule 4, Part 3, Clause 1c) + period: 2024-W15 + input: + supported_living_payment__entitled: [true, true, true, true] + social_security__in_a_relationship: [false, false, false, false] + age: [18, 18, 18, 18] + social_security__dependent_children: [1, 1, 1, 1] + social_security__income: + 2024-W15: [0, 355, 1000, 1001] + output: + supported_living_payment__base: + 2024-W15: [552.14, 552.14, 552.14, 552.14] + supported_living_payment__reduction: + 2024-W15: [0, 100.50, 552.00, 552.70] + supported_living_payment__benefit: + 2024-W15: [552.14, 451.64, 0.14, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, no Children (Schedule 4, Part 3, Clause 1di) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [342.24, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, no Children (Schedule 4, Part 3, Clause 1di) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 497 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [242.29, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, no Children (Schedule 4, Part 3, Clause 1di) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1189 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.15, 0] + supported_living_payment__benefit: + 2024-W15: [0.09, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, no Children (Schedule 4, Part 3, Clause 1di) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1190 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.50, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, with children (Schedule 4, Part 3, Clause 1dii) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [359.07, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [359.07, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, with children (Schedule 4, Part 3, Clause 1dii) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 497 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [359.07, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [259.12, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, with children (Schedule 4, Part 3, Clause 1dii) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1237 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [359.07, 0] + supported_living_payment__reduction: + 2024-W15: [358.95, 0] + supported_living_payment__benefit: + 2024-W15: [0.12, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has main benefit, with children (Schedule 4, Part 3, Clause 1dii) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1238 + partner: + social_security__granted_main_benefit: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [359.07, 0] + supported_living_payment__reduction: + 2024-W15: [359.30, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, no Children (Schedule 4, Part 3, Clause 1ei) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [342.24, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, no Children (Schedule 4, Part 3, Clause 1ei) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 497 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [242.29, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, no Children (Schedule 4, Part 3, Clause 1ei) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1189 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.15, 0] + supported_living_payment__benefit: + 2024-W15: [0.09, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, no Children (Schedule 4, Part 3, Clause 1ei) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1190 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.50, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, with children (Schedule 4, Part 3, Clause 1eii) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [372.81, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, with children (Schedule 4, Part 3, Clause 1eii) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 497 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [272.86, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, with children (Schedule 4, Part 3, Clause 1eii) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1276 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [372.60, 0] + supported_living_payment__benefit: + 2024-W15: [0.21, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has nz super, with children (Schedule 4, Part 3, Clause 1eii) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1277 + partner: + super__being_paid_nz_superannuation: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [372.95, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, no Children (Schedule 4, Part 3, Clause 1ei) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [342.24, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, no Children (Schedule 4, Part 3, Clause 1ei) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 497 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [242.29, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, no Children (Schedule 4, Part 3, Clause 1ei) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1189 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.15, 0] + supported_living_payment__benefit: + 2024-W15: [0.09, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, no Children (Schedule 4, Part 3, Clause 1ei) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1190 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342.50, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, with children (Schedule 4, Part 3, Clause 1eii) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [372.81, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, with children (Schedule 4, Part 3, Clause 1eii) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 497 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [99.95, 0] + supported_living_payment__benefit: + 2024-W15: [272.86, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, with children (Schedule 4, Part 3, Clause 1eii) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1276 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [372.60, 0] + supported_living_payment__benefit: + 2024-W15: [0.21, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, spouse has veteran's pension, with children (Schedule 4, Part 3, Clause 1eii) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1277 + partner: + veterans_support__being_paid_a_veterans_pension: + 2024-04: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [372.95, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1gi) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [684.48, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [684.48, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1gi) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 355 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [684.48, 0] + supported_living_payment__reduction: + 2024-W15: [100.50, 0] + supported_living_payment__benefit: + 2024-W15: [583.98, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1gi) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1189 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [684.48, 0] + supported_living_payment__reduction: + 2024-W15: [684.30, 0] + supported_living_payment__benefit: + 2024-W15: [0.18, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1gi) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1190 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [684.48, 0] + supported_living_payment__reduction: + 2024-W15: [685, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1gii) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [718.14, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [718.14, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1gii) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 355 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [718.14, 0] + supported_living_payment__reduction: + 2024-W15: [100.50, 0] + supported_living_payment__benefit: + 2024-W15: [617.64, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1gii) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1237 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [718.14, 0] + supported_living_payment__reduction: + 2024-W15: [717.90, 0] + supported_living_payment__benefit: + 2024-W15: [0.24, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, restricted work capacity, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1gii) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__disabled_or_blind__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 1238 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [718.14, 0] + supported_living_payment__reduction: + 2024-W15: [718.60, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1hi) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [342.24, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1hi) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 600 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [272, 0] + supported_living_payment__benefit: + 2024-W15: [140.48, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1hi) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 700 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [342, 0] + supported_living_payment__benefit: + 2024-W15: [0.48, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + no Children (Schedule 4, Part 3, Clause 1hi) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 1190 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 0 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [342.24, 0] + supported_living_payment__reduction: + 2024-W15: [685, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1hii) + No income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [0, 0] + supported_living_payment__benefit: + 2024-W15: [372.81, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1hii) + Small income + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 600 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [272, 0] + supported_living_payment__benefit: + 2024-W15: [201.62, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1hii) + Income just below cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 744 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [372.80, 0] + supported_living_payment__benefit: + 2024-W15: [0.02, 0] +- name: > + Social Security Act 2018 + Supported Living Payment + Couple, caring for another, partner has no benefits nor super nor pension + with children (Schedule 4, Part 3, Clause 1hii) + Income just above cap + period: 2024-W15 + input: + persons: + principal: + supported_living_payment__entitled: true + supported_living_payment__carer__entitled: true + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 745 + partner: + social_security__in_a_relationship: true + age: 18 + social_security__dependent_children: 1 + social_security__income: 0 + families: + Whanau: + principal: ["principal"] + partners: ["partner"] + output: + supported_living_payment__base: + 2024-W15: [372.81, 0] + supported_living_payment__reduction: + 2024-W15: [373.50, 0] + supported_living_payment__benefit: + 2024-W15: [0, 0] diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment/entitled.yaml similarity index 99% rename from openfisca_aotearoa/tests/social_security/supported_living_payment.yaml rename to openfisca_aotearoa/tests/social_security/supported_living_payment/entitled.yaml index da89fe5a..5a5bc062 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment/entitled.yaml @@ -1,5 +1,3 @@ ---- - - name: Supported Living Payment - default false period: 2019-W01 absolute_error_margin: 0 diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py index fffd78d4..1e23d0c3 100644 --- a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -84,7 +84,7 @@ class schedule_4__part3_1_d_ii(variables.Variable): def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_d", period) - has_children = people("social_security__dependent_children", period) < 1 + has_children = people("social_security__dependent_children", period) > 0 return base * has_children @@ -284,7 +284,7 @@ class schedule_4__part3_1_h_i(variables.Variable): label = "Part 3 Supported Living Payment - Clause 1(h)(i)" def formula_2018_11_26(people, period, parameters): - base = people("schedule_4__part3_1_g", period) + base = people("schedule_4__part3_1_h", period) no_children = people("social_security__dependent_children", period) < 1 return base * no_children diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index 08e57dd2..9c64b08b 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -44,13 +44,14 @@ def formula_2018_11_26(population, period, parameters): # 3. Additional 25% of income subsidy if beneficiary is blind is_blind = population("totally_blind", period) net_income = population("social_security__income", period) - benefit_post_s3 = benefit_post_c1 + numpy.where(is_blind, 0.25, * net_income, 0 * net_income) + c3_subsidy = numpy.where(is_blind, 0.25 * net_income, 0 * net_income) - # 4. Benefit must not exceed cap from clause 2 - benefit_post_c4 = numpy.where( + # 4. Subsidy + benefit must not exceed cap from clause 2 + capped_c3_subsidy = numpy.where( in_relationship, - numpy.clip(benefit_post_s3, 0, couple_cap), - numpy.clip(benefit_post_s3, 0, single_cap)) + numpy.clip(c3_subsidy, 0, numpy.clip(couple_cap - benefit_post_c1, 0, couple_cap)), + numpy.clip(c3_subsidy, 0, numpy.clip(single_cap - benefit_post_c1, 0, single_cap))) + benefit_post_c4 = benefit_post_c1 + capped_c3_subsidy # 6. If clause 5 applies, partner is entitled to payment 1b or 1c ssa_s4_6_applies = ssa_s4_p3_5_applies * population("schedule_4__part3_6", period) @@ -63,11 +64,16 @@ def formula_2018_11_26(population, period, parameters): default=0) benefit_post_c6 = benefit_post_c4 + ssa_s4_6 - # 7. If entitled as carer & in a couple, both are entitled as carers with a separate cap + # 7. If entitled as carer & in a couple, both are entitled as carers + # n.b.: this is the method used by MSD + # they give each partner the base rate and then subtract the abatement rate from each + # this is equivalent to: 2 * (base - abatement) + # an alternative would be to multiply the base rate by 2 and then subtract the abatement rate + # this can be argued to be more generous ssa_s4_7_rate = numpy.where( no_children, - clauses["clause_1_hi"], - clauses["clause_1_hii"]) + clauses["clause_1_h_i"], + clauses["clause_1_h_ii"]) ssa_s4_7_gross_benefit = 2 * numpy.clip(ssa_s4_7_rate - abatement_rate, 0, ssa_s4_7_rate) ssa_s4_7_benefit = numpy.where( no_children, @@ -86,7 +92,7 @@ def formula_2018_11_26(population, period, parameters): is_entitled = population("supported_living_payment__entitled", period) - return is_entitled * benefit_post_c7 + return numpy.round(is_entitled * benefit_post_c7, 2) # note: this does not calculate exemptions as under: @@ -111,30 +117,38 @@ def formula_2018_11_26(population, period): principal_disabled = population("supported_living_payment__restricted_work_capacity", period) principal_abled = numpy.logical_not(numpy.logical_or(principal_blind, principal_disabled)) principal_disabled_income = gross_principal_income - (20 * period.size_in_weeks) - principal_limits = { - # if a beneficiary is receiving SLP for blindness, disregard all income - principal_blind: numpy.clip(gross_principal_income, 0, 0), - # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 - principal_disabled: numpy.clip(principal_disabled_income, 0, principal_disabled_income), - # otherwise, use the gross principal income - principal_abled: gross_principal_income} # income based on whether principal population members are blind, disabled, or neither - assessable_principal_income = numpy.select(list(principal_limits.keys()), list(principal_limits.values())) - - gross_partner_income = population.partner("social_security__income", period) - partner_blind = population.partner("totally_blind", period) - partner_disabled = population.partner("supported_living_payment__restricted_work_capacity", period) + assessable_principal_income = numpy.select( + [principal_blind, principal_disabled, principal_abled], + [ + # if a beneficiary is receiving SLP for blindness, disregard all income + numpy.clip(gross_principal_income, 0, 0), + # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 + numpy.clip(principal_disabled_income, 0, principal_disabled_income), + # otherwise, use the gross principal income + gross_principal_income]) + + gross_partner_income = population.family.sum( + population.family.members("social_security__income", period), + role=entities.Family.PARTNER) + partner_blind = population.family.any( + population.family.members("totally_blind", period), + role=entities.Family.PARTNER) + partner_disabled = population.family.any( + population.family.members("supported_living_payment__restricted_work_capacity", period), + role=entities.Family.PARTNER) partner_abled = numpy.logical_not(numpy.logical_or(partner_blind, partner_disabled)) partner_disabled_income = gross_partner_income - (20 * period.size_in_weeks) - partner_limits = { - # if a beneficiary is receiving SLP for blindness, disregard all income - partner_blind: numpy.clip(gross_partner_income, 0, 0), - # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 - partner_disabled: numpy.clip(partner_disabled_income, 0, partner_disabled_income), - # otherwise, use the gross principal income - partner_abled: gross_partner_income} # income based on whether partner population members are blind, disabled, or neither - assessable_partner_income = numpy.select(list(partner_limits.keys()), list(partner_limits.values())) + assessable_partner_income = numpy.select( + [partner_blind, partner_disabled, partner_abled], + [ + # if a beneficiary is receiving SLP for blindness, disregard all income + numpy.clip(gross_partner_income, 0, 0), + # if a beneficiary is receiving SLP for disability, disregard a maximum of $20 + numpy.clip(partner_disabled_income, 0, partner_disabled_income), + # otherwise, use the gross partner income + gross_partner_income]) # numpy.floor required for income tests; reductions are per whole dollar return numpy.floor(assessable_principal_income + assessable_partner_income) @@ -179,10 +193,13 @@ def formula_2018_11_26(population, period, parameters): # 5. Halves benefit & abatement if in a relationship & meets these requirements in_relationship = population("social_security__in_a_relationship", period) ssa_s4_5_applies = population("schedule_4__part3_5", period) - return numpy.where( - in_relationship * ssa_s4_5_applies, - abatement * 0.5, - abatement) + is_entitled = population("supported_living_payment__entitled", period) + return is_entitled * numpy.round( + numpy.where( + in_relationship * ssa_s4_5_applies, + abatement * 0.5, + abatement), + 2) def formula_2020_11_09(population, period, parameters): family_income = population("supported_living_payment__assessable_income", period) @@ -214,10 +231,13 @@ def formula_2020_11_09(population, period, parameters): # 5. Halves benefit & abatement if in a relationship & meets these requirements in_relationship = population("social_security__in_a_relationship", period) ssa_s4_5_applies = population("schedule_4__part3_5", period) - return numpy.where( - in_relationship * ssa_s4_5_applies, - abatement * 0.5, - abatement) + is_entitled = population("supported_living_payment__entitled", period) + return is_entitled * numpy.round( + numpy.where( + in_relationship * ssa_s4_5_applies, + abatement * 0.5, + abatement), + 2) class supported_living_payment__base(variables.Variable): @@ -248,7 +268,7 @@ def formula_2018_11_26(population, period, parameters): clauses["clause_1_b"], clauses["clause_1_c"], clauses["clause_1_d_i"], - clauses["clause_1_d_i"], + clauses["clause_1_d_ii"], clauses["clause_1_e_i"], clauses["clause_1_e_ii"], clauses["clause_1_f_i"], @@ -262,7 +282,8 @@ def formula_2018_11_26(population, period, parameters): # 5. Halves benefit & abatement if in a relationship & meets these requirements in_relationship = population("social_security__in_a_relationship", period) ssa_s4_5_applies = population("schedule_4__part3_5", period) - return numpy.where( + is_entitled = population("supported_living_payment__entitled", period) + return is_entitled * numpy.where( in_relationship * ssa_s4_5_applies, base_rate * 0.5, base_rate) @@ -286,7 +307,7 @@ def formula_2020_11_09(population, period, parameters): clauses["clause_1_b"], clauses["clause_1_c"], clauses["clause_1_d_i"], - clauses["clause_1_d_i"], + clauses["clause_1_d_ii"], clauses["clause_1_e_i"], clauses["clause_1_e_ii"], clauses["clause_1_g_i"], @@ -298,7 +319,8 @@ def formula_2020_11_09(population, period, parameters): # 5. Halves benefit & abatement if in a relationship & meets these requirements in_relationship = population("social_security__in_a_relationship", period) ssa_s4_5_applies = population("schedule_4__part3_5", period) - return numpy.where( + is_entitled = population("supported_living_payment__entitled", period) + return is_entitled * numpy.where( in_relationship * ssa_s4_5_applies, base_rate * 0.5, base_rate) From 70fb405dce3f3b9a7b522283c3fedc287a704433 Mon Sep 17 00:00:00 2001 From: jade darko <2138067+jadedarko@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:09:20 +1000 Subject: [PATCH 9/9] Addresses comments from PR review --- CONTRIBUTING.md | 33 ++++-- .../supported_living_payment/base.yaml | 8 ++ .../supported_living_payment/base.yaml | 32 +++--- .../acts/social_security/schedule_4/part3.py | 60 ++++++----- .../supported_living_payment.py | 102 ++---------------- .../supported_living_payment__benefit.py | 18 +++- 6 files changed, 106 insertions(+), 147 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 994e9db7..b5e188c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,27 +148,41 @@ Take a look at the `/variables/acts/social_security/residency.py` and considered The variable `social_security__residential_requirement` in this file that we will be referring to is supporting both the 1964 and the 2018 Social Security Acts. It's declaration looks like this: -``` +```python class social_security__residential_requirement(variables.Variable): value_type = bool entity = entities.Person label = "Residential requirements for certain benefits, calculates for the 1964 and the 2018 Social Security Acts" definition_period = periods.MONTH - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783138", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783138", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796", # 1964-12-04 + ] ``` - Note the two references (2018 and 1964). They link to the specific section of the act on legislation.govt.nz - Note the descriptive label - Note the naming convention as described in [Naming Variables](#namingvariables) The variable has two formulas: -``` +```python def formula_1964_12_04(persons, period, parameters): ``` -``` +```python def formula_2018_11_26(persons, period, parameters): ``` This is an OpenFisca feature that ensures the correct formula will be automatically applied depending on the date supplied with the scenario. +To aid review, the reference list can contain links to the specific versions of legislation in effect for each formula. + +e.g.: + +```python + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/77.0/whole.html#DLM6783138", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/whole.html#DLM6783138", # 2020-11-09 + ] +``` + What is unique to this project is how we intend to code the content of these formulas. _At the time of writing variables within this project ARE NOT coded this way save for the example we will refer to below._ @@ -179,7 +193,7 @@ The first thing to recognise is it references the `section 16` of the Social Sec We choose to structure the code accordingly. This looks like this: -``` +```python # ssa16_1 - Descriptive, not requiring coding. ssa16_2_a = persons("immigration__citizen_or_resident", period) * \ @@ -220,7 +234,8 @@ This allows us to map the extent and reach of the project. The `structure.json` ### structure.json An array of entries, one for each prefix utilised in the code base. In the format as follows: -``` + +```json { "Title": "Accident Compensation Act 2001", "Prefix": "acc", @@ -233,6 +248,7 @@ An array of entries, one for each prefix utilised in the code base. In the forma ] } ``` + Title, Prefix, Type and Reference are all required. - Title: The legal title of the legal artifact - Prefix: The prefix utilised within the openfisca_aotearoa code base @@ -279,8 +295,7 @@ This project currently utilises one specific pattern however for benefit calcula - `jobseeker_support__benefit` (float) i.e. the formula for `jobseeker_support__benefit` would be: - ``` + + ```python jobseeker_support__entitled * min(jobseeker_support__base - jobseeker_support__reduction, jobseeker_support__cutoff) ``` - - diff --git a/openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml b/openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml index 5220d76e..57e0b2dc 100644 --- a/openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml +++ b/openfisca_aotearoa/parameters/social_security/supported_living_payment/base.yaml @@ -624,6 +624,14 @@ clauses: reference: title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii) href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html + clause_1_income_disregarded: + values: + 2018-11-26: + value: 20 + metadata: + reference: + title: Part 3 -> Schedule 4, Part 3, Clause 1 + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html clause_2: values: 2018-11-26: diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml index 99337b85..3721a7b6 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment/base.yaml @@ -826,7 +826,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -858,7 +858,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -890,7 +890,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -922,7 +922,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -954,7 +954,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -986,7 +986,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1018,7 +1018,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1050,7 +1050,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__disabled_or_blind__entitled: true + supported_living_payment__disabled_or_blind: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1082,7 +1082,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -1114,7 +1114,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -1146,7 +1146,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -1178,7 +1178,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 0 @@ -1210,7 +1210,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1242,7 +1242,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1274,7 +1274,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 @@ -1306,7 +1306,7 @@ persons: principal: supported_living_payment__entitled: true - supported_living_payment__carer__entitled: true + supported_living_payment__carer: true social_security__in_a_relationship: true age: 18 social_security__dependent_children: 1 diff --git a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py index 1e23d0c3..d28833c7 100644 --- a/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py +++ b/openfisca_aotearoa/variables/acts/social_security/schedule_4/part3.py @@ -10,8 +10,8 @@ class schedule_4__part3_1_a(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(a)" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(persons, period, parameters): single = numpy.logical_not(persons("social_security__in_a_relationship", period)) @@ -24,8 +24,8 @@ class schedule_4__part3_1_b(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(b)" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(persons, period, parameters): single = numpy.logical_not(persons("social_security__in_a_relationship", period)) @@ -38,8 +38,8 @@ class schedule_4__part3_1_c(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(c)" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(persons, period, parameters): single = numpy.logical_not(persons("social_security__in_a_relationship", period)) @@ -51,8 +51,8 @@ class schedule_4__part3_1_d(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(d)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): in_relationship = people("social_security__in_a_relationship", period) @@ -66,8 +66,8 @@ class schedule_4__part3_1_d_i(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(d)(i)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_d", period) @@ -79,8 +79,8 @@ class schedule_4__part3_1_d_ii(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(d)(ii)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_d", period) @@ -92,8 +92,11 @@ class schedule_4__part3_1_e(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(e)" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/77.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 + ] def formula_2018_11_26(people, period, parameters): in_relationship = people("social_security__in_a_relationship", period) @@ -117,8 +120,8 @@ class schedule_4__part3_1_e_i(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(e)(i)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_e", period) @@ -130,8 +133,8 @@ class schedule_4__part3_1_e_ii(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(e)(ii)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_e", period) @@ -144,9 +147,12 @@ class schedule_4__part3_1_f(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(f)" end = "2020-11-09" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/77.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 (removed) + ] def formula_2018_11_26(people, period, parameters): in_relationship = people("social_security__in_a_relationship", period) @@ -160,9 +166,9 @@ class schedule_4__part3_1_f_i(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(f)(i)" end = "2020-11-09" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_f", period) @@ -174,9 +180,9 @@ class schedule_4__part3_1_f_ii(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(f)(ii)" end = "2020-11-09" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_f", period) @@ -188,11 +194,14 @@ class schedule_4__part3_1_g(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(g)" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/77.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 + ] def formula_2018_11_26(people, period, parameters): - disabled_or_blind = people("supported_living_payment__disabled_or_blind__entitled", period) + disabled_or_blind = people("supported_living_payment__disabled_or_blind", period) in_relationship = people("social_security__in_a_relationship", period) partner_has_benefit = people.family.any( people.family.members("social_security__granted_main_benefit", period), @@ -203,7 +212,7 @@ def formula_2018_11_26(people, period, parameters): return disabled_or_blind * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super) def formula_2020_11_09(people, period, parameters): - disabled_or_blind__entitled = people("supported_living_payment__disabled_or_blind__entitled", period) + disabled_or_blind__entitled = people("supported_living_payment__disabled_or_blind", period) in_relationship = people("social_security__in_a_relationship", period) partner_has_benefit = people.family.any( people.family.members("social_security__granted_main_benefit", period), @@ -221,8 +230,8 @@ class schedule_4__part3_1_g_i(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(g)(i)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_g", period) @@ -234,8 +243,8 @@ class schedule_4__part3_1_g_ii(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_g", period) @@ -247,11 +256,14 @@ class schedule_4__part3_1_h(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(h)" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/77.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 + ] def formula_2018_11_26(people, period, parameters): - carer__entitled = people("supported_living_payment__carer__entitled", period) + carer__entitled = people("supported_living_payment__carer", period) in_relationship = people("social_security__in_a_relationship", period) partner_has_benefit = people.family.any( people.family.members("social_security__granted_main_benefit", period), @@ -262,7 +274,7 @@ def formula_2018_11_26(people, period, parameters): return carer__entitled * in_relationship * numpy.logical_not(partner_has_benefit + partner_has_super) def formula_2020_11_09(people, period, parameters): - carer__entitled = people("supported_living_payment__carer__entitled", period) + carer__entitled = people("supported_living_payment__carer", period) in_relationship = people("social_security__in_a_relationship", period) partner_has_benefit = people.family.any( people.family.members("social_security__granted_main_benefit", period), @@ -280,8 +292,8 @@ class schedule_4__part3_1_h_i(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(h)(i)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_h", period) @@ -293,8 +305,8 @@ class schedule_4__part3_1_h_ii(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" label = "Part 3 Supported Living Payment - Clause 1(g)(ii)" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784861.html" def formula_2018_11_26(people, period, parameters): base = people("schedule_4__part3_1_h", period) @@ -306,7 +318,7 @@ class schedule_4__part3_5(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - label = """Shortcut to indicate beneficiary meets the following from clause 5: + label = """Indicates beneficiary meets the following from clause 5: (a) has a psychiatric, intellectual, physical, or mental disability; and (b) is receiving long-term residential care in a hospital or rest home because of that disability; and (c) has not been means assessed under Part 6 of the Residential Care and Disability Support Services Act 2018. @@ -318,7 +330,7 @@ class schedule_4__part3_6(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK - label = """Shortcut to indicate beneficiary meets the following from clause 6: + label = """Indicates beneficiary meets the following from clause 6: if that spouse or partner is not receiving long-term residential care in a hospital or rest home. """ reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py index e3267f8f..ab4d5b86 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment.py @@ -12,20 +12,7 @@ class supported_living_payment__entitled(variables.Variable): definition_period = periods.WEEK set_input = holders.set_input_dispatch_by_period label = "Eligible for Supported Living Payment." - reference = [ - "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175", - "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", - ] - - def formula_2013_07_15(persons, period, parameters): - """ - For the 1964 version of the act (final version), this is split into two sections: - 40B on ground of sickness, injury, disability, or total blindness - 40D on ground of caring for patient requiring care - """ - ssa40B = persons("supported_living_payment__disabled_or_blind__entitled", period, parameters) - ssa40D = persons("supported_living_payment__carer__entitled", period, parameters) - return ssa40B + ssa40D + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783175" def formula_2018_11_26(persons, period, parameters): """ @@ -33,8 +20,8 @@ def formula_2018_11_26(persons, period, parameters): 34 - 39 on ground of restricted work capacity or total blindness 40 - 42 on ground of caring for another person """ - ssa34 = persons("supported_living_payment__disabled_or_blind__entitled", period, parameters) - ssa40 = persons("supported_living_payment__carer__entitled", period, parameters) + ssa34 = persons("supported_living_payment__disabled_or_blind", period, parameters) + ssa40 = persons("supported_living_payment__carer", period, parameters) # ssa116 - must undergo work ability assessment @@ -51,14 +38,12 @@ def formula_2018_11_26(persons, period, parameters): return ssa34 + ssa40 -class supported_living_payment__disabled_or_blind__entitled(variables.Variable): +class supported_living_payment__disabled_or_blind(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK label = "Eligible for Supported Living Payment, on ground of restricted work capacity or total blindness." - reference = [ - "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783174", - ] + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783174" def formula_2018_11_26(persons, period, parameters): # person P has restricted work capacity or is totally blind @@ -83,79 +68,13 @@ def formula_2018_11_26(persons, period, parameters): return ssa34_a * ssa34_b * ssa34_c * ssa36 - def formula(persons, period, parameters): - # person P has restricted work capacity - ssa40B_1_a = persons("supported_living_payment__restricted_work_capacity", period.first_week) - - # person P is totally blind - ssa40B_1_b = persons("totally_blind", period) - - # person P is 16 or older - ssa40B_1A = persons("age", period.start) >= 16 - - # person P meets the residential requirement - ssa40B_1B = persons("social_security__residential_requirement", period.first_week) - - ssa40B_1 = ssa40B_1A * ssa40B_1B * (ssa40B_1_a + ssa40B_1_b) - - # 40B_2 specifies requirements for restricted work capacity status - # 40B_3 specifies requirements for restricted work capacity status - - # 40B_4 (redundantly?) states that person P must be either totally blind or permanently disabled - - # person P is ineligible if the disability was self-inflicted to gain benefits - ssa40B_5 = numpy.logical_not(persons("supported_living_payment__disability_self_inflicted", period)) - - return ssa40B_1 * ssa40B_5 - - -class supported_living_payment__carer__entitled(variables.Variable): +class supported_living_payment__carer(variables.Variable): value_type = bool entity = entities.Person definition_period = periods.WEEK label = "Eligible for Supported Living Payment, on grounds of caring for another person." - reference = [ - "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187", - ] - - def formula_2013_07_15(persons, period, parameters): - # person C is caring for person P - ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) - - # person C is at least 18 years old if they have no dependent children - ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) - - # person C is at least 19 years old otherwise (i.e.: they have dependent children) - ssa40D_2_b = persons("age", period.start) >= 19 - - ssa40D_2 = ssa40D_2_a + ssa40D_2_b - - # person C meets the residential requirement - ssa40D_3 = persons("social_security__residential_requirement", period.first_week) - - # ssa40D_4 allows for payment to continue if not caring for 28 days - - return ssa40D_1 * ssa40D_2 * ssa40D_3 - - def formula_2016_10_25(persons, period, parameters): - # person C is caring for person P - ssa40D_1 = persons("supported_living_payment__caring_for_another_person", period.first_week) - - # person C is at least 18 years old if they have no dependent children - ssa40D_2_a = (persons("age", period.start) >= 18) * (persons("social_security__dependent_children", period.first_week) == 0) - - # person C is at least 20 years old otherwise (i.e.: they have dependent children) - ssa40D_2_b = persons("age", period.start) >= 20 - - ssa40D_2 = ssa40D_2_a + ssa40D_2_b - - # person C meets the residential requirement - ssa40D_3 = persons("social_security__residential_requirement", period.first_week) - - # ssa40D_4 allows for payment to continue if not caring for 28 days - - return ssa40D_1 * ssa40D_2 * ssa40D_3 + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187" def formula_2018_11_26(persons, period, parameters): # person C is caring for person P @@ -193,10 +112,7 @@ class supported_living_payment__restricted_work_capacity(variables.Variable): entity = entities.Person definition_period = periods.WEEK label = "Is incapable of regularly working 15 or more hours a week in open employment" - reference = [ - "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176", - "http://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM5468367", - ] + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783176" set_input = holders.set_input_dispatch_by_period @@ -224,8 +140,8 @@ class supported_living_payment__caring_for_another_person(variables.Variable): entity = entities.Person definition_period = periods.WEEK label = "Eligible for Supported Living Payment." - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187" set_input = holders.set_input_dispatch_by_period + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783187" class supported_living_payment__disability_self_inflicted(variables.Variable): diff --git a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py index 9c64b08b..5eaa627d 100644 --- a/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/supported_living_payment/supported_living_payment__benefit.py @@ -80,7 +80,7 @@ def formula_2018_11_26(population, period, parameters): numpy.clip(ssa_s4_7_gross_benefit, 0, clauses["clause_7_a"]), numpy.clip(ssa_s4_7_gross_benefit, 0, clauses["clause_7_b"])) - carer_entitled = population("supported_living_payment__carer__entitled", period, parameters) + carer_entitled = population("supported_living_payment__carer", period, parameters) # if the population is entitled as a carer, use the larger of c7 or other clauses benefit_post_c7 = numpy.where( @@ -108,15 +108,17 @@ class supported_living_payment__assessable_income(variables.Variable): label = "The assessable income of the principle & partner for the purposes of income tests." reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" - def formula_2018_11_26(population, period): + def formula_2018_11_26(population, period, parameters): # 1. Income for SLP on the basis of blindness or disability: # (a) disregard that part of the beneficiary’s income (not exceeding $20 a week) earned by the beneficiary’s own efforts; and # (b) disregard all of the income of a totally blind beneficiary earned by the beneficiary’s own efforts. + clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses gross_principal_income = population("social_security__income", period) principal_blind = population("totally_blind", period) principal_disabled = population("supported_living_payment__restricted_work_capacity", period) principal_abled = numpy.logical_not(numpy.logical_or(principal_blind, principal_disabled)) - principal_disabled_income = gross_principal_income - (20 * period.size_in_weeks) + weekly_income_exempt = clauses["clause_1_income_disregarded"] + principal_disabled_income = gross_principal_income - (weekly_income_exempt * period.size_in_weeks) # income based on whether principal population members are blind, disabled, or neither assessable_principal_income = numpy.select( [principal_blind, principal_disabled, principal_abled], @@ -159,7 +161,10 @@ class supported_living_payment__reduction(variables.Variable): entity = entities.Person definition_period = periods.WEEK label = "The amount the base benefit is reduced base on the appropriate Income Test and the person & their partners income" - reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784861" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/56.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 + ] def formula_2018_11_26(population, period, parameters): family_income = population("supported_living_payment__assessable_income", period) @@ -244,8 +249,11 @@ class supported_living_payment__base(variables.Variable): value_type = float entity = entities.Person definition_period = periods.WEEK - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784850.html" label = "Supported Living Payment - Base Amount, (this is taxed and the amounts are supplied after tax, i.e. net)" + reference = [ + "https://www.legislation.govt.nz/act/public/2018/0032/56.0/DLM6784861.html", # 2018-11-26 + "https://www.legislation.govt.nz/act/public/2018/0032/140.0/DLM6784861.html", # 2020-11-09 + ] def formula_2018_11_26(population, period, parameters): clauses = parameters(period.first_day).social_security.supported_living_payment.base.clauses