Bug #848
openMy Queue: patients waiting more than 4 hours disappear from the queue (auto-expired to Skipped, shown in no column)
0%
Description
Patients who were registered earlier in the day and not called yet vanish from My Queue. Only the completed consultation is still listed, and the counters show "In queue 0" and "1 of 1 patients".
Steps to Reproduce:
- Register 3 or 4 patients for Dr. Sravan VS (Vetri Vivega Medical Center) in the morning.
- Do not call them. Leave them Registered / Triage / Queued.
- After more than 4 hours, open My Queue (https://vvmc.test.clinq.health/doctor/my-queue).
Expected Result: Every patient registered today for this doctor is still visible on today's queue, in a column that makes their state clear (and with a way to bring them back if they were expired). The counters include them.
Actual Result: Only the completed and in-consultation patients are shown. The waiting patients are gone from all four columns (Awaiting triage 0, Queued 0, In consultation 0, Completed 1). Header shows "1 of 1 patients".
Cause (found in code, not yet confirmed against test data):
- StaleQueueExpiryService (nuvita-opd) runs every 5 minutes and expires any visit in Registered/Triage/Queued for more than Queue:StaleExpiry:ThresholdMinutes (default 240 = 4 hours): QueueService.ExpireStaleQueueEntriesAsync -> OpdVisit.ExpireStale sets Status = Skipped.
- The My Queue buckets in DoctorQueueService.GetMyQueueAsync only cover Registered/Triage (awaiting triage), Queued (queued), Called/InConsultation/Reopened (in consultation) and Completed/Cancelled/NoShow (completed). Skipped is in none of them, so these visits are returned by the query but shown nowhere and not counted.
- The same buckets are mapped by the Doctor API (Nuvita.Doctor DoctorQueueService), so My Day counts are affected too.
- The expiry's own comment says front desk can bring the patient back via Requeue, but the doctor cannot see that anyone needs requeuing.
Suggested fix (OPD, reaches Doctor Desktop on the next npm run sync:opd):
- Show Skipped/expired visits in My Queue, e.g. an "Expired / not seen" bucket with a Requeue action, or in the Completed column with an "Expired" badge. Include them in the "x of y patients" count.
- Add a regression test: a Skipped visit created today appears in My Queue.
- Review whether a 4 hour cutoff is right for a clinic day.
How to confirm: check the status of today's visits for this doctor in the OPD database (OpdVisits). If they are Skipped, this is the cause.
AV Updated by Alminta V. about 13 hours ago
- Assignee set to Fiza M.