usagov / test-at-home

Other
8 stars 4 forks source link

Explore usage of Smarty Streets API for address validation #57

Open hartsick opened 2 years ago

hartsick commented 2 years ago

Explore address validation With Smarty Streets API To discover how we might deliver the best address validation experience

Resources

Approach

Note: this is now only using the US street address validation API, since autocomplete has been deprioritized for launch.

Questions to answer

Running notes

hartsick commented 2 years ago

Note from Porta: can we compare to the USPS address validation API and see what they accept?

porta-antiporta commented 2 years ago

Looking at USPS API we will:

This recap correctly @hartsick?

porta-antiporta commented 2 years ago

We need input from SmartyStreets as to how to call their API to match as close a return as the USPS API (ex. SmartyStreets can return more than 1 address (in case of multiple potential matches), USPS API only returns one.) @ryanwoldatwork is this something we can ask SmartyStreets?

hartsick commented 2 years ago

@porta-antiporta Thinking more about this, I think we should find a way to submit the corrected address on the review page like what you had already specified in #43 (vs what we talked about earlier). I think we don't want to submit something to USPS that the person submitting hasn't seen and verified.

porta-antiporta commented 2 years ago

@hartsick yes I agree. Apologies, I was looking at this issue as fleshing out technical approach to the API, was going to update #43 with our findings. So to confirm:

  1. We accept the returned address from the API
  2. That new address is rendered on Review page along with a note/warning so the user is aware of the change.
hartsick commented 2 years ago

@porta-antiporta great! that makes sense to me!

hartsick commented 2 years ago

@porta-antiporta Poking around USPS.com and the Smarty Streets API, it seems like USPS shop currently doesn't accept dpv value D (for missing apartment numbers) but do accept Y and S. planning to move forward with that

porta-antiporta commented 2 years ago

10-4. updated above and in #43

hartsick commented 2 years ago

For going forward with this, I think we have a couple of options (loose notes before I din break):

  1. Only use strict validation from address validation API. This is the simplest technically but would mean we have many more validation failures and couldn't suggest many, if any, address corrections. The only time we might give useful feedback to user is if a correct address is missing a line 2, like apartment. I think the negative impacts of this could be reduced if we used this with the autocomplete API set onto to show postal data.
  2. Use invalid or enhanced matched strategy from address validation API. This is more complex from a technical and UX stand-point (need warnings), but might let us give suggested addresses where there was no exact match.

In all of these we'd need to implement in Javascript in order to display the suggested / corrected address back to the user before hitting the server. We would want to revalidate server-side just in case.

ryanwoldatwork commented 2 years ago

Hi @hartsick - thanks for outlining these tradeoffs.

If the USPS match is required (presumably, to support mailing needs), then strict makes sense.

Overall, this prompts me to inquire about "failure demand" - and otherwise, is there a help system to catch outlier cases/user experiences?

hartsick commented 2 years ago

Notes from Jan 11 sync: