A comprehensive Django-based healthcare management system that connects patients, hospitals, and healthcare ministry administrators. The system facilitates medical record management, patient tracking, and healthcare service delivery.
- Personal health record management
- View medical history
- Track prescriptions and medical examinations
- Monitor basic health metrics (heart rate, oxygen saturation, etc.)
- Connect with hospitals and healthcare providers
- Patient management
- Medical examination records
- Prescription management
- Disease tracking
- Basic health state monitoring
- Patient history tracking
- Hospital management
- System-wide patient oversight
- Healthcare statistics and analytics
- User management
- Data validation and verification
- Django 4.1.2
- Python 3.x
- SQLite3 database
- HTML5/CSS3
- JavaScript
- jQuery
- Bootstrap
- Chart.js for analytics
- DataTables for data presentation
- django-crispy-forms==1.14.0
- Pillow==11.1.0 (for image processing)
- bcrypt==4.0.1 (for security)
-
Clone the repository:
git clone https://github.com/MBajily/healthcare
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install required packages:
pip install -r requirements.txt
-
Run database migrations:
python manage.py makemigrations python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
- API App: Core models and database structure
- Home App: Landing pages and authentication
- Hospital App: Hospital-specific features
- Ministry App: Administrative features
- Patient App: Patient portal features
-
Patient
- View personal medical history
- Track health metrics
- Access prescriptions
-
Hospital Staff
- Manage patient records
- Create medical examinations
- Issue prescriptions
- Monitor patient health
-
Ministry Administrator
- Manage hospitals
- Overview of healthcare system
- Access analytics and reports
- User authentication and authorization
- Role-based access control
- Password hashing with bcrypt
- Form validation and sanitization
- Protected file uploads
The system uses a relational database with the following key models:
- User (Extended Django User)
- Patient Profile
- Hospital Profile
- Medical Examination
- Prescription
- Basic Health State
- Disease
- Civil Status
The system includes comprehensive test coverage for core functionality across different apps. Here's an overview of the test suite:
- Dashboard Access Tests
- Verifies admin access to dashboard
- Confirms patient access is denied
- Tests template rendering
- Hospital Management Tests
- Tests hospital creation functionality
- Validates form submission
- Verifies user role assignment
- Registration Form Tests
- Validates email format
- Tests password confirmation
- Checks required fields
- Civil Status Form Tests
- Validates nationality ID format
- Tests date formatting
- Verifies gender choices
- Tests role-based access control
- Verifies allowed_users decorator functionality
- Checks permission enforcement
- Patient Creation Flow
- Tests complete patient registration process
- Verifies automatic profile creation
- Validates civil status linkage
- Civil Status Integration
- Tests civil status requirements
- Verifies data relationships
- Checks constraint enforcement
To run the complete test suite:
python manage.py test
To run specific app tests:
python manage.py test ministry
The test suite covers:
- User authentication and authorization
- Form validation and submission
- Model relationships and constraints
- View permissions and access control
- Integration between different components
When adding new features, please ensure:
- Write tests before implementing features (TDD approach)
- Cover both success and failure cases
- Test edge cases and boundary conditions
- Include integration tests for complex features
- Follow the existing test structure and naming conventions
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Mohammed Elgaily (@MBajily)
- Django community
- Bootstrap contributors
- Other third-party package maintainers
For support, please contact elgaily.com