Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2025 Nov 6.
Published in final edited form as: Diabetes Technol Ther. 2026 Feb 1;28(2):130–141. doi: 10.1177/15209156251374711

Glucose360: An Open-Source Python Platform with Event-Based Integration for Continuous Glucose Monitoring Data Analysis

Ben Ehlert 1,*, Dhruv Aron 2,3,*, Dalia Perelman 2,4, Yue Wu 2,3, Michael P Snyder 2,3,5
PMCID: PMC12588377  NIHMSID: NIHMS2120332  PMID: 40900178

Abstract

Background and Aims:

Continuous glucose monitoring (CGM) devices provide real-time actionable data on blood glucose levels, making them essential tools for effective glucose management. Integrating blood glucose data with food log data is crucial for understanding how dietary choices impact glucose levels. Despite their utility, many CGM applications lack integration with other external services, such as food trackers, and do not generate useful glycemic variability metrics or advanced visualizations. Existing solutions vary in functionality: some are proprietary, many require additional user programming or custom preprocessing to meet diverse research needs, and few have created solutions to connect CGM data with external services. Recent reviews highlight gaps such as insufficient postprandial analytics, absence of composite indices, and inadequate tools for non-technical users.

Methods:

Glucose360 and commonly used alternative CGM applications and tools were compared by calculating glycemic variability metrics on sixty participant datasets and by contrasting their general applications for research workflows.

Results:

To address limitations, we developed Glucose360, featuring:

  1. An open-source python framework for event-based CGM data integration and analysis,

  2. Automated calculation of glucose metrics specific for meals and exercise events and other short-interval events,

  3. A user-friendly web application, designed for users with minimal programming experience and accessible at vurhd2.shinyapps.io/glucose360/.

Discussion:

Overall, Glucose360 provides a holistic analysis pipeline that is useful for both individuals and researchers to track and analyze CGM data. The source code for Glucose360 can be found at github.com/vurhd2/Glucose360.

Keywords: Continuous Glucose Monitoring, Glycemic Variability, Open-Source Software, Python Package, Glucose Data Analysis, Glucose Lifestyle Management

Introduction

Continuous glucose monitoring (CGM) devices have emerged as a valuable novel technology for helping people with diabetes, healthcare professionals, and researchers manage most forms of diabetes due to their ability to accurately monitor one’s blood glucose levels in real-time1. CGM devices not only track glucose levels but also have the potential to facilitate behavior change24 and personalize nutrition5. Professionals and researchers generally convert CGM data into glycemic variability (GV) metrics and visual reports to better analyze participants’ diabetes-related medications, health and lifestyle. Additionally, CGM devices enable individuals to share relevant data with professionals and to be more aware of hypo- or hyperglycemia events6. CGM devices have also been useful in identifying glycemic irregularities in participants from normoglycemic and pre-diabetic populations79, who frequently utilize CGM in combination with external applications not intrinsic to their CGM devices (such as meal logging app Cronometer) to learn more about their glucose responses and manage them better through lifestyle factors. However, open-source facile pipelines to overlay, generate, and deliver valuable insights from synchronized external and CGM data to various stakeholders such as users, researchers, and healthcare professionals without necessitating prior experience in data analytics or programming have not been developed10,11.

Recent comprehensive reviews have identified several limitations of existing CGM software packages, including lack of integration with external applications, limited user-friendly interfaces, and gaps in available glucose variability metrics and visualization capabilities10,11. Despite the availability of tools such as Microsoft Excel workbook EasyGV12, International Diabetes Center’s (IDC) Ambulatory Glucose Profile Report (AGP)13,14, Tidepool15, R packages CGMAnalyzer16, cgmanalysis17, and iglu18, MATLAB package/toolbox AGATA19, and Python package cgmquantify20 (See Supplementary Table 1 and Supplementary Table 2), these limitations persist. Although useful, the many applications and websites for CGM devices do not directly integrate with other relevant devices or applications (e.g. Cronometer), hampering the ability to compare the CGM data side-by-side with meal data for users with lesser technical experiences, for example.

Additionally, most CGM portals from device manufacturers often do not support plots other than time-series and Ambulatory-Glucose-Profile (AGP)13,21,22 or calculate GV metrics such as the mean amplitude of glycemic excursions (MAGE). In addition, the Python programming language is increasingly integral to machine learning and artificial intelligence purposes and is commonly used among those research communities.23 However, there are currently no open-source CGM tools in Python that support all clinician consensus-recommended glucose metrics10,11,21,24. Also, a GUI would be most helpful for users with minimal prior programming experience to integrate event data such as meals with CGM data11.

More generally, these existing tools are built primarily for people with diabetes that are insulin dependent (typically type 1 or type 2 diabetes) and for those who manage their glucose levels through medications. This results in most available features summarizing key metrics using solely all of the CGM data, and thus does not provide functionality to analyze glucose levels around specific meal or exercise times that would allow people from all populations to engage in lifestyle and preventative therapy10,11. This functionality would be particularly useful for people from normo-glycemic and pre-diabetic populations who maintain their health through lifestyle factors instead of medication. With CGMs now increasingly becoming available, including over the counter, it is even more crucial that users of all backgrounds have access to these features, particularly in the form of a free, open-source, and easy-to-use tool.

Built with capabilities for connecting with data from external services and applications, we introduce Glucose360 to fill the gap of an open-source Python CGM package designed to enable extensive glucose data analysis for both researchers and casual users from all glycemic backgrounds. Glucose360 is completely free and open-source, with source code and a beginner guide hosted online at GitHub (github.com/vurhd2/Glucose360), package installation available on the Python Packaging Index (pypi.org/project/glucose360), and a free wrapper web application hosted online at vurhd2.shinyapps.io/glucose360/.

Methods

Reading and Preprocessing Data

Glucose360 currently supports importing CGM data that follows the Dexcom CGM manufacturer and FreeStyle Libre’s CSV file formats, which generally include two columns for timestamps (in a DateTime format) and glucose values (in mg/dL); thus, data from Dexcom and FreeStyle Libre CGM devices are instantly compatible with the package, though files from other manufacturers would have to be reformatted to follow Dexcom and FreeStyle Libre guidelines or otherwise be manually imported as per Glucose360 guidelines. Glucose360 employs two main Python libraries for efficient computation and data manipulation, NumPy25 and Pandas26, respectively.

When passed a file path to a CSV file or a directory/zip file containing properly formatted CSV files with CGM data, the preprocessing pipeline will resample the data within the given CSV files, interpolate possible missing values within the data, parse the appropriate identifications for each dataset, and output a single Pandas DataFrame containing the id’s, timestamps, and glucose values for all participants in the directory (see Fig. 1a). Within the resampling process, timestamps are generated in evenly spaced user-specified intervals (five minutes by default) starting from the timestamp of the very first data point in the dataset. The glucose values for each of these timestamps are then linearly interpolated using the closest existing glucose values, essentially estimating what the participant’s blood glucose levels would have been at this exact timestamp. In order to prevent extrapolation, however, only points within inner gaps that have a duration less than the user-specified maximum length (thirty minutes by default) will be interpolated. Thus, all missing values at the start and end of the dataset are dropped, and, if the maximum gap is set to thirty minutes, for example, no values within gaps longer than thirty minutes would be interpolated. Also, all ‘Low’s and ‘High’s within the glucose column are converted to 40 mg/dL and 400 mg/dL, respectively, and columns chunking each data point into sleeping/waking hours and weekday/weekend are added to help users subset their data.

Figure 1. Workflow of Package.

Figure 1.

a Preprocessing pipeline to convert raw imported CGM data into a data structure to use throughout the package. b General workflow for the package’s three primary components after preprocessing: features, creating events through the event-based framework, and plots. The dotted black arrows near the bottom indicate where ‘events’ within the package can be used for extra functionality.

At the end of this process, each dataset is assigned an identification (id) to properly differentiate each participant’s data within the single returned DataFrame, and also to help connect the preprocessed datasets with other imported data types (such as events indicating Cronometer meals). By default, the id is a concatenation of the first and last name given within each CSV file; however, users can pass in text indicating a different way of combining the first and last name, or even pass a regular expression dictating how to parse the CSV file names to retrieve the intended id. With this in mind, the returned Pandas DataFrame is multi-indexed: it contains the relevant columns and preprocessed information for all of the participants in the directory, though users can also specifically index into only one participant’s data using their respective id. Also, due to all the data being stored within the standard Pandas DataFrame class, all NumPy and Pandas methods will work seamlessly on this data structure. Note that other CGM data analysis packages implement their own preprocessing pipelines, without consensus on the best method1719,27.

Event-Based Framework

All events share the same structure: an exact timestamp of when the event occurred, the number of minutes before and after this timestamp to be observed, the ‘type’ of event it is, and a description containing any further relevant details about this event. Through this format, different events such as meals and exercise are standardized and can be used through many of the same functions (as mentioned below). With this in mind, users can manually create events through Pandas, or bulk import them by passing in CSV files (see Fig. 1b). As an example use case, users can export data from Cronometer into CSV files, and then directly import those into events within the package.

Glucose360 provides multiple functions that act on events. With a DataFrame containing CGM data and another containing relevant events, the retrieve_event_data() function will return a filtered DataFrame that contains only the CGM data points that occurred during the supplied events. Also, the event_metrics() function will return metrics such as area under curve (AUC), baseline, peak, and slope for a given event, while the create_event_features() function will return aggregate metrics such as average AUC for multiple given events. Finally, events can also be passed to provided daily and event plots in order to render them visually (see Visualizations section below).

Features

Users have access to around sixty-six functions and eighty-four functionalities, including various summary statistics and measures of glycemic variability (see Table 1). To calculate any of the metrics, users have two main options; the create_features() and create_event_features() functions will return a Pandas DataFrame with each participant in the directory corresponding to one row, and each column corresponding to one metric. In essence, the returned DataFrame will contain all available metric computations for all available participants. Alternatively, if the user decides to calculate only one (non-event) metric for one participant, they can opt to index into a specific participant’s data and then run one of the individual metric functions (see Table 1).

Table 1. List of Provided Functionality Within Glucose360.

The left column lists general categories of functionality that Glucose360 offers. The right column indicates the specific functionalities implemented within each category by Glucose360.

Category Functionalities
Summary Statistics eA1c42,43, Fasting Blood Glucose (FBG)44, First Quartile, Glucose Management Indicator (GMI)42, Lowest Sleeping Blood Glucose44, Maximum, Mean, Mean 24-hour Area Under Curve44, Mean 24-hour Blood Glucose, Mean Sleeping Blood Glucose44, Mean Waking Blood Glucose44, Minimum, Sleeping Area Under Curve44, Third Quartile, Waking Area Under Curve44
Variability Metrics Coefficient of Variation (CV)45, Continuous Overall Net Glycemic Action (CONGA)46, Glucose Variability Percentage (GVP)47, Mean Absolute Differences, Mean Absolute Glucose (MAG)48, Mean Amplitude of Glycemic Excursions (MAGE)2832, Mean Difference Between Glucose Values Obtained at the Same Time of Day (MODD)29,49, Median Absolute Deviation, Standard Deviation21
Risk and Composite Indices Average Daily Risk Range (ADRR)50, Blood Glucose Risk Index (BGRI)45,51, Continuous Glucose Monitoring Index (COGI)52, Comprehensive Glucose Pentagon-Area53, Comprehensive Glucose Pentagon-Glycemic Risk Parameter53, Glucose Pentagon-Area54, Glucose Pentagon-Glycemic Risk Parameter54, Glycemia Risk Index (GRI)55, Absolute Glycaemic Risk Assessment Diabetes Equation (GRADE)5658, %GRADE (euglycemic)5658, GRADE Absolute (euglycemic)5658, %GRADE (hyperglycemic)5658, GRADE Absolute (hyperglycemic)5658, %GRADE (hypoglycemic)5658, GRADE Absolute (hypoglycemic)5658, High Blood Glucose Index (HBGI)50, Hyperglycemia Index45, Hypoglycemia Index45, Index of Glycemic Control (IGC)45,59, J-Index60, Low Blood Glucose Index (LBGI)50, M-value61, Q-Score62,63
Time in Ranges36,64 Percent Time Above Range, Percent Time Active, Percent Time Below Range, Percent Time in Hyperglycemia (level 0), Percent Time in Hyperglycemia (level 1), Percent Time in Hyperglycemia (level 2), Percent Time in Hypoglycemia (level 1), Percent Time in Hypoglycemia (level 2), Percent Time in Range, Percent Time in Tight Range
Event 1-hour Postprandial Blood Glucose44, 1-hour Postprandial Delta Glucose44, 2-hour Postprandial Area Under Curve44, 2-hour Postprandial Blood Glucose44, Amplitude, Area Under Curve (AUC)24, Baseline Glucose, Glucose at Nadir, Glucose at Peak, Incremental Area Under Curve (iAUC), Postprandial Peak44, Preprandial Blood Glucose44, Time to Postprandial Peak44
Events Mean Number Per Day, Mean Amplitude, Mean Downwards Slope, Mean Duration, Mean iAUC, Mean Maximum, Mean Minimum, Mean Upwards Slope, Mean Glucose During
Additional AGP13,14,22,38, Episodes21,36, Excursions, Number of Days Worn21,24,36, Rate of Change (ROC)65, Time blocking21,24,36

Many of the sixty-one non-event features have already been implemented in other studies and other CGM tools1719,27. Glucose360 uses the uniquely implemented MAGE algorithm from iglu18,2833. The thirteen features designed to summarize a single event (of any type) are baseline glucose (mg/dL), peak/maximum glucose (mg/dL), nadir/minimum glucose (mg/dL), amplitude (difference between baseline and extrema in mg/dL), area under curve / AUC (mg/dL min), incremental area under curve / iAUC (mg/dL min), preprandial blood glucose, 1-hour postprandial blood glucose, 2-hour postprandial blood glucose, 1-hour postprandial delta glucose, postprandial peak, time to postprandial peak, and 2-hour postprandial AUC. The nine aggregate features for events of the same type include mean duration (min), mean glucose (mg/dL) during this type of event, mean upwards slope (mg/dL per min), mean downwards slope (mg/dL per min), mean minimum glucose (mg/dL), mean maximum glucose (mg/dL), mean amplitude (mg/dL), mean iAUC (mg/dL min), and mean number of this type of event per day (see Fig. 2b).

Figure 2. Examples of Generated Time-Series Plots.

Figure 2.

a Direct copy of Glucose360 output from when the first two days of the Subject1 dataset are passed into the daily_plot() function (with a maximum linear interpolation gap of forty-five minutes and all remaining missing values excluded) alongside meals imported from the food logging app Cronometer as ‘events’. The blue and green colored lines represent the magnitude of the glucose values (in mg/dL) for each timestamp within the Subject1 example data, with each subplot indicating data points for a specific day. The vertical dashed lines mark the specific timestamps where the events occur, with each vertical line color representing a specific type of event (only yellow in this case due to there being only one event type). The table to the right of each day’s subplot contains the timestamps and description of all events being marked for that day, while the legend in the top right denotes what type of event each dashed vertical line represents. b Marked copy of direct output of event plot generated for the Subject1 example dataset (with the plotted event being the imported “Cronometer meal” occurring at 2023-07-04 14:00:00, with an observation interval from 2023-07-04 13:00:00 to 2023-07-04 16:00:00) in order to illustrate event metric calculations. The smooth red line indicates the participant’s blood glucose levels (in mg/dL) during this interval, and the yellow dotted lines mark when ‘Cronometer meal’ events occur during this observation interval. Also, as plotly allows panning horizontally and vertically, Glucose360 also allows users to display lines for other events as well, in case users would like to observe any other events occurring during the observation window of the one being plotted. Calculated event metrics marked on the plot: baseline glucose (first glucose value within the observed event time frame), minimum glucose, maximum glucose, delta glucose (difference between glucose value at event occurrence and peak value), upwards slope (between glucose value at event occurrence and peak), downwards slope (between peak and ending glucose value within event time frame), incremental area under curve above baseline glucose value threshold, and duration.

Visualizations

Glucose360 currently provides five main types of plots, all built with the help of the Plotly Python library34:

  1. Daily time-series plot (see Fig. 2a), which displays glucose levels with respect to time for each day in the participant’s CGM trace

  2. Event plot (see Fig. 2b), which displays the participant’s glucose levels during a zoomed-in subset of their CGM trace

  3. Weekly time-series plot (see Fig. 4), which displays glucose levels with respect to time for each week in the participant’s CGM trace

  4. Spaghetti plot (see Fig. 3a), which overlaps the participant’s glucose levels for each day with respect to timestamps

  5. AGP-report style plot35 (see Fig. 4), which displays the 5th, 25th, 50th, 75th, and 95th percentiles for the participant’s aggregate glucose levels

Figure 4. Example AGP-report Generated.

Figure 4.

Direct copy of Glucose360 output from when the Subject2 dataset is passed into the AGP_report() function (with a maximum linear interpolation gap of forty-five minutes and all remaining missing values dropped). Top left contains a time in range stacked bar chart with six ranges for the given participant: less than 54 mg/dL, between 54 and 69 mg/dL (inclusive), between 70 and 140 mg/dL (inclusive), between 141 and 180 mg/dL (inclusive), between 181 and 250 mg/dL (inclusive), and greater than 250 mg/dL. Table in top right contains five summary notes and statistics regarding the given participant’s CGM trace: identification of the given participant, dates during which the given trace has CGM values, average glucose (in mg/dL), GMI42, and glucose variability or CV45. Center represents an AGP plot, where, from top to bottom, the blue lines represent the 95th, 75th, 50th, 25th, and 5th percentiles for the Subject2 dataset’s glucose values (mg/dL) per timestamp. The horizontal light green lines denote 80 and 140 mg/dL, and the horizontal dark green line marks 180 mg/dL. Thus, the range between the light green lines indicates ideal glucose values, with the range between the green lines in general indicating typical glucose values. The space outside these bounds represent risky to problematic glucose values. Bottom of the report represents a weekly plot for the given example CGM trace, where each subplot (within the weekly plot) indicates a time span of one week (starting on Mondays), with the colored lines representing the magnitude of the glucose values (in mg/dL) for each week within the example data.

Figure 3. Examples of Generated Spaghetti (Combined) Plots.

Figure 3.

a Direct copy of Glucose360 output from when the Subject3 dataset is passed into the spaghetti_plot() function (with a maximum linear interpolation gap of forty-five minutes and all remaining missing values dropped). Each differently colored line represents the magnitude of the glucose values (in mg/dL) for each day within the Subject3 example data. b Day chunking has been enabled within the spaghetti_plot() function, resulting in two separate graphs: the left graph being a spaghetti plot of only the weekdays in the Subject3 example data, and the right graph being a spaghetti plot of only the weekends.

Additionally, Glucose360 offers some variations for the daily (time-series) and spaghetti plots. For the daily time-series plot, the user can also pass an events Pandas DataFrame (see Event-Based Framework above), for which the plot will add in vertical lines denoting where the ‘events’ took place (see Fig. 2a). For the spaghetti plot, there is also an option to chunk by weekday/weekend, splitting the plot into two (see Fig. 3b). All plots can be exported into a PNG, PDF, or HTML format.

Results

Design of Workflow

The Glucose360 package comprises four main components: 1) importing and preprocessing CGM data, 2) features such as glucose management indicator (GMI) and MAGE, 3) the event-based framework, and 4) visualizations. The package is compatible with data from Dexcom and select FreeStyle Libre devices, with minor restructuring for data from other sensors. After the preprocessing pipeline, which consists of resampling and interpolation of missing values, all of the imported data is then stored together within a single multi-indexed Pandas DataFrame (see Fig. 1a). Utilizing a Pandas DataFrame allows not only for a standardized table with columns for both timestamp and glucose values, but also allows users to index a specific participant’s data, easily utilize most NumPy and Pandas functions on the DataFrame (such as efficient splicing or general computation), and employ the DataFrame in various Python pipelines already compatible with Pandas. Users can then employ this preprocessed DataFrame to calculate features, graph plots, or retrieve events (see Fig. 1b).

Event-Based Framework

A key capability within Glucose360 is the event-based framework, designed to help users analyze specific intervals within their CGM data and capture the diversity of their routine glycemic patterns. Broadly speaking, we define an ‘event’ as any timestamp and surrounding interval that either we or the user deem important (e.g. meals or exercise). All events can be utilized in tandem with certain features and plots.

Glucose360 also provides two ‘curated’ types of events: ‘episodes’ and ‘excursions’. We define episodes as periods of time where a participant’s glucose values are in literature-defined ranges that indicate hypo- or hyperglycemia, modeled primarily on the guidelines presented by Battelino et. al36. Additionally, we also include a “level 0 hyperglycemic episode” defined by glucose values exceeding 140 mg/dL for people with prediabetes or those with normoglycemia who are looking to optimize their control. Note that this is a parameter that the user can set to different thresholds. We define excursions as periods of time where a participant’s glucose values are in ranges that indicate irregular values or trends for the individual participant (much more personalized), by default calculated by observing data points outside two standard deviations from the mean for each participant. Simply put, episodes and excursions may overlap for certain participants, but episodes generally indicate intervals where participants experienced literature-defined and population-based hypo- or hyperglycemia, while excursions describe periods where glucose levels deviate from a participant’s typical range.

As part of Glucose360’s event-based framework, users can also import and add their own custom events, such as food logs from Cronometer. For example, a user might import their own Cronometer meal logs to better understand how each of their meals corresponds to their glucose levels and overall CGM trace. Within Glucose360’s daily time-series plot (see Fig. 2a), these imported Cronometer meal logs would be displayed as vertical lines over the participant’s blood glucose levels, allowing the user to visually understand their glucose responses after each specific meal. Calculating event-specific metrics such as amplitude and duration (see Features below) for these meals also provides insights into which foods appear to spike the participant’s blood glucose levels the most drastically and for the longest duration.

Features

Glucose360 supports eighty-four various features (see Table 1). Metrics can all be calculated for only one participant or simultaneously for all participants in a given preprocessed DataFrame.

Fifty of these features are implemented in other CGM tools (see Supplementary Table 2) and can generally be grouped into the following categories: summary statistics for the overall glucose levels (e.g. mean glucose, eA1C, GMI, etc.), percentage of time within a given range (e.g. time in tight range), composite and risk indexes (e.g. J-Index, ADRR, absolute and %GRADE, LBGI, HBGI, COGI, etc.), and types of variation in glucose levels during specific time ranges (e.g. MAGE, GVP, MODD, CONGA, etc.).

Many of the other features within Glucose360 are designed to analyze specific time points of interest, such as meal consumption or exercise, as part of the event-based framework (see Event-Based Framework above) and thus are unique to this package10,11. These event-based features include metrics for quantifying individual events (e.g. AUC, baseline glucose, peak glucose, etc.) as well as event aggregates, which indicate overall trends within the CGM trace during the observation windows of specific types of events (e.g. mean glucose during “meals,” mean duration of “meals”) (see Table 1).

Visualizations

With regards to visualization, Glucose360 provides five main types of plots. The daily (time-series) plot allows users to more closely examine each day within a CGM trace (see Fig. 2a). Events can also be utilized within certain plots: within a daily (time-series) plot, vertical lines mark the timestamps of all events and side-by-side tables listing all the events that occur during each day are generated (see Fig. 2a), whereas event plots allow users to zoom in on blood glucose levels during a given event (see Fig. 2b). Similarly, the weekly (time-series) plot provides an in-depth look into each week within a CGM trace, helpful for comparing and contrasting the blood glucose levels during certain days of the week. For more comparisons, the spaghetti (combined) plot superimposes each day’s CGM trace, helping users compare blood glucose levels during specific times within the day and as well as during specific days of the week (see Fig. 3a and Fig. 3b), whereas the AGP-report provides aggregates and overall trends about a particular participant’s blood glucose levels (see Fig. 4)37.

Comparison of CGM Tools

We determined which metrics were implemented by each package by sourcing the packages’ codebases and also published manuscripts (see Supplementary Table 2 for a detailed comparison). For the event-based metrics, Glucose360 implements 100%, CGMQuantify 0%, AGATA 8.70%, iglu 8.70%, and cgmanalysis 0%, IDC’s AGP 0%, and Tidepool 0%. Glucose360 complements other CGM analysis tools by uniquely providing a set of event-based metrics for analyzing within the CGM trace.

We validated our metric calculations against IDC’s AGP report and Tidepool, as both are frequently used in clinical practice. Additionally, we also validated against iglu because of its extensive overlap in available metrics. For testing, we imported three example datasets (“Subject1”, “Subject2”, and “Subject3”) as well as the CGM data for the fifty-seven participants from the Hall et. al study into each software. We then individually ran each glucose metric algorithm, ensuring parameter consistency (e.g. using a limit of 140 mg/dL when calculating hyper-index and resampling the data to evenly-spaced five-minute intervals)9. All overlapping metrics between Glucose360 and IDC’s AGP report and Tidepool showed correlations greater than .99. Similarly, all overlapping metrics with iglu showed correlations greater than .99, except for GVP, M-value (default 100), MAG, and MODD.

Overall, the calculations from Glucose360 align with those from iglu, although we believe all significant differences can be explained by our differing preprocessing pipelines and algorithms for calculating these metrics. Primarily, iglu does not always replace blood glucose values of ‘Low’ and ‘High’ with the same constants as we do; rather, these rows are dropped altogether18. Moreover, instead of starting at the first data point’s timestamp when generating the timestamps of the resampled data (see Methods - importing and preprocessing data), iglu starts at midnight of the very first day present within the data, often resulting in most of the data points being interpolated slightly. Another notable difference between Glucose360’s processing stage and iglu is how gaps are handled. With this in mind, both Glucose360’s and iglu’s preprocessing pipeline result in near identical dataframes for datasets without missing values nor ‘Low’s and ‘High’s, which then results in identical calculations across Glucose360 and iglu for most metrics.

In terms of Glucose360’s plots, we note that our time-series plot (see Fig. 2a) and AGP-style plot (see Fig. 4) appear nearly identical to those generated with IDC’s AGP, Tidepool, and iglu, with slight differences due to the difference in preprocessing pipelines and styling.

Discussion

Here we present Glucose360 which has a variety of useful features, including an effective preprocessing pipeline that supports numerous CGM sensors, algorithms for the accurate calculations of most utilized glycemic variability metrics, interactive visualizations of trends within CGM traces, and a novel event framework to help users integrate lifestyle data from other sources to improve personalized nutrition or behavior and better isolate and manage anomalies within their overall glucose levels.

However, Glucose360 does have various limitations. First, Glucose360 primarily imports Dexcom and FreeStyle Libre sensor data by default; Data from other CGM sensors can also be imported, but they would have to be restructured to adhere to Dexcom or FreeStyle Libre guidelines or manually imported into a dataframe as per our package guidelines. Moreover, it currently supports five main plotting types, and the majority of the GV metrics Glucose360 currently calculates were not introduced or validated recently, so future endeavors could include adding other visualizations or newer measures of GV into the package. Additionally, no other packages offer functionality for events, so the validity of our algorithms for these metrics has only been checked empirically through our own testing. Finally, the majority of our algorithm testing and comparison for plotting and metric calculations was based on sixty participants’ data (the CGM data from the Hall et. al study9 and the three example datasets “Subject1”, “Subject2”, and “Subject3”). To guarantee our algorithms’ accuracy, testing with more datasets should also be done. Nonetheless, in spite of these limitations we believe the Glucose360 will be a valuable platform for many different types of stakeholders. Future extensions of this package could include extending Glucose360’s event framework to include expert recommended reports that standardize CGM and connected insulin pens joint metrics3841.

We ask that Glucose360 users cite the original sources for each functionality they utilize in table 1.

Conclusion

Glucose360 is a new open-source Python package for CGM analysis, providing multiple clinician-recommended and event-based metrics, multiple interactive graphs, and an easily modifiable codebase. The software is available on PyPi and Github, with a companion web interface for use without programming. Metric calculations were validated against IDC’s AGP report, Tidepool, and iglu, confirming concordant results. Glucose360 is a flexible platform for researchers seeking deeper lifestyle-driven insight into glucose dynamics.

Supplementary Material

1

Acknowledgements

The authors would like to thank the CGM and fiber team for their helpful comments.

Funding Statement

This work was supported by National Library of Medicine (2T15LM007033). YW is supported by American Diabetes Association Grant 11-23-PDF- 76. This work is also supported by Nutrition for Precision Health’s AIMINGS Pilot Project Program. This work is also supported by the National Institutes of Health under Grant No. R01 DK110186.

Footnotes

Author Disclosure

MPS is a cofounder and scientific advisor of Crosshair Therapeutics, Exposomics, Filtricine, Fodsel, iollo, InVu Health, January AI, Marble Therapeutics, Mirvie, Next Thought AI, Orange Street Ventures, Personalis, Protos Biologics, Qbio, RTHM, SensOmics. MPS is a scientific advisor of Abbratech, Applied Cognition, Enovone, Jupiter Therapeutics, M3 Helium, Mitrix, Neuvivo, Onza, Sigil Biosciences, TranscribeGlass, WndrHLTH, Yuvan Research. MPS is a cofounder of NiMo Therapeutics. MPS is an investor and scientific advisor of R42 and Swaza. MPS is an investor in Repair Biotechnologies.

The other authors have no disclosures.

Data and Code Availability

Fake example data is available at github.com/vurhd2/Glucose360.

Other data can be found at https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2005143.

Code is available here: github.com/vurhd2/Glucose360.

References

  • 1.Rodbard D Continuous Glucose Monitoring: A Review of Successes, Challenges, and Opportunities. Diabetes Technol Ther 2016;18(S2):S2–3; doi: 10.1089/dia.2015.0417. [DOI] [PubMed] [Google Scholar]
  • 2.Ehrhardt N, Al Zaghal E. Continuous Glucose Monitoring As a Behavior Modification Tool. Clin Diabetes 2020;38(2):126–131; doi: 10.2337/cd19-0037. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Zahedani AD, McLaughlin T, Veluvali A, et al. Digital health application integrating wearable data and behavioral patterns improves metabolic health. Npj Digit Med 2023;6(1):1–15; doi: 10.1038/s41746-023-00956-y. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Vallis M, Ryan H, Berard L, et al. How Continuous Glucose Monitoring Can Motivate Self-management: Can Motivation Follow Behaviour? Can J Diabetes 2023;47(5):435–444; doi: 10.1016/j.jcjd.2023.04.001. [DOI] [PubMed] [Google Scholar]
  • 5.Zeevi D, Korem T, Zmora N, et al. Personalized Nutrition by Prediction of Glycemic Responses. Cell 2015;163(5):1079–1094; doi: 10.1016/j.cell.2015.11.001. [DOI] [PubMed] [Google Scholar]
  • 6.Cappon G, Vettoretti M, Sparacino G, et al. Continuous Glucose Monitoring Sensors for Diabetes Management: A Review of Technologies and Applications. Diabetes Metab J 2019;43(4):383; doi: 10.4093/dmj.2019.0121. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Soliman A, DeSanctis V, Yassin M, et al. Continuous glucose monitoring system and new era of early diagnosis of diabetes in high risk groups. Indian J Endocrinol Metab 2014;18(3):274; doi: 10.4103/2230-8210.131130. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Dehghani Zahedani A, Shariat Torbaghan S, Rahili S, et al. Improvement in Glucose Regulation Using a Digital Tracker and Continuous Glucose Monitoring in Healthy Adults and Those with Type 2 Diabetes. Diabetes Ther 2021;12(7):1871–1886; doi: 10.1007/s13300-021-01081-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Hall H, Perelman D, Breschi A, et al. Glucotypes reveal new patterns of glucose dysregulation. Locasale J ed. PLOS Biol 2018;16(7):e2005143; doi: 10.1371/journal.pbio.2005143. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Piersanti A, Giurato F, Göbl C, et al. Software Packages and Tools for the Analysis of Continuous Glucose Monitoring Data. Diabetes Technol Ther 2023;25(1):69–85; doi: 10.1089/dia.2022.0237. [DOI] [PubMed] [Google Scholar]
  • 11.Olsen MT, Klarskov CK, Dungu AM, et al. Statistical Packages and Algorithms for the Analysis of Continuous Glucose Monitoring Data: A Systematic Review. J Diabetes Sci Technol 2025;19(3):787–809; doi: 10.1177/19322968231221803. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Moscardó V, Giménez M, Oliver N, et al. Updated Software for Automated Assessment of Glucose Variability and Quality of Glycemic Control in Diabetes. Diabetes Technol Ther 2020;22(10):701–708; doi: 10.1089/dia.2019.0416. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Mazze RS, Lucido D, Langer O, et al. Ambulatory Glucose Profile: Representation of Verified Self-Monitored Blood Glucose Data. Diabetes Care 1987;10(1):111–117; doi: 10.2337/diacare.10.1.111. [DOI] [PubMed] [Google Scholar]
  • 14.Pernick NL, Rodbard D. Personal computer programs to assist with self-monitoring of blood glucose and self-adjustment of insulin dosage. Diabetes Care 1986;9(1):61–69; doi: 10.2337/diacare.9.1.61. [DOI] [PubMed] [Google Scholar]
  • 15.Neinstein A, Wong J, Look H, et al. A case study in open source innovation: developing the Tidepool Platform for interoperability in type 1 diabetes management. J Am Med Inform Assoc JAMIA 2016;23(2):324–332; doi: 10.1093/jamia/ocv104. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Zhang XD, Zhang Z, Wang D. CGManalyzer: an R package for analyzing continuous glucose monitoring studies. Bioinformatics 2018;34(9):1609–1611; doi: 10.1093/bioinformatics/btx826. [DOI] [PubMed] [Google Scholar]
  • 17.Vigers T, Chan CL, Snell-Bergeon J, et al. cgmanalysis: An R package for descriptive analysis of continuous glucose monitor data. PLOS ONE 2019;14(10):e0216851; doi: 10.1371/journal.pone.0216851. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Broll S, Urbanek J, Buchanan D, et al. Interpreting blood GLUcose data with R package iglu. PLOS ONE 2021;16(4):e0248560; doi: 10.1371/journal.pone.0248560. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Cappon G, Sparacino G, Facchinetti A. AGATA: A Toolbox for Automated Glucose Data Analysis. J Diabetes Sci Technol 2024;18(5):1109–1121; doi: 10.1177/19322968221147570. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Bent B, Henriquez M, Dunn JP. Cgmquantify: Python and R Software Packages for Comprehensive Analysis of Interstitial Glucose and Glycemic Variability from Continuous Glucose Monitor Data. IEEE Open J Eng Med Biol 2021;2:263–266; doi: 10.1109/OJEMB.2021.3105816. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Battelino T, Danne T, Bergenstal RM, et al. Clinical Targets for Continuous Glucose Monitoring Data Interpretation: Recommendations From the International Consensus on Time in Range. Diabetes Care 2019;42(8):1593–1603; doi: 10.2337/dci19-0028. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Bergenstal RM, Ahmann AJ, Bailey T, et al. Recommendations for Standardizing Glucose Reporting and Analysis to Optimize Clinical Decision Making in Diabetes: The Ambulatory Glucose Profile (AGP). Diabetes Technol Ther 2013;15(3):198–211; doi: 10.1089/dia.2013.0051. [DOI] [PubMed] [Google Scholar]
  • 23.Srinath KR. Python – The Fastest Growing Programming Language. n.d.;04(12). [Google Scholar]
  • 24.Danne T, Nimri R, Battelino T, et al. International Consensus on Use of Continuous Glucose Monitoring. Diabetes Care 2017;40(12):1631–1640; doi: 10.2337/dc17-1600. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Harris CR, Millman KJ, van der Walt SJ, et al. Array programming with NumPy. Nature 2020;585(7825):357–362; doi: 10.1038/s41586-020-2649-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.McKinney W Data Structures for Statistical Computing in Python. In: Proceedings of the 9th Python in Science Conference. (van der Walt S, Millman J eds) 2010; pp. 56–61; doi: 10.25080/Majora-92bf1922-00a. [DOI] [Google Scholar]
  • 27.Millard LAC, Patel N, Tilling K, et al. GLU: a software package for analysing continuously measured glucose levels in epidemiology. Int J Epidemiol 2020;49(3):744–757; doi: 10.1093/ije/dyaa004. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Fernandes NJ, Nguyen N, Chun E, et al. Open-Source Algorithm to Calculate Mean Amplitude of Glycemic Excursions Using Short and Long Moving Averages. J Diabetes Sci Technol 2022;16(2):576–577; doi: 10.1177/19322968211061165. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.Service FJ, Nelson RL. Characteristics of Glycemic Stability. Diabetes Care 1980;3(1):58–62; doi: 10.2337/diacare.3.1.58. [DOI] [PubMed] [Google Scholar]
  • 30.Service FJ, Molnar GD, Rosevear JW, et al. Mean amplitude of glycemic excursions, a measure of diabetic instability. Diabetes 1970;19(9):644–655; doi: 10.2337/diab.19.9.644. [DOI] [PubMed] [Google Scholar]
  • 31.Fritzsche G, Kohnert K-D, Heinke P, et al. The use of a computer program to calculate the mean amplitude of glycemic excursions. Diabetes Technol Ther 2011;13(3):319–325; doi: 10.1089/dia.2010.0108. [DOI] [PubMed] [Google Scholar]
  • 32.Baghurst PA. Calculating the mean amplitude of glycemic excursion from continuous glucose monitoring data: an automated algorithm. Diabetes Technol Ther 2011;13(3):296–302; doi: 10.1089/dia.2010.0090. [DOI] [PubMed] [Google Scholar]
  • 33.Sechterberger MK, Luijf YM, Devries JH. Poor agreement of computerized calculators for mean amplitude of glycemic excursions. Diabetes Technol Ther 2014;16(2):72–75; doi: 10.1089/dia.2013.0138. [DOI] [PubMed] [Google Scholar]
  • 34.Hossain S Visualization of Bioinformatics Data with Dash Bio. In: Proceedings of the 18th Python in Science Conference. (Calloway C, Lippa D, Niederhut D, et al. eds) 2019; pp. 126–133; doi: 10.25080/Majora-7ddc1dd1-012. [DOI] [Google Scholar]
  • 35.Mazze RS, Strock E, Wesley D, et al. Characterizing glucose exposure for individuals with normal glucose tolerance using continuous glucose monitoring and ambulatory glucose profile analysis. Diabetes Technol Ther 2008;10(3):149–159; doi: 10.1089/dia.2007.0293. [DOI] [PubMed] [Google Scholar]
  • 36.Battelino T, Alexander CM, Amiel SA, et al. Continuous glucose monitoring and metrics for clinical trials: an international consensus statement. Lancet Diabetes Endocrinol 2023;11(1):42–57; doi: 10.1016/S2213-8587(22)00319-9. [DOI] [PubMed] [Google Scholar]
  • 37.Rodbard D Display of Glucose Distributions by Date, Time of Day, and Day of Week: New and Improved Methods. J Diabetes Sci Technol 2009;3(6):1388–1394. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Simonson GD, Criego AB, Battelino T, et al. Expert Panel Recommendations for a Standardized Ambulatory Glucose Profile Report for Connected Insulin Pens. Diabetes Technol Ther 2024;26(11):814–822; doi: 10.1089/dia.2024.0107. [DOI] [PubMed] [Google Scholar]
  • 39.Wolpert H, Rodbard D, Xue J, et al. Characterizing insulin dosing behaviour and glycaemic excursions: Development of metrics using connected insulin pen and continuous glucose monitoring. Diabetes Obes Metab 2025;27(5):2507–2514; doi: 10.1111/dom.16249. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40.Rodbard D, Garg SK. Standardizing Reporting of Glucose and Insulin Data for Patients on Multiple Daily Injections Using Connected Insulin Pens and Continuous Glucose Monitoring. Diabetes Technol Ther 2021;23(3):221–226; doi: 10.1089/dia.2021.0030. [DOI] [PubMed] [Google Scholar]
  • 41.Shah VN, Garg SK. Standardized Hybrid Closed-Loop System Reporting. Diabetes Technol Ther 2021;23(5):323–331; doi: 10.1089/dia.2020.0622. [DOI] [PubMed] [Google Scholar]
  • 42.Bergenstal RM, Beck RW, Close KL, et al. Glucose Management Indicator (GMI): A New Term for Estimating A1C From Continuous Glucose Monitoring. Diabetes Care 2018;41(11):2275–2280; doi: 10.2337/dc18-1581. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 43.Nathan DM, Kuenen J, Borg R, et al. Translating the A1C Assay Into Estimated Average Glucose Values. Diabetes Care 2008;31(8):1473–1478; doi: 10.2337/dc08-0545. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 44.Hernandez TL, Barbour LA. A Standard Approach to Continuous Glucose Monitor Data in Pregnancy for the Study of Fetal Growth and Infant Outcomes. review-article. Mary Ann Liebert, Inc. 140 Huguenot Street, 3rd Floor New Rochelle, NY 10801 USA; 2013.; doi: 10.1089/dia.2012.0223. [DOI] [Google Scholar]
  • 45.Rodbard D Interpretation of Continuous Glucose Monitoring Data: Glycemic Variability and Quality of Glycemic Control. Diabetes Technol Ther 2009;11(S1):S–55; doi: 10.1089/dia.2008.0132. [DOI] [Google Scholar]
  • 46.McDonnell CM, Donath SM, Vidmar SI, et al. A Novel Approach to Continuous Glucose Analysis Utilizing Glycemic Variation. Diabetes Technol Ther 2005;7(2):253–263; doi: 10.1089/dia.2005.7.253. [DOI] [PubMed] [Google Scholar]
  • 47.Peyser TA, Balo AK, Buckingham BA, et al. Glycemic Variability Percentage: A Novel Method for Assessing Glycemic Variability from Continuous Glucose Monitor Data. Diabetes Technol Ther 2018;20(1):6–16; doi: 10.1089/dia.2017.0187. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 48.Hermanides J, Vriesendorp TM, Bosman RJ, et al. Glucose variability is associated with intensive care unit mortality*. Crit Care Med 2010;38(3):838; doi: 10.1097/CCM.0b013e3181cc4be9. [DOI] [PubMed] [Google Scholar]
  • 49.Molnar GD, Taylor WF, Ho MM. Day-to-day variation of continuously monitored glycaemia: a further measure of diabetic instability. Diabetologia 1972;8(5):342–348; doi: 10.1007/BF01218495. [DOI] [PubMed] [Google Scholar]
  • 50.Kovatchev BP, Otto E, Cox D, et al. Evaluation of a New Measure of Blood Glucose Variability in Diabetes. Diabetes Care 2006;29(11):2433–2438; doi: 10.2337/dc06-1085. [DOI] [PubMed] [Google Scholar]
  • 51.Kovatchev BP, Cox DJ, Gonder-Frederick LA, et al. Symmetrization of the blood glucose measurement scale and its applications. Diabetes Care 1997;20(11):1655–1658; doi: 10.2337/diacare.20.11.1655. [DOI] [PubMed] [Google Scholar]
  • 52.Leelarathna L, Thabit H, Wilinska ME, et al. Evaluating Glucose Control With a Novel Composite Continuous Glucose Monitoring Index. J Diabetes Sci Technol 2020;14(2):277–283; doi: 10.1177/1932296819838525. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 53.Vigersky RA, Shin J, Jiang B, et al. The Comprehensive Glucose Pentagon: A Glucose-Centric Composite Metric for Assessing Glycemic Control in Persons With Diabetes. J Diabetes Sci Technol 2017;12(1):114–123; doi: 10.1177/1932296817718561. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54.Thomas A, Schönauer M, Achermann F, et al. The “glucose pentagon”: assessing glycemic control of patients with diabetes mellitus by a model integrating different parameters from glucose profiles. Diabetes Technol Ther 2009;11(6):399–409; doi: 10.1089/dia.2008.0119. [DOI] [PubMed] [Google Scholar]
  • 55.Klonoff DC, Wang J, Rodbard D, et al. A Glycemia Risk Index (GRI) of Hypoglycemia and Hyperglycemia for Continuous Glucose Monitoring Validated by Clinician Ratings. J Diabetes Sci Technol 2023;17(5):1226–1242; doi: 10.1177/19322968221085273. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 56.Hill NR, Hindmarsh PC, Stevens RJ, et al. A method for assessing quality of control from glucose profiles. Diabet Med 2007;24(7):753–758; doi: 10.1111/j.1464-5491.2007.02119.x. [DOI] [PubMed] [Google Scholar]
  • 57.Hill NR, Thompson B, Bruce J, et al. Glycaemic risk assessment in children and young people with Type 1 diabetes mellitus. Diabet Med J Br Diabet Assoc 2009;26(7):740–743; doi: 10.1111/j.1464-5491.2009.02763.x. [DOI] [Google Scholar]
  • 58.Hill NR, Oliver NS, Choudhary P, et al. Normal Reference Range for Mean Tissue Glucose and Glycemic Variability Derived from Continuous Glucose Monitoring for Subjects Without Diabetes in Different Ethnic Groups. Diabetes Technol Ther 2011;13(9):921–928; doi: 10.1089/dia.2010.0247. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 59.Moscardó V, Herrero P, Reddy M, et al. Assessment of Glucose Control Metrics by Discriminant Ratio. Diabetes Technol Ther 2020;22(10):719–726; doi: 10.1089/dia.2019.0415. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 60.Wójcicki JM. “J”-Index. A New Proposition of the Assessment of Current Glucose Control in Diabetic Patients. Horm Metab Res 1995;27(01):41–42; doi: 10.1055/s-2007-979906. [DOI] [PubMed] [Google Scholar]
  • 61.Schlichtkrull J, Munck O, Jersild M. The M-Value, an Index of Blood-sugar Control in Diabetics. Acta Med Scand 1965;177(1):95–102; doi: 10.1111/j.0954-6820.1965.tb01810.x. [DOI] [PubMed] [Google Scholar]
  • 62.Augstein P, Heinke P, Nowak A, et al. Q-Score Complements the Time in Range in the Evaluation of Short-Term Glycemic Control. J Diabetes Sci Technol 2024;19322968241246209; doi: 10.1177/19322968241246209. [DOI] [Google Scholar]
  • 63.Augstein P, Heinke P, Vogt L, et al. Q-Score: development of a new metric for continuous glucose monitoring that enables stratification of antihyperglycaemic therapies. BMC Endocr Disord 2015;15:22; doi: 10.1186/s12902-015-0019-0. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 64.Castañeda J, Arrieta A, van den Heuvel T, et al. Time in Tight Glucose Range in Type 1 Diabetes: Predictive Factors and Achievable Targets in Real-World Users of the MiniMed 780G System. Diabetes Care 2024;47(5):790–797; doi: 10.2337/dc23-1581. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 65.Clarke W, Kovatchev B. Statistical Tools to Analyze Continuous Glucose Monitor Data. Diabetes Technol Ther 2009;11(S1):S–45; doi: 10.1089/dia.2008.0138. [DOI] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

1

Data Availability Statement

Fake example data is available at github.com/vurhd2/Glucose360.

Other data can be found at https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2005143.

Code is available here: github.com/vurhd2/Glucose360.

RESOURCES