A Full-Stack Medical Healthcare Application with AI-Powered Diagnostics and Role-Based Access Control
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.
- 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
- 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
- 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
- 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
- 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
| 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 |
| 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 |
| 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 |
- 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
- 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
Patient Input โ Groq AI Processing โ LLaMA Analysis โ Medical Insights โ Doctor Review
- 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)
-
Install dependencies
npm install
-
Start development server
npm run dev
-
Access the application
- Open your browser and go to
http://localhost:5173
- Open your browser and go to
-
Navigate to backend directory
cd backend -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Install AI dependencies
pip install groq transformers torch huggingface-hub
-
Set up environment variables
- Copy
backend/.env.exampletobackend/.env - Fill in your API keys and configuration (including AI keys)
- Copy
-
Run the backend server
python main.py
-
API Documentation
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- Swagger UI:
# 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- Groq AI: Sign up at Groq Console for ultra-fast inference
- Hugging Face: Create account at Hugging Face for LLaMA models
- MongoDB: Sign up at MongoDB Atlas
- Stripe: Create account at Stripe Dashboard
- AWS S3 & SES: Set up at AWS Console
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
POST /api/auth/register- Register new userPOST /api/auth/login- User loginGET /api/auth/me- Get current user
POST /api/ai/symptom-check- AI symptom analysisPOST /api/ai/analyze-report- AI medical report analysisPOST /api/ai/drug-interaction- AI drug interaction checkGET /api/ai/health-insights- AI-generated health insightsPOST /api/ai/treatment-suggestions- AI treatment recommendations
GET /api/patient/profile- Get patient profilePUT /api/patient/profile- Update patient profilePOST /api/patient/upload-medical-record- Upload medical recordGET /api/patient/medical-records- Get patient's recordsGET /api/patient/doctors- Get AI-recommended doctorsPOST /api/patient/book-appointment- Book appointmentGET /api/patient/appointments- Get patient appointments
GET /api/doctor/profile- Get doctor profilePUT /api/doctor/profile- Update doctor profileGET /api/doctor/patients- Get assigned patientsGET /api/doctor/medical-records- Get patient records with AI insightsPOST /api/doctor/diagnosis- Create AI-enhanced diagnosisGET /api/doctor/appointments- Get doctor appointments
- Email:
patient@demo.com - Password:
password
- Email:
doctor@demo.com - Password:
password
- Speed: Sub-second inference times
- Accuracy: High-precision medical analysis
- Scalability: Handles multiple concurrent requests
- Cost-Effective: Optimized pricing for healthcare applications
- 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
- 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
npm run build
# Deploy dist/ folder to your hosting provider# Using gunicorn for production
pip install gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000# 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- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-ai-feature) - Commit your changes (
git commit -m 'Add amazing AI feature') - Push to the branch (
git push origin feature/amazing-ai-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
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





