Showing posts with label Continuous Glucose Monitoring. Show all posts
Showing posts with label Continuous Glucose Monitoring. Show all posts

Saturday, July 5, 2025

How do you visualize glucose data from a glucose CGM report using Python?

Interpretation of data from the python code from my previous post must be exercised with caution. The program explicitly puts red dots over the curve to establish verification that the method indeed achieves its objective. We have seen that the image generated does show large red circles riding the graph. 

It is easy to show by reducing the size to 0, that the curve is traced by very tiny circles shown by an underlying red ness in the trace (zoom to see). These are shown for two the two radii assumed in the next figure.

 


However, a .CSV file is generated by the code. The graphing of this file in Microsoft Excel does not show any difference between the two cases, radius=2 and radius =0 as shown.

  


The reason is these curves (one by visualization and the other set by generated CSV file) are not using the same base.

1. The cv2.circle() visualization: This is what creates the glucose_trace_detected.jpg. 

2. The matplotlib.pyplot.plot() or scatter() visualization: This is what creates the glucose_value_mg_dL plot.

However, in the plotted graphs from CSV files we find gaps in the generated graph. They can indeed correspond to event marker positions. The red dot in the visualization is only for verifying that the entire graph is captured.

We will take a look at this possibility of getting the positional data of events in the next post, as it gives us valuable information on event times. 


Monday, August 7, 2023

How do I get Glucose data from the FreeStyle Libre glucose sensor?

 I have been having glucose-related issues for many years. Although diagnostic data indicates I am diabetic, I am not taking any medication for diabetes. However, I was always concerned about its possible effects. While my lipid profiles were under safe 'standard values', I suffered a heart attack in 2022. I decided to look at my glucose values more closely to make adjustments in my lifestyle and diet. The only diagnostic at my disposal was the painful pricking of the finger and measuring with a strip. This is totally unsatisfactory as it can provide only a single data point. I have always wondered how healthcare providers make decisions on this single value measured in a doctor's office once in a couple of months.

Fortunately, I was able to get a Freestyle Libre glucose sensor (Freestyle Libre 14-day). Now, at least I have a tool to look at what I am eating and associate it with glucose levels. I have been having it for the past two days. The display available on the Libre Link app which is available for Android and iPhones is quite nice but I want to look at it more ways.  The Libre website gives access to this data on their website. 

The sensor gets data about interstitial glucose every 15 minutes and stores it on the website. Here is how you can get the data. 

These are screenshots of the steps I took to get the data on the website to my computer. It is a Dell laptop with Windows 64 OS and I also have Microsoft Excel on the computer.

This is Libre View from the Libre website


You need to agree before you proceed.


You need to log in to download data. This means you have purchased the sensor and also installed the Libre link app on your phone (Android or iPhone). Note that you have enabled two-factor authorization.



After being verified you got access to the site.


Now click Download Glucose data at the top-right corner.


Your data appears in your Downloads folder on your computer.


Here is a sample of the downloaded data.


I have clipped off some personal information.

Although I have shown a few columns, there are a lot more useful columns that contain data related to custom test times and notes associated with those events.

Hope this helps. 


Effects of Yoga using Freestyle CGM System- Will be published soon.