# TrialBench: Multi-modal AI-ready Clinical Trial Datasets
[](https://pypi.org/project/trialbench/)
[](https://opensource.org/licenses/MIT)
## 1. Installation
```bash
pip install trialbench
```
## 2. Tasks & Phases
| Supported Tasks | Task Name | Phase Name |
| ---------------------------- | ---------------------------------------------------- | ---------- |
| Mortality Prediction | `mortality_rate`/`mortality_rate_yn` | 1-4 |
| Adverse Event Prediction | `serious_adverse_rate`/`serious_adverse_rate_yn` | 1-4 |
| Patient Retention Prediction | `patient_dropout_rate`/`patient_dropout_rate_yn` | 1-4 |
| Trial Duration Prediction | `duration` | 1-4 |
| Trial Outcome Prediction | `outcome` | 1-4 |
| Trial Failure Analysis | `failure_reason` | 1-4 |
| Dosage Prediction | `dose`/`dose_cls` | All |
### Clinical Trial Phases
```
Phase 1: Safety Evaluation
Phase 2: Efficacy Assessment
Phase 3: Large-scale Testing
Phase 4: Post-marketing Surveillance
```
## 3. Quick Start
### 3.1 Usage of `trialbench`
```python
import trialbench
# Download all datasets at once (optional)
save_path = 'data/'
trialbench.function.download_all_data(save_path)
# Load dataset
task = 'dose'
phase = 'All'
# Load dataloader.Dataloader
train_loader, valid_loader, test_loader, num_classes, tabular_input_dim = trialbench.function.load_data(task, phase, data_format='dl')
# or Load pd.Dataframe
train_df, valid_df, test_df, num_classes, tabular_input_dim = trialbench.function.load_data(task, phase, data_format='df')
```
### 3.2 Attributes of Each Task
Each task provides different feature sets. The Dosage Prediction task returns `nctid_lst`, `smiles_lst`, and `mesh_lst`, while all other tasks provide `nctid_lst`, `icdcode_lst`, `smiles_lst`, `criteria_lst`, `tabular_lst`, `text_lst`, and `mesh_lst`.
All tasks use `label_lst` as the label variable. Please refer to the guide documentation for detailed feature as well as label descriptions.
```python
# Demo for accessing data elements
task = 'dose'
phase = 'All'
# When using DataLoader objects:
# Features
nctid_list = train_loader.dataset.nctid_lst
smiles_list = train_loader.dataset.smiles_lst
mesh_list = train_loader.dataset.mesh_lst
# Labels
# return [datatset_name, label_max, label_min, label_avg], e.g. ['NCT03422510', 2, 2, 2]
label_list = train_loader.dataset.label_lst
# When using DataFrames:
# Features
nctid_list = train_df.nctid_lst
smiles_list = train_df.smiles_lst
mesh_list = train_df.mesh_lst
# Labels
label_list = train_df.label_lst
```
## 4. Data Loading
### `load_data` Parameters
| Parameter | Type | Description |
| --------------- | ---- | -------------------------------------------------------- |
| `task` | str | Target prediction task (e.g., 'mortality_rate_yn') |
| `phase` | int | Clinical trial phase (1-4) |
| `data_format` | str | Data format ('dl' for Dataloader, 'df' for pd.DataFrame) |
## 5. Citation
If you use TrialBench in your research, please cite:
```bibtex
@article{chen2024trialbench,
title={Trialbench: Multi-modal artificial intelligence-ready clinical trial datasets},
author={Chen, Jintai and Hu, Yaojun and Wang, Yue and Lu, Yingzhou and Cao, Xu and Lin, Miao and Xu, Hongxia and Wu, Jian and Xiao, Cao and Sun, Jimeng and others},
journal={arXiv preprint arXiv:2407.00631},
year={2024}
}
```
Metadata
Release files for trialbench 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trialbench-0.3.2.tar.gz | 1.4 MB | Without provenance | Details for trialbench-0.3.2.tar.gz |
Release files / trialbench-0.3.2.tar.gz
| Download URL | trialbench-0.3.2.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
210d600abea964473bac6ef0cf3c78bee6e2a84a561107fab42e840bd2f3c4c8
|
|
BLAKE2b-256 checksum How to use checksums |
6ce750f1ba8044f28b4801ab2b88930a483fa17ca9532a38a32c60a3ceb63653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for trialbench 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.