A comprehensive AI-powered healthcare management platform built with Next.js 15, MongoDB, and Google Gemini AI. This modern web application provides doctors with an intuitive interface to manage patients, appointments, prescriptions, and collaborate with colleagues in real-time.
Follow this step-by-step guide to experience the full functionality of the Doctor Care System:
graph TD
A[π Landing Page] --> B[π Register Account]
B --> C[π Sign In]
C --> D[π Dashboard Overview]
D --> E[π₯ Patients Management]
E --> F[β Add New Patient]
F --> G[π Patient Assignment]
G --> H{Patient Assigned?}
H -->|No| G
H -->|Yes| I[π©Ί Medical Operations]
I --> J[π
Schedule Appointments]
I --> K[π Create Prescriptions]
I --> L[π Update Medical Records]
I --> M[π¬ Chat with Colleagues]
I --> N[π Manage Notifications]
Step | Action | Description | Status |
---|---|---|---|
1 | π Start Here | Visit the application homepage | β Entry Point |
2 | π Register | Create your doctor account with credentials | π New User |
3 | π Sign In | Login with your registered credentials | π Authentication |
4 | π Dashboard | Access your personalized dashboard overview | π Home Base |
5 | π₯ Patients Page | Navigate to patient management section | π Management |
6 | β Add Patient | Create new patient profiles in the system | π€ Registration |
7 | π Assign Patient | π― Required | |
8 | π Appointments | Schedule and manage patient appointments | ποΈ Scheduling |
9 | π Prescriptions | Create, update, and manage prescriptions | π Treatment |
10 | π¬ Collaborate | Chat with fellow doctors in real-time | π€ Communication |
π¨ CRITICAL WORKFLOW NOTE:
Patient Assignment is MANDATORY - You cannot perform any medical operations (appointments, prescriptions, medical records) without first assigning patients to yourself in the system. This ensures proper data isolation and security.
π₯ Core Features | π€ AI Features | π¬ Communication |
---|---|---|
Patient Management | AI Prescription Generator | Real-time Doctor Chat |
Appointment Scheduling | Medical Decision Support | Voice Assistant |
Prescription System | Drug Interaction Checker | Notification System |
Medical Records | Natural Language Processing | File Sharing |
---### Frontend Technologies
- Next.js 15 with App Router and React 19 for modern web development
- TypeScript for type safety and enhanced developer experience
- Tailwind CSS 4 for utility-first styling and responsive design
- Framer Motion for smooth animations and micro-interactions
- Radix UI for accessible and customizable component primitives
- Lucide React for consistent and scalable icon library
- Recharts for interactive data visualization and analytics
- React Hook Form for efficient form handling and validation
- Next.js API Routes for serverless backend functions
- MongoDB for flexible NoSQL document storage
- JWT (jsonwebtoken) for secure authentication and authorization
- bcrypt for password hashing and security
- Socket.IO for real-time bidirectional communication
- Mongoose for MongoDB object modeling and data validation
- Google Gemini AI for advanced natural language processing and medical reasoning
- Model Context Protocol (MCP) server for structured AI interactions
- OpenAI-compatible API endpoints for AI service integration
- Machine learning pipelines for prescription optimization and patient insights
- PDF generation with jsPDF and html2canvas for prescription documents
- Email service with Resend for automated communication
- File upload and processing with Next.js built-in capabilities
- Real-time notifications with custom notification system
- WebSocket connections for live data synchronization
- ESLint for code quality and consistency
- Prettier for code formatting
- TypeScript for static type checking
- Turbopack for fast development builds and hot reload
- tsx for TypeScript execution in Node.js environment
- Docker support for containerized deployment
- Vercel deployment optimization with serverless functions
- CORS configuration for secure cross-origin requests
- Rate limiting for API protection
- Input validation and sanitization
- HIPAA-compliant data handling procedures
- Encrypted data transmission with HTTPS
- Secure session management with automatic token refresh
- Node.js 18+ and npm/yarn/pnpm package manager
- MongoDB database (local installation or MongoDB Atlas cloud)
- Google Gemini AI API key for AI-powered features
- Email service API key (Resend) for prescription deliveryal records with advanced AI capabilities through the Model Context Protocol (MCP) server.
graph TB
UI[π₯οΈ Next.js UI] --> API[π API Layer]
API --> Auth[π JWT Auth]
API --> MongoDB[(ποΈ MongoDB)]
API --> MCP[π€ MCP Server]
MCP --> Gemini[π§ Google Gemini AI]
MCP --> Safety[π‘οΈ Safety Validation]
API --> Realtime[β‘ Socket.IO]
UI --> PWA[π± PWA Features]
style UI fill:#e1f5fe
style MCP fill:#f3e5f5
style Gemini fill:#fff3e0
style MongoDB fill:#e8f5e8
- Google Gemini AI Integration with sophisticated medical reasoning
- MCP (Model Context Protocol) server for intelligent patient analysis
- Smart prescription generation with safety validation and drug interaction checking
- Patient history analysis for personalized treatment recommendations
- AI confidence scoring with transparent decision-making process
- Real-time prescription feedback loop for continuous AI improvement
- Enhanced patient insights with risk assessment and treatment optimization
- 360Β° patient profiles with complete medical history, allergies, and current medications
- Advanced patient search and filtering with intelligent query capabilities
- Patient status tracking (Stable, Monitoring, Critical, Active) with real-time updates
- Doctor-patient assignment and relationship management
- Patient risk assessment and automated health insights
- Medical history timeline with interactive visualization
- Smart appointment management with AI-powered conflict detection
- Real-time scheduling with automatic resource optimization
- Multiple appointment types: Consultation, Follow-up, Surgery, Emergency, Checkup
- Virtual and in-person appointment support with seamless transitions
- Automated reminders and intelligent notification system
- Calendar integration with advanced filtering and scheduling algorithms
- AI-driven prescription creation with Gemini-powered medication recommendations
- Digital prescription generation with automated PDF creation and email delivery
- Prescription tracking with status management and expiration monitoring
- Comprehensive medication database with dosage optimization and frequency management
- Prescription renewal workflows with automated safety checks
- Prescription analytics with treatment effectiveness tracking
- JWT-based authentication with automatic token refresh and secure session management
- bcrypt password hashing with enhanced security protocols
- Role-based access control for doctors, staff, and administrators
- API rate limiting and request validation
- HIPAA-compliant data handling and storage
- Audit trails for all medical decisions and data access
- Live dashboard with KPI tracking and performance metrics
- Patient analytics with health trend analysis and outcome prediction
- Appointment analytics with completion rates and efficiency metrics
- Prescription analytics with AI-generated insights and treatment effectiveness
- Interactive charts using Recharts with drill-down capabilities
- Custom reporting with data export and visualization tools
- Beautiful dark/light theme with seamless switching and system preference detection
- Fully responsive design optimized for desktop, tablet, and mobile devices
- Smooth animations powered by Framer Motion with accessibility considerations
- Modern component library using Radix UI primitives for accessibility
- Tailwind CSS 4 for consistent and maintainable styling
- Lucide React icons for visual clarity and consistency
- Enhanced hover effects and micro-interactions for improved user experience
- WebSocket integration with Socket.IO for instant updates across all connected clients
- Live notifications for appointment changes, patient updates, and system alerts
- Real-time patient status updates with immediate synchronization
- Instant messaging between healthcare providers with message history
- Collaborative editing of patient records with conflict resolution
- Live data synchronization across multiple browser sessions and devices
The MCP server is the heart of our AI capabilities, providing sophisticated medical reasoning and intelligent prescription generation through a comprehensive set of tools.
Tool Name | Purpose | Input Requirements |
---|---|---|
get_patient_history |
Retrieves patient information and complete prescription history | patientId |
create_prescription_with_gemini |
Generates AI-powered prescriptions using Gemini AI | patientId , symptoms , doctorId , doctorName |
update_prescription_feedback |
Updates prescriptions and stores doctor feedback for AI learning | prescriptionId , modifications , doctorId |
search_prescriptions |
Advanced prescription search with multiple filter criteria | Optional: patientId , doctorId , status , dates |
Tool Name | Purpose | Input Requirements |
---|---|---|
get_enhanced_patient_context |
Comprehensive patient analysis with risk assessment | patientId |
validate_prescription_safety |
Validates prescriptions for drug interactions and allergies | medications , patientId |
suggest_prescription_improvements |
Evidence-based prescription optimization recommendations | currentPrescription , patientId |
check_drug_interactions |
Detailed drug interaction analysis with severity levels | newMedications , patientId |
Tool Name | Purpose | Input Requirements |
---|---|---|
get_doctor_preferences |
Analyzes doctor's prescribing patterns and preferences | doctorId |
get_patient_insights |
AI-generated patient management insights and recommendations | patientId , doctorId |
flowchart TD
Start([Doctor Initiates Prescription]) --> GetHistory[π Get Patient History]
GetHistory --> ValidateInput{β
Validate Input Data}
ValidateInput -->|Invalid| Error1[β Return Validation Error]
ValidateInput -->|Valid| AnalyzeContext[π Analyze Patient Context]
AnalyzeContext --> RiskAssess[β οΈ Assess Patient Risk Factors]
RiskAssess --> GeminiCall[π§ Call Gemini AI API]
GeminiCall --> GeminiAnalysis{π€ Gemini Analysis}
GeminiAnalysis -->|Error| Error2[β AI Generation Failed]
GeminiAnalysis -->|Success| ParseResponse[π Parse AI Response]
ParseResponse --> SafetyCheck[π‘οΈ Safety Validation]
SafetyCheck --> InteractionCheck[βοΈ Drug Interaction Check]
InteractionCheck --> AllergyCheck[π« Allergy Validation]
AllergyCheck --> FinalSafety{π Final Safety Assessment}
FinalSafety -->|Unsafe| SafetyError[β Safety Violation Detected]
FinalSafety -->|Safe| CreatePrescription[π Create Prescription]
CreatePrescription --> SaveDB[(πΎ Save to MongoDB)]
SaveDB --> GenerateResponse[π Generate Response]
GenerateResponse --> End([β
Return Complete Prescription])
Error1 --> End
Error2 --> End
SafetyError --> End
style Start fill:#e3f2fd
style End fill:#e8f5e8
style GeminiCall fill:#fff3e0
style SafetyCheck fill:#ffebee
style CreatePrescription fill:#f3e5f5
Retrieves comprehensive patient information including medical history, allergies, current medications, and complete prescription history.
Input Schema:
{
"patientId": "string (required)"
}
Output:
- Patient demographics and medical information
- Complete prescription history (sorted by creation date)
- Total prescription count
- Active prescriptions count
- Recent prescriptions (last 5)
The core AI prescription generation tool that leverages Google Gemini AI to create intelligent, personalized prescriptions.
Input Schema:
{
"patientId": "string (required)",
"symptoms": ["array of strings (required)"],
"diagnosis": "string (optional)",
"doctorId": "string (required)",
"doctorName": "string (required)",
"notes": "string (optional)"
}
AI Processing Steps:
- Patient Context Analysis: Reviews complete medical history, allergies, and current medications
- Symptom Assessment: Analyzes reported symptoms against medical knowledge base
- Historical Pattern Recognition: Examines previous successful treatments for similar conditions
- Drug Interaction Verification: Cross-references new medications with current prescriptions
- Allergy Screening: Validates against known patient allergies
- Dosage Optimization: Adjusts dosages based on patient age, weight, and medical history
- Confidence Scoring: Provides AI confidence level for transparency
Output:
- Complete prescription with medications, dosages, and instructions
- AI confidence score and reasoning
- Safety warnings and contraindications
- Patient context summary
- Gemini AI analysis details
Comprehensive safety validation system that checks for potential issues before prescription finalization.
Safety Checks:
- Allergy Conflicts: Cross-references medications against patient allergies
- Drug Interactions: Identifies potential interactions with current medications
- Dosage Warnings: Validates appropriate dosing for patient demographics
- Contraindications: Checks for medical conditions that prohibit specific medications
Severity Levels:
- HIGH: Critical safety concerns requiring immediate attention
- MODERATE: Important considerations requiring monitoring
- LOW: Minor interactions with minimal risk
Advanced patient analysis tool that provides comprehensive insights for informed decision-making.
Analysis Components:
- Risk Assessment: Categorizes patient risk level (LOW/MEDIUM/HIGH)
- Treatment History: Analyzes prescription patterns and effectiveness
- Medication Frequency: Identifies commonly prescribed medications
- Health Trends: Tracks patient health trajectory over time
- Recommendation Engine: Suggests personalized care improvements
Sophisticated drug interaction analysis with detailed severity assessment and clinical recommendations.
Interaction Categories:
- Major: Significant clinical impact, alternative medications recommended
- Moderate: Important monitoring required, dose adjustments may be needed
- Minor: Minimal clinical significance, routine monitoring sufficient
Clinical Decision Support:
- Detailed interaction mechanisms
- Clinical significance assessment
- Alternative medication suggestions
- Monitoring recommendations
Intelligent analysis of doctor prescribing patterns to personalize AI recommendations and improve prescription accuracy.
Analysis Features:
- Medication Preferences: Most frequently prescribed medications
- Diagnosis Patterns: Common treatment approaches for specific conditions
- Prescribing Style: Average medications per prescription, preferred dosages
- Historical Effectiveness: Success rates of prescribed treatments
- Specialty Focus: Areas of medical expertise based on prescription history
The MCP server implements a continuous learning system that improves AI recommendations over time:
- Feedback Collection: Doctors can modify AI-generated prescriptions and provide feedback
- Pattern Analysis: System analyzes successful vs. modified prescriptions
- Model Refinement: Feedback is used to improve future Gemini AI prompts
- Preference Learning: Individual doctor preferences are incorporated into recommendations
- Safety Enhancement: Safety validation rules are continuously updated based on real-world outcomes
- HIPAA Compliance: All patient data is handled according to healthcare privacy regulations
- Audit Trails: Complete logging of all AI decisions and doctor modifications
- Transparency: AI confidence scores and reasoning provided for all recommendations
- Human Oversight: All AI-generated prescriptions require doctor review and approval
- Error Handling: Comprehensive error handling with graceful degradation
- Data Validation: Multiple layers of input validation and sanitization
- Node.js 18+ and npm/yarn/pnpm
- MongoDB database (local or MongoDB Atlas)
- Google Gemini AI API key
- Clone the Repository
git clone <repository-url>
cd doctor-care-system
- Install Dependencies
# Using npm
npm install
# Using yarn
yarn install
# Using pnpm (recommended for faster installs)
pnpm install
- Environment Configuration
Create a
.env.local
file in the root directory:
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/doctor-care-system
# For MongoDB Atlas: mongodb+srv://username:[email protected]/doctor-care-system
# Authentication & Security
JWT_SECRET=your_super_secure_jwt_secret_key_here
NEXTAUTH_SECRET=your_nextauth_secret_for_enhanced_security
# AI Integration
GOOGLE_AI_API_KEY=your_gemini_api_key_from_google_ai_studio
GEMINI_API_KEY=your_gemini_api_key_from_google_ai_studio
# Email Service (Optional but recommended)
RESEND_API_KEY=your_resend_api_key_for_email_delivery
# Application Configuration
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:3000/api
# MCP Server Configuration (Optional)
MCP_SERVER_PORT=3001
MCP_SERVER_HOST=localhost
# Development & Debug
NODE_ENV=development
DEBUG=true
- Database Setup & Seeding
# Seed the database with sample data
npm run seed-db
# Or seed specific collections
npm run seed-doctors
npm run seed-patients
- Start Development Server
# Start the main application
npm run dev
# In a separate terminal, start the MCP server (optional)
npm run mcp-server
- Access the Application
- Main Application: http://localhost:3000
- API Documentation: http://localhost:3000/api/docs
- MCP Server: http://localhost:3001 (if running separately)
# Build for production
npm run build
# Start production server
npm start
# Deploy to Vercel (recommended)
npm install -g vercel
vercel --prod
POST /api/auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "securePassword123"
}
Response:
{
"success": true,
"token": "jwt_token_here",
"doctor": {
"id": "doctor_id",
"name": "Dr. Smith",
"email": "[email protected]",
"specialization": "Cardiology"
}
}
POST /api/auth/register
Content-Type: application/json
{
"name": "Dr. John Smith",
"email": "[email protected]",
"password": "securePassword123",
"specialization": "Cardiology",
"licenseNumber": "MD12345"
}
POST /api/auth/logout
Authorization: Bearer <jwt_token>
GET /api/patients
Authorization: Bearer <jwt_token>
Query Parameters:
- page: number (default: 1)
- limit: number (default: 20)
- search: string (search in name, email, phone)
- status: "stable" | "monitoring" | "critical" | "active"
- sortBy: "name" | "age" | "createdAt" | "lastVisit"
- sortOrder: "asc" | "desc"
Response:
{
"patients": [...],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalCount": 100,
"hasNext": true,
"hasPrev": false
}
}
POST /api/patients
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"name": "John Doe",
"age": 35,
"gender": "male",
"email": "[email protected]",
"phoneNumber": "+1234567890",
"allergies": ["Penicillin", "Shellfish"],
"currentMedications": ["Lisinopril 10mg"],
"medicalHistory": ["Hypertension", "Type 2 Diabetes"],
"emergencyContact": {
"name": "Jane Doe",
"relationship": "Spouse",
"phone": "+1234567891"
}
}
GET /api/patients/[id]
Authorization: Bearer <jwt_token>
Response:
{
"patient": {
"id": "patient_id",
"name": "John Doe",
"age": 35,
// ... other patient details
"prescriptionHistory": [...],
"appointmentHistory": [...],
"lastVisit": "2024-01-15T10:30:00Z"
}
}
PUT /api/patients/[id]
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"allergies": ["Penicillin", "Shellfish", "Latex"],
"currentMedications": ["Lisinopril 10mg", "Metformin 500mg"]
}
GET /api/appointments
Authorization: Bearer <jwt_token>
Query Parameters:
- date: string (YYYY-MM-DD)
- status: "scheduled" | "completed" | "cancelled" | "no-show"
- type: "consultation" | "follow-up" | "surgery" | "emergency"
- patientId: string
- doctorId: string
Response:
{
"appointments": [
{
"id": "apt_id",
"patientId": "patient_id",
"patientName": "John Doe",
"doctorId": "doctor_id",
"doctorName": "Dr. Smith",
"date": "2024-01-20",
"time": "14:30",
"type": "consultation",
"status": "scheduled",
"duration": 30,
"notes": "Regular checkup"
}
]
}
POST /api/appointments
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"patientId": "patient_id",
"doctorId": "doctor_id",
"date": "2024-01-20",
"time": "14:30",
"type": "consultation",
"duration": 30,
"notes": "Follow-up for hypertension",
"isVirtual": false
}
POST /api/ai-prescription-enhanced
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"patientId": "patient_id",
"symptoms": ["headache", "fever", "body aches"],
"diagnosis": "Viral infection",
"doctorId": "doctor_id",
"doctorName": "Dr. Smith",
"notes": "Patient reports symptoms for 3 days"
}
Response:
{
"prescription": {
"id": "rx_id",
"patientId": "patient_id",
"medications": [
{
"name": "Acetaminophen",
"strength": "500mg",
"dosage": "1-2 tablets",
"frequency": "Every 6 hours as needed",
"duration": "5 days",
"instructions": "Take with food"
}
],
"isAiGenerated": true,
"aiConfidence": 0.89,
"aiReasoning": "Based on symptoms and patient history..."
},
"safetyChecks": {
"allergyConflicts": [],
"drugInteractions": [],
"overallSafety": "SAFE"
},
"patientContext": {
"allergies": ["Penicillin"],
"currentMedications": [],
"riskLevel": "LOW"
}
}
POST /api/mcp-prescription-direct
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"tool": "create_prescription_with_gemini",
"arguments": {
"patientId": "patient_id",
"symptoms": ["chest pain", "shortness of breath"],
"diagnosis": "Possible cardiac event",
"doctorId": "doctor_id",
"doctorName": "Dr. Cardio"
}
}
GET /api/prescriptions
Authorization: Bearer <jwt_token>
Query Parameters:
- patientId: string
- doctorId: string
- status: "active" | "completed" | "cancelled" | "expired"
- dateFrom: string (YYYY-MM-DD)
- dateTo: string (YYYY-MM-DD)
- isAiGenerated: boolean
Response:
{
"prescriptions": [...],
"statistics": {
"total": 150,
"active": 45,
"aiGenerated": 30,
"averageConfidence": 0.87
}
}
GET /api/prescriptions/[id]/download
Authorization: Bearer <jwt_token>
Response: PDF file download
POST /api/prescription-email
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"prescriptionId": "rx_id",
"patientEmail": "[email protected]",
"includeInstructions": true
}
GET /api/dashboard-stats
Authorization: Bearer <jwt_token>
Response:
{
"patients": {
"total": 1250,
"new": 15,
"critical": 3,
"statusDistribution": {
"stable": 800,
"monitoring": 350,
"critical": 50,
"active": 50
}
},
"appointments": {
"today": 12,
"thisWeek": 89,
"completionRate": 0.94,
"upcomingCount": 45
},
"prescriptions": {
"total": 3400,
"thisMonth": 234,
"aiGenerated": 156,
"averageAiConfidence": 0.89
}
}
GET /api/appointment-stats
Authorization: Bearer <jwt_token>
Query Parameters:
- period: "today" | "week" | "month" | "year"
- doctorId: string (optional)
Response:
{
"totalAppointments": 156,
"completedAppointments": 142,
"cancelledAppointments": 8,
"noShowAppointments": 6,
"completionRate": 0.91,
"averageDuration": 28,
"typeDistribution": {
"consultation": 89,
"follow-up": 45,
"emergency": 12,
"surgery": 10
}
}
GET /api/websocket-status
Authorization: Bearer <jwt_token>
Response:
{
"status": "connected",
"activeConnections": 45,
"serverTime": "2024-01-15T10:30:00Z"
}
GET /api/notifications
Authorization: Bearer <jwt_token>
Query Parameters:
- unreadOnly: boolean
- limit: number
- type: "appointment" | "prescription" | "patient" | "system"
Response:
{
"notifications": [
{
"id": "notif_id",
"type": "appointment",
"title": "Upcoming Appointment",
"message": "Appointment with John Doe in 30 minutes",
"isRead": false,
"timestamp": "2024-01-15T14:00:00Z"
}
],
"unreadCount": 5
}
POST /api/mcp-prescription
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"action": "get_patient_history",
"patientId": "patient_id"
}
POST /api/mcp-prescription
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"action": "validate_prescription_safety",
"data": {
"medications": [
{
"name": "Aspirin",
"strength": "325mg",
"dosage": "1 tablet daily"
}
],
"patientId": "patient_id"
}
}
All API endpoints return consistent error responses:
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid patient ID provided",
"details": {
"field": "patientId",
"value": "invalid_id",
"expectedFormat": "Valid MongoDB ObjectId"
}
},
"timestamp": "2024-01-15T10:30:00Z"
}
Common HTTP Status Codes:
200
- Success201
- Created400
- Bad Request / Validation Error401
- Unauthorized403
- Forbidden404
- Not Found429
- Rate Limited500
- Internal Server Error
doctor-care-system/
βββ π src/ # Source code directory
β βββ π app/ # Next.js App Router (React 19)
β β βββ π favicon.ico # Application favicon
β β βββ π globals.css # Global CSS styles and theme variables
β β βββ π layout.tsx # Root layout with providers and metadata
β β βββ π page.tsx # Homepage/landing page
β β βββ π api/ # Next.js API routes (serverless functions)
β β β βββ π auth/ # Authentication endpoints
β β β β βββ π login.ts # JWT login endpoint
β β β β βββ π register.ts # Doctor registration
β β β β βββ π logout.ts # Secure logout
β β β βββ π patients/ # Patient management APIs
β β β β βββ π route.ts # CRUD operations for patients
β β β β βββ π [id]/ # Individual patient operations
β β β βββ π appointments/ # Appointment management APIs
β β β β βββ π route.ts # Appointment CRUD
β β β β βββ π stats.ts # Appointment analytics
β β β βββ π prescriptions/ # Prescription management APIs
β β β β βββ π route.ts # Prescription CRUD
β β β β βββ π download.ts # PDF generation
β β β β βββ π email.ts # Email delivery
β β β βββ π ai-prescription/ # AI-powered prescription APIs
β β β β βββ π route.ts # Basic AI prescription
β β β β βββ π enhanced.ts # Advanced AI with history
β β β βββ π mcp-prescription/ # MCP server integration
β β β β βββ π route.ts # MCP tool orchestration
β β β β βββ π direct.ts # Direct MCP calls
β β β βββ π dashboard-stats/ # Analytics and KPI endpoints
β β β βββ π notifications/ # Real-time notification system
β β β βββ π websocket-status/ # WebSocket connection management
β β βββ π dashboard/ # Protected dashboard pages
β β β βββ π page.tsx # Main dashboard with stats
β β β βββ π patients/ # Patient management interface
β β β β βββ π page.tsx # Patient list and management
β β β β βββ π [id]/ # Individual patient details
β β β βββ π appointments/ # Appointment management interface
β β β β βββ π page.tsx # Appointment calendar and list
β β β β βββ π [id]/ # Appointment details and editing
β β β βββ π prescriptions/ # Prescription management interface
β β β β βββ π page.tsx # Prescription list and search
β β β β βββ π [id]/ # Prescription details and modification
β β β βββ π notifications/ # Notification center
β β β β βββ π page.tsx # Notification management
β β β βββ π messages/ # Doctor-to-doctor messaging
β β β β βββ π page.tsx # Message interface
β β β βββ π settings/ # User preferences and configuration
β β β βββ π page.tsx # Settings overview
β β β βββ π profile.tsx # Profile management
β β β βββ π medical.tsx # Medical preferences
β β βββ π login/ # Authentication pages
β β β βββ π page.tsx # Login form with validation
β β βββ π register/ # Registration pages
β β βββ π page.tsx # Doctor registration form
β βββ π components/ # Reusable React components
β β βββ π ui/ # Base UI components (Radix + Tailwind)
β β β βββ π button.tsx # Button component with variants
β β β βββ π card.tsx # Card component for content organization
β β β βββ π dialog.tsx # Modal dialog component
β β β βββ π form.tsx # Form components with validation
β β β βββ π input.tsx # Input field with enhanced styling
β β β βββ π select.tsx # Select dropdown component
β β β βββ π table.tsx # Data table with sorting and filtering
β β β βββ π badge.tsx # Status badges and labels
β β β βββ π alert.tsx # Alert and notification components
β β β βββ π loading.tsx # Loading states and skeletons
β β βββ π dashboard/ # Dashboard-specific components
β β β βββ π dashboard-stats.tsx # Statistics cards and KPIs
β β β βββ π sidebar.tsx # Navigation sidebar
β β β βββ π header.tsx # Dashboard header with user menu
β β β βββ π quick-actions.tsx # Quick action buttons
β β β βββ π recent-activity.tsx # Activity feed component
β β βββ π patients/ # Patient-related components
β β β βββ π patient-list.tsx # Patient data table
β β β βββ π patient-card.tsx # Patient summary card
β β β βββ π patient-form.tsx # Add/edit patient form
β β β βββ π patient-search.tsx # Advanced search interface
β β β βββ π patient-history.tsx # Medical history timeline
β β βββ π appointments/ # Appointment-related components
β β β βββ π appointments-page.tsx # Main appointments interface
β β β βββ π appointment-calendar.tsx # Calendar view
β β β βββ π appointment-form.tsx # Booking form
β β β βββ π appointment-list.tsx # List view with filters
β β β βββ π appointment-card.tsx # Individual appointment card
β β βββ π prescriptions/ # Prescription-related components
β β βββ π prescriptions-page.tsx # Main prescriptions interface
β β βββ π prescription-form.tsx # Create/edit prescription
β β βββ π ai-prescription.tsx # AI-powered prescription generation
β β βββ π prescription-list.tsx # Prescription data table
β β βββ π prescription-card.tsx # Prescription summary card
β β βββ π prescription-pdf.tsx # PDF generation component
β βββ π contexts/ # React Context providers
β β βββ π AuthContext.tsx # Authentication state management
β β βββ π ThemeContext.tsx # Theme and dark mode management
β β βββ π NotificationContext.tsx # Global notification system
β β βββ π SocketContext.tsx # WebSocket connection context
β βββ π hooks/ # Custom React hooks
β β βββ π use-mobile.ts # Mobile device detection
β β βββ π useNotifications.ts # Notification management
β β βββ π useSettings.ts # User settings management
β β βββ π useSmartPolling.ts # Intelligent data polling
β β βββ π useSocket.ts # WebSocket connection management
β β βββ π useAuth.ts # Authentication state and actions
β β βββ π useLocalStorage.ts # Local storage with TypeScript
β β βββ π useDebounce.ts # Debounced input handling
β βββ π lib/ # Utility libraries and configurations
β β βββ π mongodb.ts # MongoDB connection and configuration
β β βββ π jwt.ts # JWT token management
β β βββ π utils.ts # General utility functions
β β βββ π validations.ts # Form validation schemas
β β βββ π constants.ts # Application constants
β β βββ π api-client.ts # API client with error handling
β β βββ π date-utils.ts # Date formatting and manipulation
β β βββ π notifications-client.ts # Client-side notification logic
β β βββ π notifications-server.ts # Server-side notification logic
β β βββ π notifications.ts # Shared notification utilities
β βββ π mcp-server/ # Model Context Protocol server
β β βββ π server-new.ts # Enhanced MCP server with all tools
β β βββ π server.ts # Basic MCP server implementation
β β βββ π tools/ # Individual MCP tool implementations
β β β βββ π patient-tools.ts # Patient-related MCP tools
β β β βββ π prescription-tools.ts # Prescription MCP tools
β β β βββ π safety-tools.ts # Safety validation tools
β β β βββ π analytics-tools.ts # Analytics and insights tools
β β βββ π types.ts # MCP-specific TypeScript types
β βββ π types/ # TypeScript type definitions
β βββ π appointment.ts # Appointment-related types
β βββ π prescription.ts # Prescription and medication types
β βββ π patient.ts # Patient-related types
β βββ π user.ts # User and authentication types
β βββ π api.ts # API response types
β βββ π notification.ts # Notification types
β βββ π database.ts # Database schema types
βββ π scripts/ # Database and utility scripts
β βββ π seed-database.ts # Main database seeding script
β βββ π seed-doctors.js # Doctor data seeding
β βββ π seed-patients.js # Patient data seeding
β βββ π create-specific-doctors.js # Specialized doctor creation
β βββ π check-doctors.js # Doctor data validation
β βββ π find-doctors.js # Doctor search utilities
β βββ π list-atlas-doctors.js # Atlas database doctor listing
βββ π data/ # Sample data and configurations
β βββ π patients.json # Sample patient data
β βββ π feedback/ # AI feedback and learning data
β βββ π finetune/ # AI model fine-tuning datasets
β βββ π prescription_finetune_dataset.jsonl
βββ π public/ # Static assets and resources
β βββ π favicon.ico # Application favicon
β βββ π next.svg # Next.js logo
β βββ π vercel.svg # Vercel deployment logo
β βββ π file.svg # File-related icons
β βββ π globe.svg # Global/web icons
β βββ π window.svg # UI-related icons
βββ π package.json # Project dependencies and scripts
βββ π package-lock.json # Locked dependency versions
βββ π tsconfig.json # TypeScript configuration
βββ π tsconfig.tsbuildinfo # TypeScript build cache
βββ π next.config.ts # Next.js configuration
βββ π next-env.d.ts # Next.js TypeScript definitions
βββ π tailwind.config.ts # Tailwind CSS configuration
βββ π postcss.config.mjs # PostCSS configuration
βββ π components.json # UI component configuration
βββ π eslint.config.mjs # ESLint configuration
βββ π middleware.ts # Next.js middleware for authentication
βββ π README.md # Project documentation (this file)
βββ π .env.local # Environment variables (not in repo)
βββ π .env.example # Environment variables template
βββ π .gitignore # Git ignore rules
βββ π .vercelignore # Vercel deployment ignore rules
Our AI system leverages Google Gemini AI to provide sophisticated medical reasoning:
- Contextual Analysis: Analyzes complete patient history, allergies, and current medications
- Symptom-Based Recommendations: Maps symptoms to appropriate treatments using medical knowledge
- Drug Interaction Prevention: Real-time checking against known drug interactions and contraindications
- Personalized Dosing: Adjusts medication dosages based on patient age, weight, and medical history
- Evidence-Based Decisions: Incorporates latest medical guidelines and research into recommendations
- Transparent AI: Provides confidence scores and reasoning for all AI-generated recommendations
- Automated Risk Scoring: Calculates patient risk levels based on multiple health factors
- Predictive Analytics: Identifies patients who may need additional monitoring or care
- Health Trend Analysis: Tracks patient health trajectories over time
- Early Warning System: Alerts for potential health complications before they become critical
- Historical Analysis: Reviews treatment effectiveness from previous prescriptions
- Alternative Suggestions: Recommends alternative medications when primary options are contraindicated
- Cost Optimization: Suggests generic alternatives and cost-effective treatment options
- Adherence Tracking: Monitors prescription compliance and suggests improvements
- Complete Medical History: Comprehensive tracking of all medical events and treatments
- Real-time Health Status: Live updates of patient condition and treatment progress
- Family Medical History: Integration of genetic and familial health factors
- Lifestyle Factors: Tracking of diet, exercise, and social determinants of health
- Communication Preferences: Patient preferences for appointment types and communication methods
- Intelligent Search: Natural language search across patient records
- Multi-criteria Filtering: Advanced filtering by demographics, conditions, treatments, and outcomes
- Saved Search Queries: Frequently used searches saved for quick access
- Global Search: Search across patients, appointments, prescriptions, and notes simultaneously
- Care Team Management: Coordination between multiple healthcare providers
- Referral Tracking: Management of specialist referrals and follow-up care
- Care Plan Management: Structured care plans with goals, milestones, and progress tracking
- Patient Engagement: Tools for patient education and care plan adherence
- AI-Powered Optimization: Intelligent scheduling that considers doctor availability, patient preferences, and appointment types
- Conflict Resolution: Automatic detection and resolution of scheduling conflicts
- Resource Management: Optimization of clinic resources including rooms and equipment
- Wait List Management: Intelligent wait list with automatic rebooking when slots become available
- Virtual Consultations: Integrated video calling for remote consultations
- Hybrid Appointments: Seamless transition between in-person and virtual care
- Emergency Scheduling: Priority scheduling for urgent medical needs
- Follow-up Automation: Automatic scheduling of follow-up appointments based on treatment plans
- Automated Reminders: Smart reminder system via email, SMS, and push notifications
- Pre-appointment Preparation: Automated patient instructions and preparation guidelines
- Post-appointment Follow-up: Structured follow-up communication and care instructions
- Rescheduling Intelligence: Smart rescheduling suggestions when appointments need to be changed
- Electronic Prescribing: Fully digital prescription creation and management
- E-Signature Integration: Secure digital signatures for prescription authorization
- Pharmacy Integration: Direct prescription transmission to patient's preferred pharmacy
- Insurance Verification: Real-time insurance coverage verification for prescribed medications
- Treatment Effectiveness: Analysis of prescription outcomes and patient responses
- Medication Adherence: Tracking of patient compliance with prescribed treatments
- Cost Analysis: Analysis of prescription costs and insurance coverage patterns
- Outcome Prediction: AI-powered prediction of treatment success rates
- Drug Interaction Checking: Real-time analysis of potential drug interactions
- Allergy Screening: Automatic checking against patient allergy profiles
- Dosage Validation: Verification of appropriate dosing for patient demographics
- Regulatory Compliance: Ensures all prescriptions meet regulatory requirements
- Data Encryption: End-to-end encryption for all patient data transmission and storage
- Access Controls: Role-based access control with audit trails
- Data Anonymization: Advanced anonymization techniques for analytics and research
- Breach Detection: Real-time monitoring for potential security breaches
- Multi-Factor Authentication: Enhanced security with multiple authentication factors
- Single Sign-On (SSO): Integration with healthcare organization SSO systems
- Session Management: Secure session handling with automatic timeout
- API Security: Comprehensive API security with rate limiting and request validation
- Complete Audit Trails: Detailed logging of all user actions and data access
- Compliance Reporting: Automated generation of compliance reports
- Data Retention: Automated data retention policies meeting regulatory requirements
- Privacy Controls: Granular privacy controls for sensitive patient information
- Live KPI Tracking: Real-time monitoring of key performance indicators
- Interactive Visualizations: Dynamic charts and graphs with drill-down capabilities
- Custom Dashboards: Personalized dashboards for different user roles
- Mobile Analytics: Mobile-optimized analytics for on-the-go access
- Treatment Outcome Analysis: Analysis of treatment effectiveness and patient outcomes
- Population Health: Population-level health analytics and trend identification
- Quality Metrics: Healthcare quality metrics and improvement tracking
- Research Analytics: De-identified data analytics for medical research
- Resource Utilization: Analysis of clinic resources and operational efficiency
- Staff Performance: Analytics on healthcare provider performance and productivity
- Financial Analytics: Revenue, cost, and financial performance analysis
- Patient Satisfaction: Patient satisfaction tracking and improvement analytics
- Real-time Synchronization: Instant updates across all connected devices and sessions
- Smart Notifications: Intelligent notification system with priority-based delivery
- Emergency Alerts: Critical patient alerts with immediate escalation protocols
- System Announcements: Organization-wide communication and announcement system
- Multi-Provider Coordination: Tools for coordination between multiple healthcare providers
- Shared Care Plans: Collaborative care planning with shared goals and responsibilities
- Consultation Tools: Built-in tools for provider-to-provider consultations
- Knowledge Sharing: Platform for sharing medical knowledge and best practices
- Secure Messaging: HIPAA-compliant messaging between healthcare providers
- Patient Communication: Secure patient-provider communication channels
- File Sharing: Secure sharing of medical documents and images
- Video Conferencing: Integrated video conferencing for consultations and meetings
- Mobile-First Approach: Designed primarily for mobile devices with progressive enhancement for larger screens
- Touch-Optimized Interfaces: Intuitive touch interfaces optimized for tablet and mobile use
- Progressive Web App (PWA): Full PWA capabilities with offline functionality and native app-like experience
- Accessibility Compliance: WCAG 2.1 AA compliance ensuring accessibility for users with disabilities
- Dynamic Theme System: Intelligent dark/light theme switching with system preference detection
- Custom Branding: Customizable branding and color schemes for healthcare organizations
- Layout Preferences: User-configurable layout options and dashboard customization
- Accessibility Options: High contrast modes, font size adjustments, and screen reader optimization
- Fast Loading: Optimized bundle splitting and lazy loading for sub-second page loads
- Efficient Caching: Intelligent caching strategies for both static assets and dynamic data
- Real-time Updates: WebSocket-based real-time updates without performance degradation
- Offline Capabilities: Critical functionality available even when internet connectivity is limited
- HL7 FHIR Compatibility: Standard healthcare data exchange protocols
- EHR Integration: Integration capabilities with major Electronic Health Record systems
- Laboratory Systems: Connection to laboratory information systems for test results
- Imaging Systems: Integration with medical imaging systems and PACS
- Pharmacy Networks: Integration with pharmacy networks for prescription fulfillment
- Insurance Systems: Real-time insurance verification and coverage checking
- Payment Processing: Secure payment processing for healthcare services
- Telemedicine Platforms: Integration with video conferencing and telemedicine solutions
- RESTful APIs: Comprehensive REST API for all application functionality
- GraphQL Support: GraphQL endpoints for efficient data fetching
- Webhook Support: Real-time webhooks for external system integration
- SDK Availability: Software development kits for common integration scenarios
- Sub-second Load Times: Optimized for fast loading with Next.js 15 and React 19
- Efficient Database Queries: Optimized MongoDB queries with proper indexing
- CDN Integration: Global content delivery network for static assets
- Server-Side Rendering: Enhanced SEO and initial page load performance
- Horizontal Scaling: Designed for horizontal scaling across multiple servers
- Database Sharding: Support for MongoDB sharding for large datasets
- Microservices Ready: Architecture that supports migration to microservices
- Cloud Native: Optimized for cloud deployment with containerization support
- Application Performance Monitoring: Real-time performance monitoring and alerting
- Error Tracking: Comprehensive error tracking and reporting
- Usage Analytics: Detailed usage analytics and user behavior tracking
- Health Checks: Automated health checks and system status monitoring
- Modern Tooling: Latest development tools and best practices
- Hot Reload: Instant feedback during development with hot reload
- TypeScript: Full TypeScript support for enhanced developer experience
- Code Quality: Automated code formatting, linting, and quality checks
- Unit Testing: Comprehensive unit test coverage with Jest and React Testing Library
- Integration Testing: API and component integration testing
- End-to-End Testing: Full user journey testing with Playwright or Cypress
- Performance Testing: Load testing and performance benchmarking
- CI/CD Pipeline: Automated continuous integration and deployment
- Docker Support: Containerization for consistent deployment environments
- Environment Management: Proper environment variable management and configuration
- Monitoring Integration: Built-in monitoring and alerting for production environments
- AI-Powered Diagnostics: Enhanced AI capabilities for diagnostic assistance
- Wearable Device Integration: Integration with patient wearable devices and IoT health sensors
- Blockchain Integration: Blockchain-based patient record management for enhanced security
- Advanced Analytics: Machine learning-powered predictive analytics for population health
- Multi-Language Support: Internationalization for global healthcare organizations
- Mobile Applications: Native mobile applications for iOS and Android
- Voice Integration: Voice-controlled interfaces for hands-free operation
- API Marketplace: Marketplace for third-party integrations and extensions
This project is licensed under the MIT License, allowing for both commercial and non-commercial use with proper attribution.
- Documentation: Comprehensive documentation and API references
- Community Support: Active community forum and discussion channels
- Professional Support: Enterprise support options available
- Training and Onboarding: Training programs for healthcare organizations
- Support Email: [email protected]
- Development Team: [email protected]
- Security Issues: [email protected]
- General Inquiries: [email protected]
Built with β€οΈ for modern healthcare by leveraging cutting-edge AI technology, user-centric design principles, and evidence-based medical practices to improve patient outcomes and healthcare delivery efficiency.
Key Technologies: Next.js 15 β’ React 19 β’ TypeScript β’ MongoDB β’ Google Gemini AI β’ Model Context Protocol β’ Tailwind CSS β’ Framer Motion β’ Socket.IO β’ JWT Authentication
Healthcare Focus: HIPAA Compliance β’ AI-Powered Prescriptions β’ Real-time Collaboration β’ Evidence-Based Medicine β’ Patient Safety β’ Clinical Decision Support