PRISM: AI-Powered Medication Decision Support

Enhancing Medical Decision-Making with Knowledge Graphs and AI
AI
Knowledge Representation
Healthcare
Semantic Web
Project
Author

Mahmut Osmanovic

Published

February 1, 2025

1.0 | Introduction

Medical professionals face an overwhelming challenge when prescribing medications. With thousands of drugs on the market and new ones emerging, ensuring safety and avoiding harmful interactions is complex. Studies show that 3–16% of hospitalized patients suffer from injuries due to medical intervention, with adverse drug effects being the most common issue (Oyebode, 2013).

To address this, we developed PRISM (Predictive and Interactive System for Medications), a knowledge-driven AI assistant that helps medical professionals with:

  • Answering general medical questions
  • Identifying harmful drug interactions
  • Suggesting alternative medications
  • Recommending treatments based on symptoms

PRISM integrates large language models (LLMs), knowledge graphs (Wikidata), and SPARQL queries to provide fact-based and interactive assistance.

The application is available at (https://github.com/mosmar99/PRISM)[https://github.com/mosmar99/PRISM].
For a detailed breakdown of our work, you can access the full project report here: Download Report.

2.0 | Chat Modules

PRISM is designed as a conversational AI tool with four primary chat modules, each addressing a specific medical need.

  • General Questions Chat: Responds to medical-related queries using an AI-powered interface.
  • Side Effects Identifier Chat: Detects and warns about potential negative drug interactions.
  • Alternative Medications Chat: Suggests safer alternatives to medications that may cause harmful interactions.
  • Medication Recommendation Chat: Provides medication suggestions based on user-input symptoms.

Each module leverages a combination of AI, fuzzy string matching (FuzzyWuzzy), and knowledge graph queries to deliver precise and reliable results.

The figure below illustrates the user view within the `Side-Effects-Chat.

PRISM’s backend relies on:

  • Knowledge Graphs: Wikidata, a rich source of structured medical data.
  • SPARQL Queries: Enables dynamic data retrieval for drug interactions, symptoms, and recommendations.
  • Fuzzy Matching: Uses FuzzyWuzzy for improved medication name recognition.
  • Large Language Models: Gemini 2.0 for AI-driven natural language understanding.

The figure below provides an architectural overview of PRISM.

The next figure highlights the architectural design of the Side-Effects-Chat, for the sake of brevity, the other chat structures are highlighted in the report. The precise functioning of each node is the workflow diagram is also elucidated upon in the report (see the introduction).

3.0 | Discussion

The choice of WikiData over OBO Foundry is based on two main reasons. Firstly, all application necessary information was not available at OBO Foundry. Secondly, OBO Foundry was less intuitive to query from.

Pinecone is a vector database which we considered as an alternative for string matching. By embedding the strings as vectors (through DistilBERT), one can effectively compare their likeness through the use of cosine similarity. Nonetheless FuzzyWuzzy clearly outperformed this method for small string inputs. For example, it misclassified zopiclone if even a single letter was omitted, i.e., zopiclon. The matching with Pinecone may probably be improved by using other embedding methods or larger string inputs.

The small meta-llama model llama-3.2-1B was the smallest one tested. It is sometimes unwilling to answer questions even when explicitly prompted. In addition, it lacked the ability to remember conversational context due to having a small context window.llama-3.2-8B outperforms llama-3.2-1B substantially. Its primary issue is the execution time on less powerful hardware, which leads to large variability in run time between computers. Through further exploration of available models we found that Google’s state of the art Gemini Model had a free tier API endpoint. Gemini was chosen as our language model since it addressed many of the aforementioned issues. It is fast at parsing user information with high accuracy, able to remember the conversational context and linguistically expressive. In order to provide a interactive user experience, it is of vital importance that our language model is able to remember the conversational context.

Fabricated or incorrect responses are a common occurrence in LLMs. Through the usage of SPARQL queries we enable the LLM to provide fact-based responses derived directly from a structured knowledge base like WikiData. Integrating LLMs and SPARQL queries enables the LLM to retrieve specific information dynamically rather than solely relying on pre-trained knowledge, making it valuable in fields where precision is critical, such as in the medical industry.

The usage of Chainlit allowed us to focus on the development of the application and whilst retaining a intuitive and aesthetically pleasing user interface. Chainlit’s simplicity of use was of great value.

Ethical concerns related to the utilization of LLMs in the Healthcare Industry includes patient privacy and model transparency. PRISM does not require an patient sensitive data in order to function properly. By querying WikiData we can effectively circumvent issues with model transparency.

4.0 | Conclusion & Future Work

PRISM represents a step forward in AI-assisted medical decision-making. By combining knowledge graphs, natural language processing, and AI, it provides a reliable, efficient, and interactive tool for healthcare professionals.


References

  1. Oyebode, F. (2013). Clinical errors and medical negligence. Medical Principles and Practice, 22(4), 323–333. https://doi.org/10.1159/000346296