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

Update address validation to handle a mix of street address and P.O. Box #94579

Closed
2 tasks
oddball-lindsay opened this issue Oct 8, 2024 · 4 comments
Closed
2 tasks
Assignees
Labels
accredited-representation-management-team Accredited Representation Management team backend bug Something isn't working

Comments

@oddball-lindsay
Copy link
Contributor

Background

We discovered in #93624 that there were 657 representatives with an invalid address, which resulted in their latitude and longitude being set to 0 and thus did not allow the representatives to be associated by users' search locations as expected.

Our solution will be to update how addresses are validated:

  1. If the address validator responds with a warning and/or 0 for lat + long, then we consider the address invalid
  2. Retry validation:
    i. Set original address 2 and 3 to nil and retry validation
    ii. If i. fails and there is a non-nil address 2, try with address 2 set to address 1 and address 3 as nil
    iii. if ii. fails and there is a non-nil address 3, try with address 3 set to address 1
    iv. If i-iii. fail, consider the address invalid

Tasks

  • Update address validator logic with the solution outlined above

Acceptance Criteria

  • The address validator for Find a Rep will be better equipped to handle addresses that mix a street address and a P.O. box.
@oddball-lindsay
Copy link
Contributor Author

The attached PR addresses things moving forward, would need a script to fix existing records.

@oddball-lindsay
Copy link
Contributor Author

Solution being discussed here: https://dsva.slack.com/archives/C05L6HSJLHM/p1729780243417109

Implementing the solution in Staging can happen today (once we get PO approval), and Production tomorrow (Friday). Not so dependent on Trexler File intake, could happen before or after -- aiming for before. Can process Trexler File whenever, as usual.

@oddball-lindsay
Copy link
Contributor Author

@jvcAdHoc documenting that Jen was okay with this approach and the 12 hours of downtime for the reps, so we should be good to move forward with the solution tomorrow (Friday)!

@oddball-lindsay
Copy link
Contributor Author

oddball-lindsay commented Oct 28, 2024

Updated staging numbers:

  • Veteran::Service::Representative.count: 13730
  • Veteran::Service::Representative.where(location: nil).count: 465
  • Veteran::Service::Representative.where(lat: 0, long: 0).count: 0

The nil location count is up ~100. We were able to get valid addresses for ~84% of the zero coordinate reps.

Production numbers: 13674 total, 392 nil location, 0 zero coordinate

Why are we seeing a difference between Staging and Production? Related to rate limiting, especially since we've introduced new checks.

Staging will likely have more reps (e.g. test reps) than Production because there is less cleanup in Production.


Affected reps are now showing accurate addresses. Because we've updated the validation method, the address we store in the database and show in the UI may not fully match the OGC database. In this case, some addresses may only show the P.O. Box OR the street address (not both) -- this is the sacrifice we make to show an accurate location. We hope that we can address this at a later time when we have the reps have more ability to edit/correct their address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accredited-representation-management-team Accredited Representation Management team backend bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants