Skip to content

LG 7912: Create controller for fetching addresses from ArcgisApi #7282

Merged
allthesignals merged 11 commits intomainfrom
wmg/7912-arcgis-controller
Nov 8, 2022
Merged

LG 7912: Create controller for fetching addresses from ArcgisApi #7282
allthesignals merged 11 commits intomainfrom
wmg/7912-arcgis-controller

Conversation

@allthesignals
Copy link
Contributor

🎫 Ticket

Link to the relevant ticket.

🛠 Summary of changes

Adds a controller, exposing an endpoint /verify/in_person/addresses, which returns ArcgisApi::Geocoder::AddressCandidate structs.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • automated test coverage
  • sandbox environment spot checks

🚀 Notes for Deployment

Need feedback on hiding this behind flag and authentication issues...

Comment on lines +23 to +24
suggestion = suggest(permitted_params[:address]).first
arcgis_api_response = [find_address_candidates(suggestion.magic_key).first]
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to rate limit these external calls in some form, but I'm not sure on the best strategy there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mitchellhenke any prior art elsewhere in the code that does this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I think that would be the path to take. It should probably be implemented within the service rather than the controller though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! Makes sense. Thank you.

@allthesignals allthesignals marked this pull request as ready for review November 3, 2022 21:47
@allthesignals allthesignals requested review from a team and racingspider November 3, 2022 21:47
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Are we planning to implement rate-limiting in this pull request, or separately?

@allthesignals allthesignals force-pushed the wmg/7912-arcgis-controller branch from 3901b0f to aa6707a Compare November 4, 2022 16:24
@allthesignals
Copy link
Contributor Author

Are we planning to implement rate-limiting in this pull request, or separately?

I am trying to add it in now and if for some reason turns into a rabbit hole will try to do separately.

config/routes.rb Outdated
as: :in_person_ready_to_verify
get '/in_person/usps_locations' => 'in_person/usps_locations#index'
put '/in_person/usps_locations' => 'in_person/usps_locations#update'
get '/in_person/addresses' => 'in_person/address_search#index'
Copy link
Contributor

Choose a reason for hiding this comment

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

a light convention (not 100% followed) we have is that we put our API endpoints under the /api namespace. Since this controller returns JSON and isn't expected to return HTML, I'd consider moving this there. But that could also happen in a separate PR when we actually have UI that makes s request here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also, because this is PII, going to change to a post.

Copy link
Contributor

@aduth aduth Nov 4, 2022

Choose a reason for hiding this comment

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

also, because this is PII, going to change to a post.

Good catch!

It also has me wondering if it'd make sense to change the specs to use Mx McFakerson's address. While it wouldn't have helped for HTTP logging issues (something to look in to!), we do have some guardrails to catching details from this PII constant in logging and I could imagine us doing something similar for HTTP request query parameters.

allthesignals and others added 4 commits November 4, 2022 11:59
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@allthesignals allthesignals force-pushed the wmg/7912-arcgis-controller branch from ba65ea7 to f7634b2 Compare November 4, 2022 18:57
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

LGTM

@allthesignals allthesignals force-pushed the wmg/7912-arcgis-controller branch from f7634b2 to a5b3385 Compare November 4, 2022 20:54
@allthesignals
Copy link
Contributor Author

I am going to add rate-limiting in a follow-up PR.

@allthesignals allthesignals merged commit 1ffc547 into main Nov 8, 2022
@allthesignals allthesignals deleted the wmg/7912-arcgis-controller branch November 8, 2022 18:54
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.

4 participants