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

Guaranteed Income Supplement + Spousal Allowance #102

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7bcbf44
initial commit
alex-rand Jan 12, 2023
5df6bd1
add gis_category template
alex-rand Jan 13, 2023
0e7d914
add is_widow.py
alex-rand Jan 14, 2023
ff38839
more eligibility categories
alex-rand Jan 16, 2023
0cdf46e
Add spouse_oas_eligible.py
alex-rand Jan 17, 2023
98b5c34
spa_eligibility_age.py and age_spouse.py
alex-rand Jan 18, 2023
e63ab6d
spa eligibility variables + tests + gis categories
alex-rand Jan 19, 2023
00b3d4a
fix the unit tests
alex-rand Feb 1, 2023
1bb6f0f
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
alex-rand Feb 3, 2023
ed3a1c9
add gis cap values
alex-rand Feb 3, 2023
33ef72f
add gis cap values
alex-rand Feb 3, 2023
5fdc417
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 3, 2023
77a9bde
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 3, 2023
58dfb7d
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 4, 2023
81749fa
base amount and unit tests
alex-rand Feb 4, 2023
e161995
base amount and unit tests
alex-rand Feb 4, 2023
1a05aa8
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 6, 2023
0575221
GIS reduction and unit tests
alex-rand Feb 12, 2023
af03957
Add the SPA amounts and reductions
alex-rand Feb 13, 2023
9ff2067
Add the SPA amounts and reductions
alex-rand Feb 13, 2023
a91bcc4
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 14, 2023
d99197c
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 14, 2023
c6115cb
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 15, 2023
c22252e
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 15, 2023
0ae0e55
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 16, 2023
de4d21f
breakeven variables
alex-rand Feb 19, 2023
445ed44
update entities.py to include 'state'
alex-rand Feb 20, 2023
fe38e71
fix some years, add crossover variable
alex-rand Feb 21, 2023
6bc88e5
added gis-spa couples gis reduction plateau
alex-rand Feb 23, 2023
94d680a
added gis-spa couples gis reduction plateau
alex-rand Feb 23, 2023
c708393
Merge branch 'alex-rand/issue98' of https://github.com/alex-rand/poli…
alex-rand Feb 23, 2023
dc7bae1
add GIS/SPA top-up caps
alex-rand Mar 13, 2023
60f73f0
GIS top-up reduction var, params, test
alex-rand Mar 14, 2023
8dfe339
first full draft of gis/spa
alex-rand Mar 15, 2023
ef84c1b
make format
alex-rand Mar 15, 2023
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
@@ -0,0 +1,8 @@
description: Age at which a widow becomes eligible for the GIS
values:
2020-01-01: 60
metadata:
label: SPA Widow Eligibility Age
reference:
- title: Government of Canada - Guaranteed Income Supplement
href: https://www.canada.ca/en/services/benefits/publicpensions/cpp/old-age-security/guaranteed-income-supplement/allowance-survivor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- name: Single OAS Pensioner
period: 2022
input:
is_married: false
old_age_security_pension_eligibility: true
output:
gis_spa_category: "SINGLE_WITH_OAS"

- name: Single OAS Pensioner
period: 2022
input:
is_widow: true
old_age_security_pension_eligibility: false
age: 61
output:
gis_spa_category: "WIDOW_60_64"

- name: Couple, both are OAS eligible
period: 2022
input:
is_married: true
people:
head:
age: 70
old_age_security_pension_eligibility: true
spouse:
age: 70
old_age_security_pension_eligibility: true
household:
is_married: true
members: [head, spouse]
output:
gis_spa_category: ["COUPLE_BOTH_OAS", "COUPLE_BOTH_OAS"]

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
- name: Spouse is OAS eligible
period: 2022
input:
is_married: true
people:
head:
age: 70
old_age_security_pension_eligibility: true
spouse:
age: 70
old_age_security_pension_eligibility: true
household:
members: [head, spouse]
output:
spouse_oas_eligible: [true, true]

- name: Spouse is not OAS eligible
period: 2022
input:
is_married: true
people:
head:
age: 70
old_age_security_pension_eligibility: false
spouse:
age: 70
old_age_security_pension_eligibility: true
household:
members: [head, spouse]
output:
spouse_oas_eligible: [false, true]

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from policyengine_canada.model_api import *

class gis_eligible(Variable):
value_type = bool
entity = Person
label = "Eligible for guaranteed income supplement"
definition_period = YEAR

def formula(person, period, parameters):
p = parameters(period).gov.cra.benefits.gis
age = person("age", period)
# using the pre-repayment amount here because the documentation says "receives the OAS".
oas = person("old_age_security_pension_pre_repayment", period)
income = 3

# MAKE A 'type of household' variable!!
# MAKE A 'maximum amount' parameter based on 'type of household'!!
# MAKE A 'reduction rate' parameter based on 'type of household'? Copy GISRLS for example.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from policyengine_canada.model_api import *

# Categories as listed in SPSD/M variable 'imoldtyp'
class GISSPACategory(Enum):
NONE = "none"
SINGLE_WITH_OAS = "single_with_oas"
WIDOW_60_64 = "widow_60_64"
COUPLE_BOTH_OAS = "couple_both_oas"
COUPLE_ELDER_OAS_YOUNGER_60_64 = "couple_elder_oas_younger_60_64"
COUPLE_YOUNGER_OAS = "couple_younger_oas"

class gis_spa_category(Variable):
value_type = Enum
entity = Person
possible_values = GISSPACategory
default_value = GISSPACategory.NONE
definition_period = YEAR

def formula(person, period, parameters):
household = person.household
age = person("age", period)
married = household("is_married", period)
widow = person("is_widow", period)
oas_eligible = person("old_age_security_pension_eligibility", period)
spouse_oas_eligible = person("spouse_oas_eligible", period)
p = parameters(period).gov.cra.benefits.gis_spa
return select(
[
~married & oas_eligible,
# The law specifies widows aged 60-64, but that cutoff of 64 is just because at 65 you become eligible for OAS. I just reference OAS eligibilty directly.
widow & ~married & ~oas_eligible & (age >= p.widows_eligibility_age),
married & oas_eligible & spouse_oas_eligible
],
[
GISSPACategory.SINGLE_WITH_OAS,
GISSPACategory.WIDOW_60_64,
GISSPACategory.COUPLE_BOTH_OAS
],
default=0,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_canada.model_api import *

class spouse_oas_eligible(Variable):
value_type = bool
entity = Person
label = "Spouse is eligible for the Old Age Security Pension"
definition_period = YEAR

def formula(person, period, parameters):
oas_eligible = person("old_age_security_pension_eligibility", period)
head_or_spouse = person("is_head", period) | person("is_spouse", period)
head_or_spouse_oas_eligible = head_or_spouse & oas_eligible
household = person.household
count_head_or_spouse_oas_eligible = household.sum(head_or_spouse_oas_eligible)
spouse_oas_eligible = count_head_or_spouse_oas_eligible - where(oas_eligible, 1, 0)
alex-rand marked this conversation as resolved.
Show resolved Hide resolved

return spouse_oas_eligible
8 changes: 8 additions & 0 deletions policyengine_canada/variables/household/person/is_widow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from policyengine_canada.model_api import *

class is_widow(Variable):
value_type = bool
entity = Person
label = "Widow or widower"
documentation = "Spouse or common-law partner has died and since their death the person has not remarried or become a common-law partner to another person"
definition_period = YEAR
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"tqdm>=4.46.0,<5",
"requests>=2.27.1,<3",
"pandas>=1.4.2,<2",
"policyengine_core>=1.10.18,<2",
"policyengine_core>=1.11.4,<2",
"plotly>=5.6.0,<6",
]

Expand Down