An LLM-based application that assists physicians with evaluating the correctness and completeness of discharge letters in German. The application provides tools for evaluating spelling, completeness of epikrise, diagnosis, and medication. The project was developed as part of the task "LLM for Patient Histories" of the "MedTech hackathon".
The project is a web application that assists physicians in evaluating the correctness and completeness of discharge letters in German. The user can upload a discharge letter and the application will provide feedback on the spelling, completeness of epikrise, diagnosis, and medication. The fields of the discharge letter are extracted automatically, based on a language and meta-data processing pipeline. The extracted fields are autocompleted and the user can correct them if necessary.
The application uses models from the following providers:
- OpenAI
- Ollama
The user originally selects the provider and model to be used. Subsequently, when needed, the user also inputs the appropriate API key, the characters of which are by default hidden.
Subsequenlty, the user selects which tasks to perform on the discharge letter. Finally, the user can select to include or exclude sections that are not relevant.
The page of the application is split in two parts. The left part displays the original texts extracted from the report. The CliniCorrect outputs are displayed on the right side of the page.
The application is developed using the following technologies:
- Python
- Streamlit
- OpenAI API
- Google Cloud API
- Ollama API
To use the models from OpenAI and Google, the user needs to obtain an API key from the respective providers. Please mind all costs, limitations and terms of the respectigve model providers.
- OpenAI API: Please note that using OpenAI API requires a paid subscription. You can sign-up and follow instructions on the webpage to obtain the API key.
- Google Gemini: Google Gemini provides both a limited free API and a paid API key. Both can be used CliniCorrect. Please mind potential limitation on model and API use limits applied by the provider.
- Ollama: Ollama runs offline and locally, thus no API key is required.
- The project is still in development and is not yet ready for production.
- The project is not a substitute for a medical professional.
- The safety and correctness of the model output are not guaranteed and should be verified by a medical professional.
- The project is not a medical device and should not be used as such.
- The project is not a substitute for a medical professional.
- The developers are not responsible for any misuse of the project.
- Some of the model providers may collect data from the users. The users should be aware of the privacy policy of the model providers.
- The user is solely responsible for the data that is processed and shared with the model providers.
- Text parser was developed to fit the specific format of the discharge letters used in the hackathon. The parser may not work with other formats.
- os: Windows, Linux
- python >= 3.8
- git
Ollama with llama3.1 model
Please, keep in mind that using Ollama localy without a graphics card can be slow.
git clone https://github.com/iokaf/CliniCorrect-Public
Linux:
python -m venv clinicorrect
source clinicorrect/bin/activate
Windows:
python -m venv clinicorrect
clinicorrect\Scripts\activate
pip install -r requirements.txt
To run the project, use the following command:
streamlit run clinicorrect.py
In the original interface, click the "Browse Files" button to upload a discharge letter.
After selecting the discharge letter, the user selects the model provider, model, and provides the API key if necessary.
Subsequenlty, the tasks to be executed on the discharge letter can be selected.
Furthermore, the user can select to include or exclude sections that are not relevant.
After selecting the discharge letter, its contents are read through the parser and presented in the interface. All of the text fields are also modifiable by the user, allowing in-place corrections.
The output of the selected model is displayed on the right side of the page. For each miss-spelled word, the model provides a suggestion for the correct spelling.
Suggestions for the completion of the epikrise, diagnosis, and medication are also provided in the form of a list of possible completions.
The prompts used for each of the models can be updated from the config.toml file. The user can change the prompts to better fit the specific use case.
In case more models from the same provider are available, the user can use them by adding the model name in the appropriate field in the config.toml file.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
. - Make your changes.
- Include a detailed description of your changes in a changes.md file.
- Push your branch:
git push origin feature-name
. - Create a pull request.
This project is licensed under the MIT License.