This repository contains the backend for the Digital Patient Record (DPI) management system, built using Django and Django REST Framework (DRF). The backend provides a secure and efficient API for managing patient records, medical history, treatments, prescriptions, and test results. It ensures that healthcare professionals have seamless access to up-to-date patient data.
- Project Overview
- Key Features
- Tech Stack
- Getting Started
- Running the Application
- API Documentation
- Database Migrations
- Testing
- Deployment
- Further Reading & References
- User Authentication & Authorization: Secure login for doctors, nurses, pharmacists, and lab technicians using JWT.
- Patient Record Management: Store and retrieve patient demographics, medical history, and visits.
- Medical Consultations: Retrieve a patient’s record via unique ID or QR code.
- Diagnosis & Prescription Management: Record diagnosis, prescribe medications, and request additional tests.
- Nursing Care: Track interventions, medication administration, and patient monitoring.
- Pharmacy Module: Manage in-house pharmacy inventory and verify prescriptions.
- Lab & Imaging Integration: Store lab test results and medical imaging reports.
- Patient Self-Service Portal: Patients can view records, request medical documents, and access billing summaries.
- Role-Based Access Control (RBAC): Ensures proper data access per user role.
- Framework: Django
- API Development: Django REST Framework (DRF)
- Database: PostgreSQL (Recommended), SQLite (for development)
- Authentication: JWT (JSON Web Tokens)
- Storage: AWS S3 / Local storage for file uploads
- Containerization: Docker (Optional)
Ensure you have the following installed:
- Python 3.8+
- PostgreSQL (or SQLite for local development)
- pip & virtualenv
Clone the repository:
git clone https://github.com/idrissziadi/MediDoc-Backend
cd MediDoc-BackendCreate and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`Install dependencies:
pip install -r requirements.txtSet up environment variables:
Create a .env file in the project root and add the following:
DEBUG=True
SECRET_KEY=your_secret_key
DATABASE_URL=//user:password@localhost:5432/medidoc_dbRun migrations to set up the database schema:
python manage.py migrateStart the Django development server:
python manage.py runserverThe API will be available at: http://127.0.0.1:8000/api/
API endpoints are documented using Swagger and DRF Spectacular. To access API docs:
- Swagger UI: http://127.0.0.1:8000/api/docs/
- Redoc: http://127.0.0.1:8000/api/redoc/
Run automated tests:
python manage.py testFor production deployment, configure:
- Gunicorn & Nginx for serving the application.
- Docker & Docker Compose (optional) for containerized deployment.
- CI/CD pipeline using GitHub Actions or GitLab CI.
Example production setup:
gunicorn --workers 3 --bind 0.0.0.0:8000 medidoc.wsgi:application- Django Official Documentation
- Django REST Framework (DRF)
- PostgreSQL Documentation
- JWT Authentication in Django
Thank you for using MediDoc - Digital Patient Record (DPI) Backend. For any issues or contributions, feel free to open a pull request or an issue.
GitHub Repository: https://github.com/idrissziadi/MediDoc-Backend