Agentic RAG System for FDA Drug Label Data
What it is: A system that lets you ask any question about drug labels in natural language and get answers traceable to FDA-approved text.
Not a curated database. Not a prediction model. A retrieval system over 54,483 authoritative FDA labels.
Data source: FDA Structured Product Labeling (SPL) via OpenFDA — the legally required text that appears on drug packaging. Unlike curated databases, MedCopilot retrieves from the authoritative source directly.
indications_and_usage (99.5% coverage, 32% distinct), then by dosage_and_administration (99.2% coverage, 39% distinct). Uses LSH bands + Union-Find for scalable clustering.
Extract keywords, normalize drug names
Scout → Plan → Execute SQL FTS
LLM compresses long fields
Persona-aware + citations
Suggest related questions
If the LLM cannot answer from initial results, the system automatically retries with broader scope
15 core clinical fields
LLM-planned AND/OR query
18 fields (+pharmacokinetics)
Force OR (broad)
60 text columns (full label)
Force OR + Researcher persona
"atorvastatin grapefruit interaction"
Interpret
Extract: atorvastatin, grapefruit. Intent: drug-food interaction.
Scout
Count how many labels contain each term
Plan
Construct tsquery: 'atorvastatin' & 'grapefruit'
Execute
FTS returns matching labels ranked by ts_rank_cd() (PostgreSQL) or BM25 (SQLite)
Summarize
Long fields (drug_interactions, warnings) are LLM-summarized if they exceed token limits
Answer
LLM generates response using retrieved data, with citations in format [ROW ID, field_name]
Follow-ups
LLM suggests related questions based on context
Every query translates to a visible tsquery string. The UI trace shows keywords, hit counts, retries, and timing — no hidden embeddings or unexplainable ML ranking.
Long drug label fields are compressed using LLM summarization rather than truncation. Preserves information that might be lost by cutting mid-sentence.
Before searching, count hits per keyword. LLM constructs optimal boolean query with knowledge of term frequencies. Avoids both over-restrictive and over-broad queries.
Pre-computed tsvector indexes: tsv_preferred (15 fields), tsv_extended (18), tsv_all (60). Enables precision/recall trade-off per query.
The same question gets different responses depending on who's asking
Clinical terminology
Direct, professional, with dosing details
Use case: Point-of-care reference
Technical
Comprehensive, preserves complexity
Use case: Complex clinical scenarios
Exhaustive
All variations, raw data preserved
Use case: Regulatory analysis, systematic reviews
Plain language
Clear explanations, understand your label
Use case: Understanding prescription labels
Models are configurable per task:
54K
Labels
5
Pipeline Steps
3
Retry Tiers
4
Personas
15
Prompts
3
Index Tiers
Understanding the boundaries helps position the value
DDI-GPT predicts undocumented interactions; Decagon predicts polypharmacy effects. MedCopilot retrieves documented information from FDA labels.
DrugBank curates drug targets, protein interactions, chemical structures, and clinical trials. MedCopilot focuses on FDA label text retrieval.
Lexidrug and Micromedex have human-written summaries. MedCopilot generates answers from authoritative source text.
MedWise scores polypharmacy risk. MedCopilot answers questions about what's in drug labels.
See Market Landscape for detailed comparison.