How does a closed loop artificial pancreas work when you DIY? Or: #DIYPS closed loop is working!

We closed the loop with #DIYPS and now have a DIY closed loop artificial pancreas running right now (for me, aka n=1.)

Here’s what a closed loop #DIYPS artificial pancreas looks like:


(A raspberry pi powered with a battery (shown) or via an outlet; a Carelink USB plugged into the Pi and in close proximity to the pump; a Medtronic insulin pump (an older version, thanks to a family from CGM in the Cloud for sharing it!); and of course my CGM and Android uploader phone that’s sending my data into the cloud/#DIYPS)

Here’s how a closed loop artificial pancreas or “#DIYPS closed loop” works:

Over the past year, we’ve been using #DIYPS to process BG, insulin on board and carbohydrate decay in real time. This yields real-time predictive alerts of three kinds: more insulin needed (X.X units of bolus insulin); less insulin needed (temp basal to zero insulin for X minutes); or carbs needed. Using this algorithm and my data entered (insulin taken or reduced; carbs ingested); we’ve seen significant results not only for the first 100 days, but also sustained over an entire year for improved average glucose, improved a1c, and improved time in range.

Closing the loop with #DIYPS

Three weeks ago, we mentioned at D-Data Exchange 2014 that we were planning to close the loop with #DIYPS…by August 1 (our wedding date :)).

The FDA was even in the room.

Two weeks later…we closed the loop.

It was this simple:

  • Thanks to Ben West’s awesome work, we plugged the Carelink USB into the Raspberry Pi. Thanks to a generous family from the CGM in the Cloud Facebook group, we acquired an old 522 insulin pump that could talk to the Carelink USB. (My current pump is too modern to work with this setup.)
  • Once we established that the Pi/USB setup could read from the pump, we started connecting #DIYPS to the system to close the loop.
  • Normally, #DIYPS provides 3 types of recommendations (see above). We reconfigured it so that while “looping”, it only enables the pump to do temporary basal rates instead of boluses. If #DIYPS says I need more insulin, it tells the pump to begin a temporary basal rate for 30 minutes above my normal basal rate. If #DIYPS says I need less insulin, it tells the pump to begin a temporary basal rate lower than my normal basal rate for 30 minutes, effectively reducing my net insulin.
  • When something changes and I need to do more or less insulin, #DIYPS tells the pump to increase or decrease the temporary basal rate, or resume my normal basal rate.
  • Note: there is a maximum basal rate that the pump can provide. This is a safety check so that #DIYPS cannot recommend a seriously dangerous basal rate. In fact, if I need more insulin than #DIYPS closed loop can safely provide using a 30 minute temp basal, the system will alarm and alert me to that state (although I usually already know about it). Same for if I was dropping fast and needed carbs in addition to reducing insulin; it would alarm and recommend carbs above and beyond reducing insulin.

I’ve been ‘looping’ (using #DIYPS closed loop) for a little over a week. Here are some of my overnight results:

As you can see, the outcomes are awesome. In fact, they are better than I expected!

#DIYPS closed loop results are significant

Here’s a break down that shows on an example night (Sunday night, 12/14 through Monday morning, 12/15) of how #DIYPS performed:

You can see that around 10:30 (not pictured, but in the graph), I was running low and needed some temp basals to zero, then later some higher temp basals to accommodate the resulting rise in BG. Later, my normal basal rates sufficed until another point overnight when I needed less insulin to prevent a low.

While this is 1/9 or so example nights, this is pretty much how it works every night. BGs drift up? Temp basal higher (usually 1.6 or 1.8, which is <=.5u above my normal). BGs drifting low? Temp basal lower or in extreme cases to zero to prevent a low.

What happens if the closed loop artificial pancreas fails/stops working?

If the loop stops working*, #DIYPS continues to work normally (processing all data and pushing recommendations), and my pump goes back to my normal basal profiles after any existing temp basal rates expire (which would be a max of 30 minutes). No big deal and no more dangerous than I would be walking around with my pump acting normally.

*I’ve found numerous ways to make the system stop working: no battery power; being too far away from the USB stick so the pump can’t communicate; no cell signal to provide wifi as a hotspot to the Raspberry Pi; if the pump battery goes low, RF gets turned off and the USB can’t talk to the pump; if there’s no cell signal or wifi at all, I can’t upload CGM data to #DIYPS anyway; if the SD card gets corrupted inside the Raspberry Pi; etc.

So, there’s many points of failure. But it doesn’t matter. #DIYPS closed loop is safer for me (disclaimer: just me! I’m the only one doing this as a personal experiment to my own body) than if I just had a pump and a CGM, because it can reduce insulin and prevent lows. And it can increase insulin slightly and prevent rebounds.

After about a week’s worth of data, here’s the results of #DIYPS (what I’ve been using for the past year) versus the week of closed loop #DIYPS:


The target BG is especially awesome, because we have the closed loop targeting a BG of 115!

It’s also worth noting the reduction in alarms. Remember, I sleep through CGM alarms, so we built #DIYPS. #DIYPS makes a lot of alarms – sometimes upwards of 40 a night (those are really bad nights!). With the closed loop nights, there are very few alarms..and they’re usually alerts about things #DIYPS closed loop is taking care of on it’s own (see all of those no-hitters above!).


What’s next with #DIYPS closed loop

We’re going to continue and iterate on the closed loop and keep making it better. I’m definitely going to keep using it overnight – it’s like having a working pancreas, the kind where you can go to sleep without fear.

We’re also adding this to the ‘things we’ve learned while working on #DIYPS’ list:

  • Calculating the carbohydrate absorption rate for an individual – how many carbohydrates your body absorbs in an hour
  • Tracking “carbs on board” or “carb decay” – how many carbohydrates are still being digested in your body and impact BG levels
  • “Net” IOB – tracking net IOB by incorporating “negative” boluses from temporary basal rates to zero
  • Preventing post-meal BG spikes/drops with early meal boluses and better understanding of insulin activity
  • and you can control overnight BGs solely using simple adjustments of insulin rates.

Thanks to everyone who made it through a really long post, and for the MANY people who have contributed in various ways to helping us close the loop with #DIYPS! Also, let us know what questions come to mind that we haven’t managed to answer above about how the system works, results, etc.

Why #DIYPS N=1 data is significant (and #DIYPS is a year old!)

As I’ve said many times, last year we set out to create a louder CGM alarm system. By adding “snoozes” so I didn’t drive my co-investigator crazy, we realized I might as well enter what I was doing, and be precise about it (aided by some quick bolus and quick carb buttons that made data-entry not the chore that it sounds). Thus, we had the data and the brains to realize that this made for some great predictions; much better than what you usually see in diabetes tools because they rely only on your insulin sensitivity factor (ISF) and correction rate, but don’t take into account carbs on board and their impact over time, etc.

(If you’re new to #DIYPS, read about the beginnings of it here. For more on this idea of carbs on board and the carbohydrate absorption rate and how significant it is for people with diabetes, read about that here.)

After I had spent 100 days using #DIYPS, Scott and I stopped to look and see what the impact was. For the long version, read this post about the results and the direct comparison to the bionic pancreas trial data that was available then. The short version: #DIYPS reduced my eAG and a1c significantly, reduced lows, reduced highs – aka my time in range was improved from 50% to regularly 80+%.

I have asked myself (and others have asked), are these results sustainable? Are these improved outcomes truly because of #DIYPS? It’s definitely worth noting I never changed what or how I ate. (I ate 120 grams of pizza (for science! ;)) several times to test the system, but I didn’t eat less or any healthier or otherwise change my diet.)
I can’t attribute these outcomes directly to #DIYPS alone, but I do believe they’re highly correlated. It’s hard to separate other contributing factors like the fact that I have more boluses per day using #DIYPS (which other studies have shown decreases a1c); or the fact that I spend less time high/low because with #DIYPS I actually can wake up at night and take action before I’m high or low.
So, it’d be hard to study specific factors and say “it’s all #DIYPS”. But, I’m pretty sure it’s mostly #DIYPS. Regardless, here’s the updated data about the sustainability of the results I’ve seen with #DIYPS over the past year:
Why this is significant
#DIYPS is currently n=1 (meaning one person is the study’s subject). But what is significant is that I have year’s worth of data and actual lab-tested a1cs that shows the outcome of this type of artificial pancreas work. And it (to date, but coming soon  / OMG this week!) hasn’t even been closed loop – I’m still the “human in the loop” making decisions and pushing buttons on my pump.Compared to the bionic pancreas and other artificial pancreas study trials where they have a few days and a few more (usually n=20 or so) subjects; they can look at the decrease in lows and highs and improved eAG…but they can only project what the a1c improvement is going to be.We’ve shown the improvements in lab-tested a1cs – see my graph above?

It all adds up
Scott and I are not the only ones working on a closed loop. The community of developers connected to the Nightscout community has nearly two hands full of people who are working independently on device interoperability to close the loop by freeing our data from devices and enabling us to work with our own algorithms regardless of which hardware device we use to support our diabetes management.When all of these n=1 studies add up, it matters. At some point in the near future, after we’ve closed the loop with #DIYPS (ah! this week! :)) and others have as well, we may have more n=1 hours on closed loop artificial pancreas systems than the (traditional) “researchers”. Scott and I are hoping that we can not only show the world how open source innovation and new regulatory paradigms can deliver safe and effective results for people living with T1D faster than traditional medical device development and traditional regulation; but that we can also change how all successful medical device companies approach interoperability, and how traditional medical researchers do research – possibly in partnership with patient researchers like us.

What we’ve been up to lately – closing the loop with #DIYPS and open process work

We’ve been quiet on the blogging front (yes, I admit, I blogged!) because we’ve been busy closing the loop. (We’re always active on Twitter, though – make sure you watch #DIYPS on Twitter for more real-time updates in between blog posts, and you can follow @ScottLeibrand and @DanaMLewis.)

That’s right.

Closing the loop.

It feels good to say that :).

We’re submitting a research proposal to Medtronic to get access to their research device that will enable us to send commands to my insulin pump. These commands will be generated from #DIYPS. Because that would remove the “human in the loop” component that’s a current part of #DIYPS (i.e.  me pushing the pump buttons), that would move #DIYPS from being not an artificial pancreas to a closed loop artificial pancreas system.

This is not what we imagined we would do when we set off nearly a year ago to do this work (make a louder CGM alarm system, enable remote monitoring, etc.), but this is awesome!

And, in the true #wearenotwaiting spirit, we’re not waiting for the research device to start this phase of our work. We got started with this phase of our research by getting a Raspberry Pi and hooking it up to the Carelink USB and sending commands to a test Medtronic pump.

(Note: this pump is not hooked up to my body! There is no insulin in it! We’re just testing to see how data can be read off the pump & fed into #DIYPS. There will be many tests with a pump not connected to my body and many safety checks and stages before we would get anywhere near to allowing this to run under waking, close observation let alone under observed sleeping conditions. Stay tuned for more on this later.)

Where we are with #DIYPS and Nightscout

We’ve been having many discussions with the other developers of Nightscout, and end users in the CGM in the Cloud Facebook group around this topic. Scott and I are both passionate about the open source part of our project and being open and transparent every step of the way. We’ve been learning a lot from #DIYPS and have some key features that we’re putting back into the overall Nightscout platform as a result. We’re calling this “#DIYPS-Lite”, or the “wip/iob-cob” branch of Nightscout. (This is not what the main community is using, it’s still an advanced test branch, but enables more advanced users to implement and take advantage of some of these features, like net IOB and COB.) We’ve also been contributing to the roadmap of Nightscout; as of this past weekend, we helped map out the priority list to show what are priorities of some of the core developers (including Scott and I); what’s currently being worked on; and what’s on the ‘backlog’ as a project we’re all interested in and is important to the community, but no one’s had a chance to jump in and start it yet.

Back to the closed loop update

We won’t be releasing any closed-loop systems to the public any time soon, because that would mean distributing an untested medical device system that controls administration of a potentially lethal drug (insulin), which the FDA (and anyone in their right mind) would (rightly) frown on.

Instead, we want to open up our process of developing such systems, so that other researchers (including independent ones like us, and those inside traditional research labs and companies) have a roadmap to follow for how to safely put together and test an open-source artificial pancreas system.  The more people and companies we have developing such systems, sharing their results, and learning from each other’s work, the closer we’ll be to having a system that could indeed be proven safe and effective to the FDA’s satisfaction, and eventually released to the public.  In the end, we suspect the companies and research labs developing APS systems will be the ones to commercialize them, but we are confident that our efforts will accelerate those timelines and result in a more dynamic, innovative T1D medical device ecosystem that will provide a bridge to a true cure.

We are hoping that we can show the world how open source innovation and new regulatory paradigms can deliver safe and effective results for people living with T1D faster than traditional medical device development and traditional regulation.  By doing so, we can change how all successful medical device companies approach interoperability, and get to a world where the latest ideas, algorithms, and software can be made available to everyone with T1D, regardless of what hardware they’re using.


(More to come next week as we mark 1 full year of #DIYPS in action (!) and we have some new data to share!)

12 years & counting – are we there yet?

Today marks 12 years of living with diabetes. (Like everyone else, I wonder what to do on yet another diabetes anniversary – celebrate? Cry? Eat gluten-free cupcakes? All three things?) And interestingly, I’m almost at the one year mark of living with diabetes powered by #DIYPS.

When I was diagnosed, my blood glucose meter was bigger in all dimensions than the iPhone 6+.  Luckily, that’s changed, and my meter is now about the size of my Pebble smart watch – and that watch actually shows my my blood glucose readings from my CGM every 5 minutes.

Even better, in the last year, we’ve built a system that will not only give me a number, but help me track changes and push alerts so I can pay attention when needed…but otherwise live my life and not let diabetes get in the way of the things I actually want to be doing (running marathons, reading marathons, saving the world, etc.).

What hasn’t changed, though? My insulin pump. I’m pretty sure it’s a slightly different purple color than it was 11 or so years ago, but not much else has changed. For 11+ years I’ve been wanting:

  • To be able to see (on the pump) a HISTORY of any temporary basal rates
  • To be able to have “days of the week” programmable basal rates. (As you can imagine, my Tuesdays and Saturdays look a little different!)
  • To be able to have “net IOB” calculated and displayed to reflect the true amount of insulin in my body

For 11 years, I didn’t question the lack of progress, much, though. That’s just the way it was. I imagined it would probably be this way until we got a cure for diabetes in (5 or insert your magical number here) years.

I’m glad this is no longer the way it is and that I have tools like #DIYPS. But I hope that medical device companies will get out of their rut and the way they’ve been doing innovation and business for eons and do better. Because what they’re doing right now is not good enough. And #wearenotwaiting.

How and why we are working with the FDA: background and a brief summary of the recent meeting with the FDA about the Nightscout project

On Wednesday, October 8, 2014, I accompanied several other individuals active within the CGM in the Cloud community (John Costik, Ben West, Bennet Dunlap, and Ping Fang), and an invited guest observer (Mark O’Donnell from Medtronic) to meet with the US Food and Drug Administration (FDA) to discuss the Nightscout project. Our goal was to begin a dialog with the FDA, in which we hope to educate the FDA on the Nightscout system and the open source development methodology behind it, to learn what concerns the FDA might have about the project, and to determine which efforts need to be prioritized to address those concerns and ensure the safety of everyone using the Nightscout system.

As most of you are aware (and as outlined so well in the recent front-page WSJ article), the Nightscout project started with John Costik’s early efforts to improve safety for his son going to kindergarten, by using the USB interface of his Dexcom G4 Continuous Glucose Monitor (CGM) to obtain up-to-date glucose readings, and make that data available remotely. After John and a few others released their code, many other interested developers began improving and extending it using an open-source development model.

Since that time, the CGM in the Cloud Facebook group has grown to over 7,000 members, and the open-source Nightscout project has been developed into the system used regularly by most of the over 1,100 individuals who have made their own copies (forks) of the source code on GitHub. Recognizing that this rapid growth indicated something so important to so many people living with diabetes, the FDA has reached out over the last several months to a number of us at events like the D-Mine D-Data Exchange.

We all recognize that this kind of open-source patient-driven project has the potential to greatly improve patient safety, quality of life, and quality of treatment. Furthermore, this bottom-up innovation also represents a new way of developing potentially life-saving mHealth systems: it falls somewhat outside the way medical devices have traditionally been developed and regulated, both in the open-source nature of the project and the #WeAreNotWaiting-inspired speed of software development, testing, and release.

In light of all this, the FDA encouraged those of us working on Nightscout to begin working with the FDA through their pre-submission process, so they can better understand what we are doing, and so they can work with us to make sure that we are doing everything possible to accomplish the shared goal of maximizing patient safety. We also saw it as an opportunity to work with the FDA to help them develop a model for regulating patient-driven open source mHealth software, which ensures the aforementioned focus on safety without unnecessarily slowing things down. So Ben West did exactly what the FDA suggested, documenting a number of details about how the Nightscout software and project currently work, and formally submitted them to the FDA along with a request for Wednesday’s meeting.

This meeting represented an excellent start on the dialog required to reach those goals. The FDA asked a number of questions about how Nightscout’s open-source development model works. From our perspective, they seemed particularly interested in learning about the (currently largely informal, yet effective) processes we have in place for ensuring that new features and code are well reviewed and tested before being made available to the general public, and for making sure that any reported issues that might represent a safety issue can be appropriately triaged, prioritized, fixed, and the fix distributed back to the people using the software. They also expressed an interest in making sure that there is a core person, group, or entity that is responsible for making sure nothing falls through the cracks and that any modifications or new features are well-tested and work as designed, and who will take responsibility and take appropriate action if something goes wrong.

Prior to Wednesday’s meeting, some people had expressed concern whether formally engaging with the FDA would put the Nightscout project at risk, and possibly even result in the FDA “shutting it down” and taking away a tool that many people find invaluable in helping ensure the safety of themselves or their loved ones. Given the FDA’s desire to work with us, we did not think that would be a significant risk. In fact, we felt that failing to engage the FDA would be irresponsible, because it would not only put the project at risk, but it would mean that we were not doing everything we could to ensure safety.

Now that we have actually had our first meeting with the FDA and heard what their major concerns are, I am even more confident that we are on the right track. The FDA’s initial questions were mostly focused on making sure that we have good processes, procedures, and systems in place to make sure Nightscout is safe as it can be, even in rare and challenging circumstances. We share their focus on safety, and while we have already put in place systems to address most of the things they are concerned about, we are also committed to working with them to identify and close any gaps. The FDA has not yet indicated to us that they have any problems with what Nightscout is currently doing, but rather indicated they want to learn more, discuss internally, and keep communications open.

We are currently in the process of writing up formal minutes based on the notes I took at the meeting and getting those over to FDA so they can review them for accuracy. Once they approve the minutes, we plan to post them, along with the raw notes, for everyone to review.

Over the next few weeks and months, we will be undertaking an effort to document (and in some cases improve) our processes and systems. That is partly so the FDA knows we’re doing the right thing, but it’s even more importantly so that all of you, the CGM in the Cloud community, can be confident that we’re all doing everything we can to keep our loved ones safe. That is the primary goal that we all share, and #WeAreNotWaiting to make it happen.

An artificial pancreas may not be good enough – #DIYPS perspective

I didn’t expect to end up with #DIYPS when Scott and I first started building a system that would make louder CGM alarms. (If you are new to #DIYPS, read this post to learn more about it!)

But, as we added ‘snooze’ features for the loud alarms; the ability to input carbohydrates and insulin into the system; figured out that knowing your carbohydrate absorption rate is critical for managing diabetes as is the timing of the insulin activity in your body during mealtimes; and realizing that net IOB (factoring in temporary basal rates) matters…we ended up with today’s version of #DIYPS.

After the first 100 days, we knew #DIYPS was as good as the bionic pancreas was performing in clinical trials. And after several more months, I’ve had sustained results that show the value and impact of this type of system.

But, as more news and attention lately is focused on the “bionic pancreas” and APS (artificial pancreas systems), I have started to wonder… will those be good enough (for me)?

APS/bionic pancreas will not be a cure – it will not take away diabetes. It will make managing diabetes easier for many people.

But since I have #DIYPS, those systems may not be good enough (initially, for me).

The big difference between #DIYPS and APS is automation. With #DIYPS, I make all decisions and push all buttons to add or reduce insulin. There is still a “human in the loop”.

My hope would be able to add the ability for DIYPS to automatically set basal rates to zero temporarily overnight in advance of predicted low BG, to help prevent lows without having to wake up from a deep sleep and take that action myself. (And as Medtronic’s Low Glucose Suspend (LGS) technology has shown to the world and FDA, the risk of stopping insulin delivery for up to two hours while someone is sleeping is lower than it would be to continue providing insulin to them if they are not waking up and are low.)

If we’re able to make that happen with #DIYPS, I may be one of those people who doesn’t want to jump on board for day 1 of the first market available artificial pancreas system or bionic pancreas. (Although I reserve the right to change my mind :D). After all, at this point it would be a battle of the algorithms to see what system might work best for the most people. (And since I have my own algorithms that Scott and I developed, they might be better than the alternative for me.)

I also can imagine that there will be many people who won’t implicitly trust the/a system to make decisions for them all the time. They’ll still want a “human in the loop”.

#DIYPS-type systems that are “decision assist systems” may play an important role as a stepping stone platform for people to get comfortable with this new generation of technology that can predict lows and highs and make recommendations for them to take action.

Eventually, maybe everyone will be on an APS or bionic pancreas. Even setting aside the difficult questions of cost, availability, and insurance coverage, I know that one technology will not fit every person with diabetes (like how CGM in the Cloud is not for everyone); one system will not meet the needs of everyone; and none of us will be ultimately satisfied until we’ve prevented and cured all types of diabetes and eradicated the impact of any complications from diabetes.

But until we get there, #wearenotwaiting.

“Micro” highs and lows (they’re not really all the same)

More thinking on what a snapshot of diabetes data means to me – this time on ‘micro’ highs or lows. @danamlewis #DIYPS http://bit.ly/1lt2ijE

I went to take a snapshot of my 24 hour CGM graph, because I was pleased with the outcome of the past 24 hours: no major lows or highs. According to the picture, it’s a “no hitter” (not hitting the high or low lines). However, I have the high alarm set to 170 right now, so to me knowing that I peaked around 150 overnight, including the slow crawl up to it, means it wasn’t a true no-hitter.

But, isn’t it still worth celebrating? No major overnight alarms to wake me up. No juicy juice or temp basals or reduced sleep or waking up feeling like I was dehydrated and apt to develop ketones. Diabetes, for a day, wasn’t a big deal. Isn’t this the ultimate goal of living with diabetes – living well, and not letting it stop us from living our lives and doing what we’re striving to do?

I tweeted the CGM picture with this caption:

Because it’s true. A 400 and 121 are both technically, medically speaking both “high” and “highs”. But are they the same? No.

(And same goes for any single data point – 121 could be flat, going up, or sliding down – the trend is what matters, regardless of what FDA has agreed to at this point in time. )

So, I’ve decided to categorize things as “micro” highs and lows when I’m sliding slightly below my comfortable range (like floating in low 80s or 70s and feeling low symptoms) or rising above what’s “normal” (80-120 is burned into my brain as normal), but may not warrant taking a picture as a “high”.

Semantics? Maybe. But as we talk about what these numbers represent, our ability and willingness to have a conversation about them online, including defeating data-shaming, I think it’s worth continually reframing and gaining more perspective on what diabetes data means to each of us.

“Letting go of things we can’t control” + remembering that sleep matters (#DIYPS)

Sleep + so many factors out of our control impacts BGs. (#DIYPS lessons learned from @danamlewis after #RagnarNWP): http://bit.ly/1AgTN4M

It’s been over a month since our last #DIYPS update. We haven’t made any significant changes in the system, and have been continuing to use it to successfully manage my BGs to (mostly) my satisfaction.

That is, until this past weekend.

There was a team of 12 people with diabetes that got together (thanks @ConnecT1D and @IN_events for sponsoring!) to run “Ragnar Northwest Passage”, which is a 196 mile long relay race from near the Canadian border (Blaine, Washington) to Langley, Washington.

Guess who was lucky runner #1 and woke up at 3am on Friday to run 6.3 miles at 6:15 am?
Guess who was lucky runner #1 and woke up at 3am on Friday to run 6.3 miles at 6:15 am?

Here’s how the relay works: you have two vans, each with 6 runners, that take turns on the course. Each runner runs three different times, for a total of 13-19 miles. Van 1 starts and the 6 runners hand off to each other; then Van 2 meets up as the 6th runner finishes, and runners 7-12 commence running. Meet up again and handoff back to Van 1. (I’d say “rinse and repeat”, except for there weren’t always showers involved after every single run). The race started for our team on Friday at 6:15 am (see note about 3am wakeup and running first), and continued until Saturday at 4pm-ish.

Why this became a #DIYPS post

I slept ~4 hours on Thursday night before the 3am wake up and early race start. During the actual race, I got about 3.5 hours of sleep overnight in Van 1 while Van 2 was out on the course. Normally I would have 16-20 hours of sleep under my belt for a half-marathon or longer race.

I also didn’t have #DIYPS running at full capacity during the race – my Moto G phone has taken some hard knocks and the cord that connects to my CGM was wonky. So, I pretty much went “old school” and just used my CGMs as-is.

During the race, even without #DIYPS running normally, my BGs were pretty good. I was great during my first run and only had a few lows in the afternoon after that (more from lack of protein/real food than anything else, which I fixed with a big lunch). During my 2nd run, I started my temp basal too soon, miscalculating when the runner before me was coming in, and was between 180-200 during my run. Not *that* big of a deal, but since my average BG is usually <120, I can feel it and it feels different to run. I managed to get it down after my run and in the overnight, and was fine during my 3rd run, and after that. All in all, I was very happy with my BGs during the race. (Oh – and my first run (6.3 miles) and my last run (3.1 miles) were both PRs, personal records, for me! So, yay for good running and good BGs at the same time.)

(Scott & I after the race! We look great on so little sleep and so many miles, right?)

However, once I finished the race and Scott and I headed out for dinner (real food!), despite the usual #DIYPS prebolus strategies, my BGs rocketed up pretty fast. I chalked it up to something related to my liver absorbing or dumping glucose or whatever, didn’t worry about it too much, and focused more on getting 12 hours of sleep that night. (Luckily I was running higher and not lower, so sleeping through a few alarms was ok for the night).

On Sunday, the same thing happened when I ate lunch. A few carbs and my BGs took off high. Same thing Sunday for dinner, and Monday after a breakfast that included carbs.

By Monday evening, I was puzzled and annoyed, because I had #DIYPS running but my body was not cooperating! I was also still feeling tired, above and beyond what Scott (who ran Ragnar on another team that had 12 members with functioning pancreases :) ) seemed to be feeling.

Remembering that sleep matters A LOT to your body, and the same goes for managing BGs

Overnight, my BGs settled down and were flat after 6am and all morning, including after a breakfast with lots of carbs (I ate a gluten-free cookie, it was delicious). My BGs had a slight uptick..and flattened out. Like they used to do last week and all the weeks prior with #DIYPS. I took a picture to send to Scott, and had the sudden realization that my body had probably caught up on sleep to it’s minimum levels, and that’s probably why it was handling things like “normal” again*.

This (knowing that sleep impacts your body’s function) is a lesson I’ve learned many times before, and has less to do with #DIYPS….except it helped remind me that there are SO many factors out of our control in dealing with diabetes. (Stressed? Excited? Sick? Sleep deprived? Are you a girl? Are you growing? Are you in puberty? Is the moon out? Is there a universal Diet Coke shortage?)

#DIYPS is great at helping you deal with BGs if you don’t know the exact carb count in a meal, or dealing with the chaos of running more than a half marathon over three legs in a 36 hour time period on less than 8 hours of sleep. Like I mentioned before, it also helps me keep perspective – this time to help me let the few days of higher than normal post-race BGs go and not beat myself up about it.

Final note

It’s probably a good idea to not try this kind of sleep deprivation at home (seriously – sleep is awesome, you should do as much of it as possible), and be aware that running Ragnar or another relay race** may throw off your BGs more so from lack of sleep than the actual exercise part.


*Yes, it’s normal to eat a gluten-free cookie for breakfast! The non-normal part is having to do math and bolus and watch BGs. Having diabetes is not normal!
**Scott and I are running on a Hood to Coast team in August. Gulp. Maybe I’ll manage more sleep this time around in the vans?

What is #DIYPS (Do-It-Yourself Pancreas System)?

#DIYPS (the Do-It-Yourself Pancreas System) was created by Dana Lewis and Scott Leibrand in the fall of 2013.

Curious about building a closed loop for yourself? Head to OpenAPS.org!

#DIYPS was originally developed with the goal of solving a well-known problem with an existing FDA-approved medical device. We originally set out to figure out a way to augment continuous glucose monitor (CGM) alerts, which aren’t loud enough to wake heavy sleepers, and to alert a loved one if the patient is not responding.

We were able to solve those problems and include additional features such as:

  •  Real-time processing of blood glucose (BG), insulin on board, and carbohydrate decay
  •  Customizable alerts based on CGM data and trends
  •  Real-time predictive alerts for future high or low BG states (hours in advance)
  •  Continually updated recommendations for required insulin or carbs
  • ..and as of December 2014, we ‘closed the loop’ and have #DIYPS running as a closed loop artificial pancreas.
  • (And, as of February 2015, we also launched #OpenAPS, an open and transparent effort to make safe and effective basic Artificial Pancreas System (APS) technology widely available. For more details, check out OpenAPS.org)

You can read this post for more details about how the #DIYPS system works.

While #DIYPS was invented for purposes of better using a continuous glucose monitor (CGM) and initially tailored for use with an insulin pump, what we discovered is that the concepts behind #DIYPS can actually be used with many types of diabetes technology. It can be utilized by those with:

  • CGM and insulin pump
  • CGM and multiple daily injections (MDI) of insulin
  • no CGM (fingerstick testing with BG meter) and insulin pump
  • no CGM (fingerstick testing with BG meter) and multiple daily injections (MDI) of insulin

Here are some frequently asked questions about #DIYPS:

  1. Q:I love it. How can I get it?A: #DIYPS is n=1, and because it is making recommendations based on CGM data, we previously have said that we can not publicly post the code to enable someone else to utilize #DIYPS as-is. There’s two things to know. 1) To get some of the same benefits from #DIYPS as an “open loop” system, with alerts and BG visualizations, you can get Nightscout, which includes all of the publicly-available components of #DIYPS, including the ability to upload Dexcom CGM data, view it on any web browser and on a Pebble watch, and get basic alarms for high and low BG – and depending on which features you enable, you can also get predictive alarms. Some of the other core #DIYPS features (“eating-soon mode“, and sensitivity/resistance/activity modes) are now available in Nightscout. 2) If you are interested in your own closed loop system, check out OpenAPS.org and review the available OpenAPS documentation on Github to help you determine if you have the necessary equipment and help you determine whether you want to do the work to build your own implementation.
  2. Q: “Does #DIYPS really work?”A: Yes! For N=1, using the “open loop” style system with predictive alerts and notifications, we’ve seen some great results. Click here to read a post about the results from #DIYPS after the first 100 days – it’s comparable to the bionic pancreas trial results. Or, click here to read our results after using #DIYPS for a full year. We should probably update this to talk about the second year of using #DIYPS, but the results from the first year have been sustained (yay!) and also augmented by the fact that we closed the loop and have the system auto-adjusting basal rates while I sleep.
  3. Q: “Why do you think #DIYPS works?”A: There could be some correlation with increased timed/energy spent thinking about diabetes compared to normal. (We’d love to do some small scale trials comparing people who use CGMs with easy access to time-in-range metrics and/or eAG data, to compare this effect). And, #DIYPS has also taught us some key lessons related to pre-bolusing for meals and the importance of having insulin activity in the body before a meal begins. You should read 1) this post that talks about our lessons learned from #DIYPS; 2) this post that gives a great example of how someone can eat 120 grams of carbohydrates of gluten-free pizza with minimal impact to blood glucose levels with the help of #DIYPS; 3) this post that will enable you to find out your own carbohydrate absorption rate that you can start using to help you decide when and how you bolus/inject insulin to handle large meals or 4) this post talking about how you can manually enact “eating-soon mode”. And of course, the key reason #DIYPS works (in open loop mode) is because it reduces the cognitive load for a person with diabetes by constantly providing push notifications and real time alerts and predictions about what actions a person with diabetes might need to consider taking. (Read more detail from this post about the background of the system.)
  4. Q:Awesome!  What’s next?A: If you haven’t read about #OpenAPS, we encourage you to check it out at OpenAPS.org. This is where we have taken the inspiration and lessons learned from using #DIYPS in manual mode (i.e. before we closed the loop), and from our first version of a closed loop and are paying it forward with a community of collaborators to make it possible for other people to close the loop! Some new features we wanted for #DIYPS that will likely still happen, but integrated with Nightscout and/or #OpenAPS include:
    • calculation of insulin activity and carb absorption curves (and from there, ISF & IC ratios, etc.) from historical data
    • better-calibrated BG predictions using those calculated absorption curves (with appropriate error bars representing predictive uncertainty)
    • recommendations for when to change basal rates, based on observed vs. predicted BG outcomes
    • integration with activity tracking and calendar data
    • closing the loop – done as of December 2014! :) and made possible for more than (n=1) with #OpenAPS as of February 2015

    We also are collaborating with medical technology and device companies, the FDA, and other projects and organizations like Tidepool, to make sure that the ideas, insights, and features inspired by our original work on #DIYPS get integrated as widely as possible. Stay tuned (follow the #DIYPS hashtagDana Lewis & Scott Leibrand on Twitter, and keep an eye on this blog) for more details about what we’re up to.

  5. Q: “I love it. What can I do to help the #DIYPS project? (or #openAPS)”A: #DIYPS is still a Dana-specific thing, but #OpenAPS is open source and a great place to contribute. First and foremost, if you have any ability to code (or a desire to learn), we need contributors to both the Nightscout project as well as #OpenAPS. There are many things to work on, so we need as many volunteers, with as many different types of skills, as we can get.  For those who are less technical, the CGM in the Cloud Facebook group is a great place to start. For those who are technical and/or want to close the loop for themselves, check out OpenAPS.org, join the openaps-dev google group, and hop on the #intend-to-bolus channel on Gitter. If you want to contact us directly, you can reach out to us on Twitter (@DanaMLewis @ScottLeibrand) or email us (dana@openAPS.org and scott@openAPS.org). We’d also love to know if you’re working on a similar project or if you’ve heard of something else that you think we should look into for a potential #OpenAPS feature or collaboration.

Dana Lewis & Scott Leibrand

Ending data-shaming: diabetes data should provide perspective, not judgment, on diabetes

Let’s end data-shaming. A1c is not only number that matters for ppl w/T1 diabetes. #DIYPS http://bit.ly/1n86Z3A @danamlewis @scottleibrand
My last A1c dropped significantly. Some of these results can be attributed to changes I’ve made with #DIYPS, like predictive alerts, alarms that actually wake me up at night, etc. (If you are new to #DIYPS, click here to read a post explaining what the system is.)

Right now, #DIYPS is still n=1 (me), so until we can have more people using the system and verifying the algorithms (click here to learn more about carbohydrate decay rates and how you can test this yourself) and showing the applicability for a wider group of people, we’ll have to wait and see how these results translate to other people. With this in mind (and with the thought that it’s frustrating that A1c is the ‘holy grail’ of diabetes), I wanted to start looking at additional ways to utilize #DIYPS data, so I had some relevant data between the CGM data and the A1c.

We added a number of additional “stats” to my #DIYPS dashboard:  I started looking at my eAG (estimated average glucose) for a single day, a week, and 30 days. We also added a % ‘time in range’ (between 70 and 150) for the same time periods.

Having this data at my fingertips thanks to #DIYPS provides a great balance between the flood of data I get every day (288 individual data points per CGM) and the three month “benchmark” of A1c.

Why these stats are helpful:

  • I can track overall average (eAG) over time, without having to wait 3 months for the next A1c value.
  • I don’t have to guess where I’m at or go borrow a Windows computer to look at my CGM data.
  • I’m not chasing a lower A1c/eAG at the expense of all else (i.e. having lots of lows). A <120 average for a week is good; but if my time in range is <80%, that’s not ideal. Finding a balance between time in range (95%+ is great, 90%+ is good, 80%+ is target) and a good eAG (<120 or <125) is the ultimate goal.
  • If I have a day with higher than usual BGs (usually resulting in a high 24 hour average and low % time in range), I can see the impact it has on a week and the month.

I am happily sharing my “time in range” and eAG numbers, because I am happy with them, and I’m able to show “what is working”. But I have often hesitated to share my A1c data publicly.

Here’s why:

I’ve observed judgments, negative comments, and changed behaviors based on people’s perceptions of what is a “good A1c” and whether someone is “in control” or not of diabetes, based on this SINGLE average of a value that can be off by as much as 0.5% depending on the lab. This comes back to what Scott and I talked about regarding carbohydrate consumption and judging what people eat.

Why do we do we allow any shaming – regarding food or based on snapshots of data – in our communities? Sometimes there is a conversation about the shaming that happens regarding food choices, but I don’t think we apply the same conversation to data-shaming. My hope is that one day, everyone feels safe sharing their A1c, or pictures of their CGM graphs, at any time – even if it’s not the outcome they were hoping for in that moment.

Diabetes is a constant learning process with constant decision-making. Why don’t we frame sharing data and perspectives like this:

  • Here’s what didn’t work today: (Image of a CGM roller coaster)”
  • “Wow, this (pre-bolusing and then xyz) worked! (Image of someone’s ideal CGM graph)”
  • “Hmm, I tried xyz, but didn’t quite work, I’m going to try xyz+1 next time (image of a spike on a CGM graph)”
  • “Just got my A1c back: X%. Helps me see that small changes are making a difference in the long run.”
  • “Just got my A1c back: X%. Brainstorming ideas with family/care team about what I can do differently.”

Will you join me in pledging to end data-shaming for PWDs (people with diabetes)?

  1. I pledge to stop making snap-judgments about other people’s diabetes data.One data point (A1c or a single BG reading) or a snapshot (3 hour or 24 hour CGM graph) does not tell the story of someone’s decision making and choices. It tells the outcomes of hundreds of decisions that we don’t know about, and hundreds of variables that someone doesn’t have control over. As it’s not our data and not our lives, we have no business making judgments regarding it.
  2. I pledge to start a conversation about data-shaming and bring awareness to this problem when I see it happening.
Please comment below if so, and share your thoughts on what else could be added to the pledge.