This project aims to analyze patient medical reports in PDF format to extract relevant information, provide insights into the patient's health condition, and offer recommendations for potential diseases and health risks. The system leverages multiple AI agents to process and analyze the data, giving structured feedback in an easily understandable format.
The project uses a multi-agent system to handle different tasks:
- Report Reading: Extract data from the patient's medical report in PDF format.
- Health Analysis: Analyze the extracted data to summarize the patient's health condition and potential diseases.
- Recommendations: Provide health recommendations, treatment suggestions, and relevant articles for further reading.
These tasks are performed sequentially, with each agent specializing in a specific role.
-
Report Reader
- Role: Reads the PDF report and extracts data.
- Goal: Provide the extracted data in a structured JSON format.
- Tools: Uses
extract_data_from_pdf
andSerperDevTool
for PDF data extraction and additional tools. - LLM: Utilizes
ChatOpenAI
with thegpt-3.5-turbo
model.
-
Doctor
- Role: Analyzes the extracted data to provide a summary of the patient's health condition.
- Goal: Identify possible diseases and health risks, explaining them in simple language.
- Tools: Uses
SerperDevTool
for additional data. - LLM: Utilizes
ChatOpenAI
with thegpt-3.5-turbo
model.
-
Recommendation Writer
- Role: Provides health recommendations and treatment suggestions based on the analysis.
- Goal: Suggest ways to cure abnormalities, offer home remedies, and provide article links for more information.
- Tools: Uses
SerperDevTool
for additional resources. - LLM: Utilizes
ChatOpenAI
with thegpt-3.5-turbo
model.
- Task 1: Extract data from the patient report and format it as JSON.
- Task 2: Analyze the extracted data and provide detailed insights into the patient's health.
- Task 3: Write recommendations based on the health analysis, including treatment methods and relevant articles.
- OpenAI GPT-3.5: For language processing and generating insights and recommendations.
- Camelot: For extracting tables from PDF files.
- CrewAI: For managing and orchestrating the agents and tasks.
- SerperDevTool: For additional data extraction and processing.
- Enhanced Data Extraction: Improve the accuracy of data extraction from PDFs, especially for complex reports.
- Integration with More LLMs: Incorporate other language models like Ollama to compare and enhance the analysis.
- Real-Time Updates: Allow real-time updates and monitoring of patient health data.
- Broader Recommendations: Include more comprehensive health recommendations and support for a wider range of medical conditions.
- User Interface: Develop a user-friendly interface for easier interaction with the system.
- Emergency Report Marking: Implement functionality to categorize reports by urgency using a color-coded system (red/orange/yellow) based on the severity of the results.
-
Install Required Libraries: Ensure you have all the necessary libraries installed. You can install the required packages using pip:
pip install -r requirements.txt
-
Set Environment Variables: Set your OpenAI and Serper API keys in .env file:
OPENAI_API_KEY="your_openai_api_key" SERPER_API_KEY="your_serper_api_key" FILE_PATH = "pdf name that should be in same directory as the script"
-
Prepare the PDF File: Place the patient's PDF report in the same directory as the script or provide the name of pdf in .env file.
-
Run the Script: Execute the
index.py
script:python index.py
The script will process the PDF report, analyze the data, and provide insights and recommendations.
- OpenAI: https://openai.com/
- CrewAI: https://crew.ai/
- SerperDevTool: https://serper.dev/
- Matthew Berman: https://www.youtube.com/@matthew_berman