-
Notifications
You must be signed in to change notification settings - Fork 78
118645 append ids of active appts to referral details #24665
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
base: master
Are you sure you want to change the base?
118645 append ids of active appts to referral details #24665
Conversation
add appointments attribute with empty array default value
930523f
to
5d88096
Compare
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.
Pull Request Overview
Adds referral-aware appointment lookups and exposes active (non-cancelled/non-draft) appointment IDs for a referral. Replaces the previous has_appointments boolean with a richer appointments payload and introduces EPS filtering by referralNumber.
- Added get_active_appointments_for_referral plus controller integration to include appointments summary in referral responses
- Replaced has_appointments boolean with appointments attribute across model, serializer, tests, and factories
- Enhanced EPS AppointmentService to support referralNumber query param; updated/added VCR cassettes and specs
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
appointments_service_spec.rb | Updated specs to use new fixtures and added tests for active appointment filtering/sorting. |
appointments_spec.rb | Adjusted request specs to new appointments behavior and fixtures. |
referrals_spec.rb | Stubs new active appointments lookup. |
referral_detail_spec.rb | Updated model tests for new appointments attribute replacing has_appointments. |
referrals_controller_spec.rb | Added tests ensuring appointments payload included in referral responses. |
appointments_service.rb | Added referral_appointment_already_exists? rewrite and new get_active_appointments_for_referral logic. |
eps/appointment_service.rb | Added referralNumber filtering in EPS requests. |
referral_detail_serializer.rb | Swapped has_appointments for appointments attribute in serialization. |
referral_detail.rb | Model updated to track appointments instead of has_appointments. |
referrals_controller.rb | Injects active appointment data into referral response. |
Various VCR cassettes | New/modified cassettes for mixed statuses, referral filtering, empty results, and updated EPS behavior. |
Factories & other specs | Removed has_appointments usage and aligned with new appointments structure. |
...ort/vcr_cassettes/vaos/v2/appointments/get_appointments_mixed_statuses_for_referral_test.yml
Outdated
Show resolved
Hide resolved
spec/support/vcr_cassettes/vaos/eps/get_appointments/200_v2.yml
Outdated
Show resolved
Hide resolved
8f32142
to
875ddb6
Compare
e1a1f03
to
38bd26d
Compare
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.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
...ort/vcr_cassettes/vaos/v2/appointments/get_appointments_mixed_statuses_for_referral_test.yml
Outdated
Show resolved
Hide resolved
...ort/vcr_cassettes/vaos/v2/appointments/get_appointments_mixed_statuses_for_referral_test.yml
Outdated
Show resolved
Hide resolved
32237b7
to
ccbf1e3
Compare
end | ||
|
||
eps_appointments = eps_appointments_service.get_appointments | ||
eps_appointments = eps_appointments_service.get_appointments(referral_number: referral_id) |
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.
This was a "might as well while I'm at it" change, added the optional referral number to the service method request params and it is a quick win to implement for this method, which is used in the draft appointment creation step, to prevent over-fetching.
appointments.any? do |appt| | ||
appt[:referral] && appt[:referral][:referral_number] == referral_id | ||
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.
this method no longer needed now that the fetch scopes by referral number
09fcc9c
to
2ef1212
Compare
def get_appointments(referral_number: nil) | ||
params = { patientId: patient_id } | ||
params[:referralNumber] = referral_number if referral_number.present? | ||
|
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.
…w handled in vaos appointment service
…ing active appointment ids to response payload
e3d25ec
to
7904951
Compare
bd7d7de
to
58045e1
Compare
Summary
This pull request enhances the VAOS referral details API to include appointment data directly within the referral response. It introduces a new service method to fetch active appointments for a referral, prioritizing EPS data and falling back to VAOS if necessary. The changes also refactor the data model and serializer to support this new appointments structure, and update tests accordingly.
IMPORTANT NOTE
It was decided to check for active appointments with the given referral number (not in draft or cancelled state) in EPS first, if no appointment is found then VAOS is checked for non-cancelled appointments. If a cancelled appointment is found in EPS and an active appointment is found in VAOS then the discrepancy is logged to rails logger but no appointment id will be returned. Below is a list of potential returns for the
appointments
attribute being added to the details response payload object:Note the order of the appointment id objects in the
data
array is based on appointment start date-time with most recent at the end of the list, those with no start date-time will be ordered first (so index 0)Related issue(s)
department-of-veterans-affairs/va.gov-team#118645
See this comment for explanation of dedup methodology:
department-of-veterans-affairs/va.gov-team#118645 (comment)
Testing done
Screenshots
Note: Optional
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
Acceptance criteria
Requested Feedback