Adding External Data to the Chart

In an earlier post I had shown how to add meal and exercise data to the glucose chart. This data was coming from the same data export, meaning that the data was tracked within the NutriSense app and than exported together with the glucose data. However, what about adding data to the chart that is not part of the NutriSense data export? For example, what if you already have a system in place to track your sleep? Maybe you have an Excel spreadsheet that contains data about when you fall asleep each day and when you wake up. Adding such data to the chart can further add context to the glucose values and down the line it would allow for better calculating your glucose metrics during your sleep.

This notebook is very similar to the one I posted a few days ago , it basically only adds a bit of code to open an Excel file, read the sheet and retrieve two sleep values from that sheet. The code uses openpyxl , a Python package to read and write Excel files. In the chart below, the light blue overlay represents sleep time.

Chart with Events

As a side note, NutriSense does provide a metric for your glucose during sleep, but unless you track your sleep within the NutriSense app, this number is calculated using a fasting window from 8 PM to 8 AM, which may not be what you are doing. (The information about the 8 PM to 8 AM time window was obtained by chatting with a NutriSense registered dietitian.)

All the notebooks are available from my Github repository and here is a direct download link for just this notebook.