Skip to content

Developing better equations for insulin pump therapy setting initialization

License

Notifications You must be signed in to change notification settings

novalegra/jaeb-equations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jaeb Data Equation Exploration

-- Project Status: Complete

-- Project Disclaimer: This work is for exploration

Project Objective

The purpose of this project is to create equations based on Jaeb study data that can assist with determining initial Loop settings.

Definition of Done

This phase of the project will be done when equations have been created for basal rate, carb ratio, and insulin sensitivity factor.

Project Description

This project first uses Jaeb study data to create an 'aspirational' cohort of subjects that have normal BMI, meet the international consensus on time in range (≥90% CGM), and have bolus and carbohydrate data available. This is done in create_dataset.py, annotate_with_days_carbs.py and process_data_for_fitting.py.

The project then uses 70% of the aspirational data to fit the different equation form combinations of BMI, daily CHO, and TDD for basal rate, ISF, and ICR. A 5-fold cross-validation is used to compute value loss. This is done in create_equations.py.

Finally, the project uses the remaining reserved 30% of the aspirational data to evaluate the final equations. This is done in test_final_equations_with_reserved_data.py.

Technologies

  • Python
  • Anaconda for our virtual environments
  • Pandas for working with data
  • Black for code style
  • Numpy docstring format

Getting Started with the Conda Virtual Environment

  1. Install Miniconda. CAUTION for python virtual env users: Anaconda will automatically update your .bash_profile so that conda is launched automatically when you open a terminal. You can deactivate with the command conda deactivate or you can edit your bash_profile.
  2. If you are new to Anaconda check out their getting started docs.
  3. If you want the pre-commit githooks to install automatically, then following these directions.
  4. Clone this repo (for help see this tutorial).
  5. In a terminal, navigate to the directory where you cloned this repo.
  6. Run conda update -n base -c defaults conda to update to the latest version of conda
  7. Run conda env create -f conda-environment.yml --name [input-your-env-name-here]. This will download all of the package dependencies and install them in a conda (python) virtual environment. (Insert your conda env name in the brackets. Do not include the brackets)
  8. Run conda env list to get a list of conda environments and select the environment that was created from the environmental.yml file (hint: environment name is at the top of the file)
  9. Run conda activate <conda-env-name> or source activate <conda-env-name> to start the environment.
  10. If you did not setup your global git-template to automatically install the pre-commit githooks, then run pre-commit install to enable the githooks.
  11. Run deactivate to stop the environment.

Maintaining Compatability with venv and virtualenv

This may seem counterintuitive, but when you are loading new packages into your conda virtual environment, load them in using pip, and export your environment using pip-chill > requirements.txt. We take this approach to make our code compatible with people that prefer to use venv or virtualenv. This may also make it easier to convert existing packages into pypi packages. We only install packages directly in conda using the conda-environment.yml file when packages are not available via pip (e.g., R and plotly-orca).

Getting Started with this project

  1. The data was obtained from the Jaeb observational study
  2. Data processing/transformation scripts are being kept in the src folder of this repo.

About

Developing better equations for insulin pump therapy setting initialization

Resources

License

Stars

Watchers

Forks

Languages