Skip to content

LG-10422 Validate Address1 Field from Document (DocAuth/IdV)#9002

Merged
charleyf merged 12 commits intomainfrom
charley/lg-10422-validate-address1-field-from-document
Aug 25, 2023
Merged

LG-10422 Validate Address1 Field from Document (DocAuth/IdV)#9002
charleyf merged 12 commits intomainfrom
charley/lg-10422-validate-address1-field-from-document

Conversation

@charleyf
Copy link
Contributor

@charleyf charleyf commented Aug 14, 2023

🎫 Ticket

Link to the relevant ticket.
https://cm-jira.usa.gov/browse/LG-10422

🛠 Summary of changes

  • We extract/OCR text from the images of documents that users upload.
  • One of the pieces of data we extract is the users street address (like 123 Test Ave).
  • Currently, we don't immediately check whether that address is present in the text we get back from the OCR/extraction.
  • However, if the address isn't extracted then the user will fail the verification process at a later step because of their missing street address.

This PR changes it so that if an address is not read from the document correctly we show an error immediately instead of allowing them to continue to the next step. This should help folks fix these errors and succeed in the verification process.

📜 Testing Plan

First, create two yaml files

Save this as "missing-address.yml"

document:
  type: license
  first_name: Susan
  last_name: Smith
  middle_name: Q
  address1: ""
  address2: Apt 3
  city: Bayside
  state: NY
  zipcode: "11225"
  dob: 10/06/1938
  phone: +1 314-555-1212
  state_id_number: "123456789"
  state_id_type: drivers_license
  state_id_jurisdiction: "NY"

Save this as "has-no-errors.yml"

document:
  type: license
  first_name: Susan
  last_name: Smith
  middle_name: Q
  address1: 1 Microsoft Way
  address2: Apt 3
  city: Bayside
  state: NY
  zipcode: '11364'
  dob: 10/06/1938
  phone: +1 314-555-1212
  state_id_number: '123456789'
  state_id_type: drivers_license
  state_id_jurisdiction: 'NY'

Second, navigate to the DocAuth Flow, Upload page

Log in to login.gov on your local instance, navigate to the doc auth flow by adding /verify to the end of your URL, then click through until you see the page that lets you upload the "FRONT" and "BACK" of your ID.

Third, test the errors

  • On main branch (without these changes) verify that uploading the missing-address.yml file as both the front/back of the ID causes no errors in the document upload step.
  • On this branch (with the changes) verify that uploading missing-address.yml as both the front/back of the ID causes an error. See below for a screenshot of the error we expect.
  • For regression prevention, it's worth trying a few combinations of missing-address.yml and has-no-errors.yml to make sure they behave as expected. If either the front/back has a missing address we'd expect a failure, but if both are has-no-errors.yml we expect the document upload to succeed.

Screen Shot 2023-08-18 at 2 21 54 PM

Co-authored-by: Brittany Greaner <35475380+night-jellyfish@users.noreply.github.com>
@eileen-nava
Copy link
Contributor

I'm not sure how to test this yet

I was able to test it with a yml file that contained the below information.

document:
  type: license
  first_name: Susan
  last_name: Smith
  middle_name: Q
  address1: ""
  address2: Apt 3
  city: Bayside
  state: NY
  zipcode: "11225"
  dob: 10/06/1938
  phone: +1 314-555-1212
  state_id_number: "123456789"
  state_id_type: drivers_license
  state_id_jurisdiction: "NY"

The visual result matched what I expected. (Caveat, I am not a designer!)

Screen Shot 2023-08-18 at 2 21 54 PM

I agree that it would be good to try using ActiveRecord validation helpers.

@eileen-nava eileen-nava self-requested a review August 18, 2023 18:26
@charleyf charleyf marked this pull request as ready for review August 18, 2023 18:47
@charleyf charleyf requested a review from matthinz August 18, 2023 19:44
context 'but doc_pii validation fails' do
let(:first_name) { 'FAKEY' }
let(:last_name) { 'MCFAKERSON' }
let(:address1) {'123 Houston Ave'}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matthinz Requesting your review specifically because I'd like extra eyes on these changes in spec/controllers/idv/image_uploads_controller_spec.rb. Do these look reasonable to you?

Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd still like to get some eyes on this from Team Ada.

Copy link
Contributor

@amirbey amirbey left a comment

Choose a reason for hiding this comment

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

@charleyf ... LGTM 👍🏿 ... adding a feature test would be helpful for coverage

@charleyf charleyf merged commit 4d0c431 into main Aug 25, 2023
@charleyf charleyf deleted the charley/lg-10422-validate-address1-field-from-document branch August 25, 2023 14:08
@mdiarra3 mdiarra3 mentioned this pull request Aug 29, 2023
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.

6 participants