A comprehensive medical prescription analysis system that leverages AI to enhance patient care and medical decision-making.
Our system implements a multi-faceted approach to medical analysis and prescription safety:
-
Real-time Conversation Analysis
- Automated extraction of medical context from doctor-patient dialogues
- Dynamic generation of relevant medical queries
- Intelligent follow-up question suggestions
-
Prescription Safety System
- Automated anomaly detection in prescriptions
- Cross-referencing with patient medication history
- Real-time alerts for potential drug interactions
- Analysis of patient medication adherence patterns
-
Comprehensive Reporting
- Side-by-side display of medical reports and prescription analysis
- Detailed symptom and pathology documentation
- Clear treatment plans with safety considerations
- Intelligent summarization of medical findings
Access our sample medical reports and analysis:
The project includes a robust Flask API that provides various medical analysis endpoints:
/detect-prescription-anomalies
- Analyzes prescriptions for potential conflicts/extract-ordonnance
- Extracts structured data from medical prescriptions/summarize-ordonnances
- Generates summaries of multiple prescriptions/search-medical-articles
- Searches for relevant medical literature/fetch-article-abstract/{pmid}
- Retrieves abstracts of medical articles/generate-search-summary
- Summarizes medical research findings/generate-follow-up-questions
- Generates relevant follow-up questions/extract-pertinent-points
- Extracts key medical points from conversations/generate-search-propositions
- Suggests relevant medical search queries/generate-report
- Generates comprehensive medical reports
The API runs on port 5000 by default and accepts JSON payloads for POST requests.
The project includes a user-friendly Streamlit dashboard that provides a graphical interface to interact with the API services. The dashboard offers:
- Interactive navigation sidebar for different functionalities
- Form-based input for medical data
- Real-time API response display
- Error handling and user feedback
- Medical article search interface with abstract viewing
- Report generation interface
- Prescription anomaly detection with visual alerts
-
Prescription Analysis
- Anomaly detection
- Ordonnance extraction
- Prescription summarization
-
Medical Research
- Article search with configurable results
- Abstract viewing
- Search summary generation
-
Medical Documentation
- Follow-up question generation
- Pertinent point extraction
- Report generation
The Streamlit dashboard connects to the Flask API at http://localhost:5000
.
- commit messages should follow conventional commits spec: https://www.conventionalcommits.org/en/v1.0.0/ (see sections: Summary, Examples)
- work must be merged from feature branches into main branch using Pull Requests. Once your code is ready to be reviewed, please mark me as a reviewer, which will notify me you're ready fir code review
- install uv: https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
- run
uv sync --all-extras --dev
- Before running scripts add the current directory to the PythonPath:
export PYTHONPATH=/home/azzedine/Projects/ai_action_summit_hackathon_an2i:$PYTHONPATH
- Start the Flask API:
python3 -m workspace.src.api
- Start the Streamlit Dashboard:
streamlit run workspace/app/main.py
The project can be run using Docker Compose, which sets up all required services automatically.
- Install Docker and Docker Compose on your system
- Copy the environment variables file:
cp .env.example .env
- Update the
.env
file with your credentials:- API_KEY: Your API key
- PROVIDER_URL: Your provider URL
- MongoDB credentials (if using MongoDB):
- USERNAME_MONGODB
- PASSWORD_MONGODB
- INSTANCE_MONGODB
- REGION_MONGODB
- PATH_TLS_CERTIFICATE_MONGODB
The Docker Compose setup includes the following services:
- API Service (Port 5000): Flask API server
- Streamlit Dashboard (Port 8501): Web interface
- Redis (Port 6379): Message broker for Celery
- Celery Workers:
- LLM Worker: Handles language model tasks
- API Worker: Handles API-related tasks
- Flower (Port 5555): Celery monitoring interface (credentials: admin/admin)
-
Build and start all services:
docker compose up --build
-
Access the services:
- Streamlit Dashboard: http://localhost:8501
- Flask API: http://localhost:5000
- Flower Dashboard: http://localhost:5555
-
Stop all services:
docker compose down
- open a new terminal in the root of this repo and run:
uv run ruff check --fix
uv run ruff format
uv run mypy .
- open a new terminal in the root of this repo and run:
uv run pytest