sndevBeta
Browse CategoriesDeveloper Insights
LoginGet Started
sndevBeta
Project FeedYouTube

© 2026 sndev. All rights reserved.

GenAI
Aug 18, 2026
s
sndev

Build & Deploy an End-To-End Modular RAG-based Medical Assistant

GitHub RepositoryWatch on YouTube

“Build a role-based medical chatbot using FastAPI, Groq LLaMA 3, Pinecone, and MongoDB Atlas. Features document-grounded RAG with strict RBAC for Doctors, Nurses, and Patients.”

On This Page
1System Architecture2Core Tech Stack3Key Takeaway

Medical data requires strict privacy boundaries and grounded accuracy. A single generic chatbot cannot safely serve both a surgeon reviewing clinical reports and a patient checking basic health guidelines.

This project implements a full-stack, role-aware medical assistant that combines Retrieval-Augmented Generation (RAG) with Role-Based Access Control (RBAC).

System Architecture

The architecture enforces permission checks at every stage, from document ingestion to vector retrieval:

  • Authentication & RBAC: MongoDB Atlas and Bcrypt manage user persistence and role definitions (Admin, Doctor, Nurse, Patient, and Others).

  • Document Ingestion (Admin Only): Administrators upload clinical PDFs, which are chunked, embedded via Google AI Embeddings, and indexed in Pinecone with role-level metadata.

  • Role-Filtered Retrieval: When a query is made, Pinecone filters chunks based on the user's role before returning context.

  • Low-Latency Generation: Retrieved context is passed to Groq (LLaMA 3) to produce grounded, sub-second responses.

  • Frontend: A Streamlit dashboard dynamically renders views according to authenticated privileges.

Core Tech Stack

Layer

Technology

Function

Backend API

FastAPI

Modular REST routing and dependency injection

LLM Inference

Groq (LLaMA 3)

Sub-second generative response synthesis

Vector Database

Pinecone

Metadata-filtered semantic retrieval

Embeddings

Google AI Embeddings

Document and query vectorization

User Store & Auth

MongoDB Atlas + Bcrypt

User state, credentials, and RBAC policies

User Interface

Streamlit

Dynamic, role-aware interactive client

Key Takeaway

By applying metadata filters during vector search and securing endpoints with FastAPI dependencies, the system prevents unauthorized data access and keeps LLM responses strictly grounded in verified medical records.

FastAPI
Pinecone
MongoDB
Streamlit

Community Discussion
0

Ask questions, discuss architecture, and share insights with other developers.

Sort:

Sign in to join the discussion and share your thoughts with other developers.

Sign In to Comment
Loading discussions…