Skip to content

Feat/adding statuses for queues upgradation

MR Title Queue workflow updates: add know_your_patient and post-consultation stages

MR Description

Summary

This MR updates the clinical queue flow to prevent direct movement from vitals to waiting, and extends queue tracking after consultation.

New flow: vitals -> know_your_patient -> waiting -> in_consultation -> consultation_completed -> medicine_prescribed -> medicine_verified -> counselling_done

What changed

  1. Added new queue statuses in QueueStatusEnum:
  • know_your_patient
  • medicine_prescribed
  • medicine_verified
  • counselling_done
  1. Updated queue transition rules in consultation_queue_service:
  • Enforced vitals -> know_your_patient -> waiting
  • Added post-consultation transitions:
    • consultation_completed -> medicine_prescribed
    • medicine_prescribed -> medicine_verified
    • medicine_verified -> counselling_done
  1. Fixed auto-transition behavior:
  • Removed legacy route-level forced transition vitals -> waiting
  • Added compatibility guard in /queue/status-update:
    • If client sends vitals -> waiting, backend normalizes to vitals -> know_your_patient
  1. Synced queue progression with patient_visit_details.status for:
  • consultation_completed
  • medicine_prescribed
  • medicine_verified
  • counselling_done
  1. Updated queue visibility/counts:
  • Included new statuses in Socket.IO queue data (doctor/coordinator + websocket manager)
  • Updated doctor pending queue counts to include new active stages

Database migrations

Run:

  • d3e4f5a6b7c8_add_know_your_patient_to_queuestatus.py
  • e4f5a6b7c8d9_add_post_consultation_statuses_to_queuestatus.py

Command:

alembic upgrade head

API/Frontend impact

  • Frontend can now use PUT /queue/status-update with:
    • know_your_patient
    • medicine_prescribed
    • medicine_verified
    • counselling_done
  • Frontend should follow the new strict sequence and not skip stages.

Notes

  • Existing records already in waiting from older behavior are not auto-corrected by this MR.

Merge request reports

Loading