Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add Home Grant and Kiwisaver #17

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
db62b68
add citizenship variable
May 19, 2018
d0dd21e
added kiwisaver.py and 3 variables
JudyPuff May 19, 2018
3ec3a4b
added 2 yaml files under parameters
JudyPuff May 19, 2018
f868d33
added prop_threshold yamls and more classes in kiwisaver variable
JudyPuff May 19, 2018
0841171
added formula for hs_grant calculation based on years of contribution
JudyPuff May 20, 2018
4b74409
added kiwisaver parameters and variables with Hamish
JudyPuff May 23, 2018
7d68fb9
Merge branch 'master' into kiwisaver
Br3nda May 29, 2018
596b574
Pep8 fixes
Br3nda May 29, 2018
adedacf
Removed unused import
Br3nda May 29, 2018
9d07eac
Renamed class - meets contrib duration requirement
Br3nda May 29, 2018
73e130a
Rename variales in test to have __kiwisaver
Br3nda May 29, 2018
740b954
Matching test variables to the python
Br3nda May 29, 2018
cb8c06f
Fixing more variable names
Br3nda May 29, 2018
f918a83
Rename purc_price to purchase_price
Br3nda May 29, 2018
428eaae
Merge branch 'master' into kiwisaver
Br3nda Jun 1, 2018
3d89969
Merge remote-tracking branch 'origin/master' into kiwisaver
Br3nda Jun 1, 2018
cf586c0
Clearer variable name
Br3nda Jun 1, 2018
4cb79f9
Merge branch 'kiwisaver' of github.com:ServiceInnovationLab/openfisca…
Br3nda Jun 1, 2018
eeb0fac
Merge branch 'bw/kiwisaver' into kiwisaver
Br3nda Jun 1, 2018
7ba8673
refactor - rename variable to have kiwisaver at start
Br3nda Jun 1, 2018
ca65513
More variable consistency
Br3nda Jun 1, 2018
bdf9a61
Merge branch 'master' into kiwisaver
Br3nda Nov 10, 2018
b0816f9
Merge branch 'master' into kiwisaver
Br3nda May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: Length of kiwisaver membership
description: Length of contribution to kiwisaver account
reference: "http://www.legislation.govt.nz/act/public/2006/0040/latest/DLM379487.html#DLM379487"
values:
2006-01:
Expand Down
8 changes: 4 additions & 4 deletions openfisca_aotearoa/tests/kiwisaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
period: 2018-01
absolute_error_margin: 0
input_variables:
ks_contrib_duration: 2
contrib_duration_as_per_kiwisaver: 2
output_variables:
homestart_grant: 0

- name: If contributed for 3 years, entitled to $3000
period: 2018-01
absolute_error_margin: 0
input_variables:
ks_contrib_duration: 3
contrib_duration_as_per_kiwisaver: 3
output_variables:
homestart_grant: 3000

- name: If contributed for 4 years, entitled to $4000
period: 2018-01
absolute_error_margin: 0
input_variables:
ks_contrib_duration: 4
contrib_duration_as_per_kiwisaver: 4
output_variables:
homestart_grant: 4000

- name: If contributed for over 5 years, entitled to $5000
period: 2018-01
absolute_error_margin: 0
input_variables:
ks_contrib_duration: 7
contrib_duration_as_per_kiwisaver: 7
output_variables:
homestart_grant: 5000
86 changes: 81 additions & 5 deletions openfisca_aotearoa/variables/kiwisaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ks_duration(Variable):
definition_period = MONTH
label = u"Years the prospective home buyer has been a member of a kiwisaver account"

class ks_contrib_duration(Variable):
class contrib_duration__kiwisaver(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 ks_contrib_duration_satisfied(Variable):
class contrib_duration__kiwisaver(Variable):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class name is used twice in this file.

value_type = bool
entity = Person
definition_period = MONTH
Expand All @@ -29,23 +29,99 @@ class ks_contrib_duration_satisfied(Variable):
def formula(persons, period):
return persons('ks_contrib_duration', period) >= 3

class homestart_grant(Variable):
class homestart_grant__kiwisaver(Variable):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the double underscore indicate?

value_type = float
entity = Person
definition_period = MONTH
label = u"Amount available to you from the Homestart grant"

def formula(persons, period):
duration = persons('ks_contrib_duration', period)
HS_grant = persons('ks_contrib_duration', period) * persons('ks_contrib_duration_satisfied', period) * 1000
return clip(HS_grant,0,5000)


class purc_price(Variable):
value_type = int
entity = Titled_Property
entity = Person
definition_period = YEAR
label = u"Purchase price of the proposed home"


class lvr_deposit_req__kiwisaver(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Loan to value ratio deposit requirement"

def formula(persons, period):
return persons('purc_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('purc_price', period) * 0.1


class total_savings__kiwisaver(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Homestart grant deposit requirement"

def formula(persons, period):
return persons('savings__kiwisaver', period) + persons('homestart_grant__kiwisaver', period) + persons('net__kiwisaver', period)


class gross__kiwisaver(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Gross kiwi saver balance"


class net__kiwisaver(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Gross kiwi saver balance"

def formula(persons, period):
return persons('gross__kiwisaver', period) - 1000


# The savings variable is for the purposes of calculating how much deposit, it's not part of the kiwisaver legislation
class savings__kiwisaver(Variable):
value_type = float
entity = Person
definition_period = MONTH
label = u"Personal cash savings in bank"


class 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('total_savings__kiwisaver', period) >= persons('homestart_deposit_req__kiwisaver', period)


class 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('total_savings__kiwisaver', period) >= persons('lvr_deposit_req__kiwisaver', period)


class indv_income_per_hs_grant(Variable):
value_type = int
entity = Person
Expand Down