MedConnect is an AI-powered digital healthcare platform that streamlines appointment scheduling, centralizes patient records, and enhances doctor-patient communication. The platform integrates Machine Learning models to assist doctors in early diagnosis, achieving 99.73% accuracy in kidney disease detection.
- AI-Driven Scheduling: Intelligent appointment booking system that reduces wait times by up to 40%
- ML-Assisted Diagnostics: 99.73% accuracy in kidney disease detection using advanced AI models
- Centralized Records: All medical history in one place, accessible anytime, anywhere
- AI Health Assistant: 24/7 AI-powered chatbot for instant health-related queries
- Early Disease Detection: Advanced ML models for early detection of critical diseases
- Modern UI/UX: Beautiful, responsive design with professional healthcare aesthetics
- Secure Data: Bank-level encryption and compliance standards for patient data
- Backend: Django 4.2+
- AI/ML: TensorFlow, Keras for image analysis
- Database: SQLite3 (development)
- Frontend: Bootstrap 5, HTML5, CSS3, JavaScript
- Icons: Font Awesome 6.4
- Fonts: Inter, Poppins
- Python 3.8+ - Download from python.org
- pip - Usually comes with Python
- Virtual Environment (Recommended)
git clone <repository-url>
cd medconnect- Download Python 3.8 or higher from python.org
- During installation, check "Add Python to PATH" (very important!)
- Verify installation: Open Command Prompt and run
python --version
# Navigate to project directory
cd medconnect
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On Mac/Linux:
source venv/bin/activate# Install required packages
pip install -r requirements.txtNote: llama-cpp-python requires C++ build tools on Windows. For GPU support (recommended), you'll also need CUDA Toolkit. See the Installing llama-cpp-python section below for detailed instructions.
Or install individually:
pip install django tensorflow pillow numpy cryptography
# For llama-cpp-python, see Installing llama-cpp-python section belowpython manage.py migratepython manage.py createsuperuserpython manage.py runserverThe server will start at: http://127.0.0.1:8000
Double-click run_server.bat or run:
run_server.bat.\run_server.ps1medconnect/
βββ main/ # Main application (auth, appointments, dashboards)
βββ chat/ # Chat/AI assistant app
βββ scans/ # Medical scan analysis app
βββ medconnect/ # Project settings
βββ manage.py # Django management script
βββ requirements.txt # Python dependencies
βββ db.sqlite3 # Database file (created after migrations)
βββ media/ # User-uploaded files (created automatically)
- Home Page: http://127.0.0.1:8000/
- About: http://127.0.0.1:8000/about/
- Contact: http://127.0.0.1:8000/contact/
- Admin Panel: http://127.0.0.1:8000/admin/
- Patient Registration: http://127.0.0.1:8000/register/patient/
- Doctor Registration: http://127.0.0.1:8000/register/doctor/
- Login: http://127.0.0.1:8000/login/
- Book Appointment: http://127.0.0.1:8000/book-appointment/
- AI Chat: http://127.0.0.1:8000/chat/chat/
- Scan Upload: http://127.0.0.1:8000/scans/upload/
- Register and create profile
- Book appointments with doctors
- Upload medical reports
- Access AI health assistant
- Upload scans for analysis
- View appointment history
- Register and create professional profile
- Manage appointments
- View patient records
- Access AI diagnostic assistance
- Set consultation fees
- Manage schedule
Problem: Windows shows "Python was not found" or opens Microsoft Store.
Solution 1: Disable Windows Store Python Aliases (Recommended)
- Open Windows Settings (
Win + I) - Go to: Apps β Advanced app settings β App execution aliases
- Turn OFF
python.exe,python3.exe, andpythonw.exe - Restart your terminal/command prompt
- Test:
python --version
Solution 2: Use Python Launcher
py manage.py runserverSolution 3: Add Python to PATH Manually
- Find your Python installation folder (e.g.,
C:\Python39) - Find the Scripts folder (e.g.,
C:\Python39\Scripts) - Add both to System Environment Variables β Path
- Restart terminal
- Activate your virtual environment:
venv\Scripts\activate - Install missing packages:
pip install <package-name> - Reinstall all dependencies:
pip install -r requirements.txt
- Run migrations:
python manage.py migrate - If issues persist, delete
db.sqlite3and run migrations again:del db.sqlite3 python manage.py migrate
- Change port:
python manage.py runserver 8001 - Or kill the process using port 8000
- Collect static files:
python manage.py collectstatic - Ensure
DEBUG = Truein settings.py for development
The llama-cpp-python package requires C++ compilation on Windows. Here are the installation options:
- NVIDIA GPU with CUDA support
- CUDA Toolkit installed (download from https://developer.nvidia.com/cuda-downloads)
- cuDNN (download from https://developer.nvidia.com/cudnn)
-
Install Visual Studio Build Tools:
- Visit: https://visualstudio.microsoft.com/downloads/
- Download "Build Tools for Visual Studio 2022"
- Select "Desktop development with C++" workload
- Install
-
Install CUDA Toolkit:
- Download from: https://developer.nvidia.com/cuda-downloads
- Install the latest version (11.8+ recommended)
- Add CUDA to PATH if not done automatically
-
Install llama-cpp-python with CUDA:
Option A: Using pre-built wheels (Easiest - Recommended):
# For CUDA 12.1 pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 # For CUDA 11.8 pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu118 # Check your CUDA version with: nvidia-smi
Option B: Build from source (if pre-built wheels don't work):
# Set environment variable for CUDA (use GGML_CUDA, not LLAMA_CUBLAS) set CMAKE_ARGS=-DGGML_CUDA=on # Install with CUDA support pip install llama-cpp-python --force-reinstall --no-cache-dir
Important: Make sure CUDA Toolkit is installed and
nvccis in your PATH before building.
-
Download Visual Studio Build Tools:
- Visit: https://visualstudio.microsoft.com/downloads/
- Scroll down to "Tools for Visual Studio"
- Download "Build Tools for Visual Studio 2022"
-
Install Build Tools:
- Run the installer
- Select "Desktop development with C++" workload
- Click "Install"
-
Install llama-cpp-python (CPU):
pip install llama-cpp-python
Try installing from a pre-built wheel:
pip install llama-cpp-python --only-binary :all:Note: Pre-built wheels may not be available for all Python versions.
If you have Anaconda/Miniconda installed:
conda install -c conda-forge llama-cpp-pythonAfter installation, verify it works:
from llama_cpp import Llama
print("llama-cpp-python installed successfully!")
# Test GPU support (if installed with CUDA)
try:
# Try loading a small model to test GPU
model = Llama(model_path="path/to/model.gguf", n_gpu_layers=-1)
print("GPU support: Enabled")
except Exception as e:
print(f"GPU support: {e}")
print("Falling back to CPU mode")The code is configured to use GPU by default:
n_gpu_layers=-1means use all available GPU layers- If GPU is not available, it will automatically fall back to CPU
- You can adjust GPU layers in
chat/modules/ai.pyif needed
- More GPU layers = Faster inference but requires more VRAM
- Fewer GPU layers = Slower but uses less VRAM
- Set
n_gpu_layers=0in the code to force CPU-only mode
- CMake errors: Install CMake from https://cmake.org/download/
- Compiler errors: Ensure Visual Studio Build Tools are installed
- Python version: Ensure you're using Python 3.8-3.12
- CUDA not found:
- Install CUDA Toolkit from https://developer.nvidia.com/cuda-downloads
- Verify installation:
nvcc --version - Add CUDA to PATH if needed
- GPU not detected:
- Check GPU:
nvidia-smi - Verify CUDA version matches the wheel version
- The code will automatically fall back to CPU if GPU is unavailable
- Check GPU:
- Uses TensorFlow/Keras models for medical image analysis
- Achieves 99.73% accuracy in kidney disease detection
- Supports early disease detection
- AI-driven scheduling reduces wait times by 40%
- Real-time availability checking
- Automated reminders and notifications
- 24/7 availability
- Powered by advanced language models
- Provides instant health-related information
- The project uses SQLite database by default (development)
- Static files are served automatically in development
- Media files are stored in the
media/directory - For production, configure proper database (PostgreSQL recommended) and static file serving
- Ensure proper security settings before deploying to production
All rights reserved Β© 2024 MedConnect
- Patient data encryption: All sensitive PHI (Protected Health Information) is encrypted using Fernet (AES-128) encryption
- Medical history, contact numbers, appointment notes, and chat conversations are automatically encrypted
- Encryption keys are stored securely via environment variables
- Default encryption password: "medconnect" (can be changed via
MEDCONNECT_ENCRYPTION_KEYenvironment variable)
The system uses "medconnect" as the default encryption password. This password is automatically derived into a secure Fernet key using PBKDF2 (100,000 iterations).
Set Environment Variable (Optional):
Windows (PowerShell):
$env:MEDCONNECT_ENCRYPTION_KEY="medconnect"Windows (Command Prompt):
set MEDCONNECT_ENCRYPTION_KEY=medconnectLinux/Mac:
export MEDCONNECT_ENCRYPTION_KEY="medconnect"Note: The environment variable is already set to "medconnect" by default in settings.py. You only need to set it manually if you want to change it.
For Production:
- Use a strong, unique password (not "medconnect")
- Store the password in a secure environment variable or secrets manager
- Never commit the password to version control
- Use different passwords for development and production
- HIPAA-compliant audit logging: Comprehensive audit trail of all PHI access
- Tracks user actions, IP addresses, timestamps, and resource access
- Viewable in Django admin panel
- Required for HIPAA compliance
- Automatic logging via middleware for all PHI access
-
Encrypted Fields:
- Patient medical history
- Patient contact numbers
- Doctor phone numbers
- Appointment notes and medical history
- Contact form messages
- Chat conversations (prompts and responses)
-
Encryption Method: Fernet symmetric encryption (AES-128 in CBC mode)
-
Storage: Base64 encoded encrypted strings in database
-
Audit Logging:
- Automatic logging of all PHI (Protected Health Information) access
- Tracks: user accessing data, action performed (view, create, update, delete), resource type and ID, IP address and user agent, timestamp, additional details
- Access via Admin: View audit logs in Django admin panel at
/admin/
-
Security Settings:
- Session Security: HTTP-only cookies, secure cookies (enable in production with HTTPS), session expiration, SameSite protection
- Password Security: Minimum 8 characters, complexity requirements, Django's built-in validators
- XSS Protection: Content Security Policy headers, XSS filter enabled
- Clickjacking Protection: X-Frame-Options: DENY
-
Access Control:
- Authentication required for all PHI access
- Role-based access (Patient/Doctor)
- Automatic audit logging via middleware
Test encryption using the provided test script:
python test_encryption.pyOr test manually in Python shell:
from main.utils.encryption import encrypt_data, decrypt_data
# Test encryption
encrypted = encrypt_data("Test medical history")
decrypted = decrypt_data(encrypted)
assert decrypted == "Test medical history"
print("Encryption working correctly!")Before deploying to production:
- Set
ENCRYPTION_KEYenvironment variable with a strong password - Set
DEBUG = Falsein settings.py - Set
SECURE_SSL_REDIRECT = True - Set
SESSION_COOKIE_SECURE = True - Set
CSRF_COOKIE_SECURE = True - Configure proper database (PostgreSQL recommended)
- Set up SSL/HTTPS certificate
- Configure secure file storage for media files
- Set up regular backups
- Configure log rotation for audit logs
- Review and test all security settings
- Conduct security audit
- Set up monitoring and alerting
-
Encryption Key: Never lose your encryption key! Data encrypted with a lost key cannot be recovered.
-
Backup Strategy: Ensure encrypted backups include the encryption key (stored separately and securely).
-
Performance: Encryption/decryption adds minimal overhead. Monitor performance in production.
-
Legacy Data: Existing unencrypted data will be automatically encrypted on next save.
-
File Encryption: Currently, file uploads are stored as-is. For production, implement file-level encryption or use encrypted storage services.
- Regular security audits recommended for production deployment
Note: This is a development version. For production deployment, ensure proper configuration of:
- Database (PostgreSQL recommended)
- Static file serving
- Security settings
- Environment variables
- SSL/HTTPS
- Backup systems