Skip to content

Commit

Permalink
Accident Compensation Act - Loss of Earnings and Loss of Potential Ea…
Browse files Browse the repository at this point in the history
…rnings
  • Loading branch information
Br3nda committed May 14, 2019
1 parent f2b160f commit 7b6328c
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog

# 11.3.0 [178](https://github.com/ServiceInnovationLab/openfisca-aotearoa/pull/178)
* Accident Compensation Act - Loss of Earnings and Loss of Potential Earnings

# 11.2.0 [176](https://github.com/ServiceInnovationLab/openfisca-aotearoa/pull/176)
* Bug Fix
- Rates Rebate algorithm formula incorrectly allowed negative excess income
Expand Down
@@ -0,0 +1,5 @@
description: ACC Weekly Compensation Abatement
reference: http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM104829.html
values:
2001-04-01:
value: 0.8
29 changes: 28 additions & 1 deletion openfisca_aotearoa/structure.json
Expand Up @@ -2,7 +2,34 @@
"acc" : {
"Title":"Accident Compensation Act 2001",
"Type": "Act",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM99494.html"
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM99494.html",
"Children": ["acc_sched_1", "acc_part_2", "acc_part_4"]
},
"acc_sched_1" : {
"Title":"Accident Compensation Act 2001, Schedule 1",
"Type": "Schedule",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM104541.html"
},
"acc_part_2" : {
"Title":"Accident Compensation Act 2001, Part 2",
"Type": "Part",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100676.html"
},
"acc_part_4" : {
"Title":"Accident Compensation Act 2001, Part 4",
"Type": "Part",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100999.html",
"Children": ["incapacity_for_employment", "weekly_compensation"]
},
"weekly_compensation" : {
"Title":"Incapacity for employment, 100 - 101",
"Type": "Section",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM101452.html"
},
"incapacity_for_employment" : {
"Title":"Incapacity for employment, 102 - 106",
"Type": "Section",
"Reference":"http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100999.html"
},
"accommodation_supplement" : {
"Title":"Accommodation Supplement",
Expand Down
105 changes: 105 additions & 0 deletions openfisca_aotearoa/tests/acc/acc_LOPE.yaml
@@ -0,0 +1,105 @@
---
- name: Test LOPE for person in last day of continous training since their 18th birthday
period: 2020-09
absolute_error_margin: 0
input:
acc__earner: false
acc__has_cover:
"2010-08-03": true
acc__part_2__suffered_personal_injury: true
acc__part_3__has_lodged_claim: true
acc__sched_1__engaged_fulltime_study_or_training: false
acc__sched_1__incapacitated_for_6_months: true
acc__sched_1__weekly_earnings: 500
date_of_birth: "2002-08-03"
date_of_injury: "2020-08-05"
finish_date_of_full_time_study_training_bridging_18th_birthday: "2020-08-05"
incapacity_for_employment__corporation_determination: true
acc__lope__incapacity_for_employment__by_covered_injury: true
output:
acc__potential_earner:
"2020-08-06": true
acc__sched_1__lope_eligible:
"2020-09-06": true
acc__part_2__suffered_personal_injury:
"2020-08-06": true
acc__has_cover:
"2020-08-06": true
age:
"2020-08-06": 18

- name: Test LOPE for person injured day after their last day of continous training since their 18th birthday
period: 2020-09
absolute_error_margin: 0
input:
acc__earner: false
acc__has_cover: true
acc__part_2__suffered_personal_injury: true
acc__part_3__has_lodged_claim: true
acc__sched_1__engaged_fulltime_study_or_training: false
acc__sched_1__incapacitated_for_6_months: true
date_of_birth: "2002-08-03"
date_of_injury: "2021-08-06"
finish_date_of_full_time_study_training_bridging_18th_birthday: "2021-08-05"
acc__lope__incapacity_for_employment__by_covered_injury: true
incapacity_for_employment__corporation_determination: true
output:
acc__sched_1__lope_eligible:
"2021-08-06": false

- name: Simple test for LOPE eligibility for person before and after their 18th birthday
period: 2020-09
absolute_error_margin: 0
input:
acc__earner: false
acc__has_cover: true
acc__part_2__suffered_personal_injury: true
acc__part_3__has_lodged_claim: true
acc__sched_1__engaged_fulltime_study_or_training: false
acc__sched_1__incapacitated_for_6_months: true
date_of_birth: "2002-08-03"
date_of_injury: "2019-02-02"
incapacity_for_employment__corporation_determination: true
acc__lope__incapacity_for_employment__by_covered_injury: true
output:
acc__sched_1__lope_eligible:
"2018-01-01": false
"2019-01-01": false
"2020-01-01": false
"2021-01-01": true
"2022-01-01": true

- name: Simple test for LOPE eligibility with entitlement calculation
period: 2020-09
absolute_error_margin: 0
input:
acc__earner: false
acc__has_cover: true
acc__part_2__suffered_personal_injury: true
acc__part_3__has_lodged_claim: true
acc__sched_1__engaged_fulltime_study_or_training: false
acc__sched_1__incapacitated_for_6_months: true
acc__sched_1__weekly_earnings:
"2018-01-01": 0
"2019-01-01": 0
"2020-01-01": 300
"2021-01-01": 0
"2022-01-01": 300
acc__sched_1__minimum_weekly_earnings: 900
date_of_birth: "2002-08-03"
date_of_injury: "2019-02-02"
incapacity_for_employment__corporation_determination: true
acc__lope__incapacity_for_employment__by_covered_injury: true
output:
acc__sched_1__lope_eligible:
"2018-01-01": false
"2019-01-01": false
"2020-01-01": false
"2021-01-01": true
"2022-01-01": true
acc__sched_1__lope_weekly_compensation:
"2018-01-01": 0
"2019-01-01": 0
"2020-01-01": 0
"2021-01-01": 708
"2022-01-01": 408
20 changes: 20 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/105/incapacitated.py
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class incapacity_for_employment__corporation_determination(Variable):
value_type = bool
entity = Person
definition_period = DAY
label = u"Corporation determination of incapacity"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM101462.html"


class acc__lope__incapacity_for_employment__by_covered_injury(Variable):
value_type = bool
entity = Person
definition_period = ETERNITY
label = u"The incapacity is caused by the injury for which they have cover"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM101462.html"
12 changes: 12 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/26/personal_injury.py
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class acc__part_2__suffered_personal_injury(Variable):
value_type = bool
entity = Person
definition_period = ETERNITY
label = u"Has suffered a personal injury"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100910.html"
45 changes: 45 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/3/purpose.py
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class acc__fullfils_purpose_of_act(Variable):
label = "The purpose of this Act is to enhance the public good and reinforce the social contract represented by the first accident compensation scheme by providing for a fair and sustainable scheme for managing personal injury that has, as its overriding goals, minimising both the overall incidence of injury in the community, and the impact of injury on the community (including economic, social, and personal costs),"
value_type = bool
entity = Person
definition_period = MONTH
reference = "Section 3 http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100100.html"

def formula(persons, period, parameters):
return (
(persons('acc__promotes_measures_to_reduce_incidence_and_severity_of_personal_injury', period)
+ persons('acc__the_corporation_exercised_discretion_for_child_care_as_per_section_68_3', period)
)
* persons('acc__has_a_covered_injury', period)
* persons('acc__part_3__has_lodged_claim', period)
* persons('acc__assessed_as_having_a_need_caused_by_this_covered_injury', period)
)


class acc__promotes_measures_to_reduce_incidence_and_severity_of_personal_injury(Variable):
value_type = bool
entity = Person
definition_period = MONTH
label = "establishing as a primary function of the Corporation the promotion of measures to reduce the incidence and severity of personal injury"

# (b)

# providing for a framework for the collection, co-ordination, and analysis of injury-related information:
# (c)

# ensuring that, where injuries occur, the Corporation’s primary focus should be on rehabilitation with the goal of achieving an appropriate quality of life through the provision of entitlements that restores to the maximum practicable extent a claimant’s health, independence, and participation:
# (d)

# ensuring that, during their rehabilitation, claimants receive fair compensation for loss from injury, including fair determination of weekly compensation and, where appropriate, lump sums for permanent impairment:
# (e)

# ensuring positive claimant interactions with the Corporation through the development and operation of a Code of ACC Claimants’ Rights:
# (f)

# ensuring that persons who suffered personal injuries before the commencement of this Act continue to receive entitlements where appropriate.
12 changes: 12 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/32/loss_of_earnings.py
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class weekly_compensation__loss_of_earnings_payable(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Engaged in full-time study or training, does not include full-time study or training in living or social skills"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM104891.html"
23 changes: 23 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/48/lodgeclaim.py
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class acc__part_3__has_lodged_claim(Variable):
value_type = bool
entity = Person
definition_period = ETERNITY
label = u"Has lodged a claim with the Corporation"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100910.html"

def formula(persons, period, parameters):
return (
persons('acc__lodged_claim_for_cover_for_personal_injury', period)
+ persons('acc__lodged_claim_for_cover_and_specified_entitlement_for_personal_injury', period)
+ persons('acc__assessed_as_having_a_need_caused_by_this_covered_injury', period)
)

# Missing variables
# acc__lodged_claim_for_cover_and_specified_entitlement_for_personal_injury
# acc__assessed_as_having_a_need_caused_by_this_covered_injury
51 changes: 51 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/6/definitions.py
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person
from numpy import logical_not


class acc__earner(Variable):
value_type = bool
entity = Person
definition_period = ETERNITY
label = u"A natural person who engages in employment"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100103.html#DLM100167"


class acc__potential_earner(Variable):
value_type = bool
entity = Person
definition_period = ETERNITY
label = u"Is a potential earner"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100103.html#DLM100322"

def formula(persons, period, parameters):
birth = persons('date_of_birth', period)
eighteenth_year = birth.astype('datetime64[Y]').astype(int) + 1970 + 18
eighteenth_month = birth.astype('datetime64[M]').astype(int) % 12 + 1
eighteenth_day = (birth - birth.astype('datetime64[M]') + 1).astype(int)\

date_of_injury = persons('date_of_injury', period)
injury_year = date_of_injury.astype('datetime64[Y]').astype(int) + 1970
injury_month = date_of_injury.astype('datetime64[M]').astype(int) % 12 + 1
injury_day = (date_of_injury - date_of_injury.astype('datetime64[M]') + 1).astype(int)\

injured_under_18 = ((injury_year < eighteenth_year)
+ ((injury_year == eighteenth_year) * (injury_month < eighteenth_month))
+ ((injury_year == eighteenth_year) * (injury_month == eighteenth_month) * (injury_day < eighteenth_day))
) > 0

finish_date = persons('finish_date_of_full_time_study_training_bridging_18th_birthday', period)
finish_year = finish_date.astype('datetime64[Y]').astype(int) + 1970
finish_month = finish_date.astype('datetime64[M]').astype(int) % 12 + 1
finish_day = (finish_date - finish_date.astype('datetime64[M]') + 1).astype(int)\

injured_while_studying = ((injury_year < finish_year)
+ ((injury_year == finish_year) * (injury_month < finish_month))
+ ((injury_year == finish_year) * (injury_month == finish_month) * (injury_day <= finish_day))
) > 0

injured_over_18_in_study = logical_not(injured_under_18) * injured_while_studying

return (injured_under_18 + injured_over_18_in_study) > 0
12 changes: 12 additions & 0 deletions openfisca_aotearoa/variables/acts/acc/8/has_cover.py
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class acc__has_cover(Variable):
value_type = bool
entity = Person
definition_period = DAY
label = u"Has cover for a personal injury"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM100605.html"
2 changes: 0 additions & 2 deletions openfisca_aotearoa/variables/acts/acc/acc.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-

# Import from openfisca-core the common python objects used to code the legislation in OpenFisca
from openfisca_core.model_api import *
# Import the entities specifically defined for this tax and entitlement system
from openfisca_aotearoa.entities import Person


Expand Down
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

from openfisca_core.model_api import *
from openfisca_aotearoa.entities import Person


class acc__sched_1__minimum_weekly_earnings(Variable):
value_type = float
entity = Person
definition_period = DAY
label = u"Minimum weekly earnings"
reference = "http://www.legislation.govt.nz/act/public/2001/0049/latest/DLM104874.html"

0 comments on commit 7b6328c

Please sign in to comment.