CarePath is a robust Django-based API designed to modernize hospital queue management. It streamlines patient flow, reduces waiting times, and integrates advanced AI capabilities for drug verification.
- Hospital Registry: Manage hospital details including location (latitude/longitude) and contact info.
- Patient Profiles: Track patient status (New vs. Returning) and history.
- Dynamic Queueing: Patients can join queues with automatic position calculation.
- Real-time Updates: Status tracking (Waiting → Called → Completed).
- Auto-Reordering: Intelligent queue shifting using
django-lifecyclehooks when a patient is called or leaves. - Concurrency Safety: Uses database locking (
select_for_update) to prevent race conditions during queue joining.
Powered by Google Gemini 2.5 Flash:
- Drug Validity Check: Upload an image of a drug to analyze its expiration and physical condition.
- Drug Authentication: Verify the authenticity of a drug packaging via image analysis.
- Interactive API Docs: Fully documented with Swagger UI and Redoc (via
drf-spectacular).
- Framework: Django 6.0, Django REST Framework 3.16
- Database: SQLite (Default)
- AI Engine: Google GenAI SDK (
google-genai) - Image Processing: Pillow
- Utilities:
django-lifecycle,python-decouple
- Python 3.10+
- A Google Cloud Project with the Gemini API enabled.
-
Clone the repository
git clone https://github.com/yourusername/carepath.git cd carepath -
Create a virtual environment
python -m venv venv # Windows .\venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure Environment Variables Create a
.envfile in the root directory:SECRET_KEY=your_django_secret_key DEBUG=True GEMINI_API_KEY=your_google_gemini_api_key
-
Run Migrations
python manage.py migrate
-
Start the Server
python manage.py runserver
Once the server is running, access the interactive documentation:
- Swagger UI: http://127.0.0.1:8000/api/schema/swagger-ui/
- Redoc: http://127.0.0.1:8000/api/schema/redoc/
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/queue/join/ |
Join a hospital queue |
GET |
/api/queue/list/ |
List current queues |
POST |
/api/drug/check/ |
AI Drug Validity Check (Multipart/Form-data) |
POST |
/api/drug/authenticate/ |
AI Drug Authentication (Multipart/Form-data) |
GET |
/api/hospitals/list/ |
List all hospitals |
Run the test suite to ensure everything is working correctly. The tests use unittest.mock to simulate AI responses, saving your API quota.
python manage.py test- Fork the repository.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.