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

[BE] Confirm the user's lat/long are available for the drive_time call to EPS #101426

Closed
2 of 3 tasks
randomsync opened this issue Jan 20, 2025 · 2 comments
Closed
2 of 3 tasks
Assignees
Labels
backend HCE-Checkin Healthcare Experience Check-in product

Comments

@randomsync
Copy link
Member

randomsync commented Jan 20, 2025

In AppointmentsController, we make a call to EPS get_drive_times method which requires the current_user's latitude/longitude. This ticket is to confirm that we can retrieve that using the correct vets-api method.

Tasks

  • [BE] get current_user's latitude/longitude

Acceptance Criteria

  • Deployed to staging
  • Tested on staging
@randomsync randomsync added backend HCE-Checkin Healthcare Experience Check-in product labels Jan 20, 2025
@PhilipDeFraties PhilipDeFraties self-assigned this Jan 27, 2025
@PhilipDeFraties
Copy link

PhilipDeFraties commented Jan 27, 2025

@randomsync taking a look at your proposed fetch_drive_times method it appears that you were hopeful to access the user's lat and long through the data made available from the MPI service:

latitude: current_user.address['latitude'],
            longitude: current_user.address['longitude']

however it appears that data is not stored or made available through the MPI: https://www.va.gov/vdl/documents/Infrastructure/Master_Patient_Index_%28MPI%29/rg1_0_tm.pdf

Taking a look elsewhere in the user model, I can see that there is additional demographic data made available through the vet360_contact_info method which appears to have access to the user's latitude and longitude via the VaProfile::Models::V3::BaseAddress module.

This would be accessible by calling:

current_user.vet360_contact_info.residential_address.latitude
current_user.vet360_contact_info.residential_address.longitude

I am unsure at how feasible this solution is since originally it seems the source of truth for the user's address for the purposes of creating this appointment is intended to come from from the MPI service, as well as the fact that this potential solution assumes the user has a vet360_id and the required data for the user is available from the Vet360 service.

@PhilipDeFraties
Copy link

PhilipDeFraties commented Jan 28, 2025

I’ve confirmed that the latitude and longitude fields are already included in the vet360ContactInformation attribute of the user object on the frontend. This data comes from the VA Profile (Vet360) service and is pulled in during the authentication flow. On the backend, it’s fetched via the vet360_contact_info method in the User model, which calls VAProfile::V2::ContactInformation::Service.

The key pieces involved in making this data available are:

  • Endpoint: /v0/user, which returns the serialized user object.
  • User Serializer: Adds vet360ContactInformation to the user object.
  • VA Profile Service (VAProfile::ContactInformation::Service): Retrieves the user’s address data, including latitude and longitude.
  • Address Model: VAProfile::Models::V3::Address maps latitude and longitude from the API response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend HCE-Checkin Healthcare Experience Check-in product
Projects
None yet
Development

No branches or pull requests

2 participants