Package: clinical-benchmarks
clinical-benchmarksA comprehensive set of clinical benchmarksInstallation(Recommended)Create thebenchmarkenvironment:conda env create -f environment.ymlPip install:pip install clinical_benchmarksUsageRegenerate data filesIf 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 thePython Client for Google BigQuery, setup requires you to:Select or create a Cloud Platform project.Enable billing for your project.Enable the Google Cloud BigQuery API.Setup Authentication.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:exportGCP_PROJECT='MY-GCP-PROJECT'exportBQ_DATASET='MY-BIGQUERY-DATASET'exportGCS_BUCKET='MY-STORAGE-BUCKET'exportMODEL_DIR='MY-SAVE-DIR'clinical_benchmarksdownloadIf you are not a Linux/MacOS userAlternatively, you can specify the values at the command line:clinical_benchmarks--csv_dirMY-SAVE-DIRdownload--projectMY-GCP-PROJECT--datasetMY-BIGQUERY-DATASET--bucketMY-STORAGE-BUCKETIf you prefer to mannually regenerate the data files
Check the data_pipeline.ipynb which prepared runnable cells to download data filesCreate task dependent datasetsAvailable 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_dfandsave_task_df. (detail see task.py)Procedure of creating task datasets(check data_pipeline.ipynb for runnable example)Modify theenvironment_config.envfile with your own environment variablesImport necessary packages and usedotenvto loadenvironment_config.envimportdotenvenv_file='path_to_environment.env'dotenv.load_dotenv(env_file,override=True)Choose a task, such as Vancomycin dosing prediction.Create the task object.vanco=VancomycinDosingDataProcessor()Create task dataframe by calling methodcreate_task_df. This method require two arguments,time_stepandagg.time_stepdetermines the time interval (hourly based) between each state, andaggdetermines the aggregation method that will be used during dataframe merging process, such as "last".time_step=4agg='last'vanco.create_task_df(time_step,agg)# featured_cohort_with_time is the outcome task_dfdisplay(vanco.featured_cohort_with_time)Save the task dataframe created in step 5 to a given directory by calling methodsave_task_df. This method require two arguments,csv_dirandfilename.csv_dirneeds to be a Path object, which specify the directory you would like to save the task_df, andfilenameis 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 filevanco.save_task_df(save_dir,filename)Check your saving directory, and try it with your model!