Skip to content

Commit

Permalink
Addresses comments from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
jadedarko committed Jun 6, 2024
1 parent 2858ade commit 70fb405
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 147 deletions.
33 changes: 24 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,41 @@ Take a look at the `/variables/acts/social_security/residency.py` and considered
The variable `social_security__residential_requirement` in this file that we will be referring to is supporting both the 1964 and the 2018 Social Security Acts.
It's declaration looks like this:

```
```python
class social_security__residential_requirement(variables.Variable):
value_type = bool
entity = entities.Person
label = "Residential requirements for certain benefits, calculates for the 1964 and the 2018 Social Security Acts"
definition_period = periods.MONTH
reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783138", "https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796"
reference = [
"https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#DLM6783138", # 2018-11-26
"https://www.legislation.govt.nz/act/public/1964/0136/latest/whole.html#DLM363796", # 1964-12-04
]
```
- Note the two references (2018 and 1964). They link to the specific section of the act on legislation.govt.nz
- Note the descriptive label
- Note the naming convention as described in [Naming Variables](#namingvariables)

The variable has two formulas:
```
```python
def formula_1964_12_04(persons, period, parameters):
```
```
```python
def formula_2018_11_26(persons, period, parameters):
```
This is an OpenFisca feature that ensures the correct formula will be automatically applied depending on the date supplied with the scenario.

To aid review, the reference list can contain links to the specific versions of legislation in effect for each formula.

e.g.:

```python
reference = [
"https://www.legislation.govt.nz/act/public/2018/0032/77.0/whole.html#DLM6783138", # 2018-11-26
"https://www.legislation.govt.nz/act/public/2018/0032/140.0/whole.html#DLM6783138", # 2020-11-09
]
```

What is unique to this project is how we intend to code the content of these formulas.

_At the time of writing variables within this project ARE NOT coded this way save for the example we will refer to below._
Expand All @@ -179,7 +193,7 @@ The first thing to recognise is it references the `section 16` of the Social Sec

We choose to structure the code accordingly. This looks like this:

```
```python
# ssa16_1 - Descriptive, not requiring coding.

ssa16_2_a = persons("immigration__citizen_or_resident", period) * \
Expand Down Expand Up @@ -220,7 +234,8 @@ This allows us to map the extent and reach of the project. The `structure.json`
### structure.json

An array of entries, one for each prefix utilised in the code base. In the format as follows:
```

```json
{
"Title": "Accident Compensation Act 2001",
"Prefix": "acc",
Expand All @@ -233,6 +248,7 @@ An array of entries, one for each prefix utilised in the code base. In the forma
]
}
```

Title, Prefix, Type and Reference are all required.
- Title: The legal title of the legal artifact
- Prefix: The prefix utilised within the openfisca_aotearoa code base
Expand Down Expand Up @@ -279,8 +295,7 @@ This project currently utilises one specific pattern however for benefit calcula
- `jobseeker_support__benefit` (float)

i.e. the formula for `jobseeker_support__benefit` would be:
```

```python
jobseeker_support__entitled * min(jobseeker_support__base - jobseeker_support__reduction, jobseeker_support__cutoff)
```


Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,14 @@ clauses:
reference:
title: Part 3 -> Schedule 4, Part 3, Clause 1(h)(ii)
href: https://www.legislation.govt.nz/regulation/public/2024/0011/latest/whole.html
clause_1_income_disregarded:
values:
2018-11-26:
value: 20
metadata:
reference:
title: Part 3 -> Schedule 4, Part 3, Clause 1
href: https://www.legislation.govt.nz/act/public/2018/0032/59.0/DLM6784861.html
clause_2:
values:
2018-11-26:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -858,7 +858,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -890,7 +890,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -922,7 +922,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -954,7 +954,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -986,7 +986,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1018,7 +1018,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1050,7 +1050,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__disabled_or_blind__entitled: true
supported_living_payment__disabled_or_blind: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1082,7 +1082,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -1114,7 +1114,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -1146,7 +1146,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -1178,7 +1178,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 0
Expand Down Expand Up @@ -1210,7 +1210,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1242,7 +1242,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1274,7 +1274,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down Expand Up @@ -1306,7 +1306,7 @@
persons:
principal:
supported_living_payment__entitled: true
supported_living_payment__carer__entitled: true
supported_living_payment__carer: true
social_security__in_a_relationship: true
age: 18
social_security__dependent_children: 1
Expand Down
Loading

0 comments on commit 70fb405

Please sign in to comment.