This project is a web application and patient insight utility for doctors built with Flask, providing functionalities for text and image processing. Users can upload text files and images, and the application offers three main features for AI-enabled patient understanding for clinicians:
- Text Summarization: Summarize text files using OpenAI's GPT-4 model with a structure that captures the patient's problem, current complications, and recommendations to make it faster for a clinician to audit and get the patient necessary support.
- Entity Extraction: Extract relevant information from a clinical perspective from text files and present the information in a tabular format.
- Question Answering: Utilize Weaviate's vector database to answer questions based on the content of uploaded text files via retrieval augmented generation (RAG).
- Interaction: Users upload a text file, and the application leverages OpenAI's GPT-4 model to generate a summary of the text content.
- Implementation: The Flask route
/process/<filename>handles the text summarization functionality. It utilizes thesummary_chainmethod from theTasksclass, which interacts with the OpenAI model to produce the summary.
- Interaction: Users upload a text file, and the application extracts key information from the text, such as dates, chief complaints, medications, procedures, and smoking history, presenting it in a tabular format.
- Implementation: The Flask route
/process/<filename>also handles entity extraction. It utilizes theextract_entitiesmethod from theTasksclass, which interacts with the text to extract relevant entities.
- Interaction: Users can ask questions related to the content of the uploaded text file, and the application retrieves answers using Weaviate's vector database.
- Implementation: The Flask route
/qa/<filename>handles the question-answering functionality. It utilizes thequestion_answermethod from theTasksclass, which interacts with the Weaviate vector database to find relevant answers.
- Upload Files: Users upload text files and images through the web interface.
- Choose Functionality: After uploading a text file, users can select one of the three functionalities: summarize text, extract entities, or ask questions.
- Processing: The selected functionality is executed based on the uploaded text file.
- Display Results: The application displays the results of the chosen operation to the user.
- Setting Up for Development: Fork the repository, clone it to your local machine, and create a new branch for your feature or bug fix.
- Development Workflow: Make changes to the codebase, test thoroughly, and submit pull requests with clear descriptions.
- Reporting Issues: If you encounter any issues or have suggestions for improvements, please report them in the GitHub issues section.
- Python 3.10+
- Flask
- OpenAI API key
- Docker
- Create a virtual environment and install the modules found in
weaviate/flask_app/requirements.txtvia pip.
pip install requirements.txt- Assuming Docker Desktop is enabled, navigate to the directory containing the
docker-compose.ymlfile found atweaviate/vector_dband startup the Weaviate vector database usingdocker-compose up.
docker-compose up -d- Start the Flask application.
python weaviate/flask_app/app.py