-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefill with VAProfile Contact Information V2 instead of the PCIU #18729
base: master
Are you sure you want to change the base?
Conversation
@@ -425,7 +461,7 @@ def clean!(value) | |||
end | |||
|
|||
def clean_hash!(hash) | |||
hash.deep_transform_keys! { |k| k.camelize(:lower) } | |||
hash.deep_transform_keys! { |k| k.to_s.camelize(:lower) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure symbols are converted to string before running camelize.
app/models/user.rb
Outdated
@@ -410,6 +414,16 @@ def va_profile_v2_email | |||
vaprofile_contact_info&.email&.email_address | |||
end | |||
|
|||
def va_profile_phone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
va_profile_phone and va_profile_mobile_phone are used for ContactInformation V2
6590595
to
57aac8f
Compare
@@ -348,9 +348,6 @@ features: | |||
communication_preferences: | |||
actor_type: user | |||
description: Allow user to access backend communication_preferences API | |||
contact_info_change_email: | |||
actor_type: user | |||
description: Send user a notification email when their contact info changes. | |||
covid_vaccine_registration: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used.
@@ -34,7 +34,13 @@ def metadata | |||
private | |||
|
|||
def prefill_form_address | |||
mailing_address = VAProfileRedis::ContactInformation.for_user(user).mailing_address if user.vet360_id.present? | |||
replace_pciu = Flipper.enabled?(:remove_pciu, user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can some of this be extracted to reduce duplication? Something like...
module ContactInformationVersioning
extend ActiveSupport::Concern
# Determine whether to use the new VAProfile V2 system
def use_v2_service?(user)
Flipper.enabled?(:remove_pciu, user)
end
# Retrieve the user's contact information
def contact_information_from(user)
if use_v2_service?(user)
VAProfileRedis::V2::ContactInformation.for_user(user)
else
VAProfileRedis::ContactInformation.for_user(user)
end
end
# Retrieve mailing address based on conditions
def mailing_address_from(user)
redis_prefill = contact_information_from(user)
use_v2_service = use_v2_service?(user)
# Only assign mailing address if the feature flag is enabled or the user has a vet360_id
redis_prefill&.mailing_address if use_v2_service || user.vet360_id.present?
end
end
Just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree to split this out if there were not steps after this to remove all the Contact Info V1 references. I believe the new version will be replaced soon after being pushed to prod. This would require more files to be removed when we remove PCIU and Contact Information in the later steps of the PCIU migration epic. Both Contact Information V1 and PCIU need to removed after this integration has been tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking along the same lines and thought having a module/concern in place could make future upgrades more convenient. But, you're probably right - keeping it as-is for now should simplify clean up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 LGTM
VAProfileRedis::V2::ContactInformation.for_user(self) | ||
else | ||
VAProfileRedis::ContactInformation.for_user(self) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bosawt These lines are the only changes to the user model. The previous code, quetionable code, was removed. :)
Note: Delete the description statements, complete each step. None are optional, but can be justified as to why they cannot be completed as written. Provide known gaps to testing that may raise the risk of merging to production.
Summary
Contact Information API V2 will be used to prefill data that previously used PCIU. VAProfile phone number methods were created to account for all the different number styles needed. Logs were added to
FormProfile.initialize_contact_information
to help determine if there is any data dispensary between PCIU and CI. We will be able to see if the data is obtained from the CI service before removing requests for pciu data.Spec Modifications:
Contact Information V2 data is used throughout Vets-API. Contact Info V2 user data will not be cached when
skip_va_profile_user
is present and was added to the necessary spec files.When possible,
allow(Flipper).to receive(:enabled?)
replacedFlipper.disable
to prevent flakey tests in the future.Monitoring
A temporary VAProfile Contact Information Unknown Data monitor was setup in Datadog to track missing data from the Contact Information API. Logs only checking the precense of data, no PII in logs.
Internal local testing was attempted. Did not receive any errors in the console or logs.
Related issue(s)
Testing done
Screenshots
Note: Optional
What areas of the site does it impact?
This impacts Form Profile and forms that use PCIU for prefilled data.
Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?