Skip to content

LG-15456: Source AAMVA requested attributes from request#11826

Merged
lmgeorge merged 5 commits intomainfrom
lmgeorge/LG-15456
Feb 11, 2025
Merged

LG-15456: Source AAMVA requested attributes from request#11826
lmgeorge merged 5 commits intomainfrom
lmgeorge/LG-15456

Conversation

@lmgeorge
Copy link
Contributor

Why
Requested attributes are for our internal analytics to ensure that the fields sent match any errors we get back. Prior to this change, the requested attributes were sourced from the response body, which meant that regardless of what attributes were requested, we would only know about the attributes that were "seen" and processed by DLDV.

Without knowing which fields were actually requested, troubleshooting certain errors is challenging as there would be a mismatch between what was actually sent and how AAMVA processed the request.

How

  • Added the logic for generating requested attributes to Proofing::Aamva::Request::VerificationRequest as part of creating the request body.
  • Instead of Set, we use a Hash. Attributes that have a value are coded as 1. Core attributes (e.g., birthdate), which are always requested, are coded as 0 when blank.
  • Added a constant for storing a map of attributes to XPaths to reduce duplication.
  • Updated the Proofing::Aamva::Proofer to build the request and "normalize" the requested attributes Hash per previous business logic.

Future work should consider making a subclass that solely handles building the request body.

changelog: Bug Fixes, Analytics, Log correct DLDV requested attributes

🎫 Ticket

Link to the relevant ticket:
LG-15456

@lmgeorge lmgeorge added type - bug ruby Pull requests that update Ruby code area - analytics labels Jan 30, 2025
@lmgeorge lmgeorge requested review from a team and matthinz January 30, 2025 17:45
Copy link
Contributor

@n1zyy n1zyy left a comment

Choose a reason for hiding this comment

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

I agree with Matt's notes.

Overall this looks like a nice improvement. I'm holding off an an approval just since Matt has some suggestions, but otherwise I'm good with this.

address1: applicant.address1,
city: applicant.city,
state: applicant.state,
zipcode: applicant.zipcode,
Copy link
Contributor

Choose a reason for hiding this comment

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

👏 Moving xpath selectors out makes this so much more pleasant. 😄

end
end

context 'when issue / expiration present' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of ignorance on my part, why isn't this test needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This bit of functionality is covered in the VerificationRequest spec and the individual attribute specs further up.

lmgeorge and others added 5 commits February 10, 2025 17:49
**Why**
Requested attributes are for our internal analytics to ensure that the
fields sent match any errors we get back. Prior to this change, the
requested attributes were sourced from the response body, which meant
that regardless of what attributes were requested, we would only know
about the attributes that were "seen" and processed by DLDV.

Without knowing which fields were actually requested, troubleshooting
certain errors is challenging as there would be a mismatch between what
was actually sent and how AAMVA processed the request.

**How**
* Added the logic for generating requested attributes to
  `Proofing::Aamva::Request::VerificationRequest` as part of creating
  the request body.
* Instead of Set, we use a Hash. Attributes that have a value are coded as 1.
  Core attributes (e.g., birthdate), which are always requested, are
  coded as 0 when blank.
* Added a constant for storing a map of attributes to XPaths to reduce
  duplication.
* Updated the `Proofing::Aamva::Proofer` to build the request and
  "normalize" the requested attributes Hash per previous business logic.

Future work should consider making a subclass that solely handles
building the request body.

changelog: Bug Fixes, Analytics, Log correct DLDV requested attributes
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Matt Hinz <matt.hinz@gsa.gov>

# @param document [REXML::Document]
def update_requested_attributes(document)
VERIFICATION_REQUESTED_ATTRS.each do |attribute, rule|
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good, I like that we are sourcing this from the actual XML we are building.

@lmgeorge lmgeorge merged commit 35dcaf2 into main Feb 11, 2025
2 checks passed
@lmgeorge lmgeorge deleted the lmgeorge/LG-15456 branch February 11, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area - analytics ruby Pull requests that update Ruby code type - bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants