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