TrialMatchAI is an AI-driven system for matching patients to relevant clinical trials. It combines retrieval (BM25/vector search), NLP, and LLM-based reasoning to produce transparent, ranked trial recommendations.
This software is provided for research and informational purposes only. It is not medical advice and must not replace consultation with qualified healthcare professionals.
- AI-powered matching of patient profiles to clinical trial eligibility criteria.
- Two-stage retrieval (BM25 + vector) with optional reranking.
- Explainable recommendations and criterion-level insights.
- Scalable Elasticsearch-backed indexing.
- Modular pipelines for indexing, retrieval, and reasoning.
- OS: Linux or macOS
- Python: 3.8+
- Java: required for NER/normalization components
- Elasticsearch: Docker Compose or Apptainer
- GPU: NVIDIA gpu with at least 40 GB of VRAM is recommended for large-scale processing
- Disk space: 100 GB+ for datasets and indices
- Install dependencies
uv sync- Ensure Elasticsearch credentials are configured
- If using Apptainer, set
ELASTIC_PASSWORDinelasticsearch/.env. - For the runtime pipeline, set
TRIALMATCHAI_ES_PASSWORDin your environment.
- Start Elasticsearch (auto-start supported)
trialmatchai-healthcheck --config Matcher/config/config.json --start-es- Run the pipeline
python -m Matcher.mainResults are written under results/.
You can run the all-in-one bootstrap script:
./setup.shOr run steps individually:
bash scripts/bootstrap_data.sh
bash scripts/start_es.sh
bash scripts/index_data.shpip install -e .Use environment variables or a .env file to override defaults:
# Elasticsearch
TRIALMATCHAI_ES_HOST=https://localhost:9200
TRIALMATCHAI_ES_USERNAME=elastic
TRIALMATCHAI_ES_PASSWORD=YourNewPassword
TRIALMATCHAI_ES_AUTO_START=true
TRIALMATCHAI_ES_START_SCRIPT=elasticsearch/apptainer-run-es.sh
TRIALMATCHAI_ES_START_TIMEOUT=600
# Embedder
TRIALMATCHAI_EMBEDDER_MODEL_NAME=BAAI/bge-m3
# Logging
TRIALMATCHAI_LOG_LEVEL=INFO
TRIALMATCHAI_LOG_JSON=0Note: Matcher/config/config.json ships with a placeholder password (CHANGE_ME). Use env vars for production.
trialmatchai-healthcheck --config Matcher/config/config.json --start-esuv run pytestIntegration tests (requires running ES):
TRIALMATCHAI_RUN_INTEGRATION=1 pytest -m integrationWe welcome contributions. Please open an issue or submit a PR with tests.
