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

SSI Noncitizen Eligibility #4768

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

nicholasburka
Copy link

@nicholasburka nicholasburka commented Jul 22, 2024

Fixes #4754

@nicholasburka
Copy link
Author

@PavelMakarchuk

changelog_entry.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

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

Comment on lines 20 to 33
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
Copy link
Collaborator

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)

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)}")
Copy link
Collaborator

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

@PavelMakarchuk
Copy link
Collaborator

PavelMakarchuk commented Jul 24, 2024

To fix the link and version checks (terminal commands):
lint: make format
version: git pull upstream master

Copy link
Contributor

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

Copy link
Author

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

@nicholasburka
Copy link
Author

nicholasburka commented Sep 9, 2024

The PR may interfere with previous SSI income-based test cases, due to the 1996 ssi_qualifying_quarters_threshold.

From running make test:

raise ParameterNotFoundError(param_name, self._instant_str)
E   

policyengine_core.errors.parameter_not_found_error.ParameterNotFoundError: The parameter 
'gov.ssa.ssi.income.sources[ssi_qualifying_quarters_threshold]' was not found in the 
1986-01-01 tax and benefit system.


========================= short test summary info =========================
FAILED policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/income/deemed/from_ineligible_parent.yaml:: - policyengine_core.errors.parameter_not_found_error.ParameterNotFoundEr...
FAILED policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/income/deemed/from_ineligible_parent.yaml:: - policyengine_core.errors.parameter_not_found_error.ParameterNotFoundEr...
FAILED policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/income/deemed/from_ineligible_parent.yaml:: - policyengine_core.errors.parameter_not_found_error.ParameterNotFoundEr...
FAILED policyengine_us/tests/policy/baseline/gov/ssa/ssi/eligibility/income/deemed/from_ineligible_spouse.yaml:: - policyengine_core.errors.parameter_not_found_error.ParameterNotFoundEr...
=============== 4 failed, 6169 passed in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSI Qualified Non-Citizen Eligibility Rules
3 participants