Closed ldelacosta closed 2 months ago
@ldelacosta I've looked into this a little bit but it would be useful to have a new booked Cerner appointment on staging to recreate/reproduce this behavior.
The behavior I can determine for now is:
Waiting on staging issues around Cerner appointments to be resolved.
It looks to be that the Cerner booked appointments are treated as Pending:
"data": {
"id": "CERN53785039",
"type": "appointments",
"attributes": {
"id": "CERN53785039",
"kind": "clinic",
"status": "cancelled",
"locationId": "668",
"start": "2024-08-28T16:30:00Z",
"end": "2024-08-28T17:00:00Z",
"requestedPeriods": [
{
"start": "2024-08-28T16:30:00Z",
"end": "2024-08-28T17:00:00Z"
Notified the VPG services team. Waiting for a response.
Not an issue on our end. OH is sending requested period dates in the response. We will need to make updates in FE to filter the appt (booked vs. requests). Closing out the ticket.
When a user cancels a the booked Oracle Health appointment, the appointment is then considered a cancelled request within VAOS. This is because VAOS uses the following logic to determine whether or not the appointment was originally a request or a CC request:
function getAppointmentType(appt) {
if (appt.kind === 'cc' && appt.start) { // if kind is CC and has start time is ccAppointment
return APPOINTMENT_TYPES.ccAppointment;
}
if (appt.kind === 'cc' && appt.requestedPeriods?.length) { // if kind is CC and has requestPeriods present is ccRequest
return APPOINTMENT_TYPES.ccRequest;
}
if (appt.kind !== 'cc' && appt.requestedPeriods?.length) { // if kind is NOT cc and has requestPeriods present it is a request
return APPOINTMENT_TYPES.request;
}
return APPOINTMENT_TYPES.vaAppointment;
}
The booked Oracle Health appointment is considered a cancelled request in VAOS because of this specific logic:
// if kind is NOT cc and has requestPeriods present it is a request
if (appt.kind !== 'cc' && appt.requestedPeriods?.length) {
return APPOINTMENT_TYPES.request;
}
When a user cancels a booked Oracle Health appointment, the appointment should be considered a cancelled appointment not a cancelled request.
requestedPeriods
objectstart
and end
timestamprequestedPeriods
start
timestampend
timestamprequestedPeriods
start
timestampend
timestamp"status": "cancelled"
We should change logic to:
function getAppointmentType(appt) {
if (appt.kind === 'cc' && appt.start) { // if kind is CC and has start time is ccAppointment
return APPOINTMENT_TYPES.ccAppointment;
}
if (appt.kind === 'cc' && appt.requestedPeriods?.length) { // if kind is CC and has requestPeriods present is ccRequest
return APPOINTMENT_TYPES.ccRequest;
}
if (appt.kind !== 'cc' && appt.requestedPeriods?.length && !appt.start) { // if kind is NOT cc and has requestPeriods present and has no start time
return APPOINTMENT_TYPES.request;
}
return APPOINTMENT_TYPES.vaAppointment;
}
A few things here:
requestedPeriods
for Cerner appointments in vets-api. Here's the logic. The reason that this isn't working is that the Cerner appointment linked in the issue doesn't have the expected identifier
fields. The question here is whether this is a valid appointment or if our logic for discerning cerner appointments is out of date. @simiadebowale might have a bit more background since he opened the original issue. Though I currently lean towards a BE fix, a bit more discussion here would help clarify whether a FE fix would be more appropriate.cerner
and cernerRequest
since otherwise these would be considered vaAppointment
and request
. However, I'm not sure how many more customized logic or future changes will need to be made for cerner appointments so maybe this is unwarranted.Thoughts?
A few things here:
- I do believe there is a bug on our end so we should probably put this back into Ready/Current Sprint so we can work on this.
- Actually I think this is a bug on the backend since we should be removing
requestedPeriods
for Cerner appointments in vets-api. Here's the logic. The reason that this isn't working is that the Cerner appointment linked in the issue doesn't have the expectedidentifier
fields. The question here is whether this is a valid appointment or if our logic for discerning cerner appointments is out of date. @simiadebowale might have a bit more background since he opened the original issue. Though I currently lean towards a BE fix, a bit more discussion here would help clarify whether a FE fix would be more appropriate.
Ahhh, that makes sense. I am a big fan of moving as much of this logic to vets-api
as possible.
- As an extra step, maybe we should consider adding new appointment types for
cerner
andcernerRequest
since otherwise these would be consideredvaAppointment
andrequest
. However, I'm not sure how many more customized logic or future changes will need to be made for cerner appointments so maybe this is unwarranted.
I'm currently unsure if we need to make that distinction on the FE, as a VA appointment is a VA appointment regardless of which BE a given facility is using. I'm open to adding, of course, if there is a need.
I'm currently unsure if we need to make that distinction on the FE
Perfect, I love not having to do any extra work!
Team is addressing a fix in 92185.
Summary
When a user cancels a Cerner booked appointment, the workflow is not correct. The user should receive a cancel confirmation screen for a booked appointment (not a request). After the user cancels the appointment, it ends up on the Pending list view.
Specs
Steps to Reproduce
Test user: judy.morrison@id.me
Cancel
Actual Result
https://github.com/user-attachments/assets/f3fda882-8e8b-462b-af60-8325b391726f
Desired Result
The user should receive the correct cancel confirmation screen for booked appointment not request.
Definition of Done