JeevaMano/genai-clinical-qa-assistant
0
๐ง GenAI Clinical Q&A Assistant
A GenAI-powered clinical question-answering system that allows users to ask questions about medical PDFs, patient cases, or discharge notes โ and get accurate, natural language answers.
๐ Features
- ๐ Semantic search over clinical documents using FAISS & Sentence Transformers
- ๐ฌ Question answering via FLAN-T5 (HuggingFace Inference API)
- ๐ Upload your own medical PDFs for live querying
- ๐ Frontend built with Streamlit (no React/Node required)
- ๐ง Custom-trained on real medical CSVs converted into PDF
- โ๏ธ Modular architecture using FastAPI, Python, and Hugging Face
๐ Project Structure
genai-clinical-qa/
โโโ backend/
โ โโโ app.py # FastAPI app for backend
โ โโโ qa_engine.py # Embedding + QA logic
โ โโโ document_loader.py # PDF text extraction
โ โโโ embedding_store.py # FAISS vector index
โโโ frontend/
โ โโโ app.py # Streamlit UI
โโโ data/
โ โโโ clinical_docs/ # Sample/generated PDFs
โโโ generate_pdfs_from_csv.py # Create PDFs from medical CSVs
โโโ requirements.txt
โโโ .env # HuggingFace token (excluded from Git)๐ Setup Instructions
# 1. Clone the repository
git clone https://github.com/Jeeva-soul/genai-clinical-qa.git
cd genai-clinical-qa
# 2. Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # (Windows)
# or
source venv/bin/activate # (macOS/Linux)
# 3. Install required packages
pip install -r requirements.txt
# 4. Add HuggingFace token to .env
echo HUGGINGFACEHUB_API_TOKEN=your_token_here > .env
# 5. Run the backend
uvicorn backend.app:app --reload
# 6. In a new terminal, run the Streamlit frontend
cd frontend
streamlit run app.py๐ฌ Example API Request (Backend)
POST /ask
{
"question": "What medications were prescribed?"
}๐ป Streamlit UI Features
- Elegant design with custom CSS
- Real-time question box with loading spinner
- Upload your own PDFs to instantly augment the knowledge base
- Beautifully styled answer container
๐ Dataset Used
- ๐ง Brain Tumor Dataset (Kaggle)
- ๐ Converted to PDFs to simulate real-world clinical documents
๐งฉ Future Enhancements
- ๐งฌ Clinical entity tagging (ICD-10, SNOMED)
- โ๏ธ Cloud deployment (Azure, Hugging Face Spaces)
- ๐ Multiple LLM support (switch between APIs/local models)
- ๐ Session history & PDF content preview
โ ๏ธ Security Note
Do not commit your .env or HuggingFace API keys to GitHub. They are automatically excluded using .gitignore.
๐จโ๐ป Author
Jeeva Manavalan ๐ University of Texas at Arlington | Data Scientist | GenAI Enthusiast ๐ LinkedIn โข GitHub
๐ License
MIT License
