Skip to content

IPP: Remove redundant network call from PO Search#7746

Merged
allthesignals merged 10 commits intomainfrom
wmg/experiment-single-request
Feb 1, 2023
Merged

IPP: Remove redundant network call from PO Search#7746
allthesignals merged 10 commits intomainfrom
wmg/experiment-single-request

Conversation

@allthesignals
Copy link
Contributor

🛠 Summary of changes

Removes a redundant call to the ArcGIS API from the address_search_controller method.

Further, adds functionality to find_address_canddiates in Arcgis::Geocoder class to allow other usages of the endpoint.

Context: https://gsa-tts.slack.com/archives/C03FA4VBN76/p1675267483423649.

Before:
address_search_controller#index makes a request to /suggest, then uses the magicKey data from that response to issue another request to /findAddressCandidates in order to retrieve the full address record.

After:
address_search_controller#index makes a request directly to /findAddressCandidates, passing the user search term along to the SingleLine param.

Context:
/suggest is intended for typeahead search.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Automated test in Geocoder spec
  • Local manual spot-checks
  • Dev env checks

@allthesignals allthesignals changed the title changelog: Internal, In-Person Proofing, Remove redundant ArcGIS API … IPP: Remove redundant network call from PO Search Feb 1, 2023
@allthesignals allthesignals requested review from a team, NavaTim and zachmargolis February 1, 2023 17:02
@allthesignals allthesignals force-pushed the wmg/experiment-single-request branch from 60ccb5f to 8c46252 Compare February 1, 2023 17:15
@allthesignals allthesignals force-pushed the wmg/experiment-single-request branch from 8c46252 to 1367547 Compare February 1, 2023 17:18
# @param magic_key [String] a magic key value from a previous call to the #suggest method
# Makes HTTP request to find a full address record using a magic key or single text line
# @param options [Hash] one of 'magicKey', which is an ID returned from /suggest,
# or 'SingleLine', which should be a single string address that includes at least city,
Copy link
Contributor

Choose a reason for hiding this comment

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

Super nit: City and state? City or state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh definitely AND. ty.

Copy link
Contributor

@JackRyan1989 JackRyan1989 left a comment

Choose a reason for hiding this comment

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

Hey this looks good to me! I have one small change which is super nit-picky, but could you clarify the comment you added to geocoder.rb? I just wanna be clear on what the expectations are for the singeline string.

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@allthesignals allthesignals merged commit 1ac7c4a into main Feb 1, 2023
@allthesignals allthesignals deleted the wmg/experiment-single-request branch February 1, 2023 21:19

if supported_params.empty?
raise ArgumentError, <<~MSG
Unknown parameters: #{options.except(KNOWN_FIND_ADDRESS_CANDIDATES_PARAMETERS)}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Unknown parameters: #{options.except(KNOWN_FIND_ADDRESS_CANDIDATES_PARAMETERS)}.
Unknown parameters: #{options.except(*KNOWN_FIND_ADDRESS_CANDIDATES_PARAMETERS)}.

needs the * to work as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oof. Yes. Ty.

@@ -46,7 +46,7 @@
it 'returns candidates from magic_key' do
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need 'returns candidates from single_line' test(s)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Adding that in an upcoming PR... ty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR that includes a test for that #7753

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.

5 participants