Patterns of Glycemic Variability During a Diabetes Self-Management Educational Program

Background: Variations in blood glucose levels over a given time interval is termed as glycemic variability (GV). Higher GV is associated with higher diabetes-related complications. The current study was done with the aim of detecting the sensitivity of various GV indices among individuals with type 2 diabetes mellitus of different glycemic control status. Methods: We performed a longitudinal study among individuals with type 2 diabetes mellitus (T2DM) who were participating in a two-week diabetes self-management education (DSME) program. Participants were categorized by their HbA1c as poor (≥8%), acceptable (7%–8%), and optimal control (<7%). Continuous glucose monitoring (CGM) sensors recorded interstitial glucose every 15 min from day 1. The evaluated GV measures include standard deviation (SD), coefficient of variation (CV), mean amplitude of glycemic excursion (MAGE), continuous overlapping net glycemic action (CONGA), mean of daily difference for inter-day variation (MODD), high blood glucose index (HBGI), and low blood glucose index (LBGI). Results: A total of 41 study participants with 46347 CGM values were available for analysis. Of 41 participants, 20 (48.7%) were in the poor, 10 (24.3%) in the acceptable, and 11 (26.8%) in the optimal control group. The GV indices (SD; CV; MODD; MAGE; CONGA; HBGI) of poorly controlled (77.43; 38.02; 45.82; 216.63; 14.10; 16.62) were higher than acceptable (50.02; 39.32; 30.79; 138.01; 8.87; 5.56) and optimal (34.15; 29.46; 24.56; 126.15; 8.67; 3.13) control group. Glycemic variability was reduced in the poorly and acceptably controlled groups by the end of the 2-week period. There was a rise in LBGI in the optimally controlled group, indicating pitfalls of tight glycemic control. Conclusion: Indices of glycemic variability are useful complements, and changes in it can be demonstrated within short periods.


Data Cleaning and Manipulation
The following code describes in detail the data cleaning process.

Reading in the excel file
The path of the excel file is saved as an object file_path. The file path is then passed through the read_excel function and the resulting dataset object is saved as df.

Variable manipulation
The following code manipulates the df$Time variable as a character and then coherces it into a POSIXct object with a %Y-%m-%d %H:%M:%S format. The variable df$DC_Number is coherced into a factor variable and saved as df$dc_number for ease of use. Similar renaming was done for df$Glucose.

Dataframe manipulation
In order to ensure uniformity, the readings from the frist day and the last day of each individual are discarded.
The following code describes the method how it is acheived:

Spliting of the dataframe
The dataframe df is split by the factor variable df$dc_number, resulting in a list of 46 dataframes which is saved in an object data_list of list class.

# Split dataframe by individual data_list <split(df,df$dc_number)
A vector named date_index has been created by cohercing the Date variable into a factor and then saving it as an integer. This gives the vector of date_index which contains values from 1 -14.
Next, a logical vector date_index_logical was created which was FALSE for the minimum and maximum value of the date_index variable. This was saved as a list named data.1.

Merging the dataframe
The dataframes that have been split are then merged again into a single data frame with the name df by using the do.call function and rbind. A backup of the data frame is also created and named as df.backup.

Discarding the first and last day observations
Now, df contains the observations of all 46 individuals but the first and last day observations removed. The number of observations in the dataset by date are tabulated in the table below: # Tabulate number of obs per day per individual d<-df %>% group_by(dc_number,date_index) %>% summarise(number = n())

R Code
This document presents the R codes and data for reproducing our analysis result as described in the paper. To start, first download the CGM data and R code for subsequent analysis and plotting into a folder. The data files are available as part of the paper supplementary appendix.

Functions for measures of glycemic variability (GV)
The R code for estimation of the measures of glycemic variablity: -mean of daily differences (MODD) -mean amplitude of glycemic excursions (MAGE) -continuous overall net glycemic action (CONGA) -high blood glucose index (HBGI) -low blood glucose index (LBGI)

Composite Graph
The composite graph of the measures of glycemic variability was plotted using the facet_wrap argument of the ggplot2 package. This was plotted separately for coeffecient of variation (CV), mean of daily differences (MODD), mean amplitude of glycemic excursions (MAGE), continuous overall net glycemic action (CONGA) and the high blood glucose index (HBGI) & low blood glucose index (LBGI).