Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RachalCassity
Copy link
Member

@RachalCassity RachalCassity commented Oct 3, 2024

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.

    opt[:email] ||= extract_pciu_data(:pciu_email)
    if opt[:home_phone].nil?
      opt[:home_phone] = pciu_primary_phone
      opt[:us_phone] = pciu_us_phone
    end

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?) replaced Flipper.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.

      Rails.logger.info("VAProfile Contact Info: Address? #{opt[:address].present?},
        Email? #{opt[:email].present?}, Phone? #{opt[:home_phone].present?}")

Internal local testing was attempted. Did not receive any errors in the console or logs.

Related issue(s)

Testing done

  • New code is covered by unit tests
  • Describe what the old behavior was prior to the change
  • Describe the steps required to verify your changes are working as expected. Exclusively stating 'Specs run' is NOT acceptable as appropriate testing
  • If this work is behind a flipper:
    • Tests need to be written for both the flipper on and flipper off scenarios. Docs.
    • What is the testing plan for rolling out the feature?

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

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

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?

@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 3, 2024 14:28 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 4, 2024 17:58 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 7, 2024 23:31 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 8, 2024 14:37 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 8, 2024 17:04 Inactive
@@ -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) }
Copy link
Member Author

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.

@@ -410,6 +414,16 @@ def va_profile_v2_email
vaprofile_contact_info&.email&.email_address
end

def va_profile_phone
Copy link
Member Author

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

@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 9, 2024 20:29 Inactive
@RachalCassity RachalCassity changed the title Rcassity replace pciu service Use Contact Information V2 Service for prefill instead of the PCIU Service Oct 9, 2024
@RachalCassity RachalCassity changed the title Use Contact Information V2 Service for prefill instead of the PCIU Service Prefill data with VAProfile data instead of the PCIU data. Oct 9, 2024
@RachalCassity RachalCassity changed the title Prefill data with VAProfile data instead of the PCIU data. Prefill data with VAProfile data instead of the PCIU data Oct 9, 2024
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 9, 2024 21:18 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 9, 2024 21:47 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 9, 2024 21:59 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 9, 2024 22:20 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 10, 2024 01:43 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main October 10, 2024 15:29 Inactive
@RachalCassity RachalCassity force-pushed the rcassity-replace-pciu-service branch from 6590595 to 57aac8f Compare December 17, 2024 19:04
@RachalCassity RachalCassity marked this pull request as ready for review December 17, 2024 19:04
@RachalCassity RachalCassity requested review from a team as code owners December 17, 2024 19:04
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main December 17, 2024 19:05 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to rcassity-replace-pciu-service/main/main December 17, 2024 19:23 Inactive
@@ -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:
Copy link
Member Author

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)
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

@tpharrison tpharrison Dec 18, 2024

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.

Copy link
Contributor

@tpharrison tpharrison left a comment

Choose a reason for hiding this comment

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

🚀 LGTM

@RachalCassity RachalCassity requested a review from bosawt December 18, 2024 17:55
VAProfileRedis::V2::ContactInformation.for_user(self)
else
VAProfileRedis::ContactInformation.for_user(self)
end
end
Copy link
Member Author

@RachalCassity RachalCassity Dec 18, 2024

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PCIU Replacement Step 4b: Replace PCIU calls
7 participants