Praxia is an AI-powered healthcare assistant backend system developed by Amariah Kamau. This system provides medical symptom analysis, X-ray image interpretation, medical research retrieval, and personalized health recommendations through a robust REST API.
- Symptom Analysis: AI-powered diagnosis of medical symptoms with personalized recommendations
- Multilingual Support: Translation of symptoms and responses in English, French, and Spanish
- X-ray Analysis: Deep learning-based interpretation of X-ray images for pneumonia, fractures, and tumors
- Medical Research: Integration with PubMed for retrieving relevant medical research
- Health News: Automated scraping and summarization of health news from WHO and CDC
- Diet Analysis: Nutritional assessment and personalized dietary recommendations
- User Profiles: Personalized health profiles with medical history and preferences
- Chat System: Persistent chat sessions with the AI assistant
- Real-time Communication: WebSocket support for instant AI responses
- Circuit Breakers: Resilience against external API failures with fallback responses
- Comprehensive Monitoring: Prometheus and Grafana integration for system metrics
- Framework: Django & Django REST Framework
- Database: PostgreSQL with connection pooling
- Cache & Message Broker: Redis
- Task Queue: Celery
- AI Integration: Together AI API
- Medical Imaging: MONAI with DenseNet121
- Translation: LibreTranslate (self-hosted)
- Web Scraping: BeautifulSoup4
- Text Summarization: Transformers with distilbart
- Server: Daphne (ASGI) with Nginx
- Containerization: Docker & Docker Compose
- Monitoring: Prometheus & Grafana
- WebSockets: Django Channels
For detailed setup instructions, refer to the Setup Guide.
-
Clone the repository:
git clone https://github.com/AmariahAK/Praxia_Backend.git cd Praxia_Backend -
Create a
.envfile based on the.env.examplein the project root. -
Build and start the containers:
docker-compose up -d
-
The API will be available at
http://localhost:8000/api/
Praxia_Backend/
├── api/ # Main Django application
│ ├── AI/ # AI-related logic
│ ├── email_templates/ # Email templates for notifications
│ ├── middleware/ # Custom middleware
│ ├── models/ # Database models
│ ├── serializers/ # API serializers
│ ├── urls/ # URL routing
│ │ └── urls.py # API endpoint definitions
│ ├── utils/ # Utility functions
│ │ └── download_model.py # DenseNet model download utility
│ ├── views/ # API views
│ ├── admin.py # Django admin configurations
│ ├── apps.py # App configurations
│ ├── circuit_breaker.py # Circuit breaker for external APIs
│ ├── consumers.py # WebSocket consumers
│ ├── db_routers.py # Database routing logic
│ ├── routing.py # WebSocket routing
│ └── signals.py # Signal handlers
├── data/ # Data files and configurations
│ ├── ai_identity.txt # AI identity configuration (customizable)
│ └── models/ # AI model weights storage
├── grafana/ # Grafana configuration and dashboards
├── guide/ # Documentation
│ ├── Setup.md # Detailed setup instructions
│ └── LICENSE.md # License information
├── logs/ # Application logs
├── nginx/ # Nginx configuration
│ ├── nginx.conf # Nginx server configuration
│ └── Dockerfile # Nginx Docker configuration
├── praxia_backend/ # Django project settings
│ ├── __init__.py
│ ├── asgi.py # ASGI configuration
│ ├── celery.py # Celery configuration
│ ├── settings.py # Django settings
│ ├── urls.py # Root URL configurations
│ └── wsgi.py # WSGI configuration
├── prometheus/ # Prometheus monitoring configuration
├── docker-compose.yml # Development Docker Compose
├── docker-compose.prod.yml # Production Docker Compose
├── Dockerfile # Main application Docker configuration
├── docker-entrypoint-wrapper.sh # Docker entrypoint wrapper
├── entrypoint.sh # Development entrypoint script
├── entrypoint.prod.sh # Production entrypoint script
├── manage.py # Django management script
├── requirements.txt # Python dependencies
├── .env # Development environment variables
├── .env.prod # Production environment variables
└── README.md # This file
All API endpoints are defined in api/urls/urls.py. Key endpoints include:
POST /api/auth/register/- Register a new userPOST /api/auth/login/- Login and get authentication tokenPOST /api/auth/logout/- Logout and invalidate tokenPOST /api/auth/verify_email/- Verify email addressPOST /api/auth/password-reset-request/- Request password resetPOST /api/auth/password-reset-confirm/- Confirm password reset
GET /api/profile/- Get user profilePATCH /api/profile/- Update user profilePOST /api/profile/confirm-gender/- Confirm and lock gender information
GET /api/consultations/- List medical consultationsPOST /api/consultations/- Create new consultation (supports multilingual input)GET /api/xray-analyses/- List X-ray analysesPOST /api/xray-analyses/- Upload and analyze X-ray imageGET /api/research/- List research queriesPOST /api/research/- Create new research query
GET /api/chat-sessions/- List chat sessionsPOST /api/chat-sessions/- Create new chat sessionGET /api/chat-sessions/{id}/messages/- Get chat messagesPOST /api/chat-sessions/{id}/messages/- Send message and get AI response
GET /api/health/- System health checkGET /api/health-news/- Get latest health news
ws://localhost:8000/ws/chat/{session_id}/- Real-time chatws://localhost:8000/ws/health/- Health monitoring
.env- Development configuration.env.prod- Production configuration
Developers can customize Praxia's identity by editing data/ai_identity.txt. This file contains:
- AI assistant name and description
- Developer information
- Primary healthcare functions
- Personality traits and response guidelines
If you encounter issues with the X-ray analysis model:
-
Manually run the model download script:
python api/utils/download_model.py
-
Restart the Docker containers:
docker-compose restart
The API implements rate limiting to prevent abuse:
| Endpoint Type | Authenticated Rate | Anonymous Rate |
|---|---|---|
| Chat | 30/minute | 3/minute |
| Consultations | 10/minute | 3/minute |
| X-ray Analysis | 5/hour | 3/minute |
| Research | 20/hour | 3/minute |
| Health News | 20/hour | 3/minute |
- Automatic health checks run every 6 hours at
/api/health/ - Authenticated health checks available at
/api/health/authenticated/
- Prometheus metrics:
http://localhost:9090 - Grafana dashboards:
http://localhost:3000 - Default Grafana credentials: admin / admin_password
Supports medical consultations in:
- English (default)
- French - Medical terms and symptoms
- Spanish - Medical terms and symptoms
The DenseNet121 model can detect:
- Pneumonia - Lung inflammation patterns
- Fractures - Bone fractures
- Tumors - Tumorous growths
- Normal - No significant abnormalities
Results include confidence scores and medical recommendations.
Thank you for your interest in Praxia! While I appreciate the community's enthusiasm, this project is currently maintained as a personal portfolio project. I encourage developers to fork the repository and use it as inspiration for their own healthcare applications.
If you'd like to build upon Praxia's foundation, please feel free to:
- Fork the repository for your own projects
- Use the codebase as a learning resource
- Adapt the concepts for your own healthcare solutions
Please ensure any derivative works comply with the Praxia License, including not using the name "Praxia" for derivative works and crediting Amariah Kamau, as specified in LICENSE.md.
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Make your changes
- Test thoroughly
- Commit your changes (
git commit -m "Add YourFeature") - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is licensed under the Praxia License. See LICENSE.md for details.
Praxia uses the following open-source software:
- Django - BSD License
- Django REST Framework - BSD License
- PostgreSQL - PostgreSQL License
- Redis - BSD License
- Celery - BSD License
- MONAI - Apache 2.0 License
- Docker - Apache 2.0 License
- Developer: Amariah Kamau
- LinkedIn: https://www.linkedin.com/in/amariah-kamau-3156412a6/
- GitHub: https://github.com/AmariahAK