diff --git a/CHANGELOG.md b/CHANGELOG.md index 72cc5fab..7ff085f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +### 21.0.1 - [58](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/58) + +* Tax and benefit system evolution. +* Impacted periods: all. +* Impacted areas: + - `variables/acts/social_security` + - `variables/acts/income_tax` + - `variables/regulation/student_allowance` + - `variables/regulation/social_security` + - `variables/demographics` + - `accommodation_supplement` +* Details: + - Fix rate & rebate when accommodation type is lodging or boarding + - Normally, a %62 rate is to be applied in this particular case + - However, in reality %162 was being applied, which is incorrect + - Resolve warnings present in Accomodation Supplement Tests + - Resolved linting issues + +* Breaking changes: + - `student_allowance__married_or_partnered` period changed from month to day + - `student_allowance__supported_child` period changed from month to day + - `student_allowance__partner_has_a_supported_child` period changed from month to day + - `student_allowance__person_has_spouse` period changed from month to day, formula updated + +* Changes: + - `age_of_partner` set_input_dispatch_by_period applied + ### 21.0.0 - [60](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/60) * Tax and benefit system evolution. @@ -50,6 +77,7 @@ Added new feature in folder `ōpenfisca_aotearoa/api_examples`. This is a space for example http calls to help illustrate how to call the API. Added example calls for entities, parameters, variables and then `acts/social_security/child_disability_allowance` as per project structure + ### 20.1.1 - [48](https://github.com/digitalaotearoa/openfisca-aotearoa/pull/48) * Test case. diff --git a/openfisca_aotearoa/parameters/social_security/accommodation_supplement/board_lodger_percent.yaml b/openfisca_aotearoa/parameters/social_security/accommodation_supplement/board_lodger_percent.yaml new file mode 100644 index 00000000..643dfdca --- /dev/null +++ b/openfisca_aotearoa/parameters/social_security/accommodation_supplement/board_lodger_percent.yaml @@ -0,0 +1,5 @@ +description: 62% of the amount paid for board or lodging +reference: https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#LMS28903 +values: + 2018-11-26: + value: 0.62 diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml index d1080458..e5b0e0dc 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/_benefit_me.yaml @@ -8,6 +8,8 @@ Peta: age: day:2022-01-01:365: 32 + age_of_partner: + day:2022-01-01:365: 32 social_security__residential_requirement: 2022-W49: true social_security__in_a_relationship: @@ -24,6 +26,8 @@ 2022-W49: rent accommodation_supplement__area_of_residence: 2022-W49: area_2 + student_allowance__person_has_spouse: + day:2022-12-01:31: false output: jobseeker_support__benefit: 2022-W49: 440.96 @@ -43,6 +47,8 @@ Peta: age: day:2022-01-01:365: 32 + age_of_partner: + day:2022-01-01:365: 32 social_security__residential_requirement: 2022-W49: true social_security__in_a_relationship: @@ -59,6 +65,8 @@ 2022-W49: rent accommodation_supplement__area_of_residence: 2022-W49: area_2 + student_allowance__person_has_spouse: + day:2022-12-01:31: false Anahera: family_tax_credit__dependent_child: 2022: .5 @@ -81,6 +89,8 @@ Kai: age: day:2022-01-01:365: 23 + age_of_partner: + day:2022-01-01:365: 32 accommodation_costs: week:2022-W01:52: 350 accommodation_type: @@ -89,6 +99,8 @@ week:2022-W01:52: area_2 accommodation_supplement__cash_assets: 2022-W49: 800 + student_allowance__person_has_spouse: + day:2022-12-01:31: false output: jobseeker_support__benefit: 2022-W49: 0 diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml index 7e3c6db8..6f39c955 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/accommodation_supplement.yaml @@ -1,19 +1,19 @@ - name: > Social Security Act 2018 - - § 10 Accommodation Supplement + Subpart 10 Accommodation Supplement period: 2018-11-26 absolute_error_margin: 0.005 input: accommodation_costs: - 2022-W01: [20, 50, 100, 150, 150, 200] - 2022-W02: [20, 50, 100, 150, 150, 200] - 2023-W01: [20, 50, 100, 150, 150, 200] - 2024-W01: [20, 50, 100, 150, 150, 200] + 2022-W01: [50, 100, 150, 200, 300, 400] + 2022-W02: [50, 100, 150, 200, 300, 400] + 2023-W01: [50, 100, 150, 200, 300, 400] + 2024-W01: [50, 100, 150, 200, 300, 400] accommodation_type: - 2022-W01: [lodging, lodging, lodging, lodging, lodging, lodging] - 2022-W02: [lodging, lodging, lodging, lodging, lodging, lodging] + 2022-W01: [rent, rent, rent, rent, rent, rent] + 2022-W02: [board, board, board, board, board, board] 2023-W01: [lodging, lodging, lodging, lodging, lodging, lodging] - 2024-W01: [lodging, lodging, lodging, lodging, lodging, lodging] + 2024-W01: [mortgage, mortgage, mortgage, mortgage, mortgage, mortgage] accommodation_supplement__cash_assets: 2022-W01: [8100, 8100, 8100, 8100, 8101, 8100] 2022-W02: [8100, 8100, 8100, 8100, 8101, 8100] @@ -21,9 +21,13 @@ 2024-W01: [8100, 8100, 8100, 8100, 8101, 8100] age: day:2022-01-03:7: [24, 24, 24, 24, 24, 24] - day:2022-01-11:7: [24, 24, 24, 24, 24, 24] - day:2023-01-01:7: [24, 24, 24, 24, 24, 24] + day:2022-01-10:7: [24, 24, 24, 24, 24, 24] + day:2023-01-02:7: [24, 24, 24, 24, 24, 24] day:2024-01-01:7: [24, 24, 24, 24, 24, 24] + age_of_partner: + day:2022-01-01:31: [24, 24, 24, 24, 24, 24] + day:2023-01-01:31: [24, 24, 24, 24, 24, 24] + day:2024-01-01:31: [24, 24, 24, 24, 24, 24] jobseeker_support__receiving: 2022-W01: [true, true, true, true, true, true] 2022-W02: [true, true, true, true, true, true] @@ -39,9 +43,13 @@ 2022-W02: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] 2023-W01: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] 2024-W01: [Alexandra urban area, Alexandra urban area, Alexandra urban area, Arrowtown urban area, Arrowtown urban area, Arrowtown urban area] + basic_grant__entitled: + 2022-01: [false, false, false, false, false, false] + 2023-01: [false, false, false, false, false, false] + 2024-01: [false, false, false, false, false, false] output: accommodation_supplement: - 2022-W01: [0.00, 7.96, 64.66, 121.36, 0.00, 165.00] # January - 2022-W02: [0.00, 7.96, 64.66, 121.36, 0.00, 165.00] # February (the same) - 2023-W01: [0.00, 1.57, 58.28, 114.98, 0.00, 165.00] # January a year later - 2024-W01: [0.00, 0.00, 54.30, 111.00, 0.00, 165.00] # January, another a year later + 2022-W01: [0.00, 21.26, 56.26, 91.26, 0.00, 165.00] # January + 2022-W02: [0.00, 0.00, 16.36, 38.06, 0.00, 124.86] # February (the same) + 2023-W01: [0.00, 0.00, 9.97, 31.68, 0.00, 118.48] # January a year later + 2024-W01: [0.00, 0.00, 34.07, 69.07, 0.00, 165.00] # January, another a year later diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/assets.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/assets.yaml index bbf683be..a1330c58 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/assets.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/assets.yaml @@ -1,6 +1,7 @@ - name: > Social Security Regulations 2018 - - 5 Accommodation Supplement - + Part 2 Assistance - + Subpart 5 Accommodation Supplement - 15 Assets requirement - (1) The assets requirement, for the purposes of section 65(1)(b) of the Act, is that a person’s cash assets must not exceed— @@ -47,7 +48,8 @@ - name: > Social Security Regulations 2018 - - 5 Accommodation Supplement - + Part 2 Assistance - + Subpart 5 Accommodation Supplement - 15 Assets requirement - (1) The assets requirement, for the purposes of section 65(1)(b) of the Act, is that a person’s cash assets must not exceed— @@ -93,7 +95,8 @@ - name: > Social Security Regulations 2018 - - 5 Accommodation Supplement - + Part 2 Assistance - + Subpart 5 Accommodation Supplement - 15 Assets requirement - (1) The assets requirement, for the purposes of section 65(1)(b) of the Act, is that a person’s cash assets must not exceed— @@ -139,7 +142,8 @@ - name: > Social Security Regulations 2018 - - 5 Accommodation Supplement - + Part 2 Assistance - + Subpart 5 Accommodation Supplement - 15 Assets requirement - (1) The assets requirement, for the purposes of section 65(1)(b) of the Act, is that a person’s cash assets must not exceed— diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/base.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/base.yaml index cc7eacf3..2357d146 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/base.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/base.yaml @@ -1,12 +1,14 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Beneficiaries who are single - - (a) for a single beneficiary under the age of 25 years, the maximum weekly - rate of a benefit that the beneficiary would have been entitled to - receive, before any abatement or deduction, if the beneficiary had - attained the age of 25 years: [...] + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Beneficiaries who are single - + (a) for a single beneficiary under the age of 25 years, the maximum + weekly rate of a benefit that the beneficiary would have been + entitled to receive, before any abatement or deduction, if the + beneficiary had attained the age of 25 years: [...] period: 2018-11-26 input: age: @@ -19,16 +21,18 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Beneficiaries who are single - - (b) for a single beneficiary with 1 or more dependent children,— - (i) the maximum weekly rate of a benefit that the beneficiary is - entitled to receive, before any abatement or deduction; plus - (ii) the maximum annual rate of family tax credit (divided by 52) that - is payable in respect of an eldest dependent child who is under - 16 years old under subparts MA to MF and MZ of the Income Tax Act - 2007: + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Beneficiaries who are single - + (b) for a single beneficiary with 1 or more dependent children,— + (i) the maximum weekly rate of a benefit that the beneficiary is + entitled to receive, before any abatement or deduction; plus + (ii) the maximum annual rate of family tax credit (divided by 52) + that is payable in respect of an eldest dependent child who + is under 16 years old under subparts MA to MF and MZ of the + Income Tax Act 2007: period: 2018-11-26 absolute_error_margin: 0.005 input: @@ -81,12 +85,14 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Beneficiaries who are single - - (c) for any other single beneficiary, the maximum weekly rate of a - benefit that the beneficiary would be entitled to receive before - any abatement or deduction: + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Beneficiaries who are single - + (c) for any other single beneficiary, the maximum weekly rate of a + benefit that the beneficiary would be entitled to receive before + any abatement or deduction: period: 2018-11-26 input: age: @@ -100,13 +106,15 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Beneficiaries who are in a relationship - - (c) for a beneficiary who is in a relationship and is not a beneficiary to - whom paragraph (e) applies,— - (i) the maximum weekly rate of a benefit that the beneficiary - is entitled to receive, before any abatement or deduction; [...] + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Beneficiaries who are in a relationship - + (c) for a beneficiary who is in a relationship and is not a beneficiary + to whom paragraph (e) applies,— + (i) the maximum weekly rate of a benefit that the beneficiary + is entitled to receive, before any abatement or deduction; period: 2018-11-26 input: jobseeker_support__receiving: @@ -120,15 +128,18 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Beneficiaries who are in a relationship - - (c) for a beneficiary who is in a relationship and is not a beneficiary to - whom paragraph (e) applies,— [...] - (ii) if the beneficiary has 1 or more dependent children, the maximum - annual rate of family tax credit (divided by 52) that is paid in - respect of an eldest dependent child who is under 16 years (if - any) under subparts MA to MF and MZ of the Income Tax Act 2007; + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Beneficiaries who are in a relationship - + (c) for a beneficiary who is in a relationship and is not a beneficiary + to whom paragraph (e) applies,— [...] + (ii) if the beneficiary has 1 or more dependent children, the + maximum annual rate of family tax credit (divided by 52) that + is paid in respect of an eldest dependent child who is under + 16 years (if any) under subparts MA to MF and MZ of the + Income Tax Act 2007; period: 2018-11-26 absolute_error_margin: 0.005 input: @@ -185,14 +196,18 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Non-beneficiaries who are single - - (f) for a single non-beneficiary with 1 or more dependent children,— - (i) the appropriate maximum weekly rate of jobseeker support; plus - (ii) the annual rate of family tax credit (divided by 52) that is - payable in respect of an eldest dependent child who is under 16 - years under subparts MA to MF and MZ of the Income Tax Act 2007: + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Non-beneficiaries who are single - + (f) for a single non-beneficiary with 1 or more dependent children,— + (i) the appropriate maximum weekly rate of jobseeker support; + plus + (ii) the annual rate of family tax credit (divided by 52) that is + payable in respect of an eldest dependent child who is under + 16 years under subparts MA to MF and MZ of the Income Tax Act + 2007: period: 2018-11-26 absolute_error_margin: 0.005 input: @@ -245,12 +260,14 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Non-beneficiaries who are single - - (g) for any other single non-beneficiary, the weekly rate of jobseeker - support at the rate in clause 1(d) of Part 1 of Schedule 4 of the Act - before any abatement or deduction: + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Non-beneficiaries who are single - + (g) for any other single non-beneficiary, the weekly rate of jobseeker + support at the rate in clause 1(d) of Part 1 of Schedule 4 of the + Act before any abatement or deduction: period: 2018-11-26 input: jobseeker_support__entitled: @@ -262,11 +279,13 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Non-beneficiaries who are in a relationship - - (h) for a non-beneficiary who is in a relationship,— - (i) the appropriate maximum weekly rate of jobseeker support; plus + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Non-beneficiaries who are in a relationship - + (h) for a non-beneficiary who is in a relationship,— + (i) the appropriate maximum weekly rate of jobseeker support; period: 2018-11-26 absolute_error_margin: 0.005 input: @@ -281,14 +300,17 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Non-beneficiaries who are in a relationship - - (h) for a non-beneficiary who is in a relationship,— [...] - (ii) if the beneficiary has 1 or more dependent children, the maximum - annual rate of family tax credit (divided by 52) that is payable - in respect of an eldest dependent child who is under 16 years - under subparts MA to MF and MZ of the Income Tax Act 2007; plus + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Non-beneficiaries who are in a relationship - + (h) for a non-beneficiary who is in a relationship,— [...] + (ii) if the beneficiary has 1 or more dependent children, the + maximum annual rate of family tax credit (divided by 52) that + is payable in respect of an eldest dependent child who is + under 16 years under subparts MA to MF and MZ of the Income + Tax Act 2007; period: 2018-11-26 absolute_error_margin: 0.005 input: @@ -345,17 +367,22 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - Base rate - - Non-beneficiaries who are in a relationship - - (h) for a non-beneficiary who is in a relationship,— - (i) the appropriate maximum weekly rate of jobseeker support; plus - (ii) if the beneficiary has 1 or more dependent children, the maximum - annual rate of family tax credit (divided by 52) that is payable - in respect of an eldest dependent child who is under 16 years - under subparts MA to MF and MZ of the Income Tax Act 2007; plus - (iii) the maximum weekly rate of jobseeker support that would have been - payable in respect of the beneficiary’s spouse or partner. + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (2) The base rate is as follows: + Non-beneficiaries who are in a relationship - + (h) for a non-beneficiary who is in a relationship,— + (i) the appropriate maximum weekly rate of jobseeker support; + plus + (ii) if the beneficiary has 1 or more dependent children, the + maximum annual rate of family tax credit (divided by 52) that + is payable in respect of an eldest dependent child who is + under 16 years under subparts MA to MF and MZ of the Income + Tax Act 2007; plus + (iii) the maximum weekly rate of jobseeker support that would have + been payable in respect of the beneficiary’s spouse or + partner. period: 2018-11-26 absolute_error_margin: 0.005 input: diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/beneficiary.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/beneficiary.yaml index c1196911..52a393b0 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/beneficiary.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/beneficiary.yaml @@ -1,8 +1,9 @@ - name: > Social Security Regulations 2018 - - Accommodation Supplement - - § 17 Base rate - - ¶ 1 Beneficiaries + Part 2 Assistance - + Subpart 5 Accommodation Supplement - + 17 Base rate - + (1) Beneficiaries period: 2018-11-26 input: emergency_benefit__receiving: diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/costs.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/costs.yaml index e5be3216..14d299cb 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/costs.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/costs.yaml @@ -1,8 +1,9 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - (2) Accommodation Costs - - (a) Rent + (a) Rent period: 2018-11-26 input: accommodation_costs: @@ -19,9 +20,10 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - (2) Accommodation Costs - (b) Mortgage + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - + (2) Accommodation Costs - + (b) Mortgage period: 2018-11-26 input: accommodation_costs: @@ -38,9 +40,10 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - (2) Accommodation Costs - (c) Board + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - + (2) Accommodation Costs - + (c) Board period: 2018-11-26 input: accommodation_costs: @@ -57,9 +60,10 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - (2) Accommodation Costs - (c) Lodging + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - + (2) Accommodation Costs - + (c) Lodging period: 2018-11-26 input: accommodation_costs: @@ -76,9 +80,10 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - (2) Accommodation Costs - (d) Joint tenancy + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - + (2) Accommodation Costs - + (d) Joint tenancy period: 2018-11-26 input: persons: @@ -157,9 +162,10 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - (2) Accommodation Costs - (d) Joint ownership + Subpart 10 Accommodation Supplement - + 65 Accommodation Supplement - + (2) Accommodation Costs - + (d) Joint ownership period: 2018-11-26 input: persons: diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/cutout.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/cutout.yaml index c9fc20f4..f4e019f1 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/cutout.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/cutout.yaml @@ -1,7 +1,8 @@ - name: > Social Security Act 2018 - - Accommodation Supplement - - Cut-out point + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (1) (2) (3) (4) (5) (6) Cut-out point period: 2018-11-26 input: accommodation_supplement__situation: diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/entitled.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/entitled.yaml index 22cf4e78..973956ce 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/entitled.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/entitled.yaml @@ -1,7 +1,8 @@ - name: > Social Security Act 2018 - - § 10 Accommodation Supplement - 65 (1) Entitlement + Subpart 10 Accommodation Supplement - + 65 Accommodation supplement - + (1) Entitlement period: 2018-11-26 input: accommodation_supplement__accommodation_costs: diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml index 1f9e4fe4..9c42cd9b 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/exclusion.yaml @@ -1,12 +1,15 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 66 Social housing exclusion - (a) Rent + Subpart 10 Accommodation Supplement - + 66 Social housing exclusion - + (1) Social housing exclusion - + (a) Rent period: 2018-11-26 input: accommodation_type: 2022-W01: [social_housing, under_the_sun] + age_of_partner: + day:2022-01-01:31: [ 24, 24 ] output: accommodation_supplement__social_housing_exclusion: 2022-W01: [true, false] @@ -14,9 +17,9 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 67 Other funding exclusion - (a) Couple already receiving accommodation supplement + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (a) Couple already receiving accommodation supplement period: 2018-11-26 input: persons: @@ -25,6 +28,8 @@ accommodation_supplement__receiving: 2022-W01: true 2022-W02: false + age: + day:2022-01-01:31: 24 family: principal: Vrenda partners: [Piedad] @@ -36,16 +41,20 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 67 Other funding exclusion - (b) Grant - (i) Receives student grant + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (b) Grant + (i) Receives student grant period: 2018-11-26 input: basic_grant__receiving: 2022-W01: [true, true, false, false] + basic_grant__entitled: + 2022-01: [true, true, false, false] independent_circumstances_grant__receiving: 2022-W01: [true, false, true, false] + age_of_partner: + day:2022-01-01:31: [ 24, 24, 24, 24 ] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, true, true, false] @@ -53,16 +62,18 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 67 Other funding exclusion - (b) Grant - (ii) Eligible for student grant + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (b) Grant + (ii) Eligible for student grant period: 2018-11-26 input: basic_grant__entitled: 2022-01: [true, true, false, false] independent_circumstances_grant__entitled: 2022-01: [true, false, true, false] + age_of_partner: + day:2022-01-01:31: [ 24, 24, 24, 24 ] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, true, true, false] @@ -70,16 +81,20 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 67 Other funding exclusion - (b) Grant - (iii) Would be eligible for student grant were it not means-tested + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (b) Grant + (iii) Would be eligible for student grant were it not means-tested period: 2018-11-26 input: basic_grant__would_be_entitled: 2022-W01: [true, true, false, false] + basic_grant__entitled: + 2022-01: [true, true, false, false] independent_circumstances_grant__would_be_entitled: 2022-W01: [true, false, true, false] + age_of_partner: + day:2022-01-01:31: [ 24, 24 , 24, 24 ] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, true, true, false] @@ -87,13 +102,17 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 66 Social housing exclusion - (c) Residential care + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (c) Residential care period: 2018-11-26 input: accommodation_type: 2022-W01: [residential_care, under_the_moon] + age_of_partner: + day:2022-01-01:31: [ 24, 24 ] + basic_grant__entitled: + 2022-01: [false, false] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, false] @@ -101,13 +120,17 @@ - name: > Social Security Act 2018 - - 65 Accommodation Supplement - - 66 Social housing exclusion - (d) Disability + Subpart 10 Accommodation Supplement - + 67 Other funding exclusion - + (d) Disability period: 2018-11-26 input: accommodation_supplement__disability: 2022-W01: [true, false] + age_of_partner: + day:2022-01-01:31: [ 24, 24 ] + basic_grant__entitled: + 2022-01: [false, false] output: accommodation_supplement__other_funding_exclusion: 2022-W01: [true, false] diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rate.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rate.yaml new file mode 100644 index 00000000..818a1194 --- /dev/null +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rate.yaml @@ -0,0 +1,10 @@ +- name: > + Social Security ??? 2018 - + ??? + period: 2018-11-26 + input: + accommodation_type: + 2022-W01: [unknown, rent, board, lodging, mortgage, social_housing, residential_care] + output: + accommodation_supplement__rate: + 2022-W01: [1, 1, .62, .62, 1, 1, 1] diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rebate.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rebate.yaml index 222f00c9..ea3a87dc 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rebate.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/rebate.yaml @@ -1,7 +1,8 @@ - name: > Social Security Act 2018 - - Acommodation Supplement - - Rebate amount + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (1) (2) (3) (4) (5) (6) Rebate amount period: 2018-11-26 input: accommodation_supplement__situation: @@ -14,4 +15,4 @@ 2022-W26: [1000, 1000, 1000, 1000, 1000, 1000, 1000] output: accommodation_supplement__rebate: - 2022-W26: [0, 475, 475, 661, 510, 510, 510] + 2022-W26: [0, 475, 361, 361, 510, 510, 510] diff --git a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/situation.yaml b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/situation.yaml index 73d3c201..8383df7d 100644 --- a/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/situation.yaml +++ b/openfisca_aotearoa/tests/social_security/accommodation_supplement/2018/situation.yaml @@ -1,8 +1,9 @@ - name: > Social Security Act 2018 - - Accommodation Supplement - - Situation - - Person who has 1 or more dependent children and who is in a relationship + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (1) (4) Person who has 1 or more dependent children and who is in a + relationship period: 2018-11-26 input: persons: @@ -95,9 +96,9 @@ - name: > Social Security Act 2018 - - Acommodation Supplement - - Situation - - Sole parent with 2 or more dependent children + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (1) (4) Sole parent with 2 or more dependent children period: 2018-11-26 input: persons: @@ -190,9 +191,9 @@ - name: > Social Security Act 2018 - - Acommodation Supplement - - Situation - - Person who has no dependent children and who is in a relationship + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (2) (5) Person who has no dependent children and who is in a relationship period: 2018-11-26 input: persons: @@ -285,9 +286,9 @@ - name: > Social Security Act 2018 - - Acommodation Supplement - - Situation - - Sole parent with 1 dependent child + Schedule 4 Rates of benefits - + Part 7 Accommodation Supplement - + (2) (5) Sole parent with 1 dependent child period: 2018-11-26 input: persons: diff --git a/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml b/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml index 3109f7a5..08555461 100644 --- a/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml +++ b/openfisca_aotearoa/tests/student_allowance/basic_grant.yaml @@ -6,16 +6,21 @@ persons: fulltime_uni_student: age: - "2017-08-01": 21 + "day:2017-08-01:31": 21 + age_of_partner: + "day:2017-08-01:31": 25 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true + student_allowance__married_or_partnered: false Parttime_student: age: - "2017-08-01": 18 + "day:2017-08-01:31": 18 + age_of_partner: + "day:2017-08-01:31": 25 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -23,7 +28,9 @@ Overseas_student: age: - "2017-08-01": 27 + "day:2017-08-01:31": 27 + age_of_partner: + "day:2017-08-01:31": 25 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -31,7 +38,9 @@ Refugee: age: - "2017-08-01": 25 + "day:2017-08-01:31": 25 + age_of_partner: + "day:2017-08-01:31": 25 immigration__recognised_refugee: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true @@ -39,7 +48,9 @@ Not_a_student: age: - "2017-08-01": 50 + "day:2017-08-01:31": 50 + age_of_partner: + "day:2017-08-01:31": 25 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: false @@ -57,41 +68,55 @@ persons: married_secondary_school_student_with_child: age: - "2017-08-01": 16 + "day:2017-08-01:31": 16 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true - student_allowance__married_or_partnered: true - student_allowance__supported_child: true + student_allowance__married_or_partnered: + "day:2017-08-01:31": true + student_allowance__supported_child: + "day:2017-08-01:31": true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true not_married_secondary_school_student_with_child: age: - "2017-08-01": 16 + "day:2017-08-01:31": 16 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true - student_allowance__married_or_partnered: false - student_allowance__supported_child: true + student_allowance__married_or_partnered: + "day:2017-08-01:31": false + student_allowance__supported_child: + "day:2017-08-01:31": true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true childless_married_secondary_school_student: age: - "2017-08-01": 16 + "day:2017-08-01:31": 16 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true - student_allowance__married_or_partnered: false - student_allowance__supported_child: false + student_allowance__married_or_partnered: + "day:2017-08-01:31": false + student_allowance__supported_child: + "day:2017-08-01:31": false student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true 18yo_secondary_student: age: - "2017-08-01": 18 + "day:2017-08-01:31": 18 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__secondary_student: true @@ -110,11 +135,16 @@ persons: default: age: - "2017-08-01": 22 + day:2017-08-01:31: 22 + age_of_partner: + "day:2017-08-01:31": 20 + student_allowance__married_or_partnered: false not_attending: age: - "2017-08-01": 21 + "day:2017-08-01:31": 21 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -123,7 +153,9 @@ not_immigration__citizen_or_resident: age: - "2017-08-01": 21 + "day:2017-08-01:31": 21 + age_of_partner: + "day:2017-08-01:31": 20 student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true @@ -140,16 +172,21 @@ persons: fulltime_uni_studdent: age: - "2017-08-01": 67 + "day:2017-08-01:31": 67 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true student_allowance__meets_attendance_and_performance_requirements: true + student_allowance__married_or_partnered: false Parttime_student: age: - "2017-08-01": 68 + "day:2017-08-01:31": 68 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -157,7 +194,9 @@ Overseas_student: age: - "2017-08-01": 70 + "day:2017-08-01:31": 70 + age_of_partner: + "day:2017-08-01:31": 20 citizenship__citizen: true social_security__ordinarily_resident_in_new_zealand: true student_allowance__tertiary_student: true @@ -165,7 +204,9 @@ Refugee: age: - "2017-08-01": 99 + "day:2017-08-01:31": 99 + age_of_partner: + "day:2017-08-01:31": 20 immigration__recognised_refugee: true student_allowance__tertiary_student: true student_allowance__enrolled_fulltime: true diff --git a/openfisca_aotearoa/variables/acts/income_tax/family_scheme/family_tax_credit.py b/openfisca_aotearoa/variables/acts/income_tax/family_scheme/family_tax_credit.py index 40e97dc9..0748f145 100644 --- a/openfisca_aotearoa/variables/acts/income_tax/family_scheme/family_tax_credit.py +++ b/openfisca_aotearoa/variables/acts/income_tax/family_scheme/family_tax_credit.py @@ -17,7 +17,7 @@ class family_tax_credit(Variable): def formula_2007_11_01(people, period, _params): return ( - + people("family_tax_credit__eligible", period) + people("family_tax_credit__eligible", period) * people("family_tax_credit__base", period) ) @@ -43,7 +43,7 @@ class family_tax_credit__base(Variable): def formula_2007_11_01(people, period, _params): return ( - + people("family_tax_credit__eldest", period, "add") + people("family_tax_credit__eldest", period, "add") + people("family_tax_credit__not_eldest", period, "add") ) @@ -75,7 +75,7 @@ def formula_2007_11_01(people, period, params): ) return ( - + principal + principal * eldest_child * prescribed_amount / period.this_year.days @@ -109,7 +109,7 @@ def formula_2007_11_01(people, period, params): ) return ( - + principal + principal * other_than_the_eldest_child * prescribed_amount / period.this_year.days diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/accommodation_supplement.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/accommodation_supplement.py index 43ac985f..0595855b 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/accommodation_supplement.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/accommodation_supplement.py @@ -5,7 +5,6 @@ from openfisca_core import periods, variables from openfisca_aotearoa import entities -from openfisca_aotearoa.variables.demographics.housing import AccommodationType class accommodation_supplement(variables.Variable): @@ -19,10 +18,8 @@ class accommodation_supplement(variables.Variable): def formula_2018_11_26(people, period, _params): entitled = people("accommodation_supplement__entitled", period) - # TODO: move to parameter accommodation_costs = people("accommodation_costs", period) - accommodation_type = people("accommodation_type", period) - rate = (accommodation_type == AccommodationType.lodging) * .62 + 1 + rate = people("accommodation_supplement__rate", period) cost = accommodation_costs * rate rebate = people("accommodation_supplement__rebate", period) cutout = people("accommodation_supplement__cutout", period) diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/costs.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/costs.py index 4e05aeca..7b86b443 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/costs.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/costs.py @@ -32,7 +32,7 @@ def formula_2018_11_26(people, period, _params): ) accommodation_costs_tenancy = ( - + accommodation_costs_principal_tenant + accommodation_costs_principal_tenant + accommodation_costs_other_tenants ) @@ -47,47 +47,47 @@ def formula_2018_11_26(people, period, _params): ) accommodation_costs_ownership = ( - + accommodation_costs_principal_owner + accommodation_costs_principal_owner + accommodation_costs_other_owners ) ssa2018_65_2_a = ( - + numpy.logical_not(people.has_role(entities.Tenancy.TENANT)) + numpy.logical_not(people.has_role(entities.Tenancy.TENANT)) * numpy.logical_not(people.has_role(entities.Tenancy.OTHER)) * (accommodation_costs > 0) * (accommodation_type == housing.AccommodationType.rent) ) ssa2018_65_2_b = ( - + numpy.logical_not(people.has_role(entities.Ownership.OWNER)) + numpy.logical_not(people.has_role(entities.Ownership.OWNER)) * numpy.logical_not(people.has_role(entities.Ownership.OTHER)) * (accommodation_costs > 0) * (accommodation_type == housing.AccommodationType.mortgage) ) ssa2018_65_2_c = ( - + (accommodation_costs > 0) + (accommodation_costs > 0) * ( - + (accommodation_type == housing.AccommodationType.board) + (accommodation_type == housing.AccommodationType.board) + (accommodation_type == housing.AccommodationType.lodging) ) ) ssa2018_65_2_d = ( - + ( - + people.has_role(entities.Tenancy.PRINCIPAL) + ( + people.has_role(entities.Tenancy.PRINCIPAL) * (accommodation_costs_tenancy > 0) * (accommodation_type == housing.AccommodationType.rent) ) + ( - + people.has_role(entities.Ownership.PRINCIPAL) + people.has_role(entities.Ownership.PRINCIPAL) * (accommodation_costs_ownership > 0) * (accommodation_type == housing.AccommodationType.mortgage) ) ) return ( - + ssa2018_65_2_a + ssa2018_65_2_a + ssa2018_65_2_b + ssa2018_65_2_c + ssa2018_65_2_d diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/entitled.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/entitled.py index 798edbac..8a60a9c4 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/entitled.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/entitled.py @@ -55,7 +55,7 @@ def formula_2018_11_26(people, period, parameters): ssa2018_65_1_c_ii = numpy.logical_not(other_funding_exclusion) return ( - + ssa2018_65_1_a + ssa2018_65_1_a * ssa2018_65_1_b * ssa2018_65_1_c_i * ssa2018_65_1_c_ii @@ -93,7 +93,7 @@ def formula_1964_12_04(people, period, params): ) resident_or_citizen = ( - + people("immigration__resident", this_month) + people("immigration__resident", this_month) + people("immigration__permanent_resident", this_month) + people("citizenship__citizen", this_month) ) @@ -117,7 +117,7 @@ def formula_1964_12_04(people, period, params): ) return ( - + age_requirement + age_requirement * resident_or_citizen * in_nz * accommodation_supplement__accommodation_costs diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/exclusion.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/exclusion.py index bac40129..9df5a779 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/exclusion.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/exclusion.py @@ -44,22 +44,22 @@ def formula_2018_11_26(people, period, _params): ) ssa2018_67_a = ( - + people.has_role(entities.Family.PRINCIPAL) + people.has_role(entities.Family.PRINCIPAL) * partners_accommodation_supplement ) ssa2018_67_b_i = ( - + people("basic_grant__receiving", period) + people("basic_grant__receiving", period) + people("independent_circumstances_grant__receiving", period) ) ssa2018_67_b_ii = ( - + people("basic_grant__entitled", period.first_month) + people("basic_grant__entitled", period.first_month) + people("independent_circumstances_grant__entitled", period.first_month) ) ssa2018_67_b_iii = ( - + people("basic_grant__would_be_entitled", period) + people("basic_grant__would_be_entitled", period) + people("independent_circumstances_grant__would_be_entitled", period) ) @@ -70,7 +70,7 @@ def formula_2018_11_26(people, period, _params): # TODO: ssa2018_67_e return ( - + ssa2018_67_a + ssa2018_67_a + ssa2018_67_b_i + ssa2018_67_b_ii + ssa2018_67_b_iii diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rate.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rate.py new file mode 100644 index 00000000..6c549c1b --- /dev/null +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rate.py @@ -0,0 +1,27 @@ +"""TODO: Add missing doctring.""" + +import numpy + +from openfisca_core import periods, variables + +from openfisca_aotearoa import entities +from openfisca_aotearoa.variables.demographics.housing import AccommodationType + + +class accommodation_supplement__rate(variables.Variable): + label = "in relation to a person who is a boarder or lodger in any premises, 62% of the amount paid for board or lodging" + reference = "https://www.legislation.govt.nz/act/public/2018/0032/latest/whole.html#LMS28903" + entity = entities.Person + value_type = float + default_value = 0 + definition_period = periods.DateUnit.WEEK + + def formula_2018_11_26(people, period, parameters): + board_lodger_percent = parameters(period).social_security.accommodation_supplement.board_lodger_percent + accommodation_type = people("accommodation_type", period) + not_board = (accommodation_type != AccommodationType.board) * 1 + not_lodge = (accommodation_type != AccommodationType.lodging) * 1 + not_board_lodging = (not_board + not_lodge) - 1 + not_board_lodging = numpy.clip(not_board_lodging + board_lodger_percent, 0, 1) + + return not_board_lodging diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rebate.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rebate.py index 84e7b3b4..f2085ede 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rebate.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/rebate.py @@ -8,7 +8,6 @@ from openfisca_aotearoa.variables.acts.social_security.accommodation_supplement.situation import ( AccommodationSupplement__Situation, ) -from openfisca_aotearoa.variables.demographics.housing import AccommodationType class accommodation_supplement__rebate(variables.Variable): @@ -23,8 +22,9 @@ class accommodation_supplement__rebate(variables.Variable): def formula_2018_11_26(people, period, params): situation = people("accommodation_supplement__situation", period) accommodation_costs = people("accommodation_costs", period) - accommodation_type = people("accommodation_type", period) - base_rate = people("accommodation_supplement__base", period) + rate = people("accommodation_supplement__rate", period) + cost = accommodation_costs * rate + base = people("accommodation_supplement__base", period) rebate = ( params(period) @@ -38,15 +38,12 @@ def formula_2018_11_26(people, period, params): for member in tuple(AccommodationSupplement__Situation)[1:] ] - # TODO: move to parameter - rate = (accommodation_type == AccommodationType.lodging) * .62 + 1 - ssa2018_sched_4_part_7_1_to_6 = [ - + accommodation_costs * rate + + cost - rebate[f"section_{i}"]["accommodation_costs"] * ( - + accommodation_costs * rate - - rebate[f"section_{i}"]["base_rate"] * base_rate + + cost + - rebate[f"section_{i}"]["base_rate"] * base ) for i in range(1, 7) ] diff --git a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/situation.py b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/situation.py index b027f2d2..8fbb4c74 100644 --- a/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/situation.py +++ b/openfisca_aotearoa/variables/acts/social_security/accommodation_supplement/situation.py @@ -38,33 +38,33 @@ def formula_2018_11_26(people, period, _params): # As conditions 1-3 and 4-6 differ only in the accommodation type, we # first calculate the "base condition" (w/o accommodation type). cond_1 = ( - + (dependent_children >= 1) * mingled + (dependent_children >= 1) * mingled + (dependent_children >= 2) * singles ) cond_2 = ( - + (dependent_children == 0) * mingled + (dependent_children == 0) * mingled + (dependent_children == 1) * singles ) cond_3 = ( - + numpy.logical_not(cond_1) + numpy.logical_not(cond_1) * numpy.logical_not(cond_2) ) # Then we calculate conditions 1-3. rent_board_lodge = ( - + (accommodation_type == housing.AccommodationType.rent) + (accommodation_type == housing.AccommodationType.rent) + (accommodation_type == housing.AccommodationType.board) + (accommodation_type == housing.AccommodationType.lodging) ) ssa2018_sched_4_part_7_1_to_3 = ( - + numpy.array([cond_1, cond_2, cond_3]) + numpy.array([cond_1, cond_2, cond_3]) * rent_board_lodge ) # And conditions 4-6. mortgage = accommodation_type == housing.AccommodationType.mortgage ssa2018_sched_4_part_7_4_to_6 = ( - + numpy.array([cond_1, cond_2, cond_3]) + numpy.array([cond_1, cond_2, cond_3]) * mortgage ) diff --git a/openfisca_aotearoa/variables/acts/social_security/relationships.py b/openfisca_aotearoa/variables/acts/social_security/relationships.py index cb508140..40b56f62 100644 --- a/openfisca_aotearoa/variables/acts/social_security/relationships.py +++ b/openfisca_aotearoa/variables/acts/social_security/relationships.py @@ -20,6 +20,6 @@ def formula(people, period, _params): relationship = people.family.nb_persons(entities.Family.PARTNER) > 0 return ( - + people.has_role(entities.Family.PRINCIPAL) + people.has_role(entities.Family.PRINCIPAL) * (married + civil_union + de_facto_rel + relationship) ) diff --git a/openfisca_aotearoa/variables/demographics/ages.py b/openfisca_aotearoa/variables/demographics/ages.py index 1f125738..65b152a9 100644 --- a/openfisca_aotearoa/variables/demographics/ages.py +++ b/openfisca_aotearoa/variables/demographics/ages.py @@ -70,6 +70,7 @@ class age_of_partner(Variable): definition_period = DAY unit = "years" label = "The maximum age of partner in a family" + set_input = holders.set_input_dispatch_by_period def formula(persons, period, parameters): return persons.family.max(persons.family.members("age", period), role=Family.PARTNER) diff --git a/openfisca_aotearoa/variables/demographics/work.py b/openfisca_aotearoa/variables/demographics/work.py index 5d74de50..d56ff140 100644 --- a/openfisca_aotearoa/variables/demographics/work.py +++ b/openfisca_aotearoa/variables/demographics/work.py @@ -42,6 +42,6 @@ def formula(people, period): losing_earnings_from_health_injury = people("losing_earnings_from_health_injury", period) return ( - + numpy.logical_not(fulltime_employment) + numpy.logical_not(fulltime_employment) + fulltime_employment * losing_earnings_from_health_injury ) diff --git a/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/assets.py b/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/assets.py index ae7f60bb..08ffa0f4 100644 --- a/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/assets.py +++ b/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/assets.py @@ -35,7 +35,7 @@ def formula_2018_11_26(people, period, params): ) total_cash_assets = ( - + cash_assets_principal + cash_assets_principal + cash_assets_partners ) @@ -47,18 +47,18 @@ def formula_2018_11_26(people, period, params): ) ssr2018_15_1_a_i = ( - + mingled + mingled * (total_cash_assets <= threshold.ssa2018_15_1_a) ) ssr2018_15_1_a_ii = ( - + singles + singles * children * (total_cash_assets <= threshold.ssa2018_15_1_a) ) ssr2018_15_1_b = ( - + singles + singles * no_child * (total_cash_assets <= threshold.ssa2018_15_1_b) ) diff --git a/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/base.py b/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/base.py index 2f8bb7fb..b321bd9f 100644 --- a/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/base.py +++ b/openfisca_aotearoa/variables/regulation/social_security/accommodation_supplement/base.py @@ -75,7 +75,7 @@ def formula_2018_11_26(people, period, params): # And apply all the conditions. ssr2018_17_2_a = ( - + singles + singles * beneficiaries * no_child * under25y @@ -109,7 +109,7 @@ def formula_2018_11_26(people, period, params): # And apply all the conditions. ssr2018_17_2_b = ( - + singles + singles * beneficiaries * children * (numpy.select(receiving, rates) + tax_credit) @@ -124,7 +124,7 @@ def formula_2018_11_26(people, period, params): # And apply all the conditions. ssr2018_17_2_c = ( - + singles + singles * beneficiaries * no_child * leastwise25y @@ -146,26 +146,26 @@ def formula_2018_11_26(people, period, params): # (iii) the maximum weekly rate of a benefit paid in respect of the # beneficiary’s spouse or partner: receive_partners = numpy.sum([ - + people.has_role(entities.Family.PARTNER) + people.has_role(entities.Family.PARTNER) * numpy.select(receiving, rates), ]) ssr2018_17_2_d_i_iii = ( - + mingled + mingled * beneficiaries * no_child * (numpy.select(receiving, rates) + receive_partners) ) ssr2018_17_2_d_ii_iii = ( - + mingled + mingled * beneficiaries * children * (numpy.select(receiving, rates) + receive_partners + tax_credit) ) ssr2018_17_2_d = ( - + ssr2018_17_2_d_i_iii + ssr2018_17_2_d_i_iii + ssr2018_17_2_d_ii_iii ) @@ -190,7 +190,7 @@ def formula_2018_11_26(people, period, params): eligible = people("jobseeker_support__entitled", period) ssr2018_17_2_f = ( - + singles + singles * non_beneficiaries * children * eligible @@ -210,7 +210,7 @@ def formula_2018_11_26(people, period, params): ) ssr2018_17_2_g = ( - + singles + singles * non_beneficiaries * no_child * eligible @@ -231,13 +231,13 @@ def formula_2018_11_26(people, period, params): # have been payable in respect of the beneficiary’s spouse or # partner. rate_partners = numpy.sum([ - + people.has_role(entities.Family.PARTNER) + people.has_role(entities.Family.PARTNER) * eligible * rates[1], ]) ssr2018_17_2_h_i_iii = ( - + mingled + mingled * non_beneficiaries * no_child * eligible @@ -245,7 +245,7 @@ def formula_2018_11_26(people, period, params): ) ssr2018_17_2_h_ii_iii = ( - + mingled + mingled * non_beneficiaries * children * eligible @@ -253,12 +253,12 @@ def formula_2018_11_26(people, period, params): ) ssr2018_17_2_h = ( - + ssr2018_17_2_h_i_iii + ssr2018_17_2_h_i_iii + ssr2018_17_2_h_ii_iii ) return ( - + ssr2018_17_2_a + ssr2018_17_2_a + ssr2018_17_2_b + ssr2018_17_2_c + ssr2018_17_2_d diff --git a/openfisca_aotearoa/variables/regulation/student_allowance/basic_grant.py b/openfisca_aotearoa/variables/regulation/student_allowance/basic_grant.py index 74270c25..fda3e29b 100644 --- a/openfisca_aotearoa/variables/regulation/student_allowance/basic_grant.py +++ b/openfisca_aotearoa/variables/regulation/student_allowance/basic_grant.py @@ -15,7 +15,7 @@ class basic_grant__entitled(variables.Variable): reference = "http://legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM260306" def formula(persons, period, parameters): - has_children = persons("student_allowance__supported_child", period) + has_children = persons("student_allowance__supported_child", period.start) is_secondary_student = persons("student_allowance__secondary_student", period) is_tertiary_student = persons("student_allowance__tertiary_student", period) @@ -25,7 +25,7 @@ def formula(persons, period, parameters): is_under_18 = persons("age", period.start) < 18 is_or_over_18 = persons("age", period.start) >= 18 - married_or_partnered = persons("student_allowance__married_or_partnered", period) + married_or_partnered = persons("student_allowance__married_or_partnered", period.start) criteria_a = is_secondary_student * is_or_over_16 * is_under_18 * married_or_partnered * has_children criteria_b = is_tertiary_student * is_or_over_16 * is_under_18 * has_children diff --git a/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py b/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py index c6ab84ee..75c390b3 100644 --- a/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py +++ b/openfisca_aotearoa/variables/regulation/student_allowance/interpretation.py @@ -1,6 +1,7 @@ """TODO: Add missing doctring.""" -from openfisca_core.periods import MONTH +from openfisca_core import holders +from openfisca_core.periods import DAY, MONTH from openfisca_core.variables import Variable from openfisca_aotearoa.entities import Person @@ -56,14 +57,10 @@ class student_allowance__living_with_a_parent(Variable): class student_allowance__married_or_partnered(Variable): value_type = bool entity = Person - definition_period = MONTH + definition_period = DAY label = "married or partnered as per Student Allowances Regulations 1998" reference = "http://legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM259902" - """ - (a) means having a spouse; and - (b) for the avoidance of doubt, does not include a person who is legally married - but who does not have a spouse (as that term is defined in this subclause) - """ + set_input = holders.set_input_dispatch_by_period def formula(persons, period, parameters): return persons("student_allowance__person_has_spouse", period) @@ -72,31 +69,16 @@ def formula(persons, period, parameters): class student_allowance__supported_child(Variable): value_type = bool entity = Person - definition_period = MONTH + definition_period = DAY label = "has a supported child as per Student Allowances Regulations 1998" reference = "http://legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM259968" - """ - supported child, in relation to a student applying for an allowance, means a person younger than 24— - (a) - - whose well-being and financial support are the responsibility of the student; and - (b) who lives with that student at least half of the time; and - (c) who is not in receipt of— - (i) an allowance continued by regulation 3(a) to (c); or - (ii) jobseeker support, sole parent support, an emergency benefit, or a supported living payment under the Social Security Act 1964; or - (iii) New Zealand superannuation under the New Zealand Superannuation and Retirement Income Act 2001 or a veteran’s pension under - the Veterans’ Support Act 2014; or - (iv) payments under any government-assisted scheme (other than the Student Loan Scheme) which, in the opinion of the chief executive, - is similar to a benefit under the Social Security Act 1964; or - (v) income before tax from employment or self-employment which exceeds $80 per week; and - (d) in respect of whom no orphan’s benefit or unsupported child’s benefit is payable under the Social Security Act 1964 - """ + set_input = holders.set_input_dispatch_by_period class student_allowance__partner_has_a_supported_child(Variable): value_type = bool entity = Person - definition_period = MONTH + definition_period = DAY label = "their spouse has a supported child, as per Student Allowances Regulations 1998" reference = "www.legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM6530648" @@ -104,21 +86,16 @@ class student_allowance__partner_has_a_supported_child(Variable): class student_allowance__person_has_spouse(Variable): value_type = bool entity = Person - definition_period = MONTH + definition_period = DAY label = "Has spouse as per Student Allowances Regulations 1998" reference = "http://legislation.govt.nz/regulation/public/1998/0277/latest/whole.html#DLM259958" - - """ - Spouse, in relation to an applicant, means a person who is legally married to that applicant if— - (a) both of them are of or over 24; or - (b) one or both of them are younger than 24 and at least 1 of them has a supported child - """ + set_input = holders.set_input_dispatch_by_period def formula(persons, period, parameters): # NOTE: using the age at the start of the month # Age changes on a DAY, but this calculation only has a granularity of MONTH - part_a = (persons("age", period.start) >= 24) * (persons("age_of_partner", period.start) >= 24) - part_b = ((persons("age", period.start) >= 24) + (persons("age_of_partner", period.start) >= 24)) * \ - (persons("student_allowance__supported_child", period) + persons("student_allowance__partner_has_a_supported_child", period)) + part_a = (persons("age", period) >= 24) * (persons("age_of_partner", period) >= 24) + part_b = ((persons("age", period) >= 24) + (persons("age_of_partner", period) >= 24)) * \ + (persons("student_allowance__supported_child", period.start) + persons("student_allowance__partner_has_a_supported_child", period)) return part_a + part_b diff --git a/pyproject.toml b/pyproject.toml index 00b2cbe4..eb4d540a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "OpenFisca-Aotearoa" -version = "21.0.0" +version = "21.0.1" description = "OpenFisca rules-as-code system for Aotearoa." license = "AGPL-3.0-only" authors = [