How rupalhpatel9/biosimilar-switch-agent works
SwitchDossier researches a proposed generic or biosimilar switch and produces a cited draft dossier for pharmacist review. The principal workflow is a question through the web/API, orchestrated research, evidence retrieval and extraction, verification, code-based scoring and synthesis, then review and sign-off. The README documents the agent handoffs and capabilities; source excerpts and the index corroborate selected internal calls. Some subsystem details are documented but unsampled, so those links are cited to the README rather than presented as inspected implementation.
Main entry points: agent.py Orchestrator · server.py Web and API · synth_pipeline.py Dossier synthesizer · pipeline.py Study extraction
Components 23
Research workflow
- Web and API
switchagent/server.py - Orchestrator
switchagent/orchestrator/agent.py - Run session
switchagent/orchestrator/session.py - Drug resolver
switchagent/resolver.py
Evidence pipeline
- Hybrid retrieval
switchagent/search.py - Embedding and reranking
switchagent/embed.py - Evidence ingestion
switchagent/ingest.py - Evidence sources
switchagent/sources - Study extraction
switchagent/extract/pipeline.py - Structured extractor
switchagent/extract/extractor.py
Decision support
- Patient-fit screener
switchagent/screener/screen.py - Cost and timing
switchagent/calculator/savings.py - State substitution rules
switchagent/calculator/state_rules.py - Dossier synthesizer
switchagent/synthesizer/synth_pipeline.py - Strategy tree
switchagent/synthesizer/beam.py - Dossier writer
switchagent/synthesizer/writer.py
Review and trust
- Claim verifier
switchagent/verify/judge.py - Verification checks
switchagent/verify/checks.py - Guardrails and sign-off
switchagent/guardrails
Persistence
- Dossier history
switchagent/memory/history.py - Postgres evidence store
switchagent/db.py - Read-only MCP access
switchagent/memory/mcp_server.py
Other components
- Pharmacist
Connections 24
- Pharmacist → Web and API: asks question
README.md - Web and API → Orchestrator: starts research
README.md - Orchestrator → Drug resolver: resolves drug
README.md - Orchestrator → Hybrid retrieval: searches evidence
README.md - Orchestrator → Study extraction: requests extraction
README.md - Orchestrator → Cost and timing: computes scenarios
README.md - Orchestrator → State substitution rules: checks rules
README.md - Web and API → Run session: manages run
switchagent/server.py - Hybrid retrieval → Embedding and reranking: reranks results
switchagent/search.py - Evidence ingestion → Evidence sources: loads evidence
switchagent/ingest.py - Study extraction → Hybrid retrieval: searches studies
switchagent/extract/pipeline.py - Study extraction → Structured extractor: extracts fields
switchagent/extract/pipeline.py - Study extraction → Claim verifier: verifies claims
switchagent/extract/pipeline.py - Claim verifier → Verification checks: checks claims
switchagent/verify/judge.py - Dossier synthesizer → Strategy tree: builds strategy
switchagent/synthesizer/synth_pipeline.py - Dossier synthesizer → Dossier writer: writes dossier
README.md - Dossier synthesizer → Patient-fit screener: screens patient fit
switchagent/synthesizer/synth_pipeline.py - Dossier synthesizer → Cost and timing: uses code figures
README.md - Web and API → Guardrails and sign-off: applies safeguards
README.md - Pharmacist → Web and API: reviews and signs
README.md - Run session → Postgres evidence store: stores run state
switchagent/orchestrator/session.py - Dossier history → Postgres evidence store: reads history
switchagent/memory/history.py - Read-only MCP access → Dossier history: exposes dossiers
README.md - Hybrid retrieval → Postgres evidence store: queries evidence
switchagent/search.py