Skip to main content

Glyco - Analysing Continuous Glucose Data in Python

|   Overview   | Examples |

Glyco is a glucose data analysis Python library for glucose data analysis.

  • Easy to setup: you can get started with glyco very fast. You can checkout the Get started notebook for more.

  • Easy to integrate: if you already have a workflow where you analyse glucose data. Glyco applies methods to pandas DataFrames, making it easy to integrate.

  • Targeted for all kinds of glucose data: Glyco even handles glucose data for healthy individuals. Most of the metrics in CGM data are built based on CGM data for people with diabetes. This renders a lot of them useless when performing data analysis on healthy individuals (such as comparing the impact of meals and activities). Glyco has features to handle all types of glucose data, from all types of devices.

Quick Example:

import glyco as gl
# Read glucose file
df = gl.read_csv('examples/sample_glucose.csv')
# Plot glucose hourly trend
gl.plot_trend_by_hour(df)

image

The easiest library to manipulate glucose data

Glyco does not add any more complexity.

If you are familiar with pandas dataframes, glyco makes use of pandas dataframe and does not introduce any new concepts or abstractions.

This makes it easy to use and integrate with your current workflows. Reading your glucose file into a dataframe in glyco is as easy as:

import glyco as gl

glucose = gl.read_csv(file_path='my_glucose_data.csv')

This returns a glucose dataframe, takes care of: pre-processing the timestamps and dates, cleaning missing data, making the curve smoother and converting units.

What you can do with Glyco

Glyco provides a range of features for handling continuous glucose data, as shown in the figure below: image image

  1. Read and Write glucose data Glyco handles data from different sources including CSV files (such as FreeStyleLibre or DexCom) and dataframes, and using this data is as simple as:

    glucose = gl.read_csv(file_path='my_glucose_data.csv')
    

    You can find more in the glucose documentation.

  2. Clean and Process glucose data you do not need to worry about missing values, errors and outliers. Glyco handles different types of cleaning and processing, so you can focus on analysing the data.

  3. Plotting and visual analysis (EDA) to easily explore glucose data, and aid you in understanding patterns and trends.

    gl.plot_glucose(glucose) # Where 'glucose' is the dataframe containing glucose
    gl.plot_trend_by_weekday(glucose)
    gl.plot_trend_by_hour(glucose)
    
  4. Calculate metrics and statistics for each day, or week. These metrics are targeted for analysing healthy individual data (not diagnosed with diabetes). These metrics range from general statistics (mean, percentiles etc.) to more advanced metrics (area under the curve for a day). And it's as simple as:

    # get metrics for each day
    day_metrics = gl.get_metrics_by_day(glucose)
    day_metrics = gl.get_metrics_by_day(glucose)
    

    Which results in a dataframe containing metrics such as: mean glucose, maximum glucose, standard deviation, area under the curve and more. To learn more about metrics, feel free to look at the metrics documentation.

Most inputs and outputs in Glyco are pandas dataframes. This means that you can use features of pandas on along with the ones provided by glyco.

More things you can do with glyco

Glyco can also aid you in more advanced tasks such as detecting meals, comparing the impact of different meals or activities or any type of event. image image

  1. Automatically infer Meals, or activities, or other events that impact glucose.

    # you can detect events from variations in glucose
    events = gl.get_events_from_variations(glucose)
    

    Different methods are used for infering events. More on this in the meals and events documentation.

  2. Provide events and match them to the glucose data and analyse them to see how they impact glucose.

    # you can provide a list or dataframe that contains the event times
    events = gl.get_events(event_times)
    

    You can even get the events from a folder of pictures. More on this in the meals and events documentation).

  3. Advanced analysis of events, including metrics for meals or events and how they impact glucose. As well as ranking meals and more, to further aid in understanding the glucose data.

  4. On Privacy and Personally Identifieable Information Glyco also enables making the glucose data more private by hiding sensitive information

    # you can set the 'mask_private_info' to true
    anonymised_df = gl.read_csv(
        file_path='my_glucose_data.csv',
        mask_private_info=True
        )
    

    The mask_private_info masks private information by: resetting the minimum datetime, removing specific columns (such as the device serial number), replacing categorical columns using a hash function and adding noise to the glucose data.

    More details on how to use the privacy feature in the privacy documentation here.

Limitations

  • The metric calculations for days assumes the device timezone is the user's timezone.

Disclaimer Glyco is not a medical product and shall not be used to diagnose, treat or evaluate any medical conditions. For more on the intended use and indications of use please read the healthcare considerations document.

Built on the shoulders of giants

Glyco is built using the following libraries:

  • Pandas and Numpy.
  • Matplotlib and Seaborn.
  • Rich for beautiful text displays.

Contact the author here

Metadata

Release files for glyco 0.0.1

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

Source distribution (sdist)

Source distribution for glyco 0.0.1
File Size Uploaded
glyco-0.0.1.tar.gz 42.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for glyco 0.0.1
File Interpreter ABI Platform
glyco-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 80.1 kB

Release files / glyco-0.0.1.tar.gz

Download URL glyco-0.0.1.tar.gz
Size 42.1 kB
Tags Source
SHA-256 checksum
How to use checksums
15bf82ee51544c8dafae2ab8d585e1592e6a88b272e554954dc1899b2e5e12f7
BLAKE2b-256 checksum
How to use checksums
4d262e8e1af088cb799915296312daa564da8e0bf9cfc92ba78c2af5df9e1a4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / glyco-0.0.1-py3-none-any.whl

Download URL glyco-0.0.1-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c39db4a504d6f97de342108efa54e97fa787ef6f48653e6f97a96b4dcf7c4e7
BLAKE2b-256 checksum
How to use checksums
ac258fec54cf50bccc2d70b0a95f2679dfdd50af92aba3c5fa36f4f79d7e7893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2
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