Inspiration

Right before the summer of 2024, I started feeling some pain in my shins while running. Thinking it would fade away over time, I continued to run for another 3 weeks before finally consulting a doctor and learning that I had a stress fracture, meaning I couldn't run for the next 2 months. This injury period would have been significantly shorter if I had identified the issue when it first began. This led me to build Runner's Relief, which would have helped me get back on the roads a lot quicker then.

What it does

Based on the details of the injury provided by the user, PacePal, the chatbot, will identify what injury it could potentially be and gives a confidence score based on the given information, helping runners identify the severity of their injury before having to consult a doctor. It also provide details on how it may have occurred and some remedies for the injury, so that the user can avoid the injury in the future once they have recovered from it. If the description from the user is too vague, PacePal may also ask some clarifying questions to narrow down the possibilities before providing a diagnosis.

How I built it

For this project, I decided to use Retrieval Augmented Generation, since it can be adapted in the future if more data is gathered for the database.

  1. The Database: This was the foundation of the whole application, as it stores the data that acts as the foundation for the responses generated by the chatbot. I gathered details on the most common running injuries from several sources, including Johns Hopkins Medicine and Penn Medicine. Then it was all vectorized using Langchain's OpenAIEmbeddings and stored into a Chroma database.
  2. The Response: This portion of the project was developed as a function which uses the similarity_search method in the Chroma database to get information relevant to the question asked by the user. It then combines the information from the user with the information from the database and the chat history to form a prompt for the LLM.
  3. The Model: For this project, I ended up working with ChatGPT 3.5 Turbo due to its ease of use. This model is part of the response function: it is given the prompt and the response generated by the LLM is the final output of the function.
  4. The App: Finally, all of this was tied together in the Streamlit application which allows the user to communicate with the LLM through the response function and get a response along with a diagnosis and confidence score.

Challenges I ran into

  • Prompt Engineering: This was the biggest challenge I faced in this project, as I have never worked with generative AI before and the prompt I started with didn't address the specific use case I wanted it to due to it being quite generic. After a lot of testing and refinement, I ended up with the current prompt template that mostly provides the responses I expect.
  • Diagnosis and Score: This was another challenge I faced–getting the name of the injury in the diagnosis and a confidence score separately to display on the app–and this was also solved with prompt engineering and string splitting.

What I learned during this project

Over the course of this project, I learnt a lot about Generative AI, having only worked with classification problems in the past, and also the Langchain library, which was very different compared to using Tensorflow for images. I also learnt about Streamlit for the first time during this project, and it really saved me from all the HTML and CSS that I was initially going to do. Overall, this whole project also taught me how to identify and approach a problem on a time crunch since it was my first hackathon experience.

What's next for Runner's Relief

This project is far from perfect. During development, I faced multiple smaller issues that didn't have a significant impact on the program, but it is definitely something I would like to improve on.

  • More Parameters: This program, while helpful, is quite basic in terms of the level of medical knowledge. This could be improved with the consideration of more factors like the user's age, gear, etc.
  • Bigger Database: Another big improvement for this program can be made by gathering more medical information to refine the diagnosis by the LLM. As currently its knowledge is quite limited on the injuries.
  • Better Prompt Templates: Finally, I am also aiming to work on the prompt a bit more to refine the final output that is provided. The application struggles with any question that is outside the realm of sports injuries and also struggles with using the chat history, and improving these two factors will definitely improve the overall conversational aspect of the app.

Built With

  • chatgpt
  • chromadb
  • langchain
  • openai
  • python
  • streamlit
Share this project:

Updates