One nice feature of the chart on the NutriSense Dashboard - Activity page is that events like meals and exercise are shown right in the chart. This presents the glucose data in relation to events that will likely influence glucose levels. As I had mentioned in a previous post , the NutriSense data export contains all relevant information, so I can include such events in the chart as well. Here is what the chart looks like… not as nice as the NutriSense chart, but functional. Meals are colored in black and exercise events in green.
There are only two changes to the code from the second chart notebook . First I added a line that filters the main dataset down to a new dataset that only includes meal and exercise events. This is not strictly necessary, but makes the code more readable. I should also point out that the NutriSense app allows you to track other events like meditation or sleep. These events are also included in the data export, but I am not charting them here. However, adding those events to the chart should be straight forward by slightly adapting the code that I am providing here. After creating that new dataset with just meal and exercise events, the second change is drawing a vertical line for each event and then adding text to that line describing the event. That text is whatever you enter in the NutriSense app as a description for the meal or exercise.