Side project: Type 1 Diabetes data and visualization

I have Type 1 Diabetes.

A diabetic's life is all about controlling blood glucose, or the level of sugar in the blood. I have to measure my blood glucose, and then either eat (to bring low blood glucose up) or take insulin (to bring high blood glucose down). I use an insulin pump to deliver a small and steady drip of insulin under my skin all day (a.k.a. basal insulin), and also to take larger doses of insulin, also known as bolus, at meal times based on the amount of carbohydrates I eat - since carbohydrates are converted into blood glucose.

Blood glucose measurements

Blood glucose measurements

Prior to a few weeks ago, I used finger-stick tests several times a day to measure my blood glucose. That's a literal and figurative pain that gives a partial picture of what's going on. For example, I very rarely wake up to take finger-stick readings at night. Instead I try to make sure my blood glucose is normal when I go to bed, and normal when I wake up, and trust that it is steady throughout the night.

I added a continuous glucose monitor (CGM) to my regimen on August 26. The CGM consists of a device attached to my skin that takes a blood glucose reading every five minutes, and transmits those readings to my mobile phone. This gives a clearer picture of what happens to my blood glucose over the course of the day (guess what - it changes a lot when I'm sleeping), alerts me if I'm high or low, and shares the data with my partner who can encourage or nag me (both of which I gratefully accept).

I'm lucky to live in an age where technology for the treatment of diabetes is pretty good, and always improving. Unfortunately one huge downside, one that could have been easily addressed years ago with existing technology, is that medical device companies have not prioritized patient access to their own data. Omnipod data can be extracted from the device with a Windows program that looks like it was built for Windows 95 and unchanged since. I am a data engineer, I automate everything, I use a Mac and I'm too lazy and cheap to sort out a Windows VM every time I want to look at my Omnipod data. 

Luckily, Tidepool.org came along and liberated the data from my various devices. Gratefully, I offer this small contribution back to Tidepool in the form of a download script that Tidepool users can use to pull their data from Tidepool as CSV or JSON (in its original format from Tidepool, or flattened into JSON lines). 

I sent my device data to Tidepool using their uploader tool, then used the download script to pull the data back to me. I pulled the Dexcom data directly from the Dexcom patient site - bless Dexcom for offering a data export feature, though I plan to eventually upload that data to Tidepool as well.

Then I built a Tableau dashboard, shown below, with data from both devices to show how I have already changed my insulin delivery behavior based on the Dexcom data. (Guess what? My blood glucose level is not steady through the night. It sneaks up to a high level, then sneaks back down to normal just before I wake up, like a naughty teenager sneaking out at night.) I showed this to my doctor so that we could work out new, better pump settings. And now I'm showing it to the world because somehow, somewhere it will improve humanity, hopefully contributing to the understanding and treatment of Type 1 Diabetes, maybe also by showing what can happen when patient data is liberated, or a butterfly effect I haven't imagined.