AI-powered document Q&A for pharma professionals. Upload any pharma PDF and ask questions in plain English — get instant answers with exact page references.
Medical Affairs and HEOR professionals spend hours manually searching through dense pharma documents. This tool does it in seconds.
Upload any document → ask questions → get:
- Direct answers from the document
- Exact page number references
- Source text preview for verification
- Downloadable Q&A session report
| Tool | Purpose |
|---|---|
| Python | Core language |
| scikit-learn (TF-IDF + cosine similarity) | Lexical search and retrieval |
| Claude API (Anthropic) | AI answer generation |
| PyMuPDF | PDF text extraction |
| Streamlit | Web interface |
Retrieval here is lexical (TF-IDF over unigrams and bigrams, ranked by cosine similarity), not semantic. There is no embedding model, no vector database, and no LangChain.
That started as a constraint: sentence-transformers/torch would not cooperate on Python 3.14. But it
turned out to suit the problem. Pharma questions hinge on exact terms — EGFR, ALK, TPS ≥50%,
a specific dose. Semantic search is built to find text that means roughly the same thing, which on a
drug label is how you get a confident answer about the wrong threshold. Lexical search matches the term
or returns nothing, and "nothing" is the safer failure here.
Trade-off, stated honestly: this will not find a passage that paraphrases your question without sharing its vocabulary. For long, well-structured regulatory documents where terminology is standardised, that is a good trade. For fuzzy multi-document discovery, it is not. This has not been benchmarked against an embedding baseline.
├── document_loader.py # PDF loading and chunking
├── vector_store.py # TF-IDF vector search
├── rag_chain.py # RAG pipeline
├── llm_response.py # Claude AI integration
├── streamlit_app.py # Streamlit web interface
├── requirements.txt # Python dependencies
└── .env.example # API key template
1. Clone the repo
git clone https://github.com/LifeSciForge/Pharma_Document_Intelligence.git
cd Pharma_Document_Intelligence2. Create virtual environment
python3 -m venv venv
source venv/bin/activate3. Install dependencies
pip install -r requirements.txt4. Add your API key
cp .env.example .env
# Edit .env and add your Anthropic API key5. Run the app
streamlit run streamlit_app.py| Document | Source | Use Case |
|---|---|---|
| Keytruda FDA label | FDA.gov | Drug contraindications, dosing |
| Ozempic FDA label | FDA.gov | Diabetes/obesity evidence |
| NCCN Guidelines | NCCN.org | Treatment algorithms |
| Clinical trial report | PubMed | Endpoint results |
- Medical Affairs — rapid evidence lookup
- HEOR — endpoint and outcomes extraction
- Regulatory Affairs — guideline and SOP queries
- MSL — pre-call document preparation
Get your free key at console.anthropic.com
Add to .env:
ANTHROPIC_API_KEY=your_key_here
App runs in placeholder mode without API key — document search still works, AI synthesis activates with key.
Pranjal Das AI & Automation for Life Sciences github.com/LifeSciForge