Inspiration

The inspiration for MedQuery AI stems from the challenges faced by healthcare professionals, researchers, and students in navigating vast and complex pharmaceutical data. The need for quick, reliable, and actionable insights is critical in the fast-paced medical and research environment.

We recognized that traditional methods of accessing drug information often involve time-consuming searches through databases, reports, or manuals, which can delay critical decision-making. The advent of AI and GraphQL offered an opportunity to transform this process, providing a dynamic, interactive, and user-friendly platform to retrieve and analyze drug-related information.

By combining agentic AI capabilities with real-time query handling, MedQuery AI was envisioned as a tool to empower professionals and learners alike. Its ability to respond to natural language questions and integrate structured data sources makes it a bridge between advanced technology and everyday healthcare needs.

Our mission is to streamline drug discovery and medical research, reducing the barriers to accessing key information and fostering innovation in the pharmaceutical and healthcare sectors. MedQuery AI is not just a tool—it's a step toward smarter, more efficient healthcare solutions for all.

What it does

MedQuery AI is an intelligent, interactive assistant designed to streamline access to pharmaceutical and drug-related information. It leverages AI and GraphQL to provide dynamic responses to natural language queries about drug availability, pricing, mechanisms of action, side effects, pathways, and more.

Key Features: Drug Information Retrieval: Users can ask questions like "What is the availability of Aspirin?" or "What are the side effects of Ibuprofen?", and MedQuery AI fetches precise, structured responses.

Comprehensive Drug List: Users can query the complete list of available drugs in the database, making it easier to explore options.

Natural Language Queries: The app understands conversational inputs, eliminating the need for complex database queries or technical knowledge.

Agentic Capabilities: The app intelligently uses tools and data pipelines to fetch, interpret, and return relevant information dynamically.

GraphQL Integration: By harnessing GraphQL, the app ensures efficient and tailored data fetching, reducing redundant data loads and improving performance.

MedQuery AI is ideal for healthcare professionals, researchers, and students who need quick, accurate insights for drug discovery, patient care, or academic purposes. It simplifies complex queries into actionable insights in seconds.

How we built it

  1. Backend with GraphQL and Modus SDK:

The backend leverages GraphQL for dynamic and efficient data querying. Using the Modus SDK, we implemented an agentic approach where tools interact dynamically with the drug database and the AI model. GraphQL resolvers handle queries such as fetching drug information, retrieving chemical structures, or listing all available drugs. Drug information is stored in a well-structured format in the backend to support easy querying.

  1. AI-Powered Assistant:

The core of the app is powered by an OpenAI-like LLM (Language Learning Model) integrated via Modus SDK. The LLM processes natural language queries, determines the required tool (e.g., fetching data, querying specific attributes), and dynamically executes them using an iterative reasoning loop.

  1. Frontend with Interactive UI:

Built a simple, responsive HTML interface with JavaScript to interact with the backend. Features include: Drug search queries. Specific attribute-based queries (e.g., price, availability). Listing available drugs dynamically. Displaying logs for transparency into how responses are generated.

  1. Agentic Approach:

The app incorporates tools for specific functionalities (e.g., fetching drug lists, querying specific drug attributes). The agent decides when and how to call these tools, allowing the system to simulate reasoning and dynamically fetch required data.

  1. Iterative Development:

Extensive testing of queries in the GraphQL playground ensured consistent responses. Debugging and improving the agent's reasoning loop enhanced the response accuracy and tool utilization.

  1. Scalability:

Designed with scalability in mind, the app can easily integrate additional tools or extend the drug database as new functionalities are needed.

Challenges we ran into

Complex Integration of Agentic Approach:

Implementing an agentic reasoning loop with the Modus SDK required designing tools that could seamlessly interact with both the drug database and the LLM. Fine-tuning the iterative reasoning process to avoid infinite loops or irrelevant tool calls was particularly challenging. Ensuring Accurate LLM Responses:

Handling ambiguous or vague user queries required careful prompt engineering and fallback mechanisms to ensure the app returned useful results even when the input was unclear. Debugging GraphQL Queries:

Debugging complex GraphQL resolvers, especially when querying nested fields like drug attributes and logs, was time-intensive. Validating query results in the GraphQL playground and mapping them correctly to frontend responses added extra overhead. Frontend and Backend Communication:

Synchronizing frontend UI updates with real-time responses from the GraphQL backend was tricky, especially for multi-step queries involving logs and dynamic responses. Handling errors gracefully in both GraphQL responses and the frontend required robust error-checking mechanisms. Dynamic Data Visualization:

Creating meaningful and interactive visualizations based on user queries (e.g., drug availability trends or side effect analysis) required integrating additional libraries and data parsing logic. Scalability of the Drug Database:

Designing the drug database to support new attributes and potential expansions while keeping query times low was a challenge as the data model grew more complex. User-Friendly Interface:

Balancing functionality and simplicity in the UI required iterative testing. Ensuring the user could query both detailed and general drug information intuitively was an ongoing process. Error Handling in Agentic Tools:

When tools failed or produced incomplete results (e.g., invalid drug names), the agent had to recover gracefully and provide meaningful fallback responses without crashing the app. Ensuring Real-Time Feedback:

Displaying real-time logs and results in the frontend added an extra layer of complexity, as the system needed to balance user expectations with backend processing delays. How We Overcame These Challenges Modularized the code for the agentic flow and GraphQL resolvers for better debugging and scalability. Conducted iterative testing of the LLM's responses with different prompts and edge-case queries. Used detailed error logging and real-time feedback to improve both backend and frontend interactions. Enhanced the user experience by adding informative error messages and fallback mechanisms in case of tool failures. Scaled the database structure with room for additional features and attributes for future use cases.

Accomplishments that we're proud of

Seamless Integration of Agentic AI with GraphQL Backend

Successfully implemented an agentic approach that allows the system to iteratively reason, retrieve, and synthesize drug-related data using Modus SDK and an LLM. Enabled dynamic interactions between tools, ensuring accurate responses to complex user queries. Dynamic Query Handling

Designed a system that effectively handles diverse questions about drug availability, attributes, and side effects. The app gracefully recovers from ambiguous queries, providing fallback responses and meaningful guidance. Robust GraphQL API

Developed a scalable and intuitive GraphQL backend that handles real-time requests for drug information, integrates with agentic tools, and provides comprehensive logs for every query. Enabled support for multiple types of queries, from simple drug lists to detailed attribute-specific information. Interactive Frontend with Real-Time Feedback

Created a user-friendly interface where users can explore drug details and ask natural language questions with instant, relevant responses. Added real-time logs to provide transparency and insights into the system's reasoning and data retrieval process. Expanded Functionalities

Extended the app to include chemical structure visualization and side-effect analysis, offering advanced capabilities beyond basic drug information retrieval. Designed a modular architecture that supports easy addition of future functionalities, like visualizing drug interactions or market analysis. Error Handling and User Guidance

Implemented robust error handling to ensure the app remains functional and informative even in cases of incomplete or incorrect queries. Guided users with intelligent prompts, enhancing the overall user experience. Efficient Collaboration Between Tools and AI

Built a cohesive workflow where the LLM collaborates effectively with custom tools (e.g., database queries and visualizations) to deliver precise, context-aware answers. Balanced AI reasoning with tool-specific logic, ensuring both efficiency and accuracy. Scalability of Drug Database

Developed a flexible and expandable drug database capable of storing and retrieving detailed information, including future-ready attributes for advanced drug discovery use cases. Impactful Use Case

Created a practical application for healthcare professionals, researchers, and educators, empowering them with instant access to critical drug data and insights.

What we learned

Agentic AI Design

Mastered the implementation of agentic workflows where the system autonomously reasons, iterates, and retrieves relevant data to answer user queries effectively. Learned how to optimize tool collaboration and AI-driven decision-making to ensure accurate, context-aware responses. GraphQL Integration

Gained expertise in designing and integrating a robust GraphQL backend that supports dynamic queries and provides real-time data retrieval. Learned to handle complex query structures and provide detailed logs for debugging and transparency. LLM Optimization

Learned how to fine-tune interactions with the OpenAI Chat Model to answer domain-specific questions accurately while leveraging external tools for data enrichment. Explored techniques for combining LLM reasoning with tool-based logic, achieving both depth and precision in responses. Frontend-Backend Communication

Developed a deeper understanding of managing seamless communication between the frontend and backend using GraphQL. Learned to build intuitive user interfaces that handle dynamic responses and provide real-time feedback. Data Visualization

Gained experience in visualizing structured data, such as drug chemical structures and side effects, making information easily accessible to users. Understood how to bridge the gap between data and usability through effective UI design and integration. Error Handling and User Guidance

Learned the importance of robust error handling to maintain system reliability and ensure a smooth user experience. Explored strategies for providing helpful user prompts and fallback responses when queries are incomplete or ambiguous. Scalable Architecture Design

Learned to design modular and scalable architecture for both the drug database and application logic, ensuring future enhancements can be implemented with minimal refactoring. Domain-Specific Insights

Gained knowledge about drug discovery processes, drug attributes, and how healthcare professionals interact with data for decision-making. Understood the potential of AI-driven tools in revolutionizing access to medical and pharmaceutical information. Collaborative Development

Learned the value of team collaboration in integrating AI, backend, and frontend components into a unified application. Enhanced our skills in version control, debugging, and cross-functional communication. Balancing Automation with Control

Understood how to balance automated decision-making with user control to maintain system reliability and transparency. Learned to design systems that inspire trust and are easy to use while being powered by advanced AI capabilities.

What's next for MedQuery AI

Built With

Share this project:

Updates