Skip to main content

clinical-benchmarks

A comprehensive set of clinical benchmarks

Installation

  • (Recommended) Create the benchmark environment: conda env create -f environment.yml
  • Pip install: pip install clinical_benchmarks

Usage

Regenerate data files

If you'd like to regenerate the data files from the source datasets, you'll need to have a Google Cloud Platform (GCP) account, BigQuery dataset, and GCS storage bucket prepared. These are used to (1) create intermediate tables, (2) copy those tables out of BigQuery to GCS, and finally (3) download the tables locally.

As described by the Python Client for Google BigQuery, setup requires you to:

Once you have GCP project, have created a BigQuery dataset, and have created a GCP storage bucket, you can use environment variables to specify them when running the download script:

export GCP_PROJECT='MY-GCP-PROJECT'
export BQ_DATASET='MY-BIGQUERY-DATASET'
export GCS_BUCKET='MY-STORAGE-BUCKET'
export MODEL_DIR='MY-SAVE-DIR'
clinical_benchmarks download

If you are not a Linux/MacOS user Alternatively, you can specify the values at the command line:

clinical_benchmarks --csv_dir MY-SAVE-DIR download --project MY-GCP-PROJECT --dataset MY-BIGQUERY-DATASET --bucket MY-STORAGE-BUCKET

If you prefer to mannually regenerate the data files Check the data_pipeline.ipynb which prepared runnable cells to download data files

Create task dependent datasets

Available Tasks

- Vancoymydin Dosing Prediction (Reinforcement Learning)
- Heparin Dosing Prediction (Reinforcement Learning)

All tasks are designed as data processing class, inherited from the BaseDataProcessor class. Each task class has two methods, create_task_df and save_task_df. (detail see task.py)

Procedure of creating task datasets

(check data_pipeline.ipynb for runnable example)

  1. Modify the environment_config.env file with your own environment variables
  2. Import necessary packages and use dotenv to load environment_config.env
    import dotenv
    env_file = 'path_to_environment.env'
    dotenv.load_dotenv(env_file, override=True)
    
  3. Choose a task, such as Vancomycin dosing prediction.
  4. Create the task object.
    vanco = VancomycinDosingDataProcessor()
    
  5. Create task dataframe by calling method create_task_df. This method require two arguments, time_step and agg. time_step determines the time interval (hourly based) between each state, and agg determines the aggregation method that will be used during dataframe merging process, such as "last".
    time_step = 4
    agg = 'last'
    vanco.create_task_df(time_step, agg)
    # featured_cohort_with_time is the outcome task_df
    display(vanco.featured_cohort_with_time)
    
  6. Save the task dataframe created in step 5 to a given directory by calling method save_task_df. This method require two arguments, csv_dir and filename. csv_dir needs to be a Path object, which specify the directory you would like to save the task_df, and filename is a str that represent the output file name (the filename must has a .csv.gz extension).
    csv_dir = Path('YOUR_SAVE_DIR')
    filename = 'vancomycin_dosing_task.csv.gz'
    # will save vanco.featured_cohort_with_time as a .csv.gz file
    vanco.save_task_df(save_dir, filename)
    
  7. Check your saving directory, and try it with your model!

Release files for clinical-benchmarks 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clinical-benchmarks 1.0.0
File Size Uploaded
clinical_benchmarks-1.0.0.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clinical-benchmarks 1.0.0
File Interpreter ABI Platform
clinical_benchmarks-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.9 kB

Release files / clinical_benchmarks-1.0.0.tar.gz

Download URL clinical_benchmarks-1.0.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3087ae220b823d690dc1ed5f5713112784f5882512d9b281e6e5f9e66acb8aed
BLAKE2b-256 checksum
How to use checksums
633995086339770c82752ee72ca014c6df2020c69727e6e09e0062be34a8acaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release files / clinical_benchmarks-1.0.0-py3-none-any.whl

Download URL clinical_benchmarks-1.0.0-py3-none-any.whl
Size 32.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d10ffda97da7d144452fc91638f3442d1effeedec8a6b2a9aa41ce7aea875653
BLAKE2b-256 checksum
How to use checksums
0b1c31b10503b1c071cbf6daf165c27d2616cab66a15b03db9d6affe9a55ab55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page