Inspiration

This is one of the best projects under the RAG - LLM Application. So I thought, why not help doctors identify diseases or diagnose them with maximum accuracy—or even act as a small personal doctor for individual users (of course, just for diagnosis)? To be honest, my main inspiration is Shaun Murphy from The Good Doctor! 😎

What it does

It is an application that mainly does disease diagnosis, based on scraped data from one of the largest medical encyclopedias (Medline Plus), containing 22,000 rows of data. If you are a normal user and provide symptoms that are troubling you, it will offer a list of possible causes of diseases. But if you are a doctor and provide detailed information along with test results, even for rare diseases, it will help identify them! Additionally, it can also read PDFs and store the data in a Snowflake table. Since it uses SQL, information retrieval is super fast, with an average response time of only 5 seconds. It also evaluates the app’s performance using various metrics like groundedness and context relevance, while providing contextual information.

How we built it

First, we scraped the medical encyclopedia from the Medline Plus website. Then, we combined the data into a CSV file containing 22,000 rows. We uploaded this CSV file into Snowflake and converted it into vector embeddings using Snowflake commands within the Snowflake app.

Using cosine similarity, we accurately retrieved the top 5 rows of information for any question, very quickly (Retrieval). For human-understandable responses, we used the Mistral Large model—truly a powerful AI.

We then moved to a local app, Pycharm, and used connectors to link Snowflake with our application. Finally, we integrated a Streamlit app to provide a simple, user-friendly interface.

We added four options:

View data Ask a question Upload a PDF We implemented these step by step, adding small features to create a well-developed RAG app. We also evaluated performance using Mistral AI, fetching metrics like context relevance and groundedness, along with topic-related information.

Lastly, we deployed the final code to GitHub and generated the Streamlit link.

Challenges we ran into

The most difficult challenge in this whole project was integrating the app with TruLens. The documentation changed a few months ago, and there has been a significant shift in the modules. Since there wasn’t much community support, I had to complete the project by carefully reading the documentation.

Accomplishments that we're proud of

I'm proud, happy, and excited that we completed this project! I’m confident you will appreciate this work as much as we do.

What we learned

We learned a lot about time management and the value of time. Technically, we gained excellent skills in using Streamlit, Snowflake, Mistral AI, and SQL. These are incredibly powerful tools that can create a positive impact on the world. Personally, I fell in love with Snowflake—fast, accurate, and low cost (I’m still on the free trial 🤗).

What's next for Medical Diagnosis using RAG LLM

There’s so much more to explore in this field. Right now, we’ve only added a medical encyclopedia. We can include additional health-related data, like genetics, drugs, and medications, which could expand the dataset to over 200,000 rows. But we don’t need to worry—Snowflake Cortex Search can handle it effortlessly! Integrate computer vision using YOLO. This will allow the app to analyze X-rays and medical reports directly, adding another layer of diagnostic capability. Incorporate speech-to-speech capabilities. This feature would enable users to interact with the app conversationally, making it more accessible and intuitive for users, including those with limited technical literacy.

Built With

  • mistral
  • mistral-large
  • python
  • snowflake
  • snowflake-cortex
  • sql
  • streamlit
  • trulens
Share this project:

Updates

Submission history