A complete Django web application for digital healthcare records management with QR code-based patient data sharing.
- User Registration & Authentication: Secure signup and login
- Medical Profile: Store personal info (name, age, blood group, address, phone)
- Allergies Management: Track and manage known allergies with severity levels
- Chronic Conditions: Record ongoing health conditions and their status
- Emergency Contacts: Save emergency contact information
- Medical Records: Upload and organize medical files, prescriptions, lab reports
- Medication Tracking: Keep track of current medications and dosages
- QR Code Generation: Auto-generated QR code for easy doctor access
- QR Code Scanner: Scan patient QR codes to access their data
- Patient Summary: View comprehensive patient health information
- Allergies & Conditions: See critical health information at a glance
- Medical Timeline: View recent medications and medical records
- Scan History: Track scanning history with patients
cd c:\Users\ASUS\OneDrive\Desktop\binu\pocketmedidpip install -r requirements.txtpython manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py collectstatic --noinputpython manage.py runserverAccess the application at: http://localhost:8000
Admin panel: http://localhost:8000/admin
pocketmedid/
├── core/ # Core app (auth, home)
│ ├── models.py # UserProfile model
│ ├── views.py # Home, signup, login views
│ ├── urls.py # Core URL patterns
│ ├── forms.py # Auth forms
│ └── admin.py # Admin configuration
├── patients/ # Patients app
│ ├── models.py # Patient, Allergy, ChronicCondition, etc.
│ ├── views.py # Patient profile, upload views
│ ├── urls.py # Patient URL patterns
│ ├── forms.py # Patient forms
│ └── admin.py # Admin configuration
├── doctors/ # Doctors app
│ ├── models.py # Doctor, ScanLog models
│ ├── views.py # QR scan, patient summary views
│ ├── urls.py # Doctor URL patterns
│ ├── forms.py # Doctor forms
│ └── admin.py # Admin configuration
├── templates/ # HTML templates
│ ├── base.html # Base template
│ ├── core/ # Core templates
│ ├── patients/ # Patient templates
│ └── doctors/ # Doctor templates
├── static/ # Static files
│ ├── css/
│ │ └── style.css # Main stylesheet
│ └── js/ # JavaScript files
├── media/ # User uploads (QR codes, records, etc.)
├── pocketmedid/ # Django project settings
├── manage.py # Django management script
└── requirements.txt # Python dependencies
- UserProfile: Links User to patient/doctor type
- Patient: Main patient profile
- Allergy: Known allergies with severity
- ChronicCondition: Ongoing health conditions
- EmergencyContact: Emergency contact information
- MedicalRecord: Uploaded medical documents and images
- Medicine: Current medications and dosages
- Doctor: Doctor profile with license and specialization
- ScanLog: History of QR code scans
/- Home page/signup/- Patient/Doctor signup/login/- Login/logout/- Logout/patient-dashboard/- Patient dashboard redirect/doctor-dashboard/- Doctor dashboard redirect
/patients/profile/<id>/- Patient profile/patients/<id>/upload/- Upload medical records/patients/allergy/<id>/add/- Add allergy/patients/condition/<id>/add/- Add condition/patients/emergency-contact/<id>/add/- Add contact
/doctors/scan/- QR code scanner/doctors/patient/<id>/summary/- Patient health summary
✅ Screen 1: Home - "I am a patient" / "I am a doctor" buttons ✅ Screen 2: Patient Signup/Login - Complete authentication ✅ Screen 3: Patient Profile - All info + QR code card ✅ Screen 4: Patient Upload - Medical records + photo upload ✅ Screen 5: Doctor Scan QR - QR code scanning interface ✅ Screen 6: Doctor Patient Summary - Details, allergies, meds, timeline
- QR Code Generation: Automatic QR code creation for each patient
- File Upload: Support for medical documents and images
- Responsive Design: Bootstrap 5 for mobile-friendly interface
- Admin Panel: Complete Django admin for data management
- User Authentication: Django's built-in auth system
- Data Validation: Form validation and error handling
- CSRF Protection
- Password hashing
- User authentication required for sensitive views
- File upload validation
- SQL injection protection (Django ORM)
Edit static/css/style.css to customize colors and layout.
Add more fields to models in respective models.py files and run migrations.
All templates use Bootstrap 5. Modify templates/ directory for custom designs.
python manage.py shellfrom django.contrib.auth.models import User
from core.models import UserProfile
from patients.models import Patient
from doctors.models import Doctor
# Create patient
user = User.objects.create_user(
username='patient1',
email='patient@example.com',
first_name='John',
last_name='Doe',
password='testpass123'
)
UserProfile.objects.create(user=user, user_type='patient')
Patient.objects.create(user=user, age=30, blood_group='O+')
# Create doctor
doc_user = User.objects.create_user(
username='doctor1',
email='doctor@example.com',
first_name='Jane',
last_name='Smith',
password='testpass123'
)
UserProfile.objects.create(user=doc_user, user_type='doctor')
Doctor.objects.create(
user=doc_user,
license_number='LIC123456',
specialization='Cardiology'
)For production deployment:
- Set
DEBUG = Falsein settings.py - Configure allowed hosts
- Set up proper database (PostgreSQL recommended)
- Configure static files serving (WhiteNoise or CDN)
- Use environment variables for sensitive settings
- Enable HTTPS
- Django Documentation: https://docs.djangoproject.com/
- Bootstrap Documentation: https://getbootstrap.com/
- QR Code Library: https://github.com/lincolnloop/python-qrcode
This project is created for educational purposes.
PocketMedID is a QR-based digital medical identity system that allows doctors to instantly access a patient’s essential medical history during emergencies.
Instead of carrying heavy medical files, patients simply present a QR code.
Doctors scan the QR code and securely view allergies, chronic conditions, medications, and recent medical records.
- Patients often carry bulky medical documents.
- In emergencies, critical medical history is hard to access quickly.
- Important information like allergies or chronic conditions may be unavailable.
- Delays in treatment due to missing records.
PocketMedID solves this by digitizing patient records and making them accessible through secure QR scanning.
- Each patient has a unique QR code.
- The QR code contains a secure URL with an access token.
- A doctor logs into the system.
- The doctor scans or uploads the patient's QR code.
- The system verifies the token.
- The doctor can view a patient summary instantly.
- Every scan is logged for security and auditing.
- Token-based patient access verification
- Doctor authentication required
- Scan logging system (tracks who accessed which patient and when)
- Access control between patients and doctors
- Create doctor profile (license number, specialization, clinic details)
- Scan patient QR code
- View patient summary
- View scan history logs
- Unique QR code generation
- Store:
- Allergies
- Chronic conditions
- Medicines
- Medical records
- Secure access via access token
- Backend: Django
- Database: SQLite (can be upgraded to PostgreSQL)
- Authentication: Django Auth System
- QR Code Generation:
qrcode - QR Code Scanning:
pyzbar - Image Processing: Pillow
ed2ff6e517e98c80c08c83d3cb670f214cfb8dbe