MediGuide is an AI-based medical assistant built with FastAPI, Streamlit, MongoDB, and LangChain. It connects a lightweight web UI to an API backend that stores user data, uploads medical documents, creates semantic embeddings, and answers user questions using vector search.
/client– Streamlit frontend that handles user authentication, uploads, and chat./server– FastAPI backend with authentication, document upload, vectorization, and chat endpoints./server/auth– Authentication routes and login/signup logic./server/docs– PDF upload, summarization, and metadata storage./server/chat– Question answering endpoint and RAG query logic./server/config– MongoDB configuration and database connection./server/chroma_dband/chroma_db– ChromaDB persistence stores for embeddings./uploaded_docsand/server/uploaded_docs– Saved uploaded PDF files.
- The Streamlit client reads
BASE_URLfrom the root.envfile and sends HTTP requests to the FastAPI server. - The server exposes three main areas:
/signupand/loginfor user authentication./docsfor document upload, report summary, and listing saved documents./chatfor role-based medical question answering.
- Each upload is saved in
uploaded_docs/and then processed by the server:- PDFs are parsed, split into text chunks, and embedded with HuggingFace embeddings.
- The vectors are persisted into ChromaDB.
- Medical reports are also summarized through an Ollama LLM.
- Authenticated users can query the chat endpoint, which performs a similarity search over role-specific document vectors and returns an answer with sources.
This file is required by the FastAPI backend and includes:
MONGODB_URI– MongoDB connection URI (local or Atlas)MONGODB_DB_NAME– Database nameOLLAMA_BASE_URL– Ollama server URLOLLAMA_MODEL– Ollama model nameEMBEDDING_MODEL– HuggingFace embedding modelCHROMA_PERSIST_DIR– Chroma persistence directory
Example values are already present in server/.env in this workspace.
The Streamlit client uses the root .env file and requires:
BASE_URL– URL of the running FastAPI server
Example:
BASE_URL=http://127.0.0.1:8001If you run the server on port
8001, make sureBASE_URLmatches that port.
python -m venv .venv
.venv\Scripts\activate
pip install -r server/requirements.txt
pip install -r client/requirements.txt
uvicorn server.main:app --reload --port 8001
streamlit run client/main.pyThen open:
- FastAPI docs:
http://127.0.0.1:8001/docs - Streamlit app:
http://127.0.0.1:8501
- The client uses
requestswith HTTP Basic auth to communicate with the FastAPI server. - The server verifies credentials via
server/auth/routes.py. - Uploaded documents are stored in
uploaded_docs/and indexed with Chroma inchroma_db/. - Chat questions are answered by searching the vector store and invoking an LLM.
- MongoDB stores users, report metadata, and role access information.
- The client expects
BASE_URLto point to the running FastAPI server. - The server expects
server/.envto contain valid model, Chroma, and MongoDB settings. server/config/db.pywill fall back to a mock database if MongoDB is unavailable.
This workspace now includes README documentation in these directories:
/client/server/server/auth/server/chat/server/config/server/docs/server/chroma_db/server/uploaded_docs/chroma_db/uploaded_docs