Using Realtime Capabilities To Manage Type 1 Diabetes (Part 1)

In February 2018, my family of four — wife, 6-year-old boy and 3-year-old girl — were thrust quite suddenly into the world of Type 1 diabetes. We spent about five days in the hospital trying to stabilize my daughter and learning a whole lot about how to manage the life-threatening disease that would be with her forever.

It is tough to articulate, without tearing up, the intense moments we lived through in those early days as we administered finger pricks and multiple daily insulin injections to a crying toddler. We still live with it; we’re in the early days of a long journey. It is a tough one at that, but we’re much appreciative of all of the wonderful advances that have been made, both medically and technologically.

Diabetes Type 1 and managing the life-threatening disease

Managing Type 1 diabetes lies in the real-time nature of the daily monitoring of my daughter’s disease — constantly keeping tabs on food intake and blood sugar levels so as to determine action or not. In fact, that’s what your normal pancreas — and the rest of your body — is doing right now: constantly tweaking its biochemistry in order to keep things, in this case blood sugars, in a normal, healthy range. Throw whatever you want at it, an In-N-Out Double-Double, a night out eating pizza and drinking beer, a big hangover brunch at the neighborhood diner, and your pancreas can handle it with aplomb, quickly determining exactly how much of its carb-processing power — insulin — it needs to dispense in order to convert this food into energy your body can use. Charting blood sugar over time, even for the craziest of meals, is like looking at a perfect bell curve, with a relatively small peak.

Doing the same for a person with Type 1 diabetes would yield quite a different experience. Since their pancreas cannot produce insulin, the sugars from their meals would just continue to pile up in the bloodstream — this is what creates both short-term emergency risk as well as long-term health deterioration. A chart of their blood sugars gives just a glimpse of the chaos that they deal with on a daily basis, especially without proper, attentive management.

What I set out to solve

It is against this chaos that my wife and I fight each and every minute of the day. That said, life for diabetics has changed tremendously, for the positive, with the advent of technological advancements like the insulin pump and the continuous glucose monitor (CGM). The latter is life-altering for sure; the CGM is the thing that allows my wife and me to see our daughter’s blood sugar levels at any moment in time, even when we’re at work or otherwise far away. The device is firmly planted on my daughter’s belly and has a fine filament inserted into her tissue. Every five minutes, the CGM transmitter sends the current number to a phone nearby, which further sends the data to the cloud. That’s right — our family is a walking IoT use case!

However, there’s a challenge.

The data never gets to us as fast as we would like and, perhaps as importantly, never exactly where we need it to be. For the former, as a parent, I have unrealistic expectations. It can never be fast enough, although in reality, the downstream recipients of said data — me, my wife and other caregivers — can’t and shouldn’t act immediately. But still, I want it fast! On the delivery side, I can’t be picking up my phone constantly. Or staring at a webpage somewhere. Or casually glancing at my smartwatch. I need that singular value, my daughter’s most recent blood glucose level, accessible via many channels, from phone to smartwatch to iPad to computer to whatever other devices I want to connect.

The maker of our CGM, Dexcom Inc., has done a great job with its product, and it has gotten better each release. The current version does not require a finger stick prick calibration, which means less poking of our three-year-old child. Despite the progress, and its basic tracking applications and historical reporting, Dexcom hasn’t invested heavily in the instantaneous delivery of blood glucose level readings to various types of apps and interfaces.

To deal with this limitation, I set out to solve faster delivery to any number of devices and interfaces.


Luckily for me, I haven’t been alone in this — Type 1 diabetes has a robust, advanced do-it-yourself community. Makers and developers around the world have decoded Bluetooth transmissions to create completely new management applications. They have reverse-engineered communication protocols for insulin pumps and have created advanced algorithms, resulting in the first really usable artificial pancreas implementations. And they have created great mostly real-time visualization applications so parents and others can follow their patients and know what the blood glucose numbers are.

That (poor) programmer inside cried a bit when I stumbled across the great efforts of several major players in the Type 1 diabetes DIY world — the Nightscout Foundation, OpenAPS and Loop. What could I tinker on, placating my technical curiosities, all the while making our day-to-day lives a bit easier when it came to disease management? The problem had been solved already!

As I dug deeper, I saw opportunities though. And after I joined real-time API platform leader PubNub later in the year, things started to click. I needed to have everyone involved in my daughter’s care to have the same view of the data, at the same moment in time, as myself and each other. And I needed to recognize that not everyone was going to have the same application up and open at the same time. I needed to have, and others to have, the critical data as soon as it streamed off the CGM. And to have it visible to us all, whether in real-time charts, SMS, push notifications or Slack messages. There was this real-time aspect of the problem space that even some of the DIYers were missing or had codified in closed applications.

Working with a real-time application platform allows you to think much differently about solution architectures. Integrated fast messaging, serverless extension and integration points, inline security and multiples of distribution models and user interfaces all allowed me to focus on the “business” problem that I was trying to solve:

  • Where was data being sent from?
  • To whom should it go and by which method?
  • Should I augment the data with, in this case, additional statistical aggregations?
  • Should I store it in a database, as well, for longer historical views?

I spent way less time thinking about servers, API frameworks, logging, monitoring and so forth, and more time answering the questions that inevitably made the day-to-day management of my daughter’s Type 1 diabetes that much easier.

Now that I’ve introduced you to my project and what I set out to solve, I’ll dive into the details of it all in subsequent parts. I’ll discuss the core components of the project — the hardware, the IoT network and communication — and the end-user applications. Keep an eye out for part two, coming soon!

Leave a Reply

Your email address will not be published. Required fields are marked *