How zgsddzwj/intelligent_consultation works
This is an AI-powered medical consultation platform with a React frontend and FastAPI backend. The main user journey is patient chat through the API to LangGraph agent orchestration, then specialist agents use LLM and medical knowledge services to produce cited, risk-aware responses. Separate capabilities include clinician and admin workspaces, image and speech features, and knowledge-graph exploration. The graph combines README-documented architecture with source-index references and excerpts; unsampled endpoint and subsystem internals are represented at their existing directory paths, without asserting undocumented call links.
Main entry points: api.ts API Client · agents Specialist Agents · llm_service.py LLM Service · main.py FastAPI Entry
Components 32
User Experience
- Patient Portal
frontend/src/pages/PatientPortal.tsx - Doctor Dashboard
frontend/src/pages/DoctorDashboard.tsx - Admin Workspace
frontend/src/pages/AdminPanel.tsx - Graph Explorer
frontend/src/pages/KnowledgeGraph.tsx - Chat Contracts
frontend/src/types/chat.ts - API Client
frontend/src/services/api.ts - Authentication
frontend/src/services/auth.ts
API and Orchestration
- FastAPI Entry
backend/app/main.py - API Routes
backend/app/api/v1 - Service Factory
backend/app/dependencies.py - Agent Orchestrator
backend/app/agents/orchestrator.py - Image Analysis
backend/app/api/v1/image_analysis.py - Speech Services
backend/app/services/asr_service.py
Medical Intelligence
- Agent Runtime
backend/app/agents/base.py - Specialist Agents
backend/app/agents - RAG Tool
backend/app/agents/tools/rag_tool.py - Hybrid RAG
backend/app/knowledge/rag - Medical Graph
backend/app/knowledge/graph - ML Knowledge
backend/app/knowledge/ml - LLM Service
backend/app/services/llm_service.py
Data and Operations
- PostgreSQL
- Redis
- Milvus
- Neo4j
- Object Storage
backend/app/services/object_storage.py - API Middleware
backend/app/api/middleware - Monitoring
backend/app/infrastructure/monitoring.py - Cache Service
backend/app/services/cache_service.py - Database Session
backend/app/database/session.py - Logging and Tracing
backend/app/common/tracing.py - Configuration
backend/app/config.py
Other components
- Patient
Connections 37
- Patient → Patient Portal: uses
- Patient Portal → API Client: submits consultation
frontend/src/pages/PatientPortal.tsx - Patient Portal → Chat Contracts: uses contracts
frontend/src/pages/PatientPortal.tsx - API Client → FastAPI Entry: calls API
- API Client → Authentication: clears tokens
frontend/src/services/api.ts - Authentication → API Client: posts login
frontend/src/services/auth.ts - FastAPI Entry → API Middleware: applies
backend/app/main.py - FastAPI Entry → API Routes: routes requests
backend/app/main.py - API Routes → Agent Orchestrator: dispatches consultations
- FastAPI Entry → Service Factory: initializes services
backend/app/main.py - Service Factory → Agent Orchestrator: provides
backend/app/dependencies.py - Agent Orchestrator → Specialist Agents: dispatches agents
- Specialist Agents → Agent Runtime: inherit runtime
backend/app/agents/customer_service_agent.py - Specialist Agents → RAG Tool: uses retrieval
backend/app/agents/health_manager_agent.py - RAG Tool → Hybrid RAG: retrieves context
backend/app/agents/tools/rag_tool.py - Specialist Agents → Medical Graph: queries diseases
backend/app/agents/health_manager_agent.py - Specialist Agents → ML Knowledge: recognizes entities
backend/app/agents/health_manager_agent.py - Specialist Agents → LLM Service: generates responses
backend/app/agents/base.py - Agent Runtime → LLM Service: uses service
backend/app/agents/base.py - Agent Runtime → Logging and Tracing: uses tracing
backend/app/agents/base.py - Hybrid RAG → Milvus: searches vectors
- Medical Graph → Neo4j: queries graph
- API Middleware → PostgreSQL: accesses business data
- API Middleware → Redis: uses cache
- LLM Service → Monitoring: reports metrics
backend/app/services/llm_service.py - LLM Service → Cache Service: checks semantic cache
backend/app/services/llm_service.py - Service Factory → Database Session: provides sessions
backend/app/dependencies.py - Database Session → Configuration: reads settings
backend/app/database/session.py - LLM Service → Configuration: reads settings
backend/app/services/llm_service.py - Doctor Dashboard → API Client: uses API
- Admin Workspace → API Client: uses API
- Graph Explorer → API Client: loads graph data
frontend/src/pages/KnowledgeGraph.tsx - API Routes → Image Analysis: serves analysis
- API Routes → Speech Services: serves speech
- Image Analysis → Object Storage: stores files
- FastAPI Entry → Monitoring: exports metrics
backend/app/main.py - LLM Service → Logging and Tracing: traces calls
backend/app/services/llm_service.py