diff --git a/openfisca_aotearoa/parameters/kiwisaver/homestart/akl_prop_threshold.yaml b/openfisca_aotearoa/parameters/kiwisaver/homestart/akl_prop_threshold.yaml new file mode 100644 index 00000000..9d1a7c4a --- /dev/null +++ b/openfisca_aotearoa/parameters/kiwisaver/homestart/akl_prop_threshold.yaml @@ -0,0 +1,5 @@ +description: Property price threshold to be eligible for the Homestart grant for Auckland +reference: +values: + 2006-01: # find date this was set + value: 600000 diff --git a/openfisca_aotearoa/parameters/kiwisaver/homestart/indiv_income_threshold.yaml b/openfisca_aotearoa/parameters/kiwisaver/homestart/indiv_income_threshold.yaml new file mode 100644 index 00000000..2d624d42 --- /dev/null +++ b/openfisca_aotearoa/parameters/kiwisaver/homestart/indiv_income_threshold.yaml @@ -0,0 +1,5 @@ +description: Income threshold +reference: "https://www.hnzc.co.nz/ways-we-can-help-you-to-own-a-home/kiwisaver-homestart-grant-and-savings-withdrawal/kiwisaver-homestart-grant/homestart-grant-eligibility-checklist/" +values: + 2006-01: #find the date this was set + value: 85000 \ No newline at end of file diff --git a/openfisca_aotearoa/parameters/kiwisaver/homestart/ks_duration.yaml b/openfisca_aotearoa/parameters/kiwisaver/homestart/ks_duration.yaml new file mode 100644 index 00000000..7f03eefb --- /dev/null +++ b/openfisca_aotearoa/parameters/kiwisaver/homestart/ks_duration.yaml @@ -0,0 +1,6 @@ +description: Length of contribution to kiwisaver account +reference: "http://www.legislation.govt.nz/act/public/2006/0040/latest/DLM379487.html#DLM379487" +values: + 2006-01: + value: 3 +#need to do more research under s8 Schedule 1 of the Kiwisaver Act \ No newline at end of file diff --git a/openfisca_aotearoa/parameters/kiwisaver/homestart/mid_nz_prop_threshold.yaml b/openfisca_aotearoa/parameters/kiwisaver/homestart/mid_nz_prop_threshold.yaml new file mode 100644 index 00000000..f45dc06c --- /dev/null +++ b/openfisca_aotearoa/parameters/kiwisaver/homestart/mid_nz_prop_threshold.yaml @@ -0,0 +1,5 @@ +description: Property price threshold to be eligible for the Homestart grant in the areas of Hamilton, Tauranga, Western Bay of Plenty, Kapiti Coast, Porirua, Upper Hutt, Hutt City, Wellington, Tasman, Nelson, Waimakariri, Christchurch, Selwyn, Queenstown Lakes Disctrict +reference: +values: + 2006-01: # find date this was set + value: 500000 diff --git a/openfisca_aotearoa/parameters/kiwisaver/homestart/rest_of_nz_prop_threshold.yaml b/openfisca_aotearoa/parameters/kiwisaver/homestart/rest_of_nz_prop_threshold.yaml new file mode 100644 index 00000000..2b3efc06 --- /dev/null +++ b/openfisca_aotearoa/parameters/kiwisaver/homestart/rest_of_nz_prop_threshold.yaml @@ -0,0 +1,5 @@ +description: Property price threshold to be eligible for the Homestart grant for the rest of NZ +reference: +values: + 2006-01: # find date this was set + value: 400000 diff --git a/openfisca_aotearoa/tests/kiwisaver.yaml b/openfisca_aotearoa/tests/kiwisaver.yaml new file mode 100644 index 00000000..6d4db1f9 --- /dev/null +++ b/openfisca_aotearoa/tests/kiwisaver.yaml @@ -0,0 +1,31 @@ +- name: If contributed for less than 3 years, not entitled to grant + period: 2018-01 + absolute_error_margin: 0 + input_variables: + kiwisaver__contrib_duration: 2 + output_variables: + kiwisaver__homestart_grant: 0 + +- name: If contributed for 3 years, entitled to $3000 + period: 2018-01 + absolute_error_margin: 0 + input_variables: + kiwisaver__contrib_duration: 3 + output_variables: + kiwisaver__homestart_grant: 3000 + +- name: If contributed for 4 years, entitled to $4000 + period: 2018-01 + absolute_error_margin: 0 + input_variables: + kiwisaver__contrib_duration: 4 + output_variables: + kiwisaver__homestart_grant: 4000 + +- name: If contributed for over 5 years, entitled to $5000 + period: 2018-01 + absolute_error_margin: 0 + input_variables: + kiwisaver__contrib_duration: 7 + output_variables: + kiwisaver__homestart_grant: 5000 \ No newline at end of file diff --git a/openfisca_aotearoa/variables/general.py b/openfisca_aotearoa/variables/general.py new file mode 100644 index 00000000..cc00f36e --- /dev/null +++ b/openfisca_aotearoa/variables/general.py @@ -0,0 +1,12 @@ +# 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 Person + + +class citizen(Variable): + value_type = bool + entity = Person + definition_period = ETERNITY + label = u"Number of Persons classified as dependant for the purposes of rates rebates" + reference = "http://www.legislation.govt.nz/act/public/1977/0061/latest/whole.html" diff --git a/openfisca_aotearoa/variables/kiwisaver.py b/openfisca_aotearoa/variables/kiwisaver.py new file mode 100644 index 00000000..e8374f00 --- /dev/null +++ b/openfisca_aotearoa/variables/kiwisaver.py @@ -0,0 +1,145 @@ +# -*- 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 Person +from numpy import clip + +# All variables are according to the reference link http://www.legislation.govt.nz/act/public/2006/0040/latest/DLM379487.html#DLM379487 + + +class kiwisaver__duration(Variable): + value_type = int + entity = Person + definition_period = MONTH + label = u"Years the prospective home buyer has been a member of a kiwisaver account" + + +class kiwisaver__contrib_duration(Variable): + value_type = int + entity = Person + definition_period = MONTH + label = u"Years the prospective home buyer has been contributing continuously to their kiwisaver account" + + +class kiwiserver__meets_contrib_duration_requirement(Variable): + value_type = bool + entity = Person + definition_period = MONTH + label = u"This flag returns true or false if the contribution period is valid" + + def formula(persons, period): + return persons('kiwisaver__contrib_duration', period) >= 3 + + +class kiwisaver__homestart_grant(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Amount available to you from the Homestart grant" + + def formula(persons, period): + HS_grant = persons('kiwisaver__duration', period) * \ + persons('kiwisaver__contrib_duration', period) * 1000 + return clip(HS_grant, 0, 5000) + + +class kiwisaver__purchase_price(Variable): + value_type = int + entity = Person + definition_period = YEAR + label = u"Purchase price of the proposed home" + + +class kiwisaver__lvr_deposit_req(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Loan to value ratio deposit requirement" + + def formula(persons, period): + return persons('kiwisaver__purchase_price', period) * 0.2 + + +class homestart_deposit_req__kiwisaver(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Homestart grant deposit requirement" + + def formula(persons, period): + return persons('kiwisaver__purchase_price', period) * 0.1 + + +class kiwisaver__total_savings(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Homestart grant deposit requirement" + + def formula(persons, period): + return persons('kiwisaver__savings', period) + persons('kiwisaver__homestart_grant', period) + persons('kiwisaver__net', period) + + +class kiwisaver__gross(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Gross kiwi saver balance" + + +class kiwisaver__net(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Gross kiwi saver balance" + + def formula(persons, period): + return persons('kiwisaver__gross', period) - 1000 + + +# The savings variable is for the purposes of calculating how much deposit, it's not part of the kiwisaver legislation +class kiwisaver__savings(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Personal cash savings in bank" + + +class kiwisaver__homestart_deposit_eligible(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Deposit amount needed to be eligble for homestart grant" + + def formula(persons, period): + return persons('kiwisaver__total_savings', period) >= persons('homestart_deposit_req__kiwisaver', period) + + +class kiwisaver__lvr_deposit_eligible(Variable): + value_type = float + entity = Person + definition_period = MONTH + label = u"Deposit amount needed to be eligble for homestart grant" + + def formula(persons, period): + return persons('kiwisaver__total_savings', period) >= persons('kiwisaver__lvr_deposit_req', period) + + +class kiwisaver__individual_income_per_homestart_grant(Variable): + value_type = int + entity = Person + definition_period = YEAR + set_input = set_input_divide_by_period + # Check how to set input by user and check against the threshold + + +class kiwisaver__combined_income_per_hs_grant(Variable): + value_type = int + entity = Person + definition_period = YEAR + # Allows user to declare a salary for a year. + set_input = set_input_divide_by_period + # Check how to set input by user and check against the threshold + label = "Combined income"