How vishalpriyans/unofficial_optiqueue works
Purpose and Runtime
OptiQueue is a Next.js 15 / React 19 operating-theatre scheduling prototype. It models case scheduling, OT utilization, conflicts, and emergency insertion primarily in browser-side TypeScript. The main application entry is app/page.tsx; global application composition and styling begin at app/layout.tsx and app/globals.css.
Application Surfaces and Roles
The app contains a control-tower workflow plus separate doctor and administrator experiences. Primary route boundaries are:
• Main scheduler/control tower: app/page.tsx
• Doctor dashboard and portal: app/doctor-dashboard/page.tsx, app/doctor/page.tsx
• Administrative dashboard: app/admin-dashboard/page.tsx
• Role-specific login routes: app/doctor-login/page.tsx, app/admin-login/page.tsx
Scheduling Domain State
The central scheduling model, sample cases, and local client state are organized in:
• components/optiqueue/types.ts
• components/optiqueue/store.ts
• components/optiqueue/sample-data.ts
UI actions load/add/remove cases through the local store, then feed case and resource data into scheduling, visualization, conflict, KPI, and notification features. This is prototype-local state rather than a persistent schedule database.
Optimization and Priority Pipeline
The scheduling engine assigns cases to theatres and times using heuristic logic, priority, and turnover considerations:
• components/optiqueue/scheduler.ts
• components/optiqueue/priority-engine.ts
• components/optiqueue/predictor.ts
This is the principal decision boundary: scheduling logic is TypeScript colocated with presentation components and can later move behind serverless APIs. The README identifies no current durable backend or queueing infrastructure.
Conflict and Emergency Handling
Generated or loaded schedules are evaluated for time, theatre, surgeon, equipment, and priority conflicts. Conflicts are surfaced for interactive review and resolution:
• components/optiqueue/conflict-detector.ts
• components/optiqueue/conflict-analysis-dashboard.tsx
• components/optiqueue/conflict-display.tsx
Emergency insertion is a separate rescheduling path that introduces urgent cases, then invokes emergency scheduling/replanning behavior:
• components/optiqueue/emergency-inserter.tsx
• components/optiqueue/emergency-scheduler.ts
• components/optiqueue/constraint-checker.tsx
Operational Visualization and Doctor Workflow
Schedule outputs are rendered as a Gantt/timeline control tower with utilization and KPI views:
• components/optiqueue/gantt.tsx
• components/optiqueue/utilization-dashboard.tsx
• components/optiqueue/control-tower-kpis.tsx
The doctor-facing workflow has separate sample data and store boundaries, supporting case cards, surgeon timelines, and emergency assistance:
• components/optiqueue/doctor/doctor-dashboard.tsx
• components/optiqueue/doctor/store.ts
• components/optiqueue/doctor/surgeon-timeline.tsx
Auth, Assistant, and External Boundaries
Next App Router route handlers expose authentication/session and assistant endpoints:
• app/api/auth/admin-login/route.ts
• app/api/auth/check-session/route.ts
• app/api/assistant/route.ts
Client-side protection appears in components/auth/session-protection.tsx and components/optiqueue/auth/protected-route.tsx. Notifications are abstracted as a local service/UI layer in components/optiqueue/notifications/notification-service.ts; no concrete database, identity provider, messaging provider, or AI provider is evident from the supplied tree.
Main entry points: store.ts Schedule state · scheduler.ts Scheduling engine · layout.tsx App composition · page.tsx Control tower
Components 19
Application surfaces
- App composition · Sets global application composition and styling.
app/layout.tsx - Control tower · Primary theatre scheduling workspace.
app/page.tsx - Doctor dashboard
app/doctor-dashboard/page.tsx - Doctor portal
app/doctor/page.tsx - Admin dashboard
app/admin-dashboard/page.tsx - Role login routes
app/doctor-login/page.tsx
Scheduling core
Browser-local scheduling and operational analysis.
- Schedule state · Holds cases and prototype-local schedule state.
components/optiqueue/store.ts - Sample cases
components/optiqueue/sample-data.ts - Scheduling engine · Assigns cases to theatres and times.
components/optiqueue/scheduler.ts - Priority and prediction · Supplies priority and predictive inputs to scheduling.
components/optiqueue/priority-engine.ts - Conflict review · Detects and presents time, resource, and priority conflicts.
components/optiqueue/conflict-analysis-dashboard.tsx - Emergency replanning · Inserts urgent cases and validates replanned schedules.
components/optiqueue/emergency-inserter.tsx - Operational views · Renders timeline, utilization, and control-tower KPIs.
components/optiqueue/gantt.tsx - Notifications
components/optiqueue/notifications/notification-service.ts
Doctor workflow
- Doctor state · Separate doctor-facing sample data and state boundary.
components/optiqueue/doctor/store.ts - Doctor workspace · Supports case cards, surgeon timelines, and emergency assistance.
components/optiqueue/doctor/doctor-dashboard.tsx
Route handlers
App Router endpoints with no identified external provider.
- Session protection
components/auth/session-protection.tsx - Auth session API · Handles admin login and session checks.
app/api/auth/check-session/route.ts - Assistant API · Assistant endpoint; no AI provider is identified.
app/api/assistant/route.ts
Connections 20
- App composition → Control tower: composes
- App composition → Doctor dashboard: composes
- App composition → Admin dashboard: composes
- Sample cases → Schedule state: loads
- Control tower → Schedule state: reads and updates
- Schedule state → Scheduling engine: cases and resources
- Priority and prediction → Scheduling engine: priority inputs
- Scheduling engine → Schedule state: schedule assignments
- Schedule state → Conflict review: evaluates schedule
- Schedule state → Operational views: renders schedule
- Emergency replanning → Scheduling engine: replans urgent case
- Emergency replanning → Conflict review: checks revised schedule
- Conflict review → Notifications: surfaces alerts
- Doctor dashboard → Doctor workspace: renders
- Doctor portal → Doctor workspace: renders
- Doctor workspace → Doctor state: reads and updates
- Session protection → Auth session API: checks session
- Role login routes → Auth session API: authenticates
- Admin dashboard → Session protection: protected by
- Control tower → Assistant API: assistant requests