Skip to content

Commit

Permalink
Add Peta & Kai's stories
Browse files Browse the repository at this point in the history
Merge pull request #48 from digitalaotearoa/add-petas-story
  • Loading branch information
bonjourmauko authored Sep 26, 2023
2 parents 0e0dbef + 7811e38 commit 64ab6af
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 25 deletions.
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

### 20.1.1 - [48](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/48)

* Test case.
* Details:
- Add Peta & Kai's stories.

## 20.1.0 - [57](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/57)

* Technical improvement
* Impacted periods: all
* Impacted areas: all
* Technical improvement.
* Details:
- Catch up from mainstream, both dependencies and code evolution (bumped Numpy to ~1.24 and Python to 39-311)
- These upgrades are critical as the aforesaid versions are EOL and do not easily compile in modern workstations (specially ARM64).
Expand All @@ -24,6 +28,15 @@
* Other Changes:
- `tests/social_security/sole_parent_support/sole_parent_support__benefit.yaml figure fixed for 2022/23`

## 20.1.0 - [48](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/48)

* Test case.
* Impacted periods: none.
* Impacted areas: `tests/accommodation_supplement`
* Details:
- Add Peta's story
- Add Kai's story

# 20.0.0 - [43](https://github.com/govzeroaotearoa/openfisca-aotearoa/pull/43)

* Added variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ section_5:

section_6:
description: >
o any other person whose accommodation costs are the sum of payments
To any other person whose accommodation costs are the sum of payments
required under any mortgage security, and other payments that the chief
executive is satisfied are reasonably required to be made in respect of
the person’s home.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
- name: >
BenefitMe
Peta's Story (without family tax credit)
period: 2022-12-05
relative_error_margin: 0.001
input:
persons:
Peta:
age:
day:2022-01-01:365: 32
social_security__residential_requirement:
2022-W49: true
social_security__in_a_relationship:
2022-W49: false
social_security__dependent_children:
2022-W49: 1
jobseeker_support__minimum_income:
2022-W49: true
family_tax_credit__eligible:
2022: true
accommodation_costs:
2022-W49: 350
accommodation_type:
2022-W49: rent
accommodation_supplement__area_of_residence:
2022-W49: area_2
output:
jobseeker_support__benefit:
2022-W49: 440.96
accommodation_supplement:
2022-W49: 155.00
family_tax_credit:
2022: 0


- name: >
BenefitMe
Peta's Story (with family tax credit)
period: 2022-12-05
relative_error_margin: 0.001
input:
persons:
Peta:
age:
day:2022-01-01:365: 32
social_security__residential_requirement:
2022-W49: true
social_security__in_a_relationship:
2022-W49: false
social_security__dependent_children:
2022-W49: 1
jobseeker_support__minimum_income:
2022-W49: true
family_tax_credit__eligible:
2022: true
accommodation_costs:
2022-W49: 350
accommodation_type:
2022-W49: rent
accommodation_supplement__area_of_residence:
2022-W49: area_2
Anahera:
family_tax_credit__dependent_child:
2022: .5
output:
jobseeker_support__benefit:
2022-W49: [440.96, 0]
accommodation_supplement:
2022-W49: [145.54, 0]
family_tax_credit:
2022: [6623.80, 0]


- name: >
BenefitMe
Kai's Story
period: 2022-12-05
relative_error_margin: 0.001
input:
persons:
Kai:
age:
day:2022-01-01:365: 23
accommodation_costs:
week:2022-W01:52: 350
accommodation_type:
week:2022-W01:52: board
accommodation_supplement__area_of_residence:
week:2022-W01:52: area_2
accommodation_supplement__cash_assets:
2022-W49: 800
output:
jobseeker_support__benefit:
2022-W49: 0
accommodation_supplement:
2022-W49: 105
family_tax_credit:
2022: 0
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Srko:
date_of_birth:
ETERNITY: 2006-01-11
Expand All @@ -59,7 +59,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Ash:
date_of_birth:
ETERNITY: 2006-01-12
Expand All @@ -68,7 +68,7 @@
2022-W02: true
2022-W03: true
family_tax_credit__dependent_child:
2022: 33
2022: .33
family:
principal: Vranda
children: [Piedad, Srko, Ash]
Expand Down Expand Up @@ -154,7 +154,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Srko:
date_of_birth:
ETERNITY: 2006-01-11
Expand All @@ -163,7 +163,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Ash:
date_of_birth:
ETERNITY: 2006-01-12
Expand All @@ -172,7 +172,7 @@
2022-W02: true
2022-W03: true
family_tax_credit__dependent_child:
2022: 33
2022: .33
family:
principal: Vranda
children: [Piedad, Srko, Ash]
Expand Down Expand Up @@ -214,7 +214,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Srko:
date_of_birth:
ETERNITY: 2006-01-11
Expand All @@ -223,7 +223,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Ash:
date_of_birth:
ETERNITY: 2006-01-12
Expand All @@ -232,7 +232,7 @@
2022-W02: true
2022-W03: true
family_tax_credit__dependent_child:
2022: 33
2022: .33
family:
principal: Vranda
children: [Piedad, Srko, Ash]
Expand Down Expand Up @@ -314,7 +314,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Srko:
date_of_birth:
ETERNITY: 2006-01-11
Expand All @@ -323,7 +323,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Ash:
date_of_birth:
ETERNITY: 2006-01-12
Expand All @@ -332,7 +332,7 @@
2022-W02: true
2022-W03: true
family_tax_credit__dependent_child:
2022: 33
2022: .33
family:
principal: Vranda
children: [Piedad, Srko, Ash]
Expand Down Expand Up @@ -394,7 +394,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Srko:
date_of_birth:
ETERNITY: 2006-01-11
Expand All @@ -403,7 +403,7 @@
2022-W02: true
2022-W03: false
family_tax_credit__dependent_child:
2022: 33
2022: .33
Ash:
date_of_birth:
ETERNITY: 2006-01-12
Expand All @@ -412,7 +412,7 @@
2022-W02: true
2022-W03: true
family_tax_credit__dependent_child:
2022: 33
2022: .33
family:
principal: Vranda
partners: [Bob]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def formula_2007_11_01(people, period, params):
under_16y = age < 16
principal = people.has_role(Family.PRINCIPAL)
caregived = people("family_tax_credit__dependent_child", period.this_year)
dependent = caregived >= 1 / 3 - .5 # last value is the error margin
dependent = caregived >= 1 / 3 - .005 # last value is the error margin
eldest_child = sum(under_16y * dependent) - 1 >= 0

prescribed_amount = (
Expand Down Expand Up @@ -96,7 +96,7 @@ def formula_2007_11_01(people, period, params):
under_16y = age < 16
principal = people.has_role(Family.PRINCIPAL)
caregived = people("family_tax_credit__dependent_child", period.this_year)
dependent = caregived >= 1 / 3 - .5 # last value is the error margin
dependent = caregived >= 1 / 3 - .005 # last value is the error margin
other_than_the_eldest_child = max([0, sum(under_16y * dependent) - 1])

prescribed_amount = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy
import pandas

from openfisca_core import indexed_enums, periods, variables
from openfisca_core import holders, indexed_enums, periods, variables

import openfisca_aotearoa
from openfisca_aotearoa import entities
Expand Down Expand Up @@ -38,6 +38,7 @@ class accommodation_supplement__area_of_residence(variables.Variable):
possible_values = AccommodationSupplement__AreaOfResidence
default_value = AccommodationSupplement__AreaOfResidence.unknown
definition_period = periods.DateUnit.WEEK
set_input = holders.set_input_dispatch_by_period

def formula_2018_11_26(people, period, _params):
area_of_residence = AccommodationSupplement__AreaOfResidence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class jobseeker_support__entitled(variables.Variable):
definition_period = periods.WEEK
label = "Jobseeker Support eligibility and amount"
reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783144", "http://legislation.govt.nz/act/public/1964/0136/latest/DLM5478527.html"
set_input = holders.set_input_dispatch_by_period

# Old Job Seeker formula for 1964 Act, rewritten to show gaps
def formula_2013_04_17(persons, period, parameters):
Expand Down Expand Up @@ -156,6 +157,7 @@ class jobseeker_support__receiving(variables.Variable):
label = "is receiving jobseeker support at the rate in clause 1(c), (e), or (f) of Part 1 of Schedule 4, SSA2018 21 3(a)"
definition_period = periods.WEEK
reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783146"
set_input = holders.set_input_dispatch_by_period


class jobseeker_support__granted(variables.Variable):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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.
#
Expand All @@ -24,6 +24,7 @@ class sole_parent_support__benefit(variables.Variable):
definition_period = periods.WEEK
label = "The final net benefit entitlement"
reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/DLM6784854.html"
set_input = holders.set_input_dispatch_by_period

def formula_2018_11_26(people, period, parameters):
return people("sole_parent_support__entitled", period) * numpy.clip(people("sole_parent_support__base", period) - people("sole_parent_support__reduction", period), 0, people("sole_parent_support__base", period))
Expand Down
4 changes: 3 additions & 1 deletion openfisca_aotearoa/variables/demographics/housing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""TODO: Add missing doctring."""

from openfisca_core import indexed_enums, periods, variables
from openfisca_core import holders, indexed_enums, periods, variables

from openfisca_aotearoa import entities

Expand All @@ -24,6 +24,7 @@ class accommodation_type(variables.Variable):
possible_values = AccommodationType
default_value = AccommodationType.unknown
definition_period = periods.DateUnit.WEEK
set_input = holders.set_input_dispatch_by_period


class accommodation_costs(variables.Variable):
Expand All @@ -34,3 +35,4 @@ class accommodation_costs(variables.Variable):
value_type = float
default_value = 0
definition_period = periods.DateUnit.WEEK
set_input = holders.set_input_dispatch_by_period
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "OpenFisca-Aotearoa"
version = "20.1.0"
version = "20.1.1"
description = "OpenFisca rules-as-code system for Aotearoa."
license = "AGPL-3.0-only"
authors = [
Expand Down

0 comments on commit 64ab6af

Please sign in to comment.