From 7818fa55b74c5a9dd6ec71b26936116f0df379ff Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 12:42:37 +1200 Subject: [PATCH 01/23] First basic test --- .../tests/live_organ_donor_compensation.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 openfisca_aotearoa/tests/live_organ_donor_compensation.yaml diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml new file mode 100644 index 00000000..1554c6f2 --- /dev/null +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -0,0 +1,13 @@ +# We can run this test on our command line using `openfisca-run-test openfisca_aotearoa/tests/live_organ_donor_compensation.yaml` + +- name: An employee earning $1200 per week for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year + period: 2018 + absolute_error_margin: 1 + input_variables: + pay_frequency: weekly + salary_per_pay: 1200 + kiwisaver_member: no +# donor_surgery_date + output_variables: + weekly_conpensation: 312.67 + From 0d6a6f78653408473fa0c68503ead134d38819b8 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 13:27:05 +1200 Subject: [PATCH 02/23] Added tax code and after tax amount --- openfisca_aotearoa/tests/live_organ_donor_compensation.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 1554c6f2..b4cd92e4 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -5,9 +5,11 @@ absolute_error_margin: 1 input_variables: pay_frequency: weekly - salary_per_pay: 1200 + salary_per_pay: 1200.00 + tax_code: M kiwisaver_member: no # donor_surgery_date output_variables: - weekly_conpensation: 312.67 + weekly_conpensation_before_tax: 1200.00 + weekly_conpensation_after_tax: 957.56 From fbe60366206981e159766b056d4e376303e82462 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 13:37:42 +1200 Subject: [PATCH 03/23] Commented out tax implications --- openfisca_aotearoa/tests/live_organ_donor_compensation.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index b4cd92e4..96dadfd9 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -6,10 +6,10 @@ input_variables: pay_frequency: weekly salary_per_pay: 1200.00 - tax_code: M +# tax_code: M kiwisaver_member: no # donor_surgery_date output_variables: - weekly_conpensation_before_tax: 1200.00 - weekly_conpensation_after_tax: 957.56 + weekly_compensation_before_tax: 1200.00 +# weekly_compensation_after_tax: 957.56 From cc92a5cc508d60edbbcd8226445328f11fba7ce8 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 15:00:39 +1200 Subject: [PATCH 04/23] Initial test passing --- .../live_organ_donor_compensation.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 openfisca_aotearoa/variables/live_organ_donor_compensation.py diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py new file mode 100644 index 00000000..453dff46 --- /dev/null +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -0,0 +1,63 @@ +# -*- 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 benefit system +from openfisca_aotearoa.entities import Titled_Property, Person +from numpy import clip, floor + +class weekly_compensation_before_tax(Variable): + value_type = float + entity = Person + definition_period = YEAR # TODO - determine whether we need to get WEEK to work + label = u"The amount payable as compensation per week before tax" + + def formula(persons, period, parameters): + # income_threshold = parameters(period).benefits.rates_rebates.income_threshold + # additional_per_dependant = parameters(period).benefits.rates_rebates.additional_per_dependant + # initial_contribution = parameters(period).benefits.rates_rebates.initial_contribution + # maximum_allowable = parameters(period).benefits.rates_rebates.maximum_allowable + # maximum_allowable = 10000000.00 + + # # sum allowable income including all the dependants for property + # allowable_income = (titled_properties.sum(titled_properties.members('dependants_as_per_rates_rebates', period)) * additional_per_dependant) + income_threshold + + # # wrapping floor math function is non legislative and only to conform output of variable with existing infrastracture. + # excess_income = floor((titled_properties.sum(titled_properties.members('combined_income_as_per_rates_rebates', period)) - allowable_income) / 8) + + # # minus the initial contribution + # rates_minus_contribution = titled_properties('rates_total_as_per_rates_rebates', period) - initial_contribution + + # # perform the calculation + # rebate = rates_minus_contribution - ((rates_minus_contribution / 3) + excess_income) + + # # Ensures the results aren't negative (less than 0) or greater than the maximum_allowable + return persons('salary_per_pay', period) + # return clip(1200.00, 0, 10000000) + +class PayFrequency(Enum): + weekly = u'Weekly' + fortnightly = u'Fortnightly' + four_weekly = u'Four Weekly' + monthly = u'Monthly' + +class pay_frequency(Variable): + value_type = Enum + possible_values = PayFrequency + default_value = PayFrequency.weekly # The default is mandatory + entity = Person + definition_period = YEAR + label = u"The frequency at which a person is paid" + +class salary_per_pay(Variable): + value_type = float + entity = Person + definition_period = YEAR # TODO - determine whether we need to get WEEK to work + label = u"The salary earned by a person before tax" + +class kiwisaver_member(Variable): + value_type = bool + default_value = True + entity = Person + label = u"Whether the person currently pays into Kiwisaver" + definition_period = YEAR \ No newline at end of file From 090f12dd8004fe3994541429af36ae1bac0c30a3 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 15:03:00 +1200 Subject: [PATCH 05/23] Tidy up --- .../live_organ_donor_compensation.py | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 453dff46..e4053c77 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -11,29 +11,8 @@ class weekly_compensation_before_tax(Variable): entity = Person definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" - def formula(persons, period, parameters): - # income_threshold = parameters(period).benefits.rates_rebates.income_threshold - # additional_per_dependant = parameters(period).benefits.rates_rebates.additional_per_dependant - # initial_contribution = parameters(period).benefits.rates_rebates.initial_contribution - # maximum_allowable = parameters(period).benefits.rates_rebates.maximum_allowable - # maximum_allowable = 10000000.00 - - # # sum allowable income including all the dependants for property - # allowable_income = (titled_properties.sum(titled_properties.members('dependants_as_per_rates_rebates', period)) * additional_per_dependant) + income_threshold - - # # wrapping floor math function is non legislative and only to conform output of variable with existing infrastracture. - # excess_income = floor((titled_properties.sum(titled_properties.members('combined_income_as_per_rates_rebates', period)) - allowable_income) / 8) - - # # minus the initial contribution - # rates_minus_contribution = titled_properties('rates_total_as_per_rates_rebates', period) - initial_contribution - - # # perform the calculation - # rebate = rates_minus_contribution - ((rates_minus_contribution / 3) + excess_income) - - # # Ensures the results aren't negative (less than 0) or greater than the maximum_allowable return persons('salary_per_pay', period) - # return clip(1200.00, 0, 10000000) class PayFrequency(Enum): weekly = u'Weekly' From 6800008cb448a166478d5d5f5d8321712ce4616d Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 16:44:29 +1200 Subject: [PATCH 06/23] Changed to 52 week calculation --- .../tests/live_organ_donor_compensation.yaml | 12 ++++-------- .../variables/live_organ_donor_compensation.py | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 96dadfd9..60d324c3 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -1,15 +1,11 @@ # We can run this test on our command line using `openfisca-run-test openfisca_aotearoa/tests/live_organ_donor_compensation.yaml` -- name: An employee earning $1200 per week for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year +- name: An employee earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year period: 2018 absolute_error_margin: 1 input_variables: - pay_frequency: weekly - salary_per_pay: 1200.00 -# tax_code: M + sum_of_earnings_in_last_52_weeks: 62400 + earnings_period_in_weeks: 52 kiwisaver_member: no -# donor_surgery_date output_variables: - weekly_compensation_before_tax: 1200.00 -# weekly_compensation_after_tax: 957.56 - + weekly_compensation_before_tax: 1200.00 \ No newline at end of file diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index e4053c77..12e8fd0c 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -12,7 +12,7 @@ class weekly_compensation_before_tax(Variable): definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" def formula(persons, period, parameters): - return persons('salary_per_pay', period) + return persons('sum_of_earnings_in_last_52_weeks', period) / persons('earnings_period_in_weeks', period) class PayFrequency(Enum): weekly = u'Weekly' @@ -39,4 +39,17 @@ class kiwisaver_member(Variable): default_value = True entity = Person label = u"Whether the person currently pays into Kiwisaver" - definition_period = YEAR \ No newline at end of file + definition_period = YEAR + +class sum_of_earnings_in_last_52_weeks(Variable): + value_type = float + entity = Person + label = u"Total earnings over last 52 weeks" + definition_period = YEAR + +class earnings_period_in_weeks(Variable): + value_type = int + entity = Person + label = u"The number of weeks over which earnings have been earned" + definition_period = YEAR + From 0f810b572c9ea393af6f0a02b82798b4aa3f3d0b Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 17:13:04 +1200 Subject: [PATCH 07/23] Applied rounding, commented out unneeded code --- .../tests/live_organ_donor_compensation.yaml | 7 +-- .../live_organ_donor_compensation.py | 46 +++++++++---------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 60d324c3..4e87c506 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -2,10 +2,11 @@ - name: An employee earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year period: 2018 - absolute_error_margin: 1 + absolute_error_margin: 0.0001 input_variables: - sum_of_earnings_in_last_52_weeks: 62400 + sum_of_earnings_in_last_52_weeks: 62500 earnings_period_in_weeks: 52 kiwisaver_member: no output_variables: - weekly_compensation_before_tax: 1200.00 \ No newline at end of file + weekly_compensation_before_tax: 1201.92 + diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 12e8fd0c..9b82eb50 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -3,8 +3,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 benefit system -from openfisca_aotearoa.entities import Titled_Property, Person -from numpy import clip, floor +from openfisca_aotearoa.entities import Person +from numpy import round class weekly_compensation_before_tax(Variable): value_type = float @@ -12,27 +12,27 @@ class weekly_compensation_before_tax(Variable): definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" def formula(persons, period, parameters): - return persons('sum_of_earnings_in_last_52_weeks', period) / persons('earnings_period_in_weeks', period) - -class PayFrequency(Enum): - weekly = u'Weekly' - fortnightly = u'Fortnightly' - four_weekly = u'Four Weekly' - monthly = u'Monthly' - -class pay_frequency(Variable): - value_type = Enum - possible_values = PayFrequency - default_value = PayFrequency.weekly # The default is mandatory - entity = Person - definition_period = YEAR - label = u"The frequency at which a person is paid" - -class salary_per_pay(Variable): - value_type = float - entity = Person - definition_period = YEAR # TODO - determine whether we need to get WEEK to work - label = u"The salary earned by a person before tax" + return round(persons('sum_of_earnings_in_last_52_weeks', period) / persons('earnings_period_in_weeks', period), 2) + +# class PayFrequency(Enum): +# weekly = u'Weekly' +# fortnightly = u'Fortnightly' +# four_weekly = u'Four Weekly' +# monthly = u'Monthly' + +# class pay_frequency(Variable): +# value_type = Enum +# possible_values = PayFrequency +# default_value = PayFrequency.weekly # The default is mandatory +# entity = Person +# definition_period = YEAR +# label = u"The frequency at which a person is paid" + +# class salary_per_pay(Variable): +# value_type = float +# entity = Person +# definition_period = YEAR # TODO - determine whether we need to get WEEK to work +# label = u"The salary earned by a person before tax" class kiwisaver_member(Variable): value_type = bool From b4721811fad6079c982f5417069032790fc4e23a Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 17:54:47 +1200 Subject: [PATCH 08/23] Added subpart 1 5(3) compensation earnings disregarded --- .../tests/live_organ_donor_compensation.yaml | 11 ++++++++++ .../live_organ_donor_compensation.py | 20 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 4e87c506..6410f979 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -10,3 +10,14 @@ output_variables: weekly_compensation_before_tax: 1201.92 +- name: An employee earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks + period: 2018 + absolute_error_margin: 0.0001 + input_variables: + sum_of_earnings_in_last_52_weeks: 62500 + earnings_period_in_weeks: 52 + sum_of_earnings_during_compensation_period_in_last_52_weeks: 6000 + compensation_period_in_weeks: 6 + kiwisaver_member: no + output_variables: + weekly_compensation_before_tax: 1228.26 \ No newline at end of file diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 9b82eb50..b2d37bad 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -12,7 +12,13 @@ class weekly_compensation_before_tax(Variable): definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" def formula(persons, period, parameters): - return round(persons('sum_of_earnings_in_last_52_weeks', period) / persons('earnings_period_in_weeks', period), 2) + earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) + compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) + earnings_excluding_compensation_amount = earnings_amount - compensation_amount + earnings_period = persons('earnings_period_in_weeks', period) + compensation_period = persons('compensation_period_in_weeks', period) + earnings_excluding_compensation_period = earnings_period - compensation_period + return round(earnings_excluding_compensation_amount / earnings_excluding_compensation_period , 2) # class PayFrequency(Enum): # weekly = u'Weekly' @@ -53,3 +59,15 @@ class earnings_period_in_weeks(Variable): label = u"The number of weeks over which earnings have been earned" definition_period = YEAR +class sum_of_earnings_during_compensation_period_in_last_52_weeks(Variable): + value_type = float + entity = Person + label = u"Earnings during the period in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001)" + definition_period = YEAR + +class compensation_period_in_weeks(Variable): + value_type = int + entity = Person + label = u"The number of weeks in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001) over the last 52 weeks" + definition_period = YEAR + From b2d7db235b7b4146e4dde667fc802b4115f129f8 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sat, 19 May 2018 18:56:36 +1200 Subject: [PATCH 09/23] Added self-employed earnings --- .../tests/live_organ_donor_compensation.yaml | 14 ++++++++++- .../live_organ_donor_compensation.py | 25 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 6410f979..f8bb0b77 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -20,4 +20,16 @@ compensation_period_in_weeks: 6 kiwisaver_member: no output_variables: - weekly_compensation_before_tax: 1228.26 \ No newline at end of file + weekly_compensation_before_tax: 1228.26 + +- name: A self-employed person earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks + period: 2018 + absolute_error_margin: 0.0001 + input_variables: + sum_of_earnings_in_last_52_weeks: 20200 + # earnings_period_in_weeks: 52 + sum_of_self_employed_earnings_in_most_recently_completed_tax_year: 30300 + number_of_weeks_in_most_recently_completed_tax_year: 53 + kiwisaver_member: no + output_variables: + weekly_compensation_before_tax: 960.16 \ No newline at end of file diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index b2d37bad..715216e2 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -15,10 +15,19 @@ def formula(persons, period, parameters): earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) earnings_excluding_compensation_amount = earnings_amount - compensation_amount + earnings_period = persons('earnings_period_in_weeks', period) compensation_period = persons('compensation_period_in_weeks', period) earnings_excluding_compensation_period = earnings_period - compensation_period - return round(earnings_excluding_compensation_amount / earnings_excluding_compensation_period , 2) + + self_employed_earnings_in_most_recent_tax_year = persons('sum_of_self_employed_earnings_in_most_recently_completed_tax_year', period) + most_recent_tax_year_period = persons('number_of_weeks_in_most_recently_completed_tax_year', period) + + employee_weekly_earnings = earnings_excluding_compensation_amount / earnings_excluding_compensation_period + self_employed_weekly_earnings = self_employed_earnings_in_most_recent_tax_year / most_recent_tax_year_period + + return round(employee_weekly_earnings + self_employed_weekly_earnings, 2) + # class PayFrequency(Enum): # weekly = u'Weekly' @@ -55,6 +64,7 @@ class sum_of_earnings_in_last_52_weeks(Variable): class earnings_period_in_weeks(Variable): value_type = int + default_value = 52 entity = Person label = u"The number of weeks over which earnings have been earned" definition_period = YEAR @@ -71,3 +81,16 @@ class compensation_period_in_weeks(Variable): label = u"The number of weeks in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001) over the last 52 weeks" definition_period = YEAR +class sum_of_self_employed_earnings_in_most_recently_completed_tax_year(Variable): + value_type = float + default_value = 0 + entity = Person + label = u"Self-employed earnings during the period in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001)" + definition_period = YEAR + +class number_of_weeks_in_most_recently_completed_tax_year(Variable): + value_type = int + default_value = 52 + entity = Person + label = u"The number of weeks in the most recently completed tax year" + definition_period = YEAR From dbbfcf60142e09d0f224b047c007ada6518f30e9 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sun, 20 May 2018 11:00:46 +1200 Subject: [PATCH 10/23] Added kiwisaver --- .../tests/live_organ_donor_compensation.yaml | 28 ++++++++++++++-- .../live_organ_donor_compensation.py | 33 +++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index f8bb0b77..4b210a68 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -1,6 +1,6 @@ # We can run this test on our command line using `openfisca-run-test openfisca_aotearoa/tests/live_organ_donor_compensation.yaml` -- name: An employee earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year +- name: An employee with earnings for the last 52 weeks not enrolled in Kiwisaver, no ACC payment in past year period: 2018 absolute_error_margin: 0.0001 input_variables: @@ -10,7 +10,17 @@ output_variables: weekly_compensation_before_tax: 1201.92 -- name: An employee earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks +- name: An employee with earnings for the last 20 weeks not enrolled in Kiwisaver, no ACC payment in past year + period: 2018 + absolute_error_margin: 0.0001 + input_variables: + sum_of_earnings_in_last_52_weeks: 30000 + earnings_period_in_weeks: 20 + kiwisaver_member: no + output_variables: + weekly_compensation_before_tax: 1500 + +- name: An employee with earnings for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks period: 2018 absolute_error_margin: 0.0001 input_variables: @@ -22,7 +32,19 @@ output_variables: weekly_compensation_before_tax: 1228.26 -- name: A self-employed person earning mixed salary for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks +- name: An employee with earnings for the last 52 weeks with 4% Kiwisaver, no ACC payment in last year + period: 2018 + absolute_error_margin: 0.0001 + input_variables: + sum_of_earnings_in_last_52_weeks: 26000 + earnings_period_in_weeks: 26 + kiwisaver_member: yes + kiwisaver_employee_deduction_percentage: 4 + output_variables: + weekly_compensation_before_tax: 1000 + kiwisaver_employee_deduction: 40 + +- name: A self-employed person with earnings for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks period: 2018 absolute_error_margin: 0.0001 input_variables: diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 715216e2..7464c403 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -11,6 +11,7 @@ class weekly_compensation_before_tax(Variable): entity = Person definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" + def formula(persons, period, parameters): earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) @@ -28,6 +29,31 @@ def formula(persons, period, parameters): return round(employee_weekly_earnings + self_employed_weekly_earnings, 2) +class kiwisaver_employee_deduction(Variable): + value_type = float + entity = Person + definition_period = YEAR # TODO - determine whether we need to get WEEK to work + label = u"The amount deducted as a kiwisaver contribution" + + def formula(persons, period, parameters): + earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) + compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) + earnings_excluding_compensation_amount = earnings_amount - compensation_amount + + earnings_period = persons('earnings_period_in_weeks', period) + compensation_period = persons('compensation_period_in_weeks', period) + earnings_excluding_compensation_period = earnings_period - compensation_period + + self_employed_earnings_in_most_recent_tax_year = persons('sum_of_self_employed_earnings_in_most_recently_completed_tax_year', period) + most_recent_tax_year_period = persons('number_of_weeks_in_most_recently_completed_tax_year', period) + + employee_weekly_earnings = earnings_excluding_compensation_amount / earnings_excluding_compensation_period + self_employed_weekly_earnings = self_employed_earnings_in_most_recent_tax_year / most_recent_tax_year_period + + weekly_compensation = round(employee_weekly_earnings + self_employed_weekly_earnings, 2) + + kiwisaver_employee_deduction_percentage = persons('kiwisaver_employee_deduction_percentage', period) + return round(weekly_compensation * kiwisaver_employee_deduction_percentage / 100, 2) # class PayFrequency(Enum): # weekly = u'Weekly' @@ -94,3 +120,10 @@ class number_of_weeks_in_most_recently_completed_tax_year(Variable): entity = Person label = u"The number of weeks in the most recently completed tax year" definition_period = YEAR + +class kiwisaver_employee_deduction_percentage(Variable): + value_type = int + default_value = 0 + entity = Person + label = u"Kiwisaver employee deduction percentage " + definition_period = YEAR From bc0035295c0f1e5619a75ef98fd7ebd912608fd8 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sun, 20 May 2018 14:02:06 +1200 Subject: [PATCH 11/23] Added reference to definition --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 7464c403..2cc276d0 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -86,6 +86,7 @@ class sum_of_earnings_in_last_52_weeks(Variable): value_type = float entity = Person label = u"Total earnings over last 52 weeks" + reference = "http://organiccoders.allengeer.com/brk-1234-abcdfcrg234356/" definition_period = YEAR class earnings_period_in_weeks(Variable): From 36822d71082e739718f671415c35903231799334 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Sun, 20 May 2018 14:15:58 +1200 Subject: [PATCH 12/23] Added reference to definition --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 2cc276d0..a9d6d789 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -80,6 +80,7 @@ class kiwisaver_member(Variable): default_value = True entity = Person label = u"Whether the person currently pays into Kiwisaver" + reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR class sum_of_earnings_in_last_52_weeks(Variable): From b958b43e025845f4bfbe436a2a14a0b9a388ccba Mon Sep 17 00:00:00 2001 From: Allen Geer Date: Sun, 20 May 2018 14:26:09 +1200 Subject: [PATCH 13/23] Update live_organ_donor_compensation.py Make reference actually make sense --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index a9d6d789..f715b6c8 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -80,7 +80,6 @@ class kiwisaver_member(Variable): default_value = True entity = Person label = u"Whether the person currently pays into Kiwisaver" - reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR class sum_of_earnings_in_last_52_weeks(Variable): @@ -95,6 +94,7 @@ class earnings_period_in_weeks(Variable): default_value = 52 entity = Person label = u"The number of weeks over which earnings have been earned" + reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR class sum_of_earnings_during_compensation_period_in_last_52_weeks(Variable): From 0c7ee37e66895967f4021d53986274e154918360 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 20:37:16 +1200 Subject: [PATCH 14/23] Removed commented out code --- .../live_organ_donor_compensation.py | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index a9d6d789..a6c64414 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -55,26 +55,6 @@ def formula(persons, period, parameters): kiwisaver_employee_deduction_percentage = persons('kiwisaver_employee_deduction_percentage', period) return round(weekly_compensation * kiwisaver_employee_deduction_percentage / 100, 2) -# class PayFrequency(Enum): -# weekly = u'Weekly' -# fortnightly = u'Fortnightly' -# four_weekly = u'Four Weekly' -# monthly = u'Monthly' - -# class pay_frequency(Variable): -# value_type = Enum -# possible_values = PayFrequency -# default_value = PayFrequency.weekly # The default is mandatory -# entity = Person -# definition_period = YEAR -# label = u"The frequency at which a person is paid" - -# class salary_per_pay(Variable): -# value_type = float -# entity = Person -# definition_period = YEAR # TODO - determine whether we need to get WEEK to work -# label = u"The salary earned by a person before tax" - class kiwisaver_member(Variable): value_type = bool default_value = True From 067d5cbe5cf663b91f3557698c6aafcd703a4590 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 20:54:54 +1200 Subject: [PATCH 15/23] Added references to legislation --- .../variables/live_organ_donor_compensation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index a6c64414..88481374 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -11,6 +11,8 @@ class weekly_compensation_before_tax(Variable): entity = Person definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" + # note that this also implements http://www.legislation.govt.nz/act/public/2016/0096/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM6965116 + reference = "http://www.legislation.govt.nz/act/public/2016/0096/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM6965123" def formula(persons, period, parameters): earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) @@ -34,6 +36,10 @@ class kiwisaver_employee_deduction(Variable): entity = Person definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount deducted as a kiwisaver contribution" + # Salary or wages includes a payment of earnings compensation under the Compensation for Live Organ Donors Act 2016; + # Ref: http://www.legislation.govt.nz/act/public/2007/0097/latest/DLM1519947.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM1519947 + # KiwiSaver deductions: + reference = "http://www.legislation.govt.nz/act/public/2006/0040/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM379040" def formula(persons, period, parameters): earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) @@ -60,7 +66,6 @@ class kiwisaver_member(Variable): default_value = True entity = Person label = u"Whether the person currently pays into Kiwisaver" - reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR class sum_of_earnings_in_last_52_weeks(Variable): @@ -75,6 +80,7 @@ class earnings_period_in_weeks(Variable): default_value = 52 entity = Person label = u"The number of weeks over which earnings have been earned" + reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR class sum_of_earnings_during_compensation_period_in_last_52_weeks(Variable): From f1383967c7e3389791a60829b8ac8d2c56a4aa9f Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 21:03:52 +1200 Subject: [PATCH 16/23] Fixed comments and removed kiwisaver_member variable --- .../tests/live_organ_donor_compensation.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml index 4b210a68..74088b59 100644 --- a/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml +++ b/openfisca_aotearoa/tests/live_organ_donor_compensation.yaml @@ -6,7 +6,6 @@ input_variables: sum_of_earnings_in_last_52_weeks: 62500 earnings_period_in_weeks: 52 - kiwisaver_member: no output_variables: weekly_compensation_before_tax: 1201.92 @@ -16,7 +15,6 @@ input_variables: sum_of_earnings_in_last_52_weeks: 30000 earnings_period_in_weeks: 20 - kiwisaver_member: no output_variables: weekly_compensation_before_tax: 1500 @@ -28,23 +26,21 @@ earnings_period_in_weeks: 52 sum_of_earnings_during_compensation_period_in_last_52_weeks: 6000 compensation_period_in_weeks: 6 - kiwisaver_member: no output_variables: weekly_compensation_before_tax: 1228.26 -- name: An employee with earnings for the last 52 weeks with 4% Kiwisaver, no ACC payment in last year +- name: An employee with earnings for the last 26 weeks with 4% Kiwisaver, no ACC payment in last year period: 2018 absolute_error_margin: 0.0001 input_variables: sum_of_earnings_in_last_52_weeks: 26000 earnings_period_in_weeks: 26 - kiwisaver_member: yes kiwisaver_employee_deduction_percentage: 4 output_variables: weekly_compensation_before_tax: 1000 kiwisaver_employee_deduction: 40 -- name: A self-employed person with earnings for the last 52 weeks not enrolled in Kiwisaver, with ACC over 6 weeks +- name: A person who was both employed and self-employed in the previous year; not enrolled in Kiwisaver, no ACC payment in last year period: 2018 absolute_error_margin: 0.0001 input_variables: @@ -52,6 +48,5 @@ # earnings_period_in_weeks: 52 sum_of_self_employed_earnings_in_most_recently_completed_tax_year: 30300 number_of_weeks_in_most_recently_completed_tax_year: 53 - kiwisaver_member: no output_variables: weekly_compensation_before_tax: 960.16 \ No newline at end of file From 2e507ed7b0b59ab76a5a3b43e908f246d14d1af8 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 21:15:07 +1200 Subject: [PATCH 17/23] Added docstring comment --- .../variables/live_organ_donor_compensation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 88481374..94c09c8c 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -7,6 +7,13 @@ from numpy import round class weekly_compensation_before_tax(Variable): + """ + Calculate the weekly compensation based on employee earnings over the last 52 weeks + and self-employed earnings in most recent tax year. + This relies on the user totalling the earnings over the last 52 weeks and the earnings period in weeks. + Ideally a user would be able to enter the earnings per week (over a period) and the totals would then + be calculated. + """ value_type = float entity = Person definition_period = YEAR # TODO - determine whether we need to get WEEK to work From 82a8810ca178895c272a73a6802aa51ae1401ca5 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 21:20:36 +1200 Subject: [PATCH 18/23] Fixed formatting so tests pass when using 'make test' --- .../live_organ_donor_compensation.py | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 94c09c8c..84d83a35 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -6,6 +6,7 @@ from openfisca_aotearoa.entities import Person from numpy import round + class weekly_compensation_before_tax(Variable): """ Calculate the weekly compensation based on employee earnings over the last 52 weeks @@ -16,13 +17,13 @@ class weekly_compensation_before_tax(Variable): """ value_type = float entity = Person - definition_period = YEAR # TODO - determine whether we need to get WEEK to work + definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount payable as compensation per week before tax" # note that this also implements http://www.legislation.govt.nz/act/public/2016/0096/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM6965116 reference = "http://www.legislation.govt.nz/act/public/2016/0096/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM6965123" def formula(persons, period, parameters): - earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) + earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) earnings_excluding_compensation_amount = earnings_amount - compensation_amount @@ -35,13 +36,14 @@ def formula(persons, period, parameters): employee_weekly_earnings = earnings_excluding_compensation_amount / earnings_excluding_compensation_period self_employed_weekly_earnings = self_employed_earnings_in_most_recent_tax_year / most_recent_tax_year_period - + return round(employee_weekly_earnings + self_employed_weekly_earnings, 2) + class kiwisaver_employee_deduction(Variable): value_type = float entity = Person - definition_period = YEAR # TODO - determine whether we need to get WEEK to work + definition_period = YEAR # TODO - determine whether we need to get WEEK to work label = u"The amount deducted as a kiwisaver contribution" # Salary or wages includes a payment of earnings compensation under the Compensation for Live Organ Donors Act 2016; # Ref: http://www.legislation.govt.nz/act/public/2007/0097/latest/DLM1519947.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM1519947 @@ -49,7 +51,7 @@ class kiwisaver_employee_deduction(Variable): reference = "http://www.legislation.govt.nz/act/public/2006/0040/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM379040" def formula(persons, period, parameters): - earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) + earnings_amount = persons('sum_of_earnings_in_last_52_weeks', period) compensation_amount = persons('sum_of_earnings_during_compensation_period_in_last_52_weeks', period) earnings_excluding_compensation_amount = earnings_amount - compensation_amount @@ -62,12 +64,13 @@ def formula(persons, period, parameters): employee_weekly_earnings = earnings_excluding_compensation_amount / earnings_excluding_compensation_period self_employed_weekly_earnings = self_employed_earnings_in_most_recent_tax_year / most_recent_tax_year_period - + weekly_compensation = round(employee_weekly_earnings + self_employed_weekly_earnings, 2) kiwisaver_employee_deduction_percentage = persons('kiwisaver_employee_deduction_percentage', period) return round(weekly_compensation * kiwisaver_employee_deduction_percentage / 100, 2) + class kiwisaver_member(Variable): value_type = bool default_value = True @@ -75,6 +78,7 @@ class kiwisaver_member(Variable): label = u"Whether the person currently pays into Kiwisaver" definition_period = YEAR + class sum_of_earnings_in_last_52_weeks(Variable): value_type = float entity = Person @@ -82,6 +86,7 @@ class sum_of_earnings_in_last_52_weeks(Variable): reference = "http://organiccoders.allengeer.com/brk-1234-abcdfcrg234356/" definition_period = YEAR + class earnings_period_in_weeks(Variable): value_type = int default_value = 52 @@ -90,18 +95,21 @@ class earnings_period_in_weeks(Variable): reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" definition_period = YEAR + class sum_of_earnings_during_compensation_period_in_last_52_weeks(Variable): value_type = float entity = Person label = u"Earnings during the period in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001)" definition_period = YEAR + class compensation_period_in_weeks(Variable): value_type = int entity = Person label = u"The number of weeks in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001) over the last 52 weeks" definition_period = YEAR + class sum_of_self_employed_earnings_in_most_recently_completed_tax_year(Variable): value_type = float default_value = 0 @@ -109,6 +117,7 @@ class sum_of_self_employed_earnings_in_most_recently_completed_tax_year(Variable label = u"Self-employed earnings during the period in which the donor was entitled to weekly compensation (as defined in section 6(1) of the Accident Compensation Act 2001)" definition_period = YEAR + class number_of_weeks_in_most_recently_completed_tax_year(Variable): value_type = int default_value = 52 @@ -116,6 +125,7 @@ class number_of_weeks_in_most_recently_completed_tax_year(Variable): label = u"The number of weeks in the most recently completed tax year" definition_period = YEAR + class kiwisaver_employee_deduction_percentage(Variable): value_type = int default_value = 0 From d78b98f8dacecb0764777c27f95ed9cc00bba189 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 22:47:38 +1200 Subject: [PATCH 19/23] Added reference to KiwiSaver rate --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 84d83a35..3e98cd03 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -131,4 +131,5 @@ class kiwisaver_employee_deduction_percentage(Variable): default_value = 0 entity = Person label = u"Kiwisaver employee deduction percentage " + reference = "http://www.legislation.govt.nz/act/public/2006/0040/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM379040" definition_period = YEAR From 2aaaf2b631f06991178d9d2763cd1fda564a09f3 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Mon, 21 May 2018 22:58:18 +1200 Subject: [PATCH 20/23] Removed space at end of string --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 3e98cd03..49219f2c 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -130,6 +130,6 @@ class kiwisaver_employee_deduction_percentage(Variable): value_type = int default_value = 0 entity = Person - label = u"Kiwisaver employee deduction percentage " + label = u"Kiwisaver employee deduction percentage" reference = "http://www.legislation.govt.nz/act/public/2006/0040/latest/whole.html?search=ts_act%40bill%40regulation%40deemedreg_live+organ_resel_25_a#DLM379040" definition_period = YEAR From 5fbe05f6fc5308995168912e12450ac202fb6b03 Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Wed, 23 May 2018 17:33:43 +1200 Subject: [PATCH 21/23] Added definitions of 'number of weeks' and 'earnings as an employee' --- .../definitions/earnings_as_an_employee.md | 15 +++++++++++++++ openfisca_aotearoa/definitions/number_of_weeks.md | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 openfisca_aotearoa/definitions/earnings_as_an_employee.md create mode 100644 openfisca_aotearoa/definitions/number_of_weeks.md diff --git a/openfisca_aotearoa/definitions/earnings_as_an_employee.md b/openfisca_aotearoa/definitions/earnings_as_an_employee.md new file mode 100644 index 00000000..d17223dc --- /dev/null +++ b/openfisca_aotearoa/definitions/earnings_as_an_employee.md @@ -0,0 +1,15 @@ +# DEFINITIONS: EARNINGS AS AN EMPLOYEE + +**Term name:** EarningsAsAnEmployee + +**UUID:** organiccoders/brk:/1234/ed84652e-8011-43dc-aeef-72e5ad3593f4 + +**Definition:** Earnings as an employee, in relation to any person and any tax year, means all PAYE income payments of the person for the tax year. + +**Legislation:** Schedule 2/Part1/5 Compensation for Live Organ Donors Act 2016 + +**Refers to:** earnings as an employee has the meaning given by section 6(1) of the Accident Compensation Act 2001 + +**Narrower than:** ‘Earnings’ + +**Related:** ‘Employee’ \ No newline at end of file diff --git a/openfisca_aotearoa/definitions/number_of_weeks.md b/openfisca_aotearoa/definitions/number_of_weeks.md new file mode 100644 index 00000000..e985e4ba --- /dev/null +++ b/openfisca_aotearoa/definitions/number_of_weeks.md @@ -0,0 +1,15 @@ +# DEFINITIONS: NUMBER OF WEEKS + +**Term name:** NumberOfWeeks + +**UUID:** organiccoders/brk:/1234/12a0780a-b516-44f1-bdb7-6ec4b6c3e174 + +**Definition:** number of weeks is (a) the number of full weeks plus any part week (expressed as a portion of a week), if the period is 1 week or more; and (b) a part week (expressed as a portion of a week), if the period is less than 1 week + +**Legislation:** Part 1, Section 4 + +**Narrower than:** http://purl.org/dc/terms/LocationPeriodOrJurisdiction + +**Related:** PeriodOfTime (altLabel:Period) + +**Note:** Time event (ref DCAT temporal purl.org/dc/terms/temporal) or CPSV ‘period of time’ An interval of time that is named or defined by its start and end dates. http://purl.org/dc/terms/PeriodOfTime \ No newline at end of file From 64c5842e4c719057dd5fe962ce097652a15c7f7d Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Wed, 23 May 2018 17:46:52 +1200 Subject: [PATCH 22/23] Updated references to definitions --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 49219f2c..80b94bbd 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -83,7 +83,7 @@ class sum_of_earnings_in_last_52_weeks(Variable): value_type = float entity = Person label = u"Total earnings over last 52 weeks" - reference = "http://organiccoders.allengeer.com/brk-1234-abcdfcrg234356/" + reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/data-definitions/openfisca_aotearoa/definitions/earnings_as_an_employee.md" definition_period = YEAR @@ -92,7 +92,7 @@ class earnings_period_in_weeks(Variable): default_value = 52 entity = Person label = u"The number of weeks over which earnings have been earned" - reference = "http://organiccoders.allengeer.com/definitions-number-of-weeks/" + reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/data-definitions/openfisca_aotearoa/definitions/number_of_weeks.md" definition_period = YEAR From 21e69e59be2fd5f2cae8d6e32d2488c4b5f67f4f Mon Sep 17 00:00:00 2001 From: Nigel Charman Date: Wed, 23 May 2018 20:03:03 +1200 Subject: [PATCH 23/23] Updated references to definitions on master branch --- openfisca_aotearoa/variables/live_organ_donor_compensation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openfisca_aotearoa/variables/live_organ_donor_compensation.py b/openfisca_aotearoa/variables/live_organ_donor_compensation.py index 80b94bbd..2512ad8f 100644 --- a/openfisca_aotearoa/variables/live_organ_donor_compensation.py +++ b/openfisca_aotearoa/variables/live_organ_donor_compensation.py @@ -83,7 +83,7 @@ class sum_of_earnings_in_last_52_weeks(Variable): value_type = float entity = Person label = u"Total earnings over last 52 weeks" - reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/data-definitions/openfisca_aotearoa/definitions/earnings_as_an_employee.md" + reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/master/openfisca_aotearoa/definitions/earnings_as_an_employee.md" definition_period = YEAR @@ -92,7 +92,7 @@ class earnings_period_in_weeks(Variable): default_value = 52 entity = Person label = u"The number of weeks over which earnings have been earned" - reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/data-definitions/openfisca_aotearoa/definitions/number_of_weeks.md" + reference = "https://github.com/OrganicCoders/openfisca-aotearoa/blob/master/openfisca_aotearoa/definitions/number_of_weeks.md" definition_period = YEAR