Inspiration

Medical reports contain critical information, but they are often difficult for patients to understand and navigate. Important details can be buried across lengthy PDFs, lab reports, prescriptions, and clinical documents.

We built MediRAG (RAGnosis) to make medical documents easier to understand by combining Retrieval-Augmented Generation (RAG) with an intuitive conversational interface. Instead of relying solely on an LLM's general knowledge, RAGnosis retrieves relevant information directly from the patient's uploaded reports and uses it to generate grounded, source-backed answers.

Our goal is to help users ask questions about their own medical documents in natural language and quickly find the information that matters.

What it does

MediRAG (RAGnosis) is a full-stack AI medical document analysis platform.

Users can:

  • Upload medical reports and documents.
  • Process and index document content for semantic retrieval.
  • Ask natural-language questions about their medical records.
  • Retrieve the most relevant sections of their uploaded documents.
  • Generate AI responses grounded in retrieved medical information.
  • See source-backed answers rather than relying entirely on generic LLM knowledge.
  • Maintain multiple conversations through chat sessions.
  • Rename, retrieve, and delete chat sessions and their associated messages.
  • Access previous conversation history.

The backend uses FastAPI and asynchronous SQLAlchemy to manage users, documents, chat sessions, and messages while the RAG pipeline handles document retrieval and AI-powered response generation.

RAGnosis is designed as an information and document-understanding tool, not a replacement for a qualified medical professional.

How we built it

We built MediRAG as a containerized full-stack application with a clear separation between the frontend, API, database, and AI/RAG components.

Frontend

  • Next.js 16
  • React
  • Responsive document and chat interface
  • Chat session management

Backend

  • FastAPI
  • Python
  • Async SQLAlchemy
  • PostgreSQL
  • REST APIs
  • User authentication and authorization

AI / RAG

  • Document ingestion and processing
  • Embedding generation
  • Semantic retrieval
  • LlamaIndex
  • Hugging Face models
  • Vector search using Pinecone / FAISS
  • LLM-based answer generation

The chat architecture separates conversation management from the RAG pipeline. Each authenticated user can create multiple sessions, while individual messages remain associated with the appropriate session and user.

When a patient asks a question, the system retrieves relevant information from their uploaded reports and uses that context to generate a grounded response.

Challenges we ran into

One of the biggest challenges was building a reliable pipeline between document ingestion, embeddings, vector retrieval, and LLM generation while keeping the responses relevant to the patient's actual documents.

We also had to solve several engineering challenges:

  • Processing different types of medical documents.
  • Maintaining useful context from long reports.
  • Designing effective chunking and semantic retrieval.
  • Connecting asynchronous FastAPI operations with PostgreSQL.
  • Managing chat sessions and message history securely.
  • Ensuring users can only access their own documents and conversations.
  • Running the frontend, backend, database, and AI services together using Docker.
  • Balancing useful AI explanations with the need to avoid unsupported medical claims.

Accomplishments that we're proud of

We are proud of turning a complex RAG pipeline into a usable patient-document conversational experience.

Some key accomplishments include:

  • Built a complete full-stack AI application rather than just an LLM prototype.
  • Implemented document-based RAG for medical reports.
  • Added source-grounded retrieval to reduce hallucination.
  • Built persistent multi-session conversations.
  • Implemented user-level access control for chat data.
  • Created asynchronous FastAPI APIs for scalable backend operations.
  • Integrated PostgreSQL for persistent application data.
  • Containerized the application with Docker Compose.
  • Created a foundation that can evolve into a broader medical-document intelligence platform.

Most importantly, we focused on making the AI answer questions from the patient's own documents, rather than simply generating generic medical responses.

What we learned

Building RAGnosis taught us that a good RAG application is much more than connecting an LLM to a vector database.

We learned the importance of:

  • High-quality document preprocessing.
  • Choosing appropriate chunk sizes and overlap.
  • Embedding quality and retrieval relevance.
  • Providing sufficient context to the LLM without overwhelming it.
  • Designing database relationships around real user workflows.
  • Implementing authentication and authorization throughout the application.
  • Managing asynchronous workloads in FastAPI.
  • Treating AI reliability and hallucination prevention as core engineering problems.

We also learned that in healthcare-related applications, grounding, transparency, and responsible UX are just as important as model capability.

What's next for MediRAG (RAGnosis)

We want to evolve RAGnosis from a medical document Q&A system into a more comprehensive personal medical-document intelligence platform.

Planned improvements include:

  • Multi-document reasoning across a patient's medical history.
  • Timeline generation for diagnoses, tests, medications, and procedures.
  • Lab-result trend visualization.
  • Better citation and source highlighting.
  • Improved medical terminology explanations.
  • Support for additional document formats.
  • Multilingual medical-document support.
  • Voice-based interaction.
  • More advanced hybrid and reranking-based retrieval.
  • Secure cloud deployment and scalable background document processing.
  • Integration with healthcare workflows while maintaining strong privacy and security controls.

Our long-term vision is RAGnosis: an AI assistant that helps people understand and navigate their own medical information while keeping the underlying evidence visible and accessible.

Built With

Share this project:

Updates

Submission history