This is a web-based AI-powered medical symptom triage tool designed to provide users with preliminary diagnostic insights based on their symptoms. It uses the Mistral AI model for diagnosis and integrates Mayo Clinic data for detailed condition information. The project is built with Flask (Python) for the backend prototype and JavaScript for the frontend, running in a Docker container.
Note: This tool is not a substitute for professional medical advice. Always consult a healthcare professional for accurate diagnosis and treatment.
- Symptom-Based Diagnosis: Users input age, sex, medical history, symptoms, and additional info to receive ranked possible diagnoses with likelihoods, urgency indicators, consultation advice, and home care suggestions.
- Mayo Clinic Integration: Fetches detailed condition information from Mayo Clinic via DuckDuckGo search (scoped to
https://www.mayoclinic.org/diseases-conditions) and Mistral AI. - Responsive UI: Chat-style interface with auto-scrolling and result categorization (green/yellow/red).
- Backend: Flask, Gunicorn, Python 3.9
- Frontend: HTML, CSS, JavaScript (Bootstrap 5)
- AI: Mistral API (
mistral-large-latest) - Search: DuckDuckGo API (
duckduckgo_search) - Containerization: Docker, Docker Compose
- Dependencies: Managed via
requirements.txt
main/
├── app.py # Flask application with API endpoints
├── Dockerfile # Docker configuration for building the app
├── requirements.txt # Python dependencies
├── scripts.js # Frontend JavaScript logic
├── index.html # Main page
└── styles.css # Custom CSS
- Docker and Docker Compose installed
- A Mistral API key (obtain from Mistral AI)
-
Clone the Repository:
git clone <repository-url> cd <repository-name>/main
-
Set Environment Variables: Update
docker-compose.ymlwith your Mistral API key:environment: - FLASK_ENV=production - MISTRAL_API_KEY=your-mistral-api-key
Replace
your-mistral-api-keywith your actual Mistral API key. -
Build and Run with Docker Compose:
docker-compose up -d --build
- Builds the Docker image and starts the container.
- The app will be available at
http://localhost:5000.
-
Verify the App:
- Check logs:
docker-compose logs app - Visit
http://localhost:5000in a browser.
- Check logs:
-
Stop the App:
docker-compose down
- POST /diagnose: Analyzes symptoms and returns diagnoses.
- POST /mayo-clinic-details: Fetches detailed info for a diagnosis.
- GET /health: Checks API key configuration status.
- Static Routes:
/,/scripts.js,/styles.css,/images/*
- 503 Service Unavailable: Verify
MISTRAL_API_KEYis set indocker-compose.yml. - Port Conflict: If port 5000 is in use, adjust
portsindocker-compose.yml(e.g.,"5001:5000").
- Deploy with a reverse proxy (e.g., Nginx) and HTTPS for production use.
- Ensure the Mistral API key is securely managed in the production environment.
This project is for educational purposes and not licensed for commercial use without modification and proper legal compliance.