How triallab/emulatrx works
EmulatRx turns a natural-language or registered clinical-trial protocol into structured trial components, maps eligibility and treatment information onto real-world data, constructs a cohort, and supports causal and survival analyses. The documented entry point is the notebook; its coordination details are not sampled, so agent handoffs are based on the README. The graph also preserves the model registry/RLHF and concept-mapping capabilities. Source excerpts show trial parsing, LLM calls, data preparation, and concept lookup; unsampled implementation links are omitted or marked unverified.
Main entry points: main.py Trial parser · v1-codebase.ipynb Workflow coordinator · llm_zoo_rlhf.py LLM registry · dataframe_utils.py Informatician
Components 20
Trial workflow
- Workflow coordinator
v1-codebase.ipynb
Trial parsing
- Trial parser
trialistUtils/main.py - Extraction prompts
trialistUtils/prompts.py - Trial data classes
trialistUtils/trial_classes.py - NLP utilities
trialistUtils/nlp_utils.py - Concept lookup
trialistUtils/web_utils.py - Parse helpers
trialistUtils/trialutils.py - Trial type definitions
trialist_utils.py - Trial OpenAI client
trialistUtils/openai_client.py - Clinical concept parsing
trialistUtils/parse_info.py
Real-world data
- Informatician
dataframe_utils.py - Cohort construction
dataframe_utils.py - Causal and survival analysis
emulation_utils.py - Trial artifacts
trials
Models and feedback
- LLM registry
llm_zoo_rlhf.py - Human feedback and reward
llm_zoo_rlhf.py
Other components
- Researcher
- ClinicalTrials.gov
- MIMIC/OMOP database
- LLM backends
Connections 22
- Researcher → Workflow coordinator: runs emulation
README.md - Workflow coordinator → Trial parser: coordinates parsing
README.md - Workflow coordinator → Informatician: coordinates cohorting
README.md - Workflow coordinator → Causal and survival analysis: coordinates analysis
README.md - Workflow coordinator → LLM registry: selects models
README.md - Trial parser → Extraction prompts: uses prompts
trialistUtils/main.py - Trial parser → Trial data classes: builds trial data
trialistUtils/main.py - Trial parser → Parse helpers: extracts JSON
trialistUtils/main.py - Trial parser → Trial OpenAI client: requests completions
trialistUtils/main.py - Trial parser → ClinicalTrials.gov: fetches trial records
README.md - NLP utilities → Concept lookup: looks up concepts
trialistUtils/nlp_utils.py - Trial parser → NLP utilities: parses concepts
trialistUtils/main.py - Clinical concept parsing → ClinicalTrials.gov: uses trial data
- Clinical concept parsing → Concept lookup: maps concepts
- LLM registry → LLM backends: calls models
README.md - LLM registry → Human feedback and reward: supports feedback
llm_zoo_rlhf.py - Informatician → LLM registry: generates SQL
dataframe_utils.py - Informatician → Cohort construction: builds cohorts
README.md - Cohort construction → MIMIC/OMOP database: queries data
dataframe_utils.py - Cohort construction → Trial artifacts: writes outputs
README.md - Causal and survival analysis → Trial artifacts: uses trial data
README.md - Workflow coordinator → Trial type definitions: uses trial types