How pooja-k-swamy/clinical-protocol-review works
Purpose and Runtime
Clinical Protocol Draft Assistant is a Python 3.8+ Streamlit application that generates or ingests clinical-trial protocols, obtains LLM-based expert review, and produces amendment-risk findings plus a quality score. It requires an OpenAI API key and uses LangChain-based agent behavior. Primary UI/runtime entry point: streamlit_app.py.
User Workflow Orchestrator
The Streamlit app is the control plane: users enter study parameters to draft a protocol or upload an existing PDF, TXT, or Markdown document; once protocol text is available, they trigger review and receive consolidated feedback, risk assessment, recommendations, and score.
• streamlit_app.py
• utils/document_processor.py
Protocol Draft Generation
The generation stage turns user-provided study parameters and a guideline template into an initial protocol draft through an LLM. ICH-oriented template content is a key prompt/input boundary rather than application code.
• agents/protocol_generator.py
• templates/ich_templates/ich_template_v1.md
Protocol Content Access Boundary
The MCP-inspired server provides structured protocol access to review agents, intended to expose targeted sections such as objectives or inclusion criteria instead of requiring every agent to process unstructured full text. This is the repository’s abstraction boundary between protocol content and reviewers; the README notes that the MCP model is currently planned for deeper implementation.
• mcp_interface/protocol_server.py
• mcp_interface/review_tools.py
Multi-Agent Clinical Review
Three role-specific LLM agents independently assess the protocol. Their perspectives divide responsibility across scientific rigor/feasibility/safety (PI), site execution and patient management (site physician), and regulatory, ethics, and data integrity (health authority). Their outputs feed the downstream consolidation and risk stages.
• agents/pi_agent.py
• agents/site_physician_agent.py
• agents/health_authority_agent.py
Risk and Scoring Pipeline
Consolidated agent feedback is interpreted as potential amendment triggers. The risk assessor emits severity—Low, Medium, or High—along with rationale and recommended remediation. The scoring engine converts identified risk severity into an overall numerical protocol score, where higher indicates fewer or less severe issues.
• utils/risk_assessor.py
• utils/scoring_engine.py
External Dependencies and Boundaries
The system runs locally under Streamlit, with Python dependencies defined in requirements.txt. OpenAI is the material external LLM service, configured via OPENAI_API_KEY; LangChain mediates agent/LLM behavior. Uploaded documents cross an ingestion boundary at the document processor, while generated and uploaded protocol text converge before MCP-mediated review.
• requirements.txt
• utils/document_processor.py
• mcp_interface/protocol_server.py
Main entry points: review_tools.py Review tools · streamlit_app.py Streamlit app · protocol_generator.py Protocol generator · pi_agent.py PI reviewer
Components 18
Streamlit workflow
- Streamlit app · User entry point and workflow orchestrator.
streamlit_app.py - Uploaded protocol · PDF, TXT, or Markdown protocol.
- Document processor · Extracts uploaded document text.
utils/document_processor.py - Study parameters
- Review results · Feedback, amendment risk, recommendations, and score.
Protocol generation
- ICH guideline template
templates/ich_templates/ich_template_v1.md - Protocol generator · Drafts a protocol from study parameters and template guidance.
agents/protocol_generator.py
Content access & review
- Protocol text · Generated and uploaded protocols converge here.
- Protocol server · Provides structured protocol content to reviewers.
mcp_interface/protocol_server.py - Review tools · Exposes targeted protocol sections to agents.
mcp_interface/review_tools.py - PI reviewer · Assesses scientific rigor, feasibility, and safety.
agents/pi_agent.py - Site physician reviewer · Assesses site execution and patient management.
agents/site_physician_agent.py - Health authority reviewer · Assesses regulatory, ethics, and data integrity concerns.
agents/health_authority_agent.py
Risk & scoring
- Consolidated feedback
- Risk assessor · Identifies amendment triggers, severity, and remediation.
utils/risk_assessor.py - Scoring engine · Calculates an overall protocol score from risk severity.
utils/scoring_engine.py
Other components
- OpenAI API · Configured through OPENAI_API_KEY.
- Python dependencies · Defines Streamlit, LangChain, and related packages.
requirements.txt
Connections 25
- Streamlit app → Study parameters: collects
- Streamlit app → Uploaded protocol: accepts
- Uploaded protocol → Document processor: ingests
- Document processor → Protocol text: extracts text
- Study parameters → Protocol generator: draft inputs
- ICH guideline template → Protocol generator: guides
- Protocol generator → Protocol text: generates
- Protocol generator → OpenAI API: LLM calls
- Protocol text → Protocol server: structured access
- Protocol server → Review tools: exposes sections
- Review tools → PI reviewer: protocol context
- Review tools → Site physician reviewer: protocol context
- Review tools → Health authority reviewer: protocol context
- PI reviewer → OpenAI API: LLM calls
- Site physician reviewer → OpenAI API: LLM calls
- Health authority reviewer → OpenAI API: LLM calls
- PI reviewer → Consolidated feedback: review findings
- Site physician reviewer → Consolidated feedback: review findings
- Health authority reviewer → Consolidated feedback: review findings
- Consolidated feedback → Risk assessor: assesses triggers
- Risk assessor → Scoring engine: risk severity
- Risk assessor → Review results: risk & remediation
- Scoring engine → Review results: quality score
- Streamlit app → Review results: displays
- Python dependencies → Streamlit app: runtime