From 21688c5f0a703ab2f19c66076608e9ed7434375b Mon Sep 17 00:00:00 2001 From: Hamish Fraser Date: Sat, 9 Mar 2024 19:14:41 +1300 Subject: [PATCH] Child Disability Allowance calculation and api_examples --- CHANGELOG.md | 50 +++ CONTRIBUTING.md | 2 +- openfisca_aotearoa/api_examples/README.md | 7 + .../child_disability_allowance.http | 69 ++++ openfisca_aotearoa/api_examples/entities.http | 1 + .../api_examples/parameters.http | 1 + .../api_examples/variables.http | 1 + .../child_age_threshold.yaml | 5 - ...medical_certification_required_months.yaml | 5 - .../child_disability_allowance/base.yaml | 122 +++++++ .../disability_allowance/base.yaml | 160 +++++++++ .../child_disability_allowance.yaml | 119 +++--- .../child_disability_allowance/base.yaml | 338 ++++++++++++++++++ .../social_security/childcare_subsidy.yaml | 22 +- .../tests/social_security/orphans.yaml | 18 +- .../residence_for_benefits.yaml | 41 ++- .../supported_living_payment.yaml | 2 +- .../social_security/unsupported_child.yaml | 14 +- .../variables/acts/immigration/residence.py | 15 +- .../acts/parental_leave/parental_leave.py | 1 + .../acts/social_security/abilities.py | 33 -- .../child_disability_allowance.py | 171 ++++++--- .../child_disability_allowance__payment.py | 28 ++ .../interpretation/relationship.py | 22 +- .../orphans_benefit/orphans_benefit.py | 2 +- .../acts/social_security/resident.py | 88 ++++- .../supported_living_payment.py | 10 +- .../unsupported_child/unsupported_child.py | 2 +- .../variables/demographics/health.py | 11 +- .../childcare_assistance/childcare_subsidy.py | 4 +- .../regulation/student_allowance/eligible.py | 2 +- pyproject.toml | 6 +- 32 files changed, 1171 insertions(+), 201 deletions(-) create mode 100644 openfisca_aotearoa/api_examples/README.md create mode 100644 openfisca_aotearoa/api_examples/acts/social_security/child_disability_allowance/child_disability_allowance.http create mode 100644 openfisca_aotearoa/api_examples/entities.http create mode 100644 openfisca_aotearoa/api_examples/parameters.http create mode 100644 openfisca_aotearoa/api_examples/variables.http delete mode 100644 openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/child_age_threshold.yaml delete mode 100644 openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/medical_certification_required_months.yaml create mode 100644 openfisca_aotearoa/parameters/social_security/child_disability_allowance/base.yaml create mode 100644 openfisca_aotearoa/parameters/social_security/disability_allowance/base.yaml create mode 100644 openfisca_aotearoa/tests/social_security/child_disability_allowance/base.yaml delete mode 100644 openfisca_aotearoa/variables/acts/social_security/abilities.py create mode 100644 openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance__payment.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c313af8..72cc5fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,55 @@ # Changelog +### 21.0.0 - [60](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/60) + +* Tax and benefit system evolution. +* Impacted periods: all. +* Impacted areas: + - `variables/acts/social_security` + - `variables/acts/parental_leave` + - `variables/acts/immigration` + - `variables/demographics` + - `variables/regulation/social_security/childcare_assistance` + - `variables/regulation/student_allowance` +* Details: + - Add calculation for child disability allowance + +* Added variables: + - `immigration__temporary_entry_class_visa` + - `social_security__general_limitation` + - `social_security__unlawfully_resident_or_present` + - `social_security__compelled_to_remain` + - `social_security__refugee_or_protected_person` + - `social_security__awaiting_refugee` + - `social_security__awaiting_protected_person` + - `child_disability_allowance__payment` + - `child_disability_allowance__payment_to` + - `child_disability_allowance__child_with_serious_disability` + - `child_disability_allowance__care_in_home` + - `child_disability_allowance__approved_weekly_accomodation` + - `child_disability_allowance__granted` + - `social_security__temporary_ob_or_ucb_caregiver` + - `social_security__care_and_control` + - `has_disability` + +* Breaking changes: + - `immigration__recognised_refugee` period changed from month to day + - `child_disability_allowance__eligible` formula and period changed + - `child_disability_allowance__family_has_eligible_child` formula and period changed + - `child_disability_allowance__allowance_criteria` formula and period changed + - `child_disability_allowance__constant_care_exceeding_12_months` + +* Renamed variables: + - `income_tax__principal_caregiver` renamed to `social_security__principal_caregiver` this affects: + - `orphans_benefit__entitled` + - `supported_living_payment__entitled` + - `unsupported_child__entitled` + - `childcare_assistance__eligible_childcare_subsidy` + - `social_security__disability_self_inflicted` renamed to `supported_living_payment__disability_self_inflicted` + +Added new feature in folder `ōpenfisca_aotearoa/api_examples`. This is a space for example http calls to help illustrate how to call the API. +Added example calls for entities, parameters, variables and then `acts/social_security/child_disability_allowance` as per project structure + ### 20.1.1 - [48](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/48) * Test case. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 815139e0..994e9db7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ $~$ # Pull requests -We follow the [GitHub Flow](https://guides.github.com/introduction/flow/): all code contributions are submitted via a pull request towards the `master` branch. +We follow the [GitHub Flow](https://guides.github.com/introduction/flow/): all code contributions are submitted via a pull request towards the `main` branch. Opening a Pull Request means you want that code to be merged. If you want to only discuss it, send a link to your branch along with your questions through whichever communication channel you prefer. diff --git a/openfisca_aotearoa/api_examples/README.md b/openfisca_aotearoa/api_examples/README.md new file mode 100644 index 00000000..4a44c1ff --- /dev/null +++ b/openfisca_aotearoa/api_examples/README.md @@ -0,0 +1,7 @@ +# Example API calls + +The *.http files in this directory and sub directories store example calls against the OpenFisca API. + +If you are utilising VSCode you can easily run these files by installing the `humao.rest-client` (vscode extension)[https://marketplace.visualstudio.com/items?itemName=humao.rest-client] + +Before running them you will need to ensure the API is running with `make serve` \ No newline at end of file diff --git a/openfisca_aotearoa/api_examples/acts/social_security/child_disability_allowance/child_disability_allowance.http b/openfisca_aotearoa/api_examples/acts/social_security/child_disability_allowance/child_disability_allowance.http new file mode 100644 index 00000000..12a40669 --- /dev/null +++ b/openfisca_aotearoa/api_examples/acts/social_security/child_disability_allowance/child_disability_allowance.http @@ -0,0 +1,69 @@ +POST http://localhost:5000/calculate HTTP/1.1 +content-type: application/json + +{ + "persons": { + "Mama": { + "social_security__principal_caregiver" : { + "2019-01": true + }, + "child_disability_allowance__eligible" : { + "2019-W02": null + }, + "child_disability_allowance__payment" : { + "2019-W02": null + } + }, + "Papa": { + "social_security__temporary_ob_or_ucb_caregiver" : { + "2019-W02": true + }, + "child_disability_allowance__eligible" : { + "2019-W02": null + }, + "child_disability_allowance__payment" : { + "2019-W02": null + } + }, + "Tama_disabled_child": { + "age" : { + "day:2019-01-07:7": 5 + }, + "has_disability" : { + "2019-01": true + }, + "child_disability_allowance__constant_care_exceeding_12_months" : { + "2019-W02": true + }, + "child_disability_allowance__care_in_home" : { + "2019-W02": true + }, + "child_disability_allowance__eligible" : { + "2019-W02": null + }, + "child_disability_allowance__payment" : { + "2019-W02": null + } + }, + "Tamahine_able_bodied_teenager": { + "age" : { + "day:2019-01-07:7": 19 + }, + "child_disability_allowance__eligible" : { + "2019-W02": null + }, + "child_disability_allowance__payment" : { + "2019-W02": null + } + } + }, + "families": { + "Whanau_tahi": { + "principal": "Mama", + "children": [ + "Tama_disabled_child", "Tamahine_able_bodied_teenager" + ], + "others" : "Papa" + } + } +} \ No newline at end of file diff --git a/openfisca_aotearoa/api_examples/entities.http b/openfisca_aotearoa/api_examples/entities.http new file mode 100644 index 00000000..6aafc98d --- /dev/null +++ b/openfisca_aotearoa/api_examples/entities.http @@ -0,0 +1 @@ +GET http://localhost:5000/entities HTTP/1.1 \ No newline at end of file diff --git a/openfisca_aotearoa/api_examples/parameters.http b/openfisca_aotearoa/api_examples/parameters.http new file mode 100644 index 00000000..b97a6820 --- /dev/null +++ b/openfisca_aotearoa/api_examples/parameters.http @@ -0,0 +1 @@ +GET http://localhost:5000/parameters HTTP/1.1 \ No newline at end of file diff --git a/openfisca_aotearoa/api_examples/variables.http b/openfisca_aotearoa/api_examples/variables.http new file mode 100644 index 00000000..c89af82d --- /dev/null +++ b/openfisca_aotearoa/api_examples/variables.http @@ -0,0 +1 @@ +GET http://localhost:5000/variables HTTP/1.1 \ No newline at end of file diff --git a/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/child_age_threshold.yaml b/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/child_age_threshold.yaml deleted file mode 100644 index 4e04853c..00000000 --- a/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/child_age_threshold.yaml +++ /dev/null @@ -1,5 +0,0 @@ -description: Child must be under this age -reference: MSD Policy https://www.workandincome.govt.nz/products/a-z-benefits/child-disability-allowance.html -values: - "2018": - value: 18 diff --git a/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/medical_certification_required_months.yaml b/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/medical_certification_required_months.yaml deleted file mode 100644 index 52c2c1d0..00000000 --- a/openfisca_aotearoa/parameters/entitlements/social_security/child_disability_allowance/medical_certification_required_months.yaml +++ /dev/null @@ -1,5 +0,0 @@ -description: the child has been assessed as needing constant care and attention for at least this many months because of a serious disability -reference: MSD Policy https://www.workandincome.govt.nz/products/a-z-benefits/child-disability-allowance.html -values: - "2018": - value: 12 diff --git a/openfisca_aotearoa/parameters/social_security/child_disability_allowance/base.yaml b/openfisca_aotearoa/parameters/social_security/child_disability_allowance/base.yaml new file mode 100644 index 00000000..d97a3165 --- /dev/null +++ b/openfisca_aotearoa/parameters/social_security/child_disability_allowance/base.yaml @@ -0,0 +1,122 @@ +description: Child Disability Allowance +metadata: +# currency or /1 (rate) or year (never used) + unit: currency +# single_amount or marginal_rate or marginal_amount or value? + type: value + reference: + 2013-07-15: + title: Social Security Act 1964 + href: + - https://www.legislation.govt.nz/act/public/1964/0136/latest/DLM5478527.html#DLM5478527, + - https://www.legislation.govt.nz/act/public/2013/0013/latest/DLM4542346.html +# TODO - requires old act calculation + 2007-03-05: + title: Social Security (Rates of Benefits and Allowances) Order 2007 + href: https://www.legislation.govt.nz/regulation/public/2007/0060/latest/DLM428373.html +# TODO - requires old act calculation + 2008-03-03: + title: Social Security (Rates of Benefits and Allowances) Order 2008 + href: https://www.legislation.govt.nz/regulation/public/2008/0053/latest/DLM1161407.html +# TODO - requires old act calculation + 2009-02-23: + title: Social Security (Rates of Benefits and Allowances) Order 2009 + href: https://www.legislation.govt.nz/regulation/public/2009/0027/latest/DLM1841301.html +# TODO - requires old act calculation + 2010-02-22: + title: Social Security (Rates of Benefits and Allowances) Order 2010 + href: https://www.legislation.govt.nz/regulation/public/2010/0021/latest/DLM2748958.html +# TODO - requires old act calculation + 2010-08-30: + title: Social Security (Rates of Benefits and Allowances) Order (No 2) 2010 + href: https://www.legislation.govt.nz/regulation/public/2010/0289/latest/DLM3185601.html +# TODO - requires old act calculation + 2011-02-21: + title: Social Security (Rates of Benefits and Allowances) Order 2011 + href: https://www.legislation.govt.nz/regulation/public/2011/0016/latest/DLM3561401.html +# TODO - requires old act calculation + 2012-02-27: + title: Social Security (Rates of Benefits and Allowances) Order 2012 + href: https://www.legislation.govt.nz/regulation/public/2012/0021/latest/DLM4299301.html +# TODO - requires old act calculation + 2013-02-25: + title: Social Security (Rates of Benefits and Allowances) Order 2013 + href: https://www.legislation.govt.nz/regulation/public/2013/0019/latest/DLM5032541.html +# TODO - requires old act calculation + 2014-02-24: + title: Social Security (Rates of Benefits and Allowances) Order 2014 + href: https://www.legislation.govt.nz/regulation/public/2014/0039/latest/DLM5941010.html +# TODO - requires old act calculation + 2015-02-23: + title: Social Security (Rates of Benefits and Allowances) Order 2015 + href: https://www.legislation.govt.nz/regulation/public/2015/0033/latest/DLM6387601.html +# TODO - requires old act calculation + 2016-03-07: + title: Social Security (Rates of Benefits and Allowances) Order 2016 + href: https://www.legislation.govt.nz/regulation/public/2016/0053/latest/DLM6746223.html +# TODO - requires old act calculation + 2017-02-27: + title: Social Security (Rates of Benefits and Allowances) Order 2017 + href: https://www.legislation.govt.nz/regulation/public/2017/0030/latest/DLM7118101.html +# TODO - requires old act calculation + 2018-02-26: + title: Social Security (Rates of Benefits and Allowances) Order 2018 + href: https://www.legislation.govt.nz/regulation/public/2018/0019/latest/whole.html +# TODO - requires old act calculation + 2018-11-26: + title: Social Security Act 2018 (As Enacted) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784850.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 + href: https://www.legislation.govt.nz/regulation/public/2020/0013/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 + 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 +clauses: + clause_1: + values: + 2018-11-26: + value: 47.64 + metadata: + reference: + title: Schedule 4, Part 9, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784880.html + 2019-04-01: + value: 48.45 + metadata: + reference: + title: Schedule 2, Part 1, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 49.26 + metadata: + reference: + title: Schedule 2, Part 1, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2020/0013/11.0/whole.html + 2021-04-01: + value: 49.83 + metadata: + reference: + title: Schedule 2, Part 1, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2022-04-01: + value: 52.79 + metadata: + reference: + title: Schedule 2, Part 3, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 56.60 + metadata: + reference: + title: Schedule 2, Part 2, Clause 1 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html diff --git a/openfisca_aotearoa/parameters/social_security/disability_allowance/base.yaml b/openfisca_aotearoa/parameters/social_security/disability_allowance/base.yaml new file mode 100644 index 00000000..da392274 --- /dev/null +++ b/openfisca_aotearoa/parameters/social_security/disability_allowance/base.yaml @@ -0,0 +1,160 @@ +description: Child Disability Allowance +metadata: +# currency or /1 (rate) or year (never used) + unit: currency +# single_amount or marginal_rate or marginal_amount or value? + type: value + reference: + 2013-07-15: + title: Social Security Act 1964 + href: + - https://www.legislation.govt.nz/act/public/1964/0136/latest/DLM5478527.html#DLM5478527, + - https://www.legislation.govt.nz/act/public/2013/0013/latest/DLM4542346.html +# TODO - requires old act calculation + 2007-03-05: + title: Social Security (Rates of Benefits and Allowances) Order 2007 + href: https://www.legislation.govt.nz/regulation/public/2007/0060/latest/DLM428373.html +# TODO - requires old act calculation + 2008-03-03: + title: Social Security (Rates of Benefits and Allowances) Order 2008 + href: https://www.legislation.govt.nz/regulation/public/2008/0053/latest/DLM1161407.html +# TODO - requires old act calculation + 2009-02-23: + title: Social Security (Rates of Benefits and Allowances) Order 2009 + href: https://www.legislation.govt.nz/regulation/public/2009/0027/latest/DLM1841301.html +# TODO - requires old act calculation + 2010-02-22: + title: Social Security (Rates of Benefits and Allowances) Order 2010 + href: https://www.legislation.govt.nz/regulation/public/2010/0021/latest/DLM2748958.html +# TODO - requires old act calculation + 2010-08-30: + title: Social Security (Rates of Benefits and Allowances) Order (No 2) 2010 + href: https://www.legislation.govt.nz/regulation/public/2010/0289/latest/DLM3185601.html +# TODO - requires old act calculation + 2011-02-21: + title: Social Security (Rates of Benefits and Allowances) Order 2011 + href: https://www.legislation.govt.nz/regulation/public/2011/0016/latest/DLM3561401.html +# TODO - requires old act calculation + 2012-02-27: + title: Social Security (Rates of Benefits and Allowances) Order 2012 + href: https://www.legislation.govt.nz/regulation/public/2012/0021/latest/DLM4299301.html +# TODO - requires old act calculation + 2013-02-25: + title: Social Security (Rates of Benefits and Allowances) Order 2013 + href: https://www.legislation.govt.nz/regulation/public/2013/0019/latest/DLM5032541.html +# TODO - requires old act calculation + 2014-02-24: + title: Social Security (Rates of Benefits and Allowances) Order 2014 + href: https://www.legislation.govt.nz/regulation/public/2014/0039/latest/DLM5941010.html +# TODO - requires old act calculation + 2015-02-23: + title: Social Security (Rates of Benefits and Allowances) Order 2015 + href: https://www.legislation.govt.nz/regulation/public/2015/0033/latest/DLM6387601.html +# TODO - requires old act calculation + 2016-03-07: + title: Social Security (Rates of Benefits and Allowances) Order 2016 + href: https://www.legislation.govt.nz/regulation/public/2016/0053/latest/DLM6746223.html +# TODO - requires old act calculation + 2017-02-27: + title: Social Security (Rates of Benefits and Allowances) Order 2017 + href: https://www.legislation.govt.nz/regulation/public/2017/0030/latest/DLM7118101.html +# TODO - requires old act calculation + 2018-02-26: + title: Social Security (Rates of Benefits and Allowances) Order 2018 + href: https://www.legislation.govt.nz/regulation/public/2018/0019/latest/whole.html +# TODO - requires old act calculation + 2018-11-26: + title: Social Security Act 2018 (As Enacted) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784850.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 + href: https://www.legislation.govt.nz/regulation/public/2020/0013/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 + 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 +clauses: + clause_2: + values: + 2018-11-26: + value: 63.22 + metadata: + reference: + title: Schedule 4, Part 9, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784880.html + 2019-04-01: + value: 64.29 + metadata: + reference: + title: Schedule 2, Part 1, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 65.36 + metadata: + reference: + title: Schedule 2, Part 1, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2020/0013/11.0/whole.html + 2021-04-01: + value: 66.11 + metadata: + reference: + title: Schedule 2, Part 1, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2022-04-01: + value: 70.04 + metadata: + reference: + title: Schedule 2, Part 3, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 75.10 + metadata: + reference: + title: Schedule 2, Part 2, Clause 2 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html + clause_3: + values: + 2018-11-26: + value: 39.43 + metadata: + reference: + title: Schedule 4, Part 9, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784880.html + 2019-04-01: + value: 40.10 + metadata: + reference: + title: Schedule 2, Part 1, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2019/0027/latest/whole.html + 2020-04-01: + value: 40.77 + metadata: + reference: + title: Schedule 2, Part 1, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2020/0013/11.0/whole.html + 2021-04-01: + value: 41.24 + metadata: + reference: + title: Schedule 2, Part 1, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2021/0015/latest/whole.html + 2022-04-01: + value: 43.69 + metadata: + reference: + title: Schedule 2, Part 3, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2022/0028/latest/whole.html + 2023-04-01: + value: 46.84 + metadata: + reference: + title: Schedule 2, Part 2, Clause 3 (Child disability allowance and disability allowance) + href: https://www.legislation.govt.nz/regulation/public/2023/0038/latest/whole.html diff --git a/openfisca_aotearoa/tests/social_security/child_disability_allowance.yaml b/openfisca_aotearoa/tests/social_security/child_disability_allowance.yaml index 89391cf2..13fb8001 100644 --- a/openfisca_aotearoa/tests/social_security/child_disability_allowance.yaml +++ b/openfisca_aotearoa/tests/social_security/child_disability_allowance.yaml @@ -1,33 +1,56 @@ --- - name: Child disability allowance - period: 2018-08 + period: 2018-W32 absolute_error_margin: 0 input: persons: Mama: social_security__ordinarily_resident_in_new_zealand: true immigration__resident: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: + month:2018-08:01: true Papa: social_security__ordinarily_resident_in_new_zealand: true immigration__resident: true Tama_disabled_child: age: - "2018-08-01": 5 - social_security__child_with_serious_disability: true + day:2018-08-01:31: 5 + child_disability_allowance__child_with_serious_disability: true + child_disability_allowance__constant_care_exceeding_12_months: true social_security__ordinarily_resident_in_new_zealand: true - social_security__medical_certification_months: 12 - social_security__requires_constant_care_and_attention: true Tamahine_able_bodied_teenager: age: - "2018-08-01": 19 + day:2018-08-01:31: 19 families: Whanau_tahi: principal: Mama children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] others: Papa output: + child_disability_allowance__allowance_criteria: + - false # mama (principal carer) + - false # papa + - true # Tama (disabled child) + - false # tamahine (able bodied) + child_disability_allowance__child_with_serious_disability: + - false # mama (principal carer) + - false # papa + - true # Tama (disabled child) + - false # tamahine (able bodied) + child_disability_allowance__constant_care_exceeding_12_months: + - false # mama (principal carer) + - false # papa + - true # Tama (disabled child) + - false # tamahine (able bodied) + child_disability_allowance__family_has_eligible_child: + - true + social_security__principal_caregiver: + month:2018-08: + - true # mama (principal carer) + - false # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) child_disability_allowance__eligible: - true # mama (principal carer) - false # papa @@ -35,46 +58,57 @@ - false # tamahine (able bodied) - name: Child Disability Allowance, eligible - period: 2018-08 + period: 2018-W32 absolute_error_margin: 0 input: persons: Koro: immigration__resident: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: + month:2018-08: true Tama_disabled_child: age: - "2018-08-01": 17 - social_security__child_with_serious_disability: true + day:2018-08-01:31: 17 + child_disability_allowance__child_with_serious_disability: true social_security__ordinarily_resident_in_new_zealand: true - social_security__medical_certification_months: 12 - social_security__requires_constant_care_and_attention: true + child_disability_allowance__constant_care_exceeding_12_months: true families: Whanau: children: [Tama_disabled_child] principal: Koro output: + social_security__principal_caregiver: + month:2018-08: + - true + - false + child_disability_allowance__allowance_criteria: + - false + - true + child_disability_allowance__family_has_eligible_child: + - true child_disability_allowance__eligible: - true # Koro - false # Tama - name: Child disability allowance - constant care not needed - period: 2018-08 + period: 2018-W31 absolute_error_margin: 0 input: persons: Koro: immigration__resident: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: + month:2018-07:2: true Tama_disabled_child: age: - "2018-08-01": 17 - social_security__child_with_serious_disability: true + day:2018-07-30:7: 17 + has_disability: + month:2018-07:2: true social_security__ordinarily_resident_in_new_zealand: true - social_security__medical_certification_months: 12 - social_security__requires_constant_care_and_attention: false + child_disability_allowance__constant_care_exceeding_12_months: false + social_security__financially_independent: false families: Whanau: principal: Koro @@ -86,7 +120,7 @@ - name: Child disability allowance - no principal carer - period: 2018-08 + period: 2018-W31 absolute_error_margin: 0 input: persons: @@ -95,10 +129,9 @@ social_security__ordinarily_resident_in_new_zealand: true Tama_disabled_child: age: - "2018-08-01": 5 - social_security__child_with_serious_disability: true - social_security__requires_constant_care_and_attention: true - social_security__medical_certification_months: 12 + day:2018-07-30:7: 5 + child_disability_allowance__child_with_serious_disability: true + child_disability_allowance__constant_care_exceeding_12_months: true families: Whanau: children: [Tama_disabled_child] @@ -109,45 +142,21 @@ - false # Tama - name: Child disability allowance - child too old - period: 2018-08 - absolute_error_margin: 0 - input: - persons: - Koro: - immigration__resident: true - social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true - Tama_disabled_child: - age: - "2018-08-01": 19 - social_security__child_with_serious_disability: true - social_security__requires_constant_care_and_attention: true - social_security__medical_certification_months: 12 - families: - Whanau: - children: [Tama_disabled_child] - principal: Koro - output: - child_disability_allowance__eligible: - - false # Koro - - false # Tama - - -- name: Child disability allowance - Disabled for less than 12 months - period: 2018-08 + period: 2018-W31 absolute_error_margin: 0 input: persons: Koro: immigration__resident: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: + month:2018-07:2: true Tama_disabled_child: age: - "2018-08-01": 17 - social_security__child_with_serious_disability: true - social_security__requires_constant_care_and_attention: true - social_security__medical_certification_months: 11 + day:2018-07-30:7: 19 + has_disability: + month:2018-07:2: true + child_disability_allowance__constant_care_exceeding_12_months: true families: Whanau: children: [Tama_disabled_child] diff --git a/openfisca_aotearoa/tests/social_security/child_disability_allowance/base.yaml b/openfisca_aotearoa/tests/social_security/child_disability_allowance/base.yaml new file mode 100644 index 00000000..791a2759 --- /dev/null +++ b/openfisca_aotearoa/tests/social_security/child_disability_allowance/base.yaml @@ -0,0 +1,338 @@ +--- + +- name: Child disability allowance with principal caregiver + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: true + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + child_disability_allowance__eligible: + - true # mama (principal carer) + - false # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) + +- name: Child disability allowance with temporary OB or UCB caregiver + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: false + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + child_disability_allowance__eligible: + - false # mama (principal carer) + - true # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) + +- name: Child disability allowance with care and control + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: false + Papa: + social_security__care_and_control: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + child_disability_allowance__eligible: + - false # mama (principal carer) + - true # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) + +- name: Child disability allowance with ufb and care and control + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__temporary_ob_or_ucb_caregiver: false + Papa: + social_security__care_and_control: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + child_disability_allowance__eligible: + - false # mama (principal carer) + - true # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) +- name: Child disability allowance with UCB caregiver care and control + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: false + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Papa2: + social_security__care_and_control: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: [ Papa, Papa2 ] + output: + child_disability_allowance__eligible: + - false # mama (principal carer) + - true # papa + - false # papa2 + - false # Tama (disabled child) + - false # tamahine (able bodied) + +- name: Child disability allowance with principal caregiver, UCB caregiver care and control + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: true + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Papa2: + social_security__care_and_control: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: [ Papa, Papa2 ] + output: + child_disability_allowance__eligible: + - true # mama (principal carer) + - false # papa + - false # papa2 + - false # Tama (disabled child) + - false # tamahine (able bodied) +- name: Child disability allowance with unlawfully present principal caregiver + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: true + social_security__unlawfully_resident_or_present: + - true + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + social_security__general_limitation: + - false # mama (principal carer) + - true # papa + - true # Tama (disabled child) + - true # tamahine (able bodied) + child_disability_allowance__eligible: + - false # mama (principal carer) + - true # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) +- name: Child disability allowance with unlawful principal caregiver, unlawful UCB caregiver care and control + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: true + social_security__unlawfully_resident_or_present: + - true + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + social_security__unlawfully_resident_or_present: + - true + Papa2: + social_security__care_and_control: true + social_security__unlawfully_resident_or_present: + - false + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: [ Papa, Papa2 ] + output: + social_security__general_limitation: + - false # mama (principal carer) + - false # papa + - true # papa2 + - true # Tama (disabled child) + - true # tamahine (able bodied) + child_disability_allowance__eligible: + - false # mama (principal carer) + - false # papa + - true # papa2 + - false # Tama (disabled child) + - false # tamahine (able bodied) + +- name: Child disability allowance with principal caregiver calculated amount + period: 2019-W02 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__principal_caregiver: + 2019-01: true + Papa: + social_security__temporary_ob_or_ucb_caregiver: true + Tama_disabled_child: + age: + day:2019-01-07:7: 5 + has_disability: + 2019-01: true + child_disability_allowance__constant_care_exceeding_12_months: true + child_disability_allowance__care_in_home: true + Tamahine_able_bodied_teenager: + age: + day:2019-01-07:7: 19 + families: + Whanau_tahi: + principal: Mama + children: [ Tama_disabled_child, Tamahine_able_bodied_teenager] + others: Papa + output: + child_disability_allowance__eligible: + - true # mama (principal carer) + - false # papa + - false # Tama (disabled child) + - false # tamahine (able bodied) + child_disability_allowance__payment: + - 47.64 # mama (principal carer) + - 0 # papa + - 0 # Tama (disabled child) + - 0 # tamahine (able bodied) + +- name: Testing amounts + period: 2019-W02 + absolute_error_margin: 0 + input: + child_disability_allowance__eligible: + 2019-W01: [true, false] + 2020-W01: [true, false] + 2021-W01: [true, false] + 2021-W23: [true, false] + 2022-W01: [true, false] + 2023-W01: [true, false] + output: + child_disability_allowance__payment: + 2019-W01: [47.64, 0] + 2020-W01: [48.45, 0] + 2021-W01: [49.26, 0] + 2021-W23: [49.83, 0] + 2022-W01: [49.83, 0] + 2023-W01: [52.79, 0] diff --git a/openfisca_aotearoa/tests/social_security/childcare_subsidy.yaml b/openfisca_aotearoa/tests/social_security/childcare_subsidy.yaml index 839849c5..07eefc9c 100644 --- a/openfisca_aotearoa/tests/social_security/childcare_subsidy.yaml +++ b/openfisca_aotearoa/tests/social_security/childcare_subsidy.yaml @@ -7,7 +7,7 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: "week:2018-W01:52": true @@ -40,7 +40,7 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: "week:2018-W01:52": true @@ -74,16 +74,16 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: - "week:2018-W01:52": true + "week:2018-W31:5": true age: - "2018-08-01": 5 + "day:2018-07-30:32": 5 early_childcare_hours_participation_per_week: 3 - social_security__child_with_serious_disability: true - social_security__requires_constant_care_and_attention: true - social_security__medical_certification_months: 12 + child_disability_allowance__child_with_serious_disability: + "week:2018-W31:5": true + child_disability_allowance__constant_care_exceeding_12_months: true citizenship__citizen: true attending_school: true families: @@ -110,7 +110,7 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: "week:2018-W01:52": true @@ -144,7 +144,7 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: "week:2018-W01:52": true @@ -171,7 +171,7 @@ "Mama": citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Child": social_security__dependent_child: "week:2018-W01:52": true diff --git a/openfisca_aotearoa/tests/social_security/orphans.yaml b/openfisca_aotearoa/tests/social_security/orphans.yaml index 794bb923..fb4b1cb8 100644 --- a/openfisca_aotearoa/tests/social_security/orphans.yaml +++ b/openfisca_aotearoa/tests/social_security/orphans.yaml @@ -11,7 +11,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -38,7 +38,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: false - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -65,7 +65,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -92,7 +92,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -118,7 +118,7 @@ immigration__resident: true social_security__parent_of_dependent_child: false social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -146,7 +146,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": age: "day:2018-07-30:28": 5 @@ -172,7 +172,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -201,7 +201,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: false + social_security__principal_caregiver: false "Tama": immigration__resident: true age: @@ -230,7 +230,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": citizenship__citizen: true age: diff --git a/openfisca_aotearoa/tests/social_security/residence_for_benefits.yaml b/openfisca_aotearoa/tests/social_security/residence_for_benefits.yaml index 15b99e2a..23a27642 100644 --- a/openfisca_aotearoa/tests/social_security/residence_for_benefits.yaml +++ b/openfisca_aotearoa/tests/social_security/residence_for_benefits.yaml @@ -67,7 +67,7 @@ - true # Mary - true # Barry - false # Larry -- name: Test for residence status appropriate for recieving benefits for 2018 ACT +- name: Test for residence status appropriate for recieving benefits for 2018 ACT, Section 16 Residential requirement period: 2020-W32 absolute_error_margin: 0 input: @@ -100,7 +100,7 @@ social_security__resided_continuously_nz_2_years_citizen_or_resident: false Mary: immigration__recognised_refugee: - 2020-08: false + day:2020-08-03:7: false immigration__resident: false social_security__ordinarily_resident_in_country_with_reciprocity_agreement: true years_resided_continuously_in_new_zealand: @@ -113,7 +113,7 @@ social_security__resided_continuously_nz_2_years_citizen_or_resident: false Larry: immigration__recognised_refugee: - 2020-08: false + day:2020-08-03:7: false immigration__resident: false social_security__ordinarily_resident_in_country_with_reciprocity_agreement: true years_resided_continuously_in_new_zealand: @@ -146,3 +146,38 @@ - true # Mary - true # Barry - false # Larry +- name: Test for general limitation for recieving benefits for 2018 ACT section 19 + period: 2020-W32 + absolute_error_margin: 0 + input: + persons: + Mama: + social_security__unlawfully_resident_or_present: true + immigration__temporary_entry_class_visa: true + Papa: + social_security__unlawfully_resident_or_present: true + immigration__temporary_entry_class_visa: false + Tamahine: + social_security__unlawfully_resident_or_present: false + immigration__temporary_entry_class_visa: true + TamahineRua: + social_security__unlawfully_resident_or_present: false + immigration__temporary_entry_class_visa: false + Barry: + social_security__unlawfully_resident_or_present: true + social_security__refugee_or_protected_person: true + immigration__temporary_entry_class_visa: true + immigration__recognised_refugee: + day:2020-08-03:7: true + Larry: + social_security__unlawfully_resident_or_present: false + immigration__temporary_entry_class_visa: false + social_security__refugee_or_protected_person: true + output: + social_security__general_limitation: + - false # mama + - false # papa + - false # tamahine + - true # TamahineRua + - true # Barry + - true # Larry diff --git a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml index 8f248e1f..181f13c8 100644 --- a/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml +++ b/openfisca_aotearoa/tests/social_security/supported_living_payment.yaml @@ -48,7 +48,7 @@ citizenship__citizen: true supported_living_payment__restricted_work_capacity: true supported_living_payment__below_income_threshold: true - social_security__disability_self_inflicted: true + supported_living_payment__disability_self_inflicted: true social_security__residential_requirement: true output: supported_living_payment__entitled: false diff --git a/openfisca_aotearoa/tests/social_security/unsupported_child.yaml b/openfisca_aotearoa/tests/social_security/unsupported_child.yaml index 4d99c5b2..8e3f0aca 100644 --- a/openfisca_aotearoa/tests/social_security/unsupported_child.yaml +++ b/openfisca_aotearoa/tests/social_security/unsupported_child.yaml @@ -11,7 +11,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -38,7 +38,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: false - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -65,7 +65,7 @@ social_security__parent_of_dependent_child: true social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -92,7 +92,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -120,7 +120,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -146,7 +146,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true "Tama": immigration__resident: true age: @@ -174,7 +174,7 @@ social_security__parent_of_dependent_child: false social_security__principal_carer_for_one_year_from_application_date: true social_security__ordinarily_resident_in_new_zealand: true - income_tax__principal_caregiver: true + social_security__principal_caregiver: true families: "Whanau tahi": principal: "Mama" diff --git a/openfisca_aotearoa/variables/acts/immigration/residence.py b/openfisca_aotearoa/variables/acts/immigration/residence.py index 925ff6d9..ae2a1c6d 100644 --- a/openfisca_aotearoa/variables/acts/immigration/residence.py +++ b/openfisca_aotearoa/variables/acts/immigration/residence.py @@ -4,7 +4,7 @@ # # For more information on OpenFisca's available modules: # https://openfisca.org/doc/openfisca-python-api/index.html -from openfisca_core import periods, variables +from openfisca_core import holders, periods, variables # We import the required `entities` corresponding to our formulas. # @@ -56,8 +56,10 @@ def formula(persons, period, parameters): class immigration__recognised_refugee(variables.Variable): value_type = bool entity = entities.Person - definition_period = periods.MONTH + definition_period = periods.DAY label = "is recognised as a refugee" + set_input = holders.set_input_dispatch_by_period + reference = "https://www.legislation.govt.nz/act/public/2009/0051/latest/whole.html#DLM1440502" class immigration__protected_person(variables.Variable): @@ -65,3 +67,12 @@ class immigration__protected_person(variables.Variable): entity = entities.Person definition_period = periods.MONTH label = "is recognised as a a protected person in New Zealand" + + +class immigration__temporary_entry_class_visa(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.DAY + reference = "https://www.legislation.govt.nz/act/public/2009/0051/latest/whole.html#DLM1440546" + label = "means a temporary visa, a limited visa, or an interim visa" + set_input = holders.set_input_dispatch_by_period diff --git a/openfisca_aotearoa/variables/acts/parental_leave/parental_leave.py b/openfisca_aotearoa/variables/acts/parental_leave/parental_leave.py index 8c4f8d33..62fc7767 100644 --- a/openfisca_aotearoa/variables/acts/parental_leave/parental_leave.py +++ b/openfisca_aotearoa/variables/acts/parental_leave/parental_leave.py @@ -26,6 +26,7 @@ def formula_2002(persons, period, parameters): # Mark who is the principal caregiver, as there may be >1 eligible # PPL Section 7 (2) + # TODO This seems an incorrect reference, the legislation doesn't mention principal caregiver nominated = persons("income_tax__principal_caregiver", period) return nominated * (biological_mother + (her_spouse * received_transferred_entitlement) + (other * permanent)) diff --git a/openfisca_aotearoa/variables/acts/social_security/abilities.py b/openfisca_aotearoa/variables/acts/social_security/abilities.py deleted file mode 100644 index 0cdf9b0c..00000000 --- a/openfisca_aotearoa/variables/acts/social_security/abilities.py +++ /dev/null @@ -1,33 +0,0 @@ -"""TODO: Add missing doctring.""" - -from openfisca_core import periods, variables - -from openfisca_aotearoa import entities - - -# TODO: Review against the new 2018 act -class social_security__child_with_serious_disability(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.MONTH - label = "Child has serious disability" - reference = """Social Security Act 1964 Part 1D Child disability allowance 39A - (1)For the purposes of this section and of sections 39B to 39E, child with a serious disability means a dependent child who - (a) has a physical or mental disability; - (b) because of that disability needs constant care and attention; and - (c) is likely to need such care and attention permanently or for a period exceeding 12 months. - """ - - -# TODO: Review against the new 2018 act -class social_security__disability_self_inflicted(variables.Variable): - value_type = bool - entity = entities.Person - definition_period = periods.MONTH - 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 = """ - 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. - """ diff --git a/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance.py b/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance.py index 7328634e..a87d18e1 100644 --- a/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance.py +++ b/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance.py @@ -1,36 +1,28 @@ """TODO: Add missing doctring.""" -from openfisca_core.periods import MONTH -from openfisca_core.variables import Variable +import numpy -from openfisca_aotearoa.entities import Family, Person +from openfisca_core import holders, periods, variables +from openfisca_aotearoa import entities -# TODO: Review against the new 2018 act -class child_disability_allowance__eligible(Variable): - value_type = bool - entity = Person - definition_period = MONTH - label = "Eligible for Child Disability Allowance" - reference = "http://www.legislation.govt.nz/act/public/1964/0136/latest/DLM361659.html" - def formula(persons, period, parameters): - # The applicant +class child_disability_allowance__eligible(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Eligible for Child Disability Allowance discretionary grant" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783266", "#P2-S13", "http://www.legislation.govt.nz/act/public/1964/0136/latest/DLM361659.html" + set_input = holders.set_input_dispatch_by_period + + def formula_1964_12_04(persons, period, parameters): + # This 1964 section was reviewed when writing the 2018 version and it is likely insufficient resident_or_citizen = persons("immigration__citizen_or_resident", period) - is_principal_carer = persons("income_tax__principal_caregiver", period) + is_principal_carer = persons("social_security__principal_caregiver", period.first_month) has_eligible_disabled_child = persons.family("child_disability_allowance__family_has_eligible_child", period) - # http://www.legislation.govt.nz/act/public/1964/0136/latest/DLM363772.html - # Notwithstanding anything to the contrary in this Act or Part 6 of the Veterans’ - # Support Act 2014 or the New Zealand Superannuation and Retirement Income Act 2001, - # the chief executive may, in the chief executive’s discretion, refuse to grant any - # benefit or may terminate or reduce any benefit already granted or may grant a - # benefit at a reduced rate in any case where the chief executive is satisfied— - # (a) that the applicant, or the spouse or partner of the applicant or any person - # in respect of whom the benefit or any part of the benefit is or would be payable, - # is not ordinarily resident in New Zealand; - + # this is possible not correct, in 2018 the general limitation applies resides_in_nz = persons( "social_security__ordinarily_resident_in_new_zealand", period) @@ -39,48 +31,123 @@ def formula(persons, period, parameters): is_principal_carer * \ has_eligible_disabled_child + # Note this is the date the 2018 act commenced + def formula_2018_11_26(persons, period, parameters): + ssa78 = persons.family("child_disability_allowance__family_has_eligible_child", period) + # Note 80, 81 - MSD "may require" points (not coded) + + ssa82 = persons("child_disability_allowance__payment_to", period) + # 83 - test for other benefits, Veteran's Support Act and ACC compensation + + return ssa78 * ssa82 + + +class child_disability_allowance__payment_to(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Manages who is elegible to recieve the payment" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783275", "#s82" + set_input = holders.set_input_dispatch_by_period + + def formula_2018_11_26(persons, period, parameters): + general_limitation = persons("social_security__general_limitation", period) + + # 82 - the allowance is payable to the principal caregiver, temporary OB or UCB caregiver of the child. Or the person "for the time being" + ssa82 = general_limitation * persons("social_security__principal_caregiver", period.first_month) + principals = persons.family.any(general_limitation * persons("social_security__principal_caregiver", period.first_month)) + ssa82 = ssa82 + (numpy.logical_not(principals) * general_limitation * persons("social_security__temporary_ob_or_ucb_caregiver", period)) + ucb = persons.family.any(general_limitation * persons("social_security__temporary_ob_or_ucb_caregiver", period)) + ssa82 = ssa82 + (numpy.logical_not(ucb) * general_limitation * persons("social_security__care_and_control", period)) + + return ssa82 + + +class child_disability_allowance__child_with_serious_disability(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Child with a serious disability" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783270", "#s79-p1", "https://www.legislation.govt.nz/act/public/1964/0136/latest/DLM361659.html" + set_input = holders.set_input_dispatch_by_period + + def formula_2018_11_26(persons, period, parameters): + ssa79_1 = persons("social_security__dependent_child", period) + ssa79_1_a = persons("has_disability", period.first_month) + ssa79_1_b = persons("child_disability_allowance__constant_care_exceeding_12_months", period) + + # ssa79_1_c wrapped up in ssa79_1_b for simplicity + + # ssa79_2 What MSD must consider if discretionary conditions met + # ssa79_2_a + # ssa79_2_b + # ssa79_2_c + + return ssa79_1 * ssa79_1_a * ssa79_1_b + + +class child_disability_allowance__care_in_home(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Cared for in the home of C’s principal caregiver or temporary OB or UCB caregiver" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783267", "#s78-p1-b-i" + set_input = holders.set_input_dispatch_by_period + + +class child_disability_allowance__approved_weekly_accomodation(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Child disability allowance -> approved_weekly_accomodation" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783269", "#s78-p1-b-ii" + set_input = holders.set_input_dispatch_by_period + -class child_disability_allowance__family_has_eligible_child(Variable): +class child_disability_allowance__family_has_eligible_child(variables.Variable): value_type = bool - entity = Family - definition_period = MONTH - label = "Does the family have a child who meets the criteria for disabled" - reference = "http://legislation.govt.nz/bill/government/2017/0004/15.0/DLM7512349.html" + entity = entities.Family + definition_period = periods.WEEK + label = "Does the family have a child who meets the criteria for the child disability allowance" def formula(families, period, parameters): - has_disability = families.members("child_disability_allowance__allowance_criteria", period) - child_age_threshold = parameters(period).entitlements.social_security.child_disability_allowance.child_age_threshold - children = families.members("age", period.start) <= child_age_threshold - disabled_children = has_disability * children - return families.any(disabled_children, role=Family.CHILD) + hd = families.members("child_disability_allowance__allowance_criteria", period) + return families.any(hd, role=entities.Family.CHILD) -# TODO: Review against the new 2018 act -class child_disability_allowance__allowance_criteria(Variable): +class child_disability_allowance__allowance_criteria(variables.Variable): value_type = bool - entity = Person + entity = entities.Person label = "Has serious disability" - definition_period = MONTH + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783267", "#s78", "http://www.legislation.govt.nz/act/public/1964/0136/latest/DLM361659.html" + set_input = holders.set_input_dispatch_by_period - def formula(persons, period, parameters): - med_cert_required_months = parameters(period).entitlements.social_security.child_disability_allowance.medical_certification_required_months + def formula_1964_12_04(persons, period, parameters): - return persons("social_security__child_with_serious_disability", period) * \ - persons("social_security__requires_constant_care_and_attention", period) * \ - (persons("social_security__medical_certification_months", period) >= med_cert_required_months) + return persons("child_disability_allowance__child_with_serious_disability", period) + # Note this is the date the 2018 act commenced + def formula_2018_11_26(persons, period, parameters): + ssa78_1a = persons("child_disability_allowance__child_with_serious_disability", period) + ssa78_1b_i = persons.family.members("child_disability_allowance__care_in_home", period) + ssa78_1b_ii = persons.family.members("child_disability_allowance__approved_weekly_accomodation", period) -# TODO: Review against the new 2018 act -class social_security__medical_certification_months(Variable): - value_type = int - entity = Person - label = "Number of future months the disability is expected to last for, in months" - definition_period = MONTH + return ssa78_1a * (ssa78_1b_i + ssa78_1b_ii) -# TODO: Review against the new 2018 act -class social_security__requires_constant_care_and_attention(Variable): +class child_disability_allowance__constant_care_exceeding_12_months(variables.Variable): value_type = bool - entity = Person + entity = entities.Person label = "Requires constant care and attention" - definition_period = MONTH + definition_period = periods.ETERNITY + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783270", "#s79-p1-c" + + +class child_disability_allowance__granted(variables.Variable): + value_type = bool + default_value = False + entity = entities.Person + label = "Person is currently granted the Child Disability Allowace" + definition_period = periods.WEEK + reference = "Variable is useful for checking: 'granted a main benefit'" diff --git a/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance__payment.py b/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance__payment.py new file mode 100644 index 00000000..58d809d0 --- /dev/null +++ b/openfisca_aotearoa/variables/acts/social_security/child_disability_allowance/child_disability_allowance__payment.py @@ -0,0 +1,28 @@ +"""This module provides eligibility and amount for Jobseeker Support.""" + +# We import the required OpenFisca modules needed to define a formula. +# +# For more information on OpenFisca's available modules: +# https://openfisca.org/doc/openfisca-python-api/index.html +from openfisca_core import periods, variables + +# We import the required `entities` corresponding to our formulas. +# +# Entities are an OpenFisca abstraction that allows us to model legislation's +# `subjects of law`: person, couple, family, household, and so on. +# +# For more information on OpenFisca's `entities`: +# https://openfisca.org/doc/key-concepts/person,_entities,_role.html +from openfisca_aotearoa import entities + + +class child_disability_allowance__payment(variables.Variable): + value_type = float + entity = entities.Person + definition_period = periods.WEEK + label = "Rate of child disability allowance" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#LMS118455", "#sd4-P9-tb1-tr1" + + def formula_2018_11_26(people, period, parameters): + child_disability_allowance = parameters(period.first_day).social_security.child_disability_allowance.base.clauses["clause_1"] + return people("child_disability_allowance__eligible", period) * child_disability_allowance diff --git a/openfisca_aotearoa/variables/acts/social_security/interpretation/relationship.py b/openfisca_aotearoa/variables/acts/social_security/interpretation/relationship.py index 7dc95c05..7c5d11b0 100644 --- a/openfisca_aotearoa/variables/acts/social_security/interpretation/relationship.py +++ b/openfisca_aotearoa/variables/acts/social_security/interpretation/relationship.py @@ -5,6 +5,7 @@ from openfisca_aotearoa import entities +# TODO: Review against the new 2018 act class social_security__been_married_or_civil_union_or_de_facto_relationship(variables.Variable): value_type = bool entity = entities.Person @@ -18,6 +19,7 @@ class social_security__parent(variables.Variable): entity = entities.Person definition_period = periods.MONTH label = "Is a parent?" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784624", "#sd2-d138" class social_security__principal_caregiver(variables.Variable): @@ -26,4 +28,22 @@ class social_security__principal_caregiver(variables.Variable): definition_period = periods.MONTH label = "Principal Caregiver in relation to a dependent child" set_input = holders.set_input_dispatch_by_period - reference = "https://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM6784656" + reference = "https://legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784655", "#sd2-d155", "https://legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM360463" + + +class social_security__temporary_ob_or_ucb_caregiver(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "Principal Temporary Caregiver in relation to a child AND is entitled to and receiving an orphan’s benefit or an unsupported child’s benefit for the child" + set_input = holders.set_input_dispatch_by_period + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#LMS515263", "#sd2-d216" + + +class social_security__care_and_control(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.WEEK + label = "The person for the time being having the care and control of the child" + set_input = holders.set_input_dispatch_by_period + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783275", "#s82-l1" diff --git a/openfisca_aotearoa/variables/acts/social_security/orphans_benefit/orphans_benefit.py b/openfisca_aotearoa/variables/acts/social_security/orphans_benefit/orphans_benefit.py index 4ad70c41..9b8ef070 100644 --- a/openfisca_aotearoa/variables/acts/social_security/orphans_benefit/orphans_benefit.py +++ b/openfisca_aotearoa/variables/acts/social_security/orphans_benefit/orphans_benefit.py @@ -36,7 +36,7 @@ def formula(persons, period, parameters): one_year = persons( "social_security__principal_carer_for_one_year_from_application_date", period) - is_principal_carer = persons("income_tax__principal_caregiver", period) + is_principal_carer = persons("social_security__principal_caregiver", period) has_orphaned_child_in_family = persons.family( "social_security__orphaned_child_in_family", period) diff --git a/openfisca_aotearoa/variables/acts/social_security/resident.py b/openfisca_aotearoa/variables/acts/social_security/resident.py index 24048898..3150d328 100644 --- a/openfisca_aotearoa/variables/acts/social_security/resident.py +++ b/openfisca_aotearoa/variables/acts/social_security/resident.py @@ -1,5 +1,7 @@ """This module provides eligibility and amount for Jobseeker Support.""" +import numpy + # We import the required OpenFisca modules needed to define a formula. # # For more information on OpenFisca's available modules: @@ -21,7 +23,7 @@ class social_security__residential_requirement(variables.Variable): entity = entities.Person label = "Residential requirements for certain benefits, calculates for the 1964 and the 2018 Social Security Acts" definition_period = periods.WEEK - 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", "#s16", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796" set_input = holders.set_input_dispatch_by_period # Note this is the date the 1964 act commenced, but jobseeker came later @@ -33,7 +35,7 @@ def formula_1964_12_04(persons, period, parameters): ssa64_74aa_1_b = persons("social_security__ordinarily_resident_in_new_zealand", period.first_month) - ssa64_74aa_1_c = persons("immigration__recognised_refugee", period.first_month) \ + ssa64_74aa_1_c = persons("immigration__recognised_refugee", period.first_day) \ + persons("immigration__protected_person", period.first_month) \ + persons("social_security__resided_continuously_nz_2_years_citizen_or_resident", period) @@ -56,7 +58,7 @@ def formula_2018_11_26(persons, period, parameters): ssa16_2_a_i = persons("social_security__resided_continuously_nz_2_years_citizen_or_resident", periods.ETERNITY) - ssa16_2_a_ii = persons("immigration__recognised_refugee", period.first_month) + \ + ssa16_2_a_ii = persons("immigration__recognised_refugee", period.first_day) + \ persons("immigration__protected_person", period.first_month) ssa16_2_b = persons("social_security__ordinarily_resident_in_country_with_reciprocity_agreement", period) * (persons("years_resided_continuously_in_new_zealand", period.first_month) >= 2) @@ -74,7 +76,7 @@ class social_security__ordinarily_resident_in_new_zealand(variables.Variable): entity = entities.Person label = "is ordinarily resident in New Zealand" definition_period = periods.ETERNITY - reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784616", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM360407", "https://www.openlaw.nz/case/2014NZCA611" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6784616", "#sd2-d134", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM360407", "https://www.openlaw.nz/case/2014NZCA611" class social_security__resided_continuously_nz_2_years_citizen_or_resident(variables.Variable): @@ -82,7 +84,7 @@ class social_security__resided_continuously_nz_2_years_citizen_or_resident(varia entity = entities.Person label = "has resided continuously in New Zealand for a period of at least 2 years after becoming a citizen, 16 2(a)i" definition_period = periods.ETERNITY - 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", "#s16-p2-a-i", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796" class social_security__ordinarily_resident_in_country_with_reciprocity_agreement(variables.Variable): @@ -90,4 +92,78 @@ class social_security__ordinarily_resident_in_country_with_reciprocity_agreement entity = entities.Person label = "is ordinarily resident in a country with which New Zealand has a reciprocity agreement" definition_period = periods.ETERNITY - 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", "#s16-p2-b", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796" + + +class social_security__general_limitation(variables.Variable): + value_type = bool + entity = entities.Person + label = "persons unlawfully resident or temporary entry class visa generally not eligible" + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783143", "#s19" + set_input = holders.set_input_dispatch_by_period + + # Note this is the date the 2018 act commenced + def formula_2018_11_26(persons, period, parameters): + + ssa19_1_a = persons("social_security__unlawfully_resident_or_present", period) + ssa19_1_b = persons("immigration__temporary_entry_class_visa", period.first_day) + ssa19_2 = persons("immigration__recognised_refugee", period.first_day) + + return numpy.logical_not(ssa19_1_a + ssa19_1_b) + ssa19_2 + + +class social_security__unlawfully_resident_or_present(variables.Variable): + value_type = bool + entity = entities.Person + label = "Unlawfully resident or present in New Zealand, this is a term not mentioned in the Immigration Act specifically" + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783138", "#s19-p1-a", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796" + + +class social_security__compelled_to_remain(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.DAY + label = "compelled to remain in New Zealand because of unforeseen circumstances, this is a term only found in the social security act and social security regulations, not the immigration act." + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783542", "#s205-p1-c" + + +class social_security__refugee_or_protected_person(variables.Variable): + value_type = bool + default_value = False + entity = entities.Person + label = "Refugee or protected person status, Section 205, only to be utilised with emergency benefit and temporary additional support" + definition_period = periods.WEEK + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783542", "#s205-p1" + set_input = holders.set_input_dispatch_by_period + + # Note this is the date the 2018 act commenced + def formula_2018_11_26(persons, period, parameters): + + ssa205_1_a = persons("social_security__awaiting_refugee", period.first_day) + persons("social_security__awaiting_protected_person", period.first_day) + ssa205_1_b = persons("immigration__recognised_refugee", period.first_day) + persons("immigration__protected_person", period.first_month) + ssa205_1_c = persons("social_security__compelled_to_remain", period) + + # ssa205_2_a refers to where this section is relevant + # ssa205_2_b refers to where this section is relevant + + # ssa205_3 indications which section this section overrides + + return ssa205_1_a + ssa205_1_b + ssa205_1_c + + +class social_security__awaiting_refugee(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.DAY + label = " is awaiting the outcome of the person’s claim for recognition as a refugee" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783542", "#s205-p1-a" + + +class social_security__awaiting_protected_person(variables.Variable): + value_type = bool + entity = entities.Person + definition_period = periods.DAY + label = " is awaiting the outcome of the person’s claim for recognition as a protected person" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783542", "#s205-p1-a" 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 db1549a5..1755f7d0 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 @@ -88,7 +88,7 @@ def formula(persons, period, parameters): # 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("social_security__disability_self_inflicted", period)) + not_self_inflicted = not_(persons("supported_living_payment__disability_self_inflicted", period)) # 40B (1A) An applicant for the supported living payment under # this section must be aged at least 16 years. @@ -114,3 +114,11 @@ class supported_living_payment__base(variables.Variable): value_type = float default_value = 0 definition_period = periods.DateUnit.WEEK + + +class supported_living_payment__disability_self_inflicted(variables.Variable): + value_type = bool + 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" diff --git a/openfisca_aotearoa/variables/acts/social_security/unsupported_child/unsupported_child.py b/openfisca_aotearoa/variables/acts/social_security/unsupported_child/unsupported_child.py index 404015da..297944e2 100644 --- a/openfisca_aotearoa/variables/acts/social_security/unsupported_child/unsupported_child.py +++ b/openfisca_aotearoa/variables/acts/social_security/unsupported_child/unsupported_child.py @@ -40,7 +40,7 @@ def formula(persons, period, parameters): one_year = persons( "social_security__principal_carer_for_one_year_from_application_date", period) - is_principal_carer = persons("income_tax__principal_caregiver", period) + is_principal_carer = persons("social_security__principal_caregiver", period) has_unsupported_child_in_family = persons.family( "unsupported_child__unsupported_child_in_family", period) diff --git a/openfisca_aotearoa/variables/demographics/health.py b/openfisca_aotearoa/variables/demographics/health.py index f7407921..a7368333 100644 --- a/openfisca_aotearoa/variables/demographics/health.py +++ b/openfisca_aotearoa/variables/demographics/health.py @@ -2,7 +2,7 @@ from datetime import date -from openfisca_core import periods, variables +from openfisca_core import holders, periods, variables from openfisca_aotearoa import entities @@ -29,3 +29,12 @@ class totally_blind(variables.Variable): entity = entities.Person definition_period = periods.ETERNITY label = "Person is totally blind" + + +class has_disability(variables.Variable): + value_type = bool + entity = entities.Person + label = "Person has a disability" + definition_period = periods.MONTH + reference = "This appears to not be defined within legislation" + set_input = holders.set_input_dispatch_by_period diff --git a/openfisca_aotearoa/variables/regulation/social_security/childcare_assistance/childcare_subsidy.py b/openfisca_aotearoa/variables/regulation/social_security/childcare_assistance/childcare_subsidy.py index ad507f73..1affb237 100644 --- a/openfisca_aotearoa/variables/regulation/social_security/childcare_assistance/childcare_subsidy.py +++ b/openfisca_aotearoa/variables/regulation/social_security/childcare_assistance/childcare_subsidy.py @@ -20,7 +20,7 @@ def formula(persons, period, parameters): normally_in_nz = persons("social_security__ordinarily_resident_in_new_zealand", period) income_below_threshold = persons.family("childcare_assistance__household_income_below_childcare_subsidy_threshold", period) - is_principal_carer = persons("income_tax__principal_caregiver", period) + is_principal_carer = persons("social_security__principal_caregiver", period) under_5_years_28_days_not_attending_school = persons.family( "childcare_assistance__family_has_resident_child_under_5_not_in_school", period) @@ -88,7 +88,7 @@ def formula(families, period, parameters): dependent_children = families.members( "social_security__dependent_child", period.first_week) eligible_children = families( - "child_disability_allowance__family_has_eligible_child", period) + "child_disability_allowance__family_has_eligible_child", period.first_week) under_6 = families.members("age", period.start) < 6 citizens_and_residents = families.members( "immigration__citizen_or_resident", period) diff --git a/openfisca_aotearoa/variables/regulation/student_allowance/eligible.py b/openfisca_aotearoa/variables/regulation/student_allowance/eligible.py index fc30e437..744dd294 100644 --- a/openfisca_aotearoa/variables/regulation/student_allowance/eligible.py +++ b/openfisca_aotearoa/variables/regulation/student_allowance/eligible.py @@ -29,7 +29,7 @@ def formula(persons, period, parameters): # (iii) satisfies the chief executive that he or she is recognised under the Immigration # Act 2009 as a refugee or a protected person and is entitled under the Immigration # Act 2009 to reside indefinitely in New Zealand; or - refugee_or_protected = persons("immigration__recognised_refugee", period) + persons("immigration__protected_person", period) + refugee_or_protected = persons("immigration__recognised_refugee", period.first_day) + persons("immigration__protected_person", period) # (iv) satisfies the chief executive that he or she is entitled under the Immigration Act # 2009 to reside indefinitely in New Zealand and was sponsored into New Zealand by a diff --git a/pyproject.toml b/pyproject.toml index 22b05544..d0a68aaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ license = "AGPL-3.0-only" authors = [ "Asghar Hussain Kazi ", "Brenda Wallace ", - "Hamish Fraser ", + "Hamish Fraser ", "Jonah Duckles ", "Mauko Quiroga Alvarado ", "Pia Andrews ", @@ -14,13 +14,13 @@ authors = [ maintainers = [ "Asghar Hussain Kazi ", "Brenda Wallace ", - "Hamish Fraser ", + "Hamish Fraser ", "Jonah Duckles ", "Mauko Quiroga Alvarado ", "Pia Andrews ", ] readme = "README.md" -homepage = "https://benefitme.nz" +homepage = "https://github.com/digitalaotearoa/openfisca-aotearoa" repository = "https://github.com/digitalaotearoa/openfisca-aotearoa" documentation = "https://openfisca.org/doc" keywords = ["microsimulation", "tax", "benefit", "rac", "rules-as-code"]