Features
- Multi-tenancy: Each tenant (organization or domain) has its own isolated database.
- Multi-user dashboard, records, and calendar: Each doctor has their own calendar, dashboard, and records. Patients registered under the doctor are assigned exclusively to that doctor.
- Doctor Appointments: Manage appointments with a calendar view and dashboard categorizing appointments into active, archived, and completed.
- Patient Records: Maintain patient records, ensuring only patients with existing records can be added to appointments.
- Patient Appointments: Multiple patients can be added to a single event, only if the patient's record exists.
- User Authentication and Authorization: Secure user authentication and role-based access control (RBAC).
- RESTful API: Exposes a RESTful API for integration with other services.
- Scalable and Extendable: Built to accommodate growth and additional features.
How It Works
For each created tenant with a domain, there will be a separate database independent from the other tenants. You can create users and doctors, assign users to doctors, and assign doctors to the domain (tenant) via the admin panel. Each doctor manages their own patients and appointments, with data isolated by database IDs, ensuring no cross-user interference.
Repository Structure
- DoctorsApp/: Main application directory containing all the core functionalities and modules.
- manage.py: Command-line utility for administrative tasks.
- requirements.txt: List of dependencies required to run the application.
Installation
- Clone the repository:
git clone https://github.com/TsvetanG2/Multi-tenant-DocApp-with-independent-database-for-each-tenant-domain.git cd Multi-tenant-DocApp-with-independent-database-for-each-tenant-domain
- Install dependencies:
pip install -r requirements.txt
- Set up the database in settings.py:
DATABASES = { "default": { "ENGINE": 'django_tenants.postgresql_backend', "NAME": "your_database", "USER": "your_user", "PASSWORD": "your_password", "HOST": "your_default_host", "PORT": "your_default_port", } }
Run App
- Make migrations:
python manage.py makemigrations
- Migrate:
python manage.py migrate_schemas --shared python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
- Create a tenant superuser:
python manage.py create_tenant_superuser
- Run the app:
python manage.py runserver
Usage
Once the app is running, visit your_default_host:your_default_port
. To access the main admin panel, navigate to your_default_host:your_default_port/admin
. Add tenants and domains, then assign users and doctors as needed. Login pages are available at your_custom_domain_name:your_default_port/login
.
Contributing
Contributions are welcome! Please fork the repository and create a pull request with your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
App Screenshots
- Django Default Page:
- Django Admin Panel:
- Tenant-Domain Admin Panel:
- Tenant-Domain Login Page:
- Tenant-Domain Home Page:
- Tenant-Domain Add Record Page:
- Tenant-Domain Calendar Page:
- Tenant-Domain Dashboard Page: