Project Info
This project did not submit a demo video on Devpost.
Inspiration
In today's medical landscape, the volume of new research, clinical data, and patient information is growing at an exponential rate. We were inspired by the daily challenge faced by clinicians and researchers: how to quickly and accurately access and synthesize this vast sea of data to make informed decisions. A conversation with a radiology resident highlighted a specific pain point: the time-consuming process of cross-referencing a patient's imaging findings with their clinical history and the latest peer-reviewed literature. This sparked the core idea for CliniSearch: an AI agent that could not only "read" but also "see," acting as an intelligent assistant to bridge the gap between diverse medical data types.
What it does
CliniSearch is a powerful, multimodal AI agent designed to be a "second brain" for medical professionals. Its functionality is split into two primary tools: Medical RAG Q&A: Users can ask complex medical questions and receive synthesized, evidence-based answers. The agent retrieves information in real-time from three distinct sources: General Web Search: For broad context and general knowledge. PubMed: For access to peer-reviewed scientific literature. Uploaded Documents: Users can upload their own PDFs (research papers, reports) to create a private, searchable knowledge base for highly specific queries. Medical RAG Q&A: Users can ask complex medical questions and receive synthesized, evidence-based answers. The agent retrieves information in real-time from three distinct sources: General Web Search: For broad context and general knowledge. PubMed: For access to peer-reviewed scientific literature. Uploaded Documents: Users can upload their own PDFs (research papers, reports) to create a private, searchable knowledge base for highly specific queries. Radiology Image Analysis: This tool is designed specifically for radiologists. A user can: Upload an anonymized medical image (e.g., an X-ray). Optionally upload a related context document (e.g., a patient's clinical notes). The AI then analyzes the image, providing a preliminary description of findings and potential differential diagnoses, using the context from the uploaded text to deliver a more holistic and relevant analysis. Radiology Image Analysis: This tool is designed specifically for radiologists. A user can: Upload an anonymized medical image (e.g., an X-ray). Optionally upload a related context document (e.g., a patient's clinical notes). The AI then analyzes the image, providing a preliminary description of findings and potential differential diagnoses, using the context from the uploaded text to deliver a more holistic and relevant analysis. All outputs are clearly sourced with links, ensuring transparency and allowing for easy verification.
How we built it
We architected CliniSearch as a modular, modern web application with a clear separation of concerns. Frontend: The user interface is built with Streamlit, chosen for its ability to rapidly create interactive and data-centric web apps in Python. We used tabs to separate the two main functionalities and custom styling to ensure a clean, professional UI. Frontend: The user interface is built with Streamlit, chosen for its ability to rapidly create interactive and data-centric web apps in Python. We used tabs to separate the two main functionalities and custom styling to ensure a clean, professional UI. Backend & Orchestration: The core logic resides within the Streamlit app (app.py), which orchestrates calls to various backend components. We used Python's asyncio library to handle concurrent requests to our data sources, improving efficiency. Backend & Orchestration: The core logic resides within the Streamlit app (app.py), which orchestrates calls to various backend components. We used Python's asyncio library to handle concurrent requests to our data sources, improving efficiency. Tool Servers (MCP): We built two lightweight, independent tool servers using FastAPI to handle data retrieval. This "Model Context Protocol" approach makes the system modular and scalable. One server uses the duckduckgo-search library for web searches. The other uses BioPython to interact with the NCBI Entrez API for PubMed searches. Tool Servers (MCP): We built two lightweight, independent tool servers using FastAPI to handle data retrieval. This "Model Context Protocol" approach makes the system modular and scalable. One server uses the duckduckgo-search library for web searches. The other uses BioPython to interact with the NCBI Entrez API for PubMed searches. AI & RAG Pipeline: This is the heart of our project. LLMs: We leveraged the Google Gemini API, specifically gemini-1.5-flash-latest, for its powerful text synthesis and state-of-the-art multimodal (vision) capabilities. Embeddings: For our local RAG feature, we used a sentence-transformers model to generate vector embeddings from PDF text. Vector Store: We implemented an in-memory vector database using FAISS from Meta AI, which allows for incredibly fast semantic similarity searches on the uploaded documents. AI & RAG Pipeline: This is the heart of our project. LLMs: We leveraged the Google Gemini API, specifically gemini-1.5-flash-latest, for its powerful text synthesis and state-of-the-art multimodal (vision) capabilities. Embeddings: For our local RAG feature, we used a sentence-transformers model to generate vector embeddings from PDF text. Vector Store: We implemented an in-memory vector database using FAISS from Meta AI, which allows for incredibly fast semantic similarity searches on the uploaded documents. GCP Readiness: The project was built with an eye towards production, with a structure ready for deployment on Google Cloud Platform services like Cloud Run (for the app and servers) and Vertex AI (for embeddings and vector search). GCP Readiness: The project was built with an eye towards production, with a structure ready for deployment on Google Cloud Platform services like Cloud Run (for the app and servers) and Vertex AI (for embeddings and vector search).
Challenges we ran into
Real-time API Latency: Integrating multiple real-time APIs (Web Search, PubMed, Gemini) presented a challenge. Initial user requests were slow. We mitigated this by using asyncio to run the data retrieval tasks concurrently, significantly speeding up the process. Real-time API Latency: Integrating multiple real-time APIs (Web Search, PubMed, Gemini) presented a challenge. Initial user requests were slow. We mitigated this by using asyncio to run the data retrieval tasks concurrently, significantly speeding up the process. Context Window Management: LLMs have finite context windows. Combining information from three different RAG sources could easily exceed this limit. Our solution was to process each source independently and present separate, synthesized answers, which not only solved the technical problem but also improved the clarity and traceability of the output for the user. Context Window Management: LLMs have finite context windows. Combining information from three different RAG sources could easily exceed this limit. Our solution was to process each source independently and present separate, synthesized answers, which not only solved the technical problem but also improved the clarity and traceability of the output for the user. UI State and Interactivity: Streamlit reruns the script on every interaction, which made managing the state of our vector store and file uploads tricky. We solved this by effectively using st.session_state to persist data across reruns and implementing logic to ensure PDFs were only processed once upon upload. UI State and Interactivity: Streamlit reruns the script on every interaction, which made managing the state of our vector store and file uploads tricky. We solved this by effectively using st.session_state to persist data across reruns and implementing logic to ensure PDFs were only processed once upon upload.
Accomplishments we're proud of
True Multimodality: We're incredibly proud of the Radiology Analysis tab. It's not just an image-to-text model; it's a system that fuses visual analysis with contextual text-based RAG, which we believe is a significant step towards creating truly useful clinical AI assistants. True Multimodality: We're incredibly proud of the Radiology Analysis tab. It's not just an image-to-text model; it's a system that fuses visual analysis with contextual text-based RAG, which we believe is a significant step towards creating truly useful clinical AI assistants. Modular and Scalable Design: By separating our data retrieval into microservice-like MCP servers, we've built a system that is easy to maintain and extend. Adding a new data source would be as simple as building another small FastAPI server. Modular and Scalable Design: By separating our data retrieval into microservice-like MCP servers, we've built a system that is easy to maintain and extend. Adding a new data source would be as simple as building another small FastAPI server. Delivering a Polished UX: Despite the technical complexity on the backend, we managed to create a clean, intuitive, and professional-looking user interface that is genuinely usable. Delivering a Polished UX: Despite the technical complexity on the backend, we managed to create a clean, intuitive, and professional-looking user interface that is genuinely usable.
What we learned
The Power of RAG: We learned firsthand how Retrieval-Augmented Generation can ground LLMs in factual, real-time, or private data, drastically reducing hallucinations and increasing the reliability of their outputs. The Nuances of Prompt Engineering: Crafting effective prompts is an art. We learned how to structure prompts to instruct the LLM to use only the provided context, to cite sources, and to tailor its response for a specific audience (like a medical professional). Full-Stack Python Development: This project was a deep dive into the modern Python ecosystem, from backend APIs with FastAPI to interactive web UIs with Streamlit and advanced AI/ML libraries like FAISS and Sentence Transformers.
What's next
CliniSearch is a powerful proof-of-concept with immense potential for growth. Our next steps would include: Deployment on GCP:6 -x Moving the application and its components to Google Cloud Platform to make it scalable, reliable, and accessible. This would involve using Cloud Run, Vertex AI Vector Search, and Document AI for more robust PDF parsing. Enhanced Conversational Memory: Implementing a more sophisticated chat history management system (e.g., using Firestore) to allow for meaningful follow-up questions. Deeper EMR/RIS Integration: Developing secure integrations with hospital systems (like EMRs) to automatically pull relevant patient context, further enhancing the AI's utility. Model Evaluation and Fine-Tuning: Rigorously evaluating the accuracy of different models (including the Claude family) and potentially fine-tuning a model on a specific medical domain for even higher accuracy and reliability.
CliniSearch: A Multimodal Medical Research & Radiology Assistant
CliniSearch is an advanced, multimodal AI agent developed for the UCB Hackathon. It is designed to be a powerful assistant for medical professionals, particularly radiologists, by streamlining clinical research and providing AI-powered preliminary image analysis. The agent integrates multiple state-of-the-art technologies, including premium LLMs (Google Gemini), a multi-source RAG pipeline, and a user-friendly web interface built with Streamlit.
Video Demo:
[
](https://www.youtube.com/watch?v=Q3a4GuCqoKQ"CliniSearch AI Agent Demo")
๐ Application & Real-World Benefit
In the fast-paced medical field, professionals face the dual challenges of information overload and time scarcity. Spectra AI is designed to address these critical issues directly.
- For Clinicians & Researchers: It acts as an intelligent research assistant, capable of querying real-time web data, peer-reviewed PubMed articles, and user-uploaded documents (like research papers or reports). By providing synthesized, source-cited answers from these distinct domains, it dramatically accelerates literature reviews, deepens contextual understanding, and helps identify research gaps.
- For Radiologists: The "Radiology Image Analysis" tab offers a cutting-edge tool for decision support. A radiologist can upload a medical image (e.g., an X-ray, CT scan) and receive a preliminary analysis from a multimodal AI. By combining this visual analysis with contextual information from uploaded patient reports, Spectra AI can help identify potential abnormalities, suggest differential diagnoses, and reduce cognitive load, acting as a "second pair of eyes" to enhance diagnostic confidence and efficiency.
โจ Features
- User-Friendly Web Interface: A clean, tabbed UI built with Streamlit separates the text-based RAG Q&A from the specialized Radiology Image Analysis tool.
- Multi-Source RAG Pipeline:
- Dynamically queries Web Search (via DuckDuckGo) and PubMed (via NCBI Entrez) for real-time information.
- Allows users to upload their own PDF documents, creating a private, searchable knowledge base for highly contextualized answers.
- Multimodal Radiology Analysis:
- Leverages Google Gemini Pro Vision to analyze uploaded medical images.
- Context-Aware Analysis: Uniquely combines image analysis with a RAG search of user-uploaded PDFs (e.g., patient reports), providing a holistic preliminary assessment.
- High-Quality AI Models: Powered by the Google Gemini API (
gemini-1.5-flash) for state-of-the-art text synthesis and multimodal understanding. - Structured & Sourced Outputs: All answers are presented in a clean, readable format with clearly listed sources and clickable links, ensuring transparency and enabling further verification.
- GCP-Ready Architecture: The modular design (MCP servers, API clients, RAG processing) is built to be scalable and easily deployable on Google Cloud Platform services like Cloud Run, Vertex AI, and Cloud Storage.
๐ ๏ธ Technical Complexity & Design
CliniSearch demonstrates a strong command of modern AI engineering principles and technologies.
- Asynchronous Architecture: Utilizes
asyncioandhttpxfor efficient, non-blocking calls to the backend MCP tool servers. - Advanced RAG Implementation: The system implements a full RAG pipeline, including:
- Document Parsing: Using
PyMuPDFto extract text from PDFs. - Text Chunking & Embedding: Using
sentence-transformersfor local text embedding. - Vector Search: Using
faiss-cputo create an efficient, in-memory vector store that simulates the functionality of a production service like GCP Vertex AI Vector Search.
- Document Parsing: Using
- Sophisticated Prompt Engineering: Prompts are dynamically constructed to be context-aware, instructing the LLM to use only the provided information and to cite its sources.
- Multimodal Fusion: The radiology tool showcases a complex workflow where insights from a text-based RAG search (on PDFs) are fused into the prompt for a visual analysis task, demonstrating a true multimodal approach.
- Modular Codebase: The project is well-organized into a Streamlit frontend (
app.py), backend API clients (utils/api_clients.py), RAG logic (utils/rag_processing.py), and tool servers (mcp_servers/), promoting maintainability and scalability.
Detailed System Architecture & Data Flow
The diagram above provides a comprehensive overview of the Spectra AI technology stack and the flow of data from user interaction to final output. The system is divided into four logical domains: Frontend, Backend/Orchestrator, Local Tools & Services, and External APIs.
-
Frontend (UI - Blue) Streamlit App (app.py): This is the user's single point of interaction. It's responsible for rendering the web interface, managing user inputs (text queries, file uploads), and displaying the final, formatted results.
-
Application Backend / Orchestrator (Purple) RAG & Multimodal Logic: This is the "brain" of the application, also residing within app.py. It orchestrates the entire workflow, deciding which tools to call, when to process data, which LLMs to query for synthesis, and how to format the final response.
-
Local Tools & Services (Green) This domain contains components that run locally alongside the main application.
MCP Tool Servers (FastAPI): These are two independent, lightweight servers built with FastAPI. They act as modular tools that the main orchestrator can call. Web Search Server: Receives a query, uses the duckduckgo-search library to get results from the internet, and returns them in a standard JSON format. PubMed Server: Receives a query, uses the BioPython library to interact with the NCBI Entrez API, and returns formatted PubMed abstracts. Local RAG Pipeline Components: This sub-domain handles the processing of user-uploaded documents. (Step 3a) PDF Parser (PyMuPDF): When a user uploads a PDF, this library extracts the raw text. (Step 3b) Embedding Model (Sentence Transformer): This is a crucial local LLM. It takes the text chunks from the PDF and converts them into numerical vector embeddings. We use a lightweight but effective model like all-MiniLM-L6-v2. (Step 3c) Vector Store (FAISS CPU): The generated embeddings are stored in this in-memory vector database. FAISS (Facebook AI Similarity Search) allows for incredibly fast and efficient semantic searches, simulating the functionality of a production service like GCP Vertex AI Vector Search. 7. External APIs & Data Sources (Orange) This domain represents all the third-party services the system relies on.
Google Gemini API: The primary engine for high-level reasoning. It's used for: Text Synthesis: Generating the final, human-readable answers based on the context provided by the RAG pipeline. Vision Analysis: Analyzing the content of uploaded medical images.
Anthropic Claude API (Optional): The system is built to be model-agnostic. The Claude API can be used as an alternative to Gemini for text synthesis, allowing for flexibility and comparison.
DuckDuckGo Search: The data source for real-time web search. NCBI PubMed: The data source for peer-reviewed medical literature.
A Typical Workflow (Tracing the Arrows) A User asks a question or uploads an image and a PDF to the Streamlit Frontend. The frontend triggers the RAG & Multimodal Logic in the backend. If a PDF was uploaded, it is parsed by PyMuPDF, its text is converted to embeddings by the Sentence Transformer model, and these embeddings are stored in the FAISS Vector Store. The orchestrator sends the user's query to the MCP Servers for Web and PubMed results and simultaneously performs a semantic search on the FAISS Vector Store. The MCP servers in turn query their respective data sources, DuckDuckGo and PubMed.
The orchestrator gathers all the retrieved context (from web, PubMed, and local PDFs) and constructs a detailed prompt. This prompt, along with the user's original question (and an image, if applicable), is sent via API call to a powerful external LLM like Google Gemini. The orchestrator receives the synthesized answer from the LLM. The answer is formatted neatly (with sources and links) and displayed back to the User in the Streamlit interface.
User Interaction: The user interacts with the Streamlit App, either by asking a text question in the "Medical RAG Q&A" tab or by uploading an image and text prompt in the "Radiology Image Analysis" tab.
RAG Orchestration: The app's RAG Orchestrator processes the request.
Information Retrieval (Parallel):
It sends queries to the Web Search and PubMed MCP Servers for real-time data.
Simultaneously, it performs a semantic search against the local Vector Store (FAISS), which contains the indexed content of any uploaded PDFs.
Context Synthesis:
For RAG Q&A: The formatted context from each enabled source (Web, PubMed, PDF) is sent separately to the LLM Synthesizer (Gemini). This ensures the answers are based on distinct evidence trails.
For Radiology Analysis: The Multimodal LLM (Gemini) receives the uploaded image, the user's text prompt, and context retrieved from the PDF vector store.
Final Output: The synthesized text answers and image analyses are formatted and displayed in the Streamlit UI, with sources clearly cited.
Sure! Below is a clean, copy-paste-ready script you can include in your README.md on GitHub under a "โ๏ธ Setup & Running the System" section. It uses markdown formatting with code blocks and provides clear step-by-step instructions.
โ๏ธ Setup & Running the System
๐ ๏ธ Prerequisites
- Python 3.9+
- Git
๐ฆ Clone the Repository
git clone <your-repo-url>
cd <your-project-directory>
๐งช Set up Virtual Environment
Create the environment
python -m venv venv
Activate the environment
On macOS/Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
๐ฅ Install Dependencies
pip install -r requirements.txt
๐ Configure API Keys
- Rename the environment example file:
mv .env.example .env
-
Open
.envand set the following:GOOGLE_API_KEY=<your_google_api_key>NCBI_EMAIL=<your_email_for_ncbi_access>
๐ Run the MCP Servers
Open two separate terminals, and ensure the virtual environment is activated in both.
Terminal 1 โ Web Search Server
python -m uvicorn mcp_servers.web_search_server:app --reload --port 8001
Terminal 2 โ PubMed Server
python -m uvicorn mcp_servers.pubmed_search_server:app --reload --port 8002
๐ Run the Main Web Application
In a third terminal, with the virtual environment activated:
streamlit run app.py
Your browser will automatically open with the Spectra AI application running.
โ๏ธ Ethical Considerations
Spectra AI is a powerful assistant, but not a substitute for professional medical judgment. All analyses and outputs are intended for informational and research purposes only and should not be used to make final clinical decisions. Always consult and verify results with a qualified medical professional.
Analysis
View
Metric
- 7
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- FastAPIIn code
- PythonIn code
- StreamlitIn code
4 of 4 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
41 KB
Source files
8
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
Kush614/CliniSearch
11 files ยท 43 KB ยท @ 5badd22
Structure
Application logic
7 files ยท 64%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here โ open the file browser to check anything the diagram implies.
Languages
- Python71%
- Markdown29%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
requirements.txt
pypi ยท 14- anthropic
- biopython
- duckduckgo-search
- faiss-cpu
- fastapi
- google-cloud-aiplatform
- google-generativeai
- httpx
- numpy
- pymupdf
- python-dotenv
- sentence-transformers
- streamlit
- uvicorn[standard]
Declared in the repositoryโs manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This projectโs features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.