- **Description:** Connect to Python ML service and implement Socket.io - **Activities:** - **ML Service HTTP Client:** - Setup Axios/Fetch client to communicate with the separate Python ML API. - POST `/api/booking/predict`: Receive patient request, fetch current queue/db state, send payload to ML API, return ML estimation to frontend. - Handle ML API timeouts gracefully (fallback to historical DB averages). - **Socket.io Implementation:** - Attach Socket.io server to Express instance. - Setup socket authentication (validate JWT on connection). - Create rooms based on `userId` and `departmentId`. - **Broadcast Service:** - Emit events when queue statuses change (e.g., `queue_updated`, `patient_called`). - Push live queue position updates to active patient clients. - **Deliverables:** Axios ML API client wrapper, fallback logic, Socket.io server, real-time event emitters
/api/booking/predict: Receive patient request, fetch current queue/db state, send payload to ML API, return ML estimation to frontend.userIdanddepartmentId.queue_updated,patient_called).