How oscarmarulanda/clinicdesk-ai works
ClinicDesk AI is a customer-support agent for clinic staff, with an embeddable chat widget and an admin console. The main workflow is a staff message over WebSocket, processed by the chat use case with AI and knowledge-base tools; session state is persisted, and unresolved requests can lead to callback scheduling and human escalation. Separate admin workflows cover authentication, article management, document ingestion, session review, escalation tracking, and analytics. The graph combines sampled call sites with README-documented capabilities; unsampled feature links are omitted or marked unverified.
Main entry points: api Admin API Routes · process_chat_message.py Chat Processing · app.js Admin Dashboard · ingest_document.py Document Ingestion
Components 25
User Channels
- Chat Widget
frontend/widget/chat-widget.js - Admin Dashboard
frontend/admin/app.js - Chat WebSocket
src/presentation/ws/chat.py - Admin API Routes
src/presentation/api - Admin Notifications
src/presentation/ws/admin.py
Application Workflows
- Authentication
src/application/use_cases/authenticate_user.py - Chat Processing
src/application/use_cases/process_chat_message.py - Knowledge Search
src/application/use_cases/search_knowledge_base.py - Article Management
src/application/use_cases/manage_articles.py - Document Ingestion
src/application/use_cases/ingest_document.py - Session Review
src/application/use_cases/get_sessions.py - Escalation Management
src/application/use_cases/manage_escalations.py - Analytics
src/application/use_cases/get_analytics.py - Callback Scheduling
src/application/use_cases/schedule_callback.py - Escalation Email
src/application/use_cases/send_escalation_email.py
Domain and Data
- Knowledge Articles
src/infrastructure/database/knowledge_repository.py - Session Store
src/infrastructure/database/session_repository.py - Escalation Store
src/infrastructure/database/escalation_repository.py - User Store
src/infrastructure/database/user_repository.py
External Integrations
- AI Service
src/infrastructure/ai/claude_service.py - Document Extractor
src/infrastructure/documents/document_extractor.py - Google Calendar
src/infrastructure/calendar/google_calendar_service.py - SendGrid Email
src/infrastructure/email/sendgrid_service.py
Other components
- Clinic Staff
- Clinic Admins
Connections 30
- Clinic Staff → Chat Widget: asks for help
- Chat Widget → Chat WebSocket: sends chat
- Chat WebSocket → Chat Processing: processes message
src/presentation/ws/chat.py - Chat Processing → AI Service: requests AI response
- Chat Processing → Knowledge Search: uses knowledge tools
- Chat Processing → Knowledge Articles: searches articles
- Chat Processing → Session Store: uses session state
src/presentation/dependencies.py - Chat Processing → Escalation Store: uses escalation data
src/presentation/dependencies.py - Chat Processing → Google Calendar: checks and books
- Chat Processing → SendGrid Email: sends escalation notices
- Clinic Admins → Admin Dashboard: manages support
- Admin Dashboard → Admin API Routes: uses admin features
- Admin Dashboard → Admin Notifications: receives updates
- Admin API Routes → Authentication: authenticates users
src/presentation/api/auth.py - Authentication → User Store: reads and creates users
src/application/use_cases/authenticate_user.py - Admin API Routes → Article Management: manages articles
src/presentation/api/articles.py - Article Management → Knowledge Articles: reads and writes
src/application/use_cases/manage_articles.py - Admin API Routes → Document Ingestion: submits documents
src/presentation/api/ingest.py - Document Ingestion → Document Extractor: extracts text
src/application/use_cases/ingest_document.py - Document Ingestion → AI Service: structures article
src/application/use_cases/ingest_document.py - Admin API Routes → Session Review: lists sessions
src/presentation/api/sessions.py - Session Review → Session Store: reads sessions
src/presentation/dependencies.py - Admin API Routes → Escalation Management: tracks escalations
- Escalation Management → Escalation Store: manages records
src/presentation/dependencies.py - Admin API Routes → Analytics: requests metrics
- Admin API Routes → Callback Scheduling: schedules callbacks
- Callback Scheduling → Google Calendar: books callback
- Admin API Routes → Escalation Email: triggers notifications
- Escalation Email → SendGrid Email: delivers email
- Admin Notifications → Clinic Admins: pushes escalation alerts