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

#3234: Modify create_federal_portfolio script to add requested suborg fields - [AG] #3303

Merged
merged 42 commits into from
Jan 13, 2025

Conversation

zandercymatics
Copy link
Contributor

@zandercymatics zandercymatics commented Jan 6, 2025

Ticket

Resolves #3234

Changes

  • Modifies the create_federal_portfolio script to add requested suborg fields
  • Adds to the create_federal_portfolio script to add a post-processing step where for started domain requests under the same portfolio, the federal agency is set to none if the federal agency name and the organization match
  • Adds string normaliziation to organization_name, requested suborg and suborg city
  • Adds a "normalize_string" helper function

Context for reviewers

This PR adds some missing data to the create_federal_portfolio script -- we are now adding data to "requested suborganization, suborganization city, and suborganization state_territory" if the domain request is requesting a suborganization name that does not yet currently exist.

Additionally, it does some normalization on org names so we don't get duplicates.

Note: Department of Defense has a lot of good data, which may be helpful when testing this PR.

Setup

This is on getgov-ag so you can view the results there. Specifically, I'd recommend looking at department of defense and its started domains, as well. To test this locally, create a new domain request with the organization_name, state, and state_territory fields filled out. Then add a portfolio to said domain request, and run the script

Code Review Verification Steps

As the original developer, I have

Satisfied acceptance criteria and met development standards

  • Met the acceptance criteria, or will meet them in a subsequent PR
  • Created/modified automated tests
  • Update documentation in READMEs and/or onboarding guide

Ensured code standards are met (Original Developer)

  • If any updated dependencies on Pipfile, also update dependencies in requirements.txt.
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values

Validated user-facing changes (if applicable)

  • Tag @dotgov-designers in this PR's Reviewers for design review. If code is not user-facing, delete design reviewer checklist
  • Verify new pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)

As a code reviewer, I have

Reviewed, tested, and left feedback about the changes

  • Pulled this branch locally and tested it
  • Verified code meets all checks above. Address any checks that are not satisfied
  • Reviewed this code and left comments. Indicate if comments must be addressed before code is merged
  • Checked that all code is adequately covered by tests
  • Verify migrations are valid and do not conflict with existing migrations

Validated user-facing changes as a developer

Note: Multiple code reviewers can share the checklists above, a second reviewer should not make a duplicate checklist. All checks should be checked before approving, even those labeled N/A.

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Meets all designs and user flows provided by design/product
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • (Rarely needed) Tested as both an analyst and applicant user

As a designer reviewer, I have

Verified that the changes match the design intention

  • Checked that the design translated visually
  • Checked behavior. Comment any found issues or broken flows.
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links

Validated user-facing changes as a designer

  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • Tested with multiple browsers (check off which ones were used)
    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

References

Screenshots

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

2 similar comments
Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

@zandercymatics zandercymatics changed the title [Draft] #3234: Update create_federal_portfolio to include requested suborganization fields - [AG] [Draft] #3234: Add script to include requested suborganization fields on domain requests - [AG] Jan 6, 2025
fields_to_update = ["requested_suborganization", "suborganization_city", "suborganization_state_territory"]
self.mass_update_records(DomainRequest, filter_conditions, fields_to_update)

def custom_filter(self, records):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: maybe this function should be renamed to something more semantic within the context of its confines.
Basically all this does is after the initial filter, it does an exclude on the existing set of records

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 6, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 8, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 8, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

github-actions bot commented Jan 9, 2025

🥳 Successfully deployed to developer sandbox ag.

1 similar comment
Copy link

github-actions bot commented Jan 9, 2025

🥳 Successfully deployed to developer sandbox ag.

Copy link

🥳 Successfully deployed to developer sandbox ag.

@dave-kennedy-ecs dave-kennedy-ecs self-assigned this Jan 13, 2025
@dave-kennedy-ecs
Copy link
Contributor

This comment does not apply to your changes, but to the create_federal_portfolio.py file. add_arguments method could use explanation in its method comment for the --branch option.

@zandercymatics
Copy link
Contributor Author

@dave-kennedy-ecs Good find, thanks. I added a better comment to it which you may find helpful, as well

@@ -111,6 +170,8 @@ def handle_populate_portfolio(self, federal_agency, parse_domains, parse_request
if parse_requests or both:
self.handle_portfolio_requests(portfolio, federal_agency)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why is handle_portfolio_domains only called if created, but handle_portfolio_requests is called regardless of whether it is a creation?

Copy link
Contributor Author

@zandercymatics zandercymatics Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't entirely remember, to be honest. This script has "outgrown its shoes" a few times, so honestly probably a leftover

In a follow-on PR I am not checking on "created" for create_suborganizations either, so it probably makes sense to remove that created check, imo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it. Thanks for the explanation. I don't think it effects this PR, as it is focused on domain request.

@dave-kennedy-ecs
Copy link
Contributor

Review of code is done. Script is easy to read and follow. And appears to meet the ACs. Will now test in AG.

Copy link

🥳 Successfully deployed to developer sandbox ag.

Copy link

🥳 Successfully deployed to developer sandbox ag.

Copy link
Contributor

@dave-kennedy-ecs dave-kennedy-ecs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully locally and on AG sandbox
Approved

Copy link

🥳 Successfully deployed to developer sandbox ag.

@zandercymatics zandercymatics merged commit 652ebeb into main Jan 13, 2025
10 checks passed
@zandercymatics zandercymatics deleted the ag/3234-test-existing-script branch January 13, 2025 18:07
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.

Test existing script to associate domain requests with their portfolio
2 participants