Skip to main content

Python package by Stanford University's Snyder Lab for holistic continuous glucose monitoring (CGM) analysis for both patients and researchers.

Project description

Glucose360

A Python package that provides Continuous Glucose Monitoring (CGM) data preprocessing, feature extraction, event detection, and plotting utilities. Whether you're analyzing CGM data for research, clinical insights, or personal projects, this library aims to simplify your workflow.


Table of Contents


Overview

This package simplifies the handling of CGM (Continuous Glucose Monitoring) data by providing:

  1. Preprocessing: Easily clean and structure raw CGM readings.
  2. Feature Extraction: Derive statistical, temporal, or clinically relevant metrics from your CGM data.
  3. Event Detection: Automatically identify significant patterns, such as hypo- or hyperglycemic events or create features around events such as meals.
  4. Plotting: Generate visualizations.

Hosted Web UI

If you prefer not to install anything locally, explore our hosted web application here:
Web App »

⚠️ Important Privacy Notice: The hosted web application is provided for demonstration purposes only. Please DO NOT upload any Protected Health Information (PHI) or personally identifiable medical data to this public instance. We do not store any data on our servers - all processing is done in-memory and data is immediately discarded after your session ends. For processing sensitive health data, we strongly recommend installing and running the package locally in your secure environment.

Use it to upload CGM files, process them on the fly, and visualize key metrics immediately.


Installation

Via pip

pip install glucose360

Visit the PyPI package page for more details.

This is the simplest method to install the package and will automatically handle all dependencies.

From Source

  1. Clone or Download

    git clone https://github.com/vurhd2/Glucose360.git
    

    Or download the repository as a ZIP and unzip it.

  2. Navigate

    cd Glucose360
    
  3. Install Dependencies

    • General library dependencies:
      pip install -r requirements.txt
      
    • If you also want to run the local web application:
      pip install -r app_requirements.txt
      

That's it! You're ready to use the library.


Getting Started

Here's how to start using the package:

import pandas as pd
from preprocessing import *
from features import *
from events import *
from plots import *

# Import and preprocess your data
df = import_data("datasets/")  # Supports .csv, directory of .csvs, or .zip

# Calculate CGM metrics and statistics
metrics = create_features(df)
print("Key Stats:", metrics)

# Get CGM events (e.g., hypo/hyperglycemic episodes)
events = get_curated_events(df)
print("Detected Events:", events)

# Generate visualizations
daily_plot(df)  # Time series plot
AGP_plot(df)  # Ambulatory Glucose Profile

For a more detailed walkthrough, see guide.ipynb.


Using the Local Web Application

  1. Navigate to app.py:

    cd path/to/Glucose360/app
    
  2. Launch the Shiny App:

    shiny run
    
  3. Interact in the Browser:
    Access the provided URL (usually http://127.0.0.1:xxxx) to upload your own data, process it, and visualize results in real time.

  4. Feature Overview:
    See web_app_walkthrough.mp4 for a guided tour.


Documentation

Complete documentation is available on ReadTheDocs:
ReadTheDocs Link


License

This project is licensed under the GNU General Public License v2.0. Feel free to use, modify, and distribute this software under the terms of this license.

MAGE algorithm: Glucose360 reuses iglu's unique implementation of MAGE with only a R->python modification. If you use Glucose360's implementation of MAGE, we ask that you additionally cite the following papers:

Fernandes N, Nguyen N, Chun E, Punjabi N and Gaynanova I (2022) Open-Source Algorithm to Calculate Mean Amplitude of Glycemic Excursions Using Short and Long Moving Averages. Journal of Diabetes Science and Technology, Vol. 16, No. 2, 576-577.

Broll S, Urbanek J, Buchanan D, Chun E, Muschelli J, Punjabi N and Gaynanova I (2021). Interpreting blood glucose data with R package iglu. PLoS One, Vol. 16, No. 4, e0248560.

Chun E, Fernandes JN and Gaynanova I (2024) An Update on the iglu Software for Interpreting Continuous Glucose Monitoring Data. Diabetes Technology and Therapeutics, Vol. 26, No. 12, 939-950.


Other excellent CGM data analysis packages can be found in the following languages:

R: cgmanalysis

R: GLU

R: iglu

Matlab: AGATA

Thanks for using Glucose360!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glucose360-0.0.2.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glucose360-0.0.2-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file glucose360-0.0.2.tar.gz.

File metadata

  • Download URL: glucose360-0.0.2.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for glucose360-0.0.2.tar.gz
Algorithm Hash digest
SHA256 818f128f7070bfcf58ca690b5820fa6d34384e85cb28e2b10ef8cd65836714b2
MD5 1791e72d4a4a7d978a2e4a221626ded1
BLAKE2b-256 b4eb71d8c63dad1a570597e6a31af55042815771d0251dd4df40d520fd35c969

See more details on using hashes here.

File details

Details for the file glucose360-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: glucose360-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for glucose360-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 944e926b20fde77228af6925c98a9d60a10ea1cdfb001b58e13b4d0bd957c4bd
MD5 7a70401a497e08d852e32feb120a7de3
BLAKE2b-256 600a96c8ee20a417bc772908eb05d603e12ade358836ff5f795b4fa70ea2568e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page