diff --git a/README.md b/README.md index f3e02b8..3b36169 100644 --- a/README.md +++ b/README.md @@ -1 +1,396 @@ -MedCareDoctorPatient +# MedCare ๐Ÿฅ๐Ÿ’ป๐Ÿค– + +*A Full-Stack Medical Healthcare Application with AI-Powered Diagnostics and Role-Based Access Control* + +--- + +## ๐Ÿ“– Description + +**MedCare** is a comprehensive healthcare platform that connects patients with verified doctors through a modern web interface enhanced with cutting-edge AI technology. Our platform leverages **Groq AI** and **LLaMA models** to provide intelligent symptom analysis, preliminary diagnostics, and treatment recommendations, while maintaining secure appointment booking, medical record management, and consultation services with role-based access control. + +Whether you're a patient seeking AI-enhanced healthcare insights or a doctor utilizing advanced AI tools for better patient care, MedCare offers an intuitive, secure, and intelligent platform for all your healthcare needs. + +## โœจ Key Features + +### ๐Ÿค– **AI-Powered Healthcare Intelligence** +- **Groq AI Integration**: Ultra-fast AI inference for real-time medical analysis +- **LLaMA Model Support**: Advanced language models for medical text understanding +- **Intelligent Symptom Checker**: AI-powered preliminary diagnosis based on symptoms +- **Medical Report Analysis**: Automated analysis of uploaded medical documents +- **Treatment Recommendations**: AI-generated treatment suggestions for doctors +- **Drug Interaction Checker**: AI-powered medication safety analysis +- **Medical Literature Search**: AI-enhanced search through medical databases + +### ๐Ÿ‘จโ€โš•๏ธ **For Doctors (AI-Enhanced)** +- **AI Diagnostic Assistant**: Get AI-powered insights for patient diagnosis +- **Patient Management**: View and manage assigned patients with AI-generated summaries +- **Medical Records Review**: AI-enhanced analysis of patient medical records +- **Diagnosis Notes**: Create comprehensive diagnosis records with AI suggestions +- **Appointment Management**: AI-optimized scheduling and patient prioritization +- **Professional Profile**: Manage credentials, specializations, and consultation fees +- **Clinical Decision Support**: AI-powered treatment recommendations + +### ๐Ÿฅ **For Patients (AI-Powered)** +- **AI Symptom Checker**: Get preliminary AI analysis of your symptoms +- **Smart Appointment Booking**: AI-recommended doctor matching based on symptoms +- **Medical Records Upload**: AI-powered document analysis and categorization +- **Appointment History**: Track appointments with AI-generated health insights +- **Secure Payments**: Process consultation fees through integrated payment system +- **Health Insights**: AI-powered health trend analysis and recommendations +- **Medication Reminders**: AI-optimized medication scheduling + +### ๐Ÿ” **Security & Authentication** +- JWT-based authentication with role-based access control +- Secure password hashing with bcrypt +- Protected routes based on user roles +- Session management with token refresh +- HIPAA-compliant data handling for AI processing + +### ๐Ÿ’พ **Data Management & AI Processing** +- MongoDB integration for scalable data storage +- File upload to AWS S3 with secure access +- Email notifications via AWS SES +- Stripe payment processing integration +- **Groq AI API** for lightning-fast inference +- **LLaMA model deployment** for advanced medical NLP +- Secure AI data processing with privacy protection + +## ๐Ÿ› ๏ธ Tech Stack + +### Frontend +| Technology | Purpose | +|------------|---------| +| **React 18** | Modern UI framework with hooks | +| **TypeScript** | Type-safe development | +| **Tailwind CSS** | Utility-first CSS framework | +| **React Router** | Client-side routing | +| **Lucide React** | Beautiful icon library | +| **Vite** | Fast build tool and dev server | + +### Backend +| Technology | Purpose | +|------------|---------| +| **FastAPI** | High-performance Python web framework | +| **MongoDB** | NoSQL database with Motor async driver | +| **JWT** | Secure authentication tokens | +| **AWS S3** | File storage and management | +| **AWS SES** | Email notification service | +| **Stripe** | Payment processing | +| **bcrypt** | Password hashing | + +### AI & Machine Learning +| Technology | Purpose | +|------------|---------| +| **Groq AI** | Ultra-fast AI inference engine | +| **LLaMA Models** | Advanced language models for medical NLP | +| **Transformers** | Hugging Face transformers for model deployment | +| **OpenAI API** | Additional AI capabilities (optional) | +| **scikit-learn** | Traditional ML algorithms for health analytics | +| **pandas** | Data processing for AI model inputs | + +## ๐Ÿค– AI Integration Details + +### Groq AI Implementation +- **Real-time Inference**: Sub-second response times for medical queries +- **Symptom Analysis**: Instant preliminary diagnosis suggestions +- **Medical Text Processing**: Fast analysis of patient reports and notes +- **Drug Interaction Checking**: Rapid medication safety verification + +### LLaMA Model Applications +- **Medical Literature Understanding**: Advanced comprehension of medical texts +- **Patient Communication**: Natural language processing for patient queries +- **Clinical Note Generation**: AI-assisted medical documentation +- **Treatment Planning**: Intelligent treatment recommendation generation + +### AI Workflow +``` +Patient Input โ†’ Groq AI Processing โ†’ LLaMA Analysis โ†’ Medical Insights โ†’ Doctor Review +``` + +## ๐Ÿ“ธ Screenshots + +### AI Symptom Checker +![AI Symptom Checker](./pictures/ai_analysis.png) + +### AI-Enhanced Doctor Dashboard +![AI Doctor Dashboard](./pictures/doctor_dashboard.png) + +### Landing Page +![Landing Page](./pictures/landingpage_of_healthbridge.png) + +### Patient Dashboard +![Patient Dashboard](./pictures/patient_dashboard.png) + +### Appointment Booking +![Appointment Booking](./pictures/appointment_2222.png) + +### Medical Records with AI Analysis +![Medical Records](./pictures/medical_records.png) + +## ๐Ÿš€ Setup Instructions + +### Prerequisites +- Node.js 18+ and npm +- Python 3.10+ +- MongoDB (local or Atlas) +- AWS Account (for S3 and SES) +- Stripe Account (for payments) +- **Groq AI API Key** +- **Hugging Face Account** (for LLaMA models) + +### Frontend Setup + +1. **Install dependencies** + ```bash + npm install + ``` + +2. **Start development server** + ```bash + npm run dev + ``` + +3. **Access the application** + - Open your browser and go to `http://localhost:5173` + +### Backend Setup + +1. **Navigate to backend directory** + ```bash + cd backend + ``` + +2. **Create virtual environment** + ```bash + python -m venv venv + source venv/bin/activate # On Windows: venv\Scripts\activate + ``` + +3. **Install dependencies** + ```bash + pip install -r requirements.txt + ``` + +4. **Install AI dependencies** + ```bash + pip install groq transformers torch huggingface-hub + ``` + +5. **Set up environment variables** + - Copy `backend/.env.example` to `backend/.env` + - Fill in your API keys and configuration (including AI keys) + +6. **Run the backend server** + ```bash + python main.py + ``` + +7. **API Documentation** + - Swagger UI: `http://localhost:8000/docs` + - ReDoc: `http://localhost:8000/redoc` + +## ๐Ÿ” Environment Variables + +### Backend (.env) +```env +# Database +DATABASE_URL=mongodb://localhost:27017 +DATABASE_NAME=medcare + +# JWT Authentication +SECRET_KEY=your-super-secret-jwt-key-here +ALGORITHM=HS256 +ACCESS_TOKEN_EXPIRE_MINUTES=30 + +# Stripe Configuration +STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here +STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here +STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here + +# AWS Configuration +AWS_ACCESS_KEY_ID=your_aws_access_key_id +AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key +AWS_REGION=us-east-1 +AWS_S3_BUCKET_NAME=medcare-files +FROM_EMAIL=noreply@yourdomain.com + +# AI Configuration +GROQ_API_KEY=your_groq_api_key_here +HUGGINGFACE_API_TOKEN=your_huggingface_token_here +LLAMA_MODEL_NAME=meta-llama/Llama-2-7b-chat-hf +OPENAI_API_KEY=your_openai_key_here # Optional + +# Application Settings +CORS_ORIGINS=http://localhost:3000,http://localhost:5173 +``` + +### How to Get AI API Keys: + +1. **Groq AI**: Sign up at [Groq Console](https://console.groq.com) for ultra-fast inference +2. **Hugging Face**: Create account at [Hugging Face](https://huggingface.co) for LLaMA models +3. **MongoDB**: Sign up at [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) +4. **Stripe**: Create account at [Stripe Dashboard](https://dashboard.stripe.com) +5. **AWS S3 & SES**: Set up at [AWS Console](https://console.aws.amazon.com) + +## ๐Ÿ“ Project Structure + +``` +medcare/ +โ”œโ”€โ”€ src/ # Frontend React application +โ”‚ โ”œโ”€โ”€ components/ # React components +โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Authentication components +โ”‚ โ”‚ โ”œโ”€โ”€ patient/ # Patient-specific components +โ”‚ โ”‚ โ”œโ”€โ”€ doctor/ # Doctor-specific components +โ”‚ โ”‚ โ”œโ”€โ”€ ai/ # AI-powered components +โ”‚ โ”‚ โ””โ”€โ”€ ui/ # Reusable UI components +โ”‚ โ”œโ”€โ”€ contexts/ # React contexts (Auth, AI, etc.) +โ”‚ โ””โ”€โ”€ main.tsx # Application entry point +โ”œโ”€โ”€ +โ”œโ”€โ”€ backend/ # FastAPI backend +โ”‚ โ”œโ”€โ”€ routes/ # API route handlers +โ”‚ โ”‚ โ”œโ”€โ”€ patient.py # Patient endpoints +โ”‚ โ”‚ โ”œโ”€โ”€ doctor.py # Doctor endpoints +โ”‚ โ”‚ โ””โ”€โ”€ ai.py # AI-powered endpoints +โ”‚ โ”œโ”€โ”€ auth/ # Authentication logic +โ”‚ โ”œโ”€โ”€ services/ # External service integrations +โ”‚ โ”‚ โ”œโ”€โ”€ stripe.py # Payment processing +โ”‚ โ”‚ โ”œโ”€โ”€ s3.py # File storage +โ”‚ โ”‚ โ”œโ”€โ”€ ses.py # Email service +โ”‚ โ”‚ โ”œโ”€โ”€ groq_ai.py # Groq AI integration +โ”‚ โ”‚ โ””โ”€โ”€ llama_service.py # LLaMA model service +โ”‚ โ”œโ”€โ”€ models/ # Data models +โ”‚ โ”œโ”€โ”€ ai/ # AI model configurations +โ”‚ โ”œโ”€โ”€ database.py # Database operations +โ”‚ โ””โ”€โ”€ main.py # FastAPI application +โ”œโ”€โ”€ +โ”œโ”€โ”€ package.json # Frontend dependencies +โ”œโ”€โ”€ tailwind.config.js # Tailwind CSS configuration +โ”œโ”€โ”€ vite.config.ts # Vite build configuration +โ””โ”€โ”€ README.md # This file +``` + +## ๐Ÿ”ฎ API Endpoints + +### Authentication +- `POST /api/auth/register` - Register new user +- `POST /api/auth/login` - User login +- `GET /api/auth/me` - Get current user + +### AI-Powered Endpoints +- `POST /api/ai/symptom-check` - AI symptom analysis +- `POST /api/ai/analyze-report` - AI medical report analysis +- `POST /api/ai/drug-interaction` - AI drug interaction check +- `GET /api/ai/health-insights` - AI-generated health insights +- `POST /api/ai/treatment-suggestions` - AI treatment recommendations + +### Patient Endpoints +- `GET /api/patient/profile` - Get patient profile +- `PUT /api/patient/profile` - Update patient profile +- `POST /api/patient/upload-medical-record` - Upload medical record +- `GET /api/patient/medical-records` - Get patient's records +- `GET /api/patient/doctors` - Get AI-recommended doctors +- `POST /api/patient/book-appointment` - Book appointment +- `GET /api/patient/appointments` - Get patient appointments + +### Doctor Endpoints +- `GET /api/doctor/profile` - Get doctor profile +- `PUT /api/doctor/profile` - Update doctor profile +- `GET /api/doctor/patients` - Get assigned patients +- `GET /api/doctor/medical-records` - Get patient records with AI insights +- `POST /api/doctor/diagnosis` - Create AI-enhanced diagnosis +- `GET /api/doctor/appointments` - Get doctor appointments + +## ๐Ÿงช Demo Accounts + +### Patient Account +- **Email**: `patient@demo.com` +- **Password**: `password` + +### Doctor Account +- **Email**: `doctor@demo.com` +- **Password**: `password` + +## ๐Ÿค– AI Model Information + +### Groq AI Features +- **Speed**: Sub-second inference times +- **Accuracy**: High-precision medical analysis +- **Scalability**: Handles multiple concurrent requests +- **Cost-Effective**: Optimized pricing for healthcare applications + +### LLaMA Model Capabilities +- **Medical NLP**: Specialized in healthcare language understanding +- **Multilingual**: Support for multiple languages +- **Context Awareness**: Understanding of medical context and terminology +- **Privacy-Focused**: Can be deployed locally for sensitive data + +## ๐Ÿ”’ Security Features + +- **Authentication**: JWT tokens with role-based access +- **Data Protection**: Encrypted passwords with bcrypt +- **File Security**: Secure S3 uploads with signed URLs +- **Input Validation**: Comprehensive data validation +- **CORS Protection**: Configured for secure cross-origin requests +- **AI Privacy**: Secure AI processing with data anonymization +- **HIPAA Compliance**: Healthcare data protection standards + +## ๐Ÿš€ Deployment + +### Frontend (Netlify/Vercel) +```bash +npm run build +# Deploy dist/ folder to your hosting provider +``` + +### Backend (Production) +```bash +# Using gunicorn for production +pip install gunicorn +gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 +``` + +### AI Model Deployment +```bash +# For local LLaMA deployment +python -m transformers.models.llama.convert_llama_weights_to_hf \ + --input_dir /path/to/llama/weights \ + --model_size 7B \ + --output_dir ./models/llama-7b-hf +``` + +## ๐Ÿค Contributing + +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-ai-feature`) +3. Commit your changes (`git commit -m 'Add amazing AI feature'`) +4. Push to the branch (`git push origin feature/amazing-ai-feature`) +5. Open a Pull Request + +## ๐Ÿ“„ License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## ๐Ÿ“ž Support + +For support and questions: +- Create an issue in the repository +- Check the API documentation at `/docs` +- Review the AI model documentation +- Check Groq AI documentation for inference optimization + +--- + +
+ +**Built with โค๏ธ for AI-Enhanced Modern Healthcare** + +*Connecting Patients and Doctors Through Advanced AI Technology* + +[![React](https://img.shields.io/badge/React-18-blue.svg)](https://reactjs.org/) +[![FastAPI](https://img.shields.io/badge/FastAPI-Latest-green.svg)](https://fastapi.tiangolo.com/) +[![Groq AI](https://img.shields.io/badge/Groq-AI-orange.svg)](https://groq.com/) +[![LLaMA](https://img.shields.io/badge/LLaMA-Models-red.svg)](https://ai.meta.com/llama/) +[![TypeScript](https://img.shields.io/badge/TypeScript-5-blue.svg)](https://www.typescriptlang.org/) +[![Tailwind CSS](https://img.shields.io/badge/Tailwind-3-blue.svg)](https://tailwindcss.com/) + +
diff --git a/pictures/ai_analysis.png b/pictures/ai_analysis.png new file mode 100644 index 0000000..498d5de Binary files /dev/null and b/pictures/ai_analysis.png differ diff --git a/pictures/appointment_2222.png b/pictures/appointment_2222.png new file mode 100644 index 0000000..2cf0f04 Binary files /dev/null and b/pictures/appointment_2222.png differ diff --git a/pictures/doctor_dashboard.png b/pictures/doctor_dashboard.png new file mode 100644 index 0000000..a8ac42d Binary files /dev/null and b/pictures/doctor_dashboard.png differ diff --git a/pictures/landingpage_of_healthbridge.png b/pictures/landingpage_of_healthbridge.png new file mode 100644 index 0000000..d41aef3 Binary files /dev/null and b/pictures/landingpage_of_healthbridge.png differ diff --git a/pictures/medical_records.png b/pictures/medical_records.png new file mode 100644 index 0000000..70f4652 Binary files /dev/null and b/pictures/medical_records.png differ diff --git a/pictures/patient_dashboard.png b/pictures/patient_dashboard.png new file mode 100644 index 0000000..d0e3adc Binary files /dev/null and b/pictures/patient_dashboard.png differ diff --git a/src/components/patient/MedicalRecords.tsx b/src/components/patient/MedicalRecords.tsx index bf7eeca..64cfc14 100644 --- a/src/components/patient/MedicalRecords.tsx +++ b/src/components/patient/MedicalRecords.tsx @@ -46,7 +46,7 @@ export default function MedicalRecords() { } if (file.size > 10 * 1024 * 1024) { // 10MB limit - toast.error('File size must be less than 10MB'); + toast.error('File size should be less than 10MB'); return; }