Like any good parent of a child with Type 1 diabetes, I have no time. I know, I know. Every parent with young kids complains of a lack of free time. Of a lack of sleep. Of stress brought on by the craziness of life with young kids. Trust me. Type 1 diabetes parents are running on fumes, barely able to keep up with anything, given the incredible stress and demands that the disease puts on their lives and that of their family.
All of this is my excuse for taking so long for my next post! But the above also is the rationale of why I started playing with various technical solutions in search of something that could make the management of Type 1 diabetes more manageable. Type 1 Diabetes really sucks (English degree for the win!?). Having a real personal reason to drive one to build solutions with technology? Pretty cool. Especially when a bunch of that tech is from the company at which you work and part of a product that you yourself manage.
If you remember my previous post, it was not long after diagnosis that I started envisioning potential systems that could help with the day-to-day management of the disease. And it was at the same time that I discovered an incredibly rich, sophisticated and innovative DIY community that was building life-changing technology for the Type 1 diabetes world, outside the commercial space.
We’re talking about organizations that have emerged over the last decade or so, where people who just wanted answers, who just wanted a better, improved way of managing Type 1 diabetes, dug into the depths of figuring out how things like the continuous glucose monitor (CGM) and insulin pumps were working — wanting to take advantage of data and capabilities and technology advancements in their own day-to-day lives to ease the burden of Type 1 diabetes.
Without a doubt, the people and teams behind things like the Nightscout Project, OpenAPS and Loop are tremendous examples of what can be done by a collaborative open source community.
So as a technologist, a product manager and now a father of a daughter with Type 1 diabetes, I was energized about what I was seeing out there. I set forth, harnessing the power of the open source community, with one objective in mind: to have the fastest, most secure, scalable, resilient and flexible system for me to see my daughter’s ever-changing blood glucose levels.
In this post, I’ll provide more detail on the hardware, network and communication software, and end-user applications for my DIY Type 1 diabetes management system.
Solution Architecture
I started by establishing what it was that I wanted to improve and outlining my challenges and requirements. My primary goal was to create a technology stack that could stream updates from my daughter’s CGM to an increasing amount of end-user applications, including SMS, push notifications, Slack, IoT lightbulbs (more on that one in a bit) — any interface I interact with throughout the day.
Why so many apps? I have a life to live myself. I have to go to work. My wife and I both needed to be able to consume the data and updates, and it needs to be the exact same data. I can’t be looking at my phone all of the time, but I need to know the moment there’s a potential problem. Most important, I need to know that I have the most up-to-date data available.
My solution architecture looks like this: Using PubNub, it’s 100% serverless, has reliable high-speed message delivery, it’s easy to integrate new clients and continues to prove extensible via PubNub Functions. More on those further down in this post.
Hardware
It all starts with the Dexcom continuous glucose monitor attached to my daughter’s belly. The CGM communicates with her phone that is always nearby, via Bluetooth. Every five minutes, the CGM sends her current blood glucose level to her phone.
Software and network communication
From that phone, using a slightly customized Loop application, the system sniffs out the Bluetooth traffic for new numbers and sends that data to PubNub through Wi-Fi or LTE. And from there, it’s off to the races.
So, why PubNub?
• I don’t have to stand up any servers. It’s entirely serverless.
• I don’t have to build up any sophisticated application stacks.
• It’s super-fast. Messages are sent from my daughter’s CGM to all end-user apps in under a quarter of a second.
• Reliability. I’ve got great confidence that every message will be delivered in real time.
The PubNub Data Stream Network is responsible for augmenting and distributing that data in sub-quarter-second speeds through any number of application channels. As you can see from the below picture, comparing the PubNub-powered application to the Dexcom cloud-based one, I receive the data almost instantaneously, and routinely many, many seconds before the Dexcom application, if not several minutes or longer. It’s so fast that I’ve made my non-techie wife a big fan of PubNub and a heavy user of our primary phone application, Slack.
PubNub Functions, our serverless compute platform, also plays a big role in this and allows me to do a lot of things that I wouldn’t be able to do with the CGM system right out of the box. I have a number, the current blood glucose level, but now what can I do with it? A simple number might not be completely useful. What are the 10 numbers that came before it? What’s the trend? What other data can I add into that data packet that I’m going to distribute out?
The platform brings business logic into my real-time environment. I can add in statistical analysis and make the data more readily understandable by humans. It’s all part of the data flow. It also expands what apps and devices integrate into the application, and we’ll cover those in our next part.
End-user applications
That data can be published to any number of application channels. Using core PubNub SDKs, I was able to quickly stream updates to my Mac menu bar, publish updates to a real-time chart or custom JavaScript webpage in the browser, and send a push notification with the newest reading.
But not everything can be rapidly integrated into the app through the core PubNub SDKs, specifically the third-party services and devices. That needs a little bit of integration work. That’s where PubNub Functions comes into play, really opening up where I could stream the data to.
This is how I’m able to trigger an SMS/text message through a third-party service. This is also how I’m able to send every new reading to Slack. And it’s how I’m able to change the color of an LIFX lightbulb depending on the number.
Continuing to add new applications
The LIFX lightbulb was particularly interesting to me and shows how flexible the system really is for adding new end-user applications. When my daughter’s asleep and I’m in my bedroom reading a book or watching TV, looking at my phone with each update takes me out of my concentration. Relaxation at the end of a long day is hard to achieve!
So, I added the LIFX internet-connected lightbulb to the system, which changes color and brightness based on my daughter’s blood sugar levels. Red means high, green means in range, blue means trending low and incredibly bright blue means low and action required. It’s had a huge impact on my wife’s and my nightly routine. And it only took 15 minutes to implement, start to finish.
Why all the fuss?
Why am I so excited about what I’ve built and how I’ve used PubNub? The emotional benefit has been incredible for my wife and me. The whole notion of being able to see data the moment it comes off my daughter’s CGM — it’s huge as a parent.
From there, I can easily distribute that number to an ever-growing number of applications I interact with, continuing to improve how I consume it in a more efficient, less disruptive way in my everyday life. That data is wherever I need it, whenever I need it.
Lastly, resilience. This is what PubNub and other hosted-platforms like it do. Day in and day out, these vendors work to solve data distribution needs in the most reliable and secure way.
I look forward to continuing adding new end-user applications, enhancing my system and improving how my wife and I manage my daughter’s Type 1 diabetes. And I’ll continue to share and watch with excitement as the DIY, open-source Type 1 diabetes community grows.