This project leverages CrewAI to analyze blood reports, search the web according to the report summary, and provide recommendations to the patient along with relevant links to articles. It includes a backend server for processing and a front-end interface for easy access.
To tackle this AI Internship Assignment, I followed these steps:
-
Understanding the Task: Broke down the assignment into main parts: reading the report, analyzing it, researching health info, and making recommendations.
-
Framework Setup: Used the CrewAI framework as required. Learned how it works through documentation and tutorials.
-
Creating AI Helpers: Made two AI agents:
- One to understand blood test results
- Another to search for health articles
-
Defining Jobs: Set up two main tasks:
- Analyzing the blood report
- Researching health info and making recommendations
-
Work-flow
- PDF Reading: Extracts text from blood test reports using PyPDF2.
- Web Search: Uses SerperDevTool for internet searches related to the report findings.
- Input Handling: A Flask server manages file uploads for the blood test reports.
- Report Analysis: Utilizes Google Gemini to summarize key points from the report.
- Research: Searches for relevant health articles based on the report summary.
- Recommendations: Combines analysis and research to provide health advice.
- Result Delivery: The server returns the analysis and recommendations as a JSON response to the client.
-
Error Handling:
- I implemented error handling throughout the process to manage potential issues like file reading errors or processing failures.
- A fallback mechanism was added to ensure that even if the latest output files are not available, the system can still provide useful information from previous runs.
-
Testing and Improving: Repeatedly tested the system and made improvements to make it work better.
This approach allowed me to create a comprehensive system that takes a blood test report as input, analyzes it, performs relevant research, and provides health recommendations, all while leveraging the power of the CrewAI framework.
A user-friendly front-end interface is available to interact with the system: Blood Report Analysis Front-End.
This interface allows users to upload blood reports and receive analysis and recommendations directly from the web.
The project has the following structure:
server
: Contains the backend server code.agents
: Contains the agents responsible for different parts of the analysis.tools
: Contains the tools for web scraping, PDF processing, and more.tasks
: Contains tasks to be performed by the agents.crew
: Contains the main CrewAI configuration and setup files.requirement.txt
: Lists all the dependencies required for the project.
First, create a virtual environment for the project. This helps to manage dependencies and keep the project isolated from other projects on your system.
pip install -r requirement.txt
GOOGLE_API_KEY
,
EXA_API_KEY
python -m waitress --host=0.0.0.0 --port=5000 server:app.py