Closed marcynadeau closed 3 years ago
@jbalboni From a technical perspective, does this overlapping appointment check have to happen on click of confirm appointment at the final step?
@laurenernest We on the FE have no way of knowing this ahead of time. This is a var-resources error, it needs to be fixed in the backend. They need to:
@saneshark Can you find out how often this occurs?
@grossb1 Can you create a BE ticket to find out how often this double booking error occurs?
@laurenernest This is just for direct scheduling, so it's not happening in production, just staging.
Do we have data from when direct scheduling was on though? Or was that too short of a time?
@laurenernest I think it was too short of a time (it was on for a few weeks, I think) and it was also long enough ago that we don't still have the logs, though @saneshark or @grossb1 could confirm that.
Here is another similar error, for a user who books a slot that is occupied between them choosing it and them submitting the appointment:
{"errors":[{"title":"Bad Gateway","detail":"Received an an invalid response from the upstream server","code":"VAOS_502","source":{"vamfUrl":"https://internal-dsva-vagov-staging-fwdproxy-1821450725.us-gov-west-1.elb.amazonaws.com:4463/var/VeteranAppointmentRequestService/v4/rest/direct-scheduling/site/983/patient/ICN/1013120820V528557/booked-appointments","vamfBody":"{\"id\":\"037fb5b5-7e4f-453e-b5fc-b3fb1477b5d2\",\"traceId\":\"693ddfc1dff9f29f\",\"code\":500,\"message\":\"Could not book appointment from VistA Scheduling Service\",\"errorCode\":7001,\"detail\":\"400: {\\n \\\"code\\\" : 400,\\n \\\"message\\\" : \\\"813 NO_OPEN_SLOT:Invalid appointment. RESULT(0)=APTNOST^NO OPEN SLOTS THEN^1\\\",\\n \\\"id\\\" : \\\"9d3f9dbf-b79c-418d-8134-8b58ddccaba7\\\",\\n \\\"errorCode\\\" : 400\\n}\",\"meta\":{\"upstreamErrorSource\":\"vista-scheduling-service\"}}","vamfStatus":500},"status":"502"}]}
@saneshark @grossb1 Both the error I just posted and the error in the original description are interpreted by vets-api as 500 errors, rather than as 400 level errors. Is that because we're doing something wrong in vets-api, or because the status isn't correct from VAMF?
So in this case VAMF is returning a 500 error. This should be a 409 conflict much like they return for appointments that fail cancellation.
We can temporarily parse the error payload and return a 400 level error much like we did when appointments#cancel was broken, but I really think this needs to be resolved at the VAMF level -- this should not be a 500 level error from VAMF.
@grossb1 Lets put together a report we can run daily that fetches this type of issue from Rails logs.
It will be a 500 level exception coming from VAMF to /var/VeteranAppointmentRequestService/v4/rest/direct-scheduling/site/<SOME SITE>/patient/<SOME ICN>/booked-appointments
We won't observe any in production, but we should be able to observe some on staging. I think you'll need to change the constant for where the logs are stored to staging to validate the script is working correctly, but we'll want to verify this type of thing in production when we enable covid sheduling.
@saneshark Are you going to create a VAOSR ticket for getting this fixed on the VAMF side?
@jbalboni how soon are we likely to encounter this in production? If the fix in VAMF will take longer we might need to discuss tomorrow on SoS a way whereby we can parse the JSON body and return something other than 502 to the FE, interpret the 500 received as a 409 as a temporary stopgap until they can fix.
@saneshark I think it's something that could potentially come up quickly. Marcy pointed out that if we have a lot of people try to book a limited number of slots, the risk of the slot being filled between the calendar page and the final submit page goes up. I think it probably makes sense to update asap, and also make sure that we have a way on the FE do tell that it's specifically due to a slot being filled, since I could see us wanting to be specific about that.
Steps to recreate
(Note the same issue presents if VA appointments are overlapping. An existing appointment at 0800 that is 60 minutes long and then user tries to book an a new appointment at 0830. Same error message displays in dev tools.)
See attachment.