How ph-tejas/medassist---ai-patient-document-assistant works
MedAssist is a medical-document question-answering API. Users register or log in, upload PDFs, and ask questions about their documents; the API extracts and stores text, indexes chunks for retrieval, and uses retrieved context to generate answers. Separate branches cover authenticated document listing and retrieval/answer evaluation. The excerpts show the main call paths; integrations and persistence are represented where their use is explicit.
Main entry points: main.py HTTP API · retrieval.py Embedding search · evaluate.py RAG evaluation · database.py Document and chunk storage
Components 14
API workflows
- HTTP API
MedAssist/app/main.py
Identity
- Authentication
MedAssist/app/auth.py - User records
MedAssist/app/database.py
Document retrieval
- PDF extraction
MedAssist/app/pdf_utils.py - Text chunking
MedAssist/app/chunker.py - Embedding search
MedAssist/app/retrieval.py - Document and chunk storage
MedAssist/app/database.py
Answer generation
- Answer generation
MedAssist/app/llm.py - RAG evaluation
MedAssist/app/evaluate.py
Other components
- User
- Ollama service
- MySQL
- Sentence Transformers
- FAISS index
Connections 17
- User → HTTP API: sends requests
MedAssist/app/main.py - HTTP API → Authentication: hashes and verifies
MedAssist/app/main.py - HTTP API → User records: reads and creates users
MedAssist/app/main.py - HTTP API → Document and chunk storage: lists and saves documents
MedAssist/app/main.py - HTTP API → PDF extraction: extracts PDF text
MedAssist/app/main.py - HTTP API → Embedding search: indexes and retrieves
MedAssist/app/main.py - HTTP API → Answer generation: generates answers
MedAssist/app/main.py - Embedding search → Text chunking: chunks text
MedAssist/app/retrieval.py - Embedding search → Document and chunk storage: stores and loads chunks
MedAssist/app/retrieval.py - Embedding search → Sentence Transformers: embeds text
MedAssist/app/retrieval.py - Embedding search → FAISS index: builds and searches
MedAssist/app/retrieval.py - Answer generation → Ollama service: requests completion
MedAssist/app/llm.py - User records → MySQL: queries and writes
MedAssist/app/database.py - Document and chunk storage → MySQL: queries and writes
MedAssist/app/database.py - RAG evaluation → Text chunking: tests chunking
MedAssist/app/evaluate.py - RAG evaluation → Embedding search: measures retrieval
MedAssist/app/evaluate.py - RAG evaluation → Answer generation: measures answers
MedAssist/app/evaluate.py