-
Notifications
You must be signed in to change notification settings - Fork 174
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
SSI Noncitizen Eligibility #4768
base: master
Are you sure you want to change the base?
SSI Noncitizen Eligibility #4768
Conversation
policyengine_us/parameters/gov/ssa/ssi/eligibility/status/qualified_noncitizen.yaml
Outdated
Show resolved
Hide resolved
policyengine_us/parameters/gov/ssa/ssi/eligibility/status/qualified_noncitizen.yaml
Outdated
Show resolved
Hide resolved
policyengine_us/tests/policy/baseline/gov/ssa/ssi/ssi_noncitizen_basic.yaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually we would create multiple unit tests in one file but in this case it fine to leave it as it is
policyengine_us/variables/gov/ssa/ssi/eligibility/status/is_ssi_eligible_individual.py
Outdated
Show resolved
Hide resolved
policyengine_us/variables/gov/ssa/ssi/eligibility/status/is_ssi_eligible_individual.py
Outdated
Show resolved
Hide resolved
for qualified_status in qualified_statuses: | ||
if qualified_status == "LEGAL_PERMANENT_RESIDENT": | ||
# LPR's need 40 Qualifying Quarters of Earnings | ||
conditions.append(np.logical_and(status == ImmigrationStatus.LEGAL_PERMANENT_RESIDENT, has_40qq_earnings)) | ||
else: | ||
conditions.append(status == getattr(ImmigrationStatus, qualified_status)) | ||
|
||
# If any of the tests pass, return True | ||
qualified = np.select( | ||
conditions, | ||
[True] * len(conditions), | ||
default=False | ||
) | ||
return qualified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify to something like this:
conditions = [
np.logical_and(status == ImmigrationStatus.LEGAL_PERMANENT_RESIDENT, has_40qq_earnings)
if qualified_status == "LEGAL_PERMANENT_RESIDENT"
else status == getattr(ImmigrationStatus, qualified_status)
for qualified_status in qualified_statuses
]
# If any of the tests pass, return True
return tax_unit.any(conditions)
policyengine_us/variables/household/income/person/ssi_40qq_earnings.py
Outdated
Show resolved
Hide resolved
person("immigration_status_str", period).decode_to_str() | ||
) | ||
status_str = person("immigration_status_str", period).decode_to_str() | ||
print(f"Raw immigration_status_str values in formula: {np.unique(status_str)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the print or can we remove it here
Co-authored-by: Pavel Makarchuk <[email protected]>
Co-authored-by: Pavel Makarchuk <[email protected]>
Co-authored-by: Pavel Makarchuk <[email protected]>
Co-authored-by: Pavel Makarchuk <[email protected]>
Co-authored-by: Pavel Makarchuk <[email protected]>
To fix the link and version checks (terminal commands): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make a variable for ssi_qualifying_quarters_earnings
instead and add 40 as a policy parameter, for consistency with our standard to avoid parameter values in variable names/definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, nice shift, will do
The PR may interfere with previous SSI income-based test cases, due to the 1996 ssi_qualifying_quarters_threshold. From running make test:
|
Fixes #4754