Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Presentations Artificial Pancreas System: #WeAreNotWaiting in Healthcare

Artificial Pancreas System: #WeAreNotWaiting in Healthcare



Dana Lewis, a founder of the open source artificial pancreas (OpenAPS) movement, discusses open source innovation in unexpected places (like healthcare) and how we can democratize data (and innovation processes) to enable more people to solve the most pressing problems in their lives.


Dana Lewis is Principal Investigator for Robert Wood Johnson Foundation funded grant project - Opening Pathways. She helped found the open source artificial pancreas movement, making safe & effective artificial pancreas technology available for people with diabetes. She has designed, coded, tested features for the open source automated insulin delivery algorithm now used by over a thousand people.

About the conference

Software is changing the world. QCon empowers software development by facilitating the spread of knowledge and innovation in the developer community. A practitioner-driven conference, QCon is designed for technical team leads, architects, engineering directors, and project managers who influence innovation in their teams.


Lewis: As was said, I want to talk to you about a problem that I had and how I solved it. I first want to point something out, which is I see two people in the room, two groups of people in the room, and you probably think it's those who appreciate binary jokes and those who do not.

However, when I look at the room, I see those who naturally produce insulin and those who do not. I'm one of those people who no longer naturally produce their own insulin because I was diagnosed with type 1 diabetes at the age of 14. What does that mean? Well, I knew what diabetes meant, I knew that it meant that I would have to take insulin, but I didn't realize how hard it was. What I learned when I was diagnosed with type 1 is that getting diagnosed with any chronic disease, asthma, cystic fibrosis, cancer, diabetes, type 1 or type 2, it's like being struck by lightning. You have no way to prepare. If you or a loved one has ever had a healthcare experience, you probably remember that feeling of just shock, and what's going to happen next, and the feeling that there was a before, and now there's an after, and you're going to have to figure out how to make it work for you. That's what I did. I was able to take insulin because with type 1 diabetes, you don't make insulin, you need insulin. It's easy.

Well, what so many people don't know is that there's a ton of unknowns in type 1 diabetes. We actually don't know really what causes it, we don't have a cure. If you don't know the problem, you can't really fix it. It's just really hard on a regular basis because even though we have insulin, and insulin works, it's not magic and instantaneous. It takes 45 to 60 minutes for an injection of insulin to peek into your body. Your blood sugar may be rising, you can look at that and give yourself insulin, but it can take minutes, if not hours, for that to fully go into effect and fix the problem of your blood sugar rising.

On the flip side, there are things like food that obviously also impact your blood sugar, and those kick-in in about 15 minutes. It's an unfair fight between food and insulin, not just food and insulin, but everything else, stress, adrenaline, excitement, daily life, exercise. Some of these things make your blood sugar go up. Do you know how to measure your stress? Do you know how to adjust your blood sugar for stress? That's really hard to do, to quantify, and to correct for that.

That's why with diabetes, you're often playing catch up between the timing effects of things like food and exercise and stress, and the insulin which has a delayed onset, which is why you often see graphs of people's blood sugar's going up and down and up and down, because you're playing chase and catch up. That's not on the person with diabetes, it's not their fault. Diabetes is inherently really hard. That's what's so frustrating about it.

We have some tools to help, you've probably heard of a continuous glucose monitor, it's something that you can wear on your body. It gives you blood sugar every five minutes. What more could you possibly want? In fact, CGM is really common now in people without diabetes, people who do exercise and really just want to quantify their own body and understand what's happening even if their blood sugar levels are within target. Well, these CGM devices, even though they are made for people with type 1 diabetes, they're not perfect.

You can't change the alarm on it. That was actually my fundamental problem that I'm the world's best sleeper. For example, last night, I went to bed at midnight eastern. I slept for many hours because, one, I was coming from the west coast, so I have a time zone difference, but two, I needed sleep, my body loves sleep. I slept for many hours and I would not have heard this alarm had it gone off. Number two problem is about the insulin pump. Instead of having to inject insulin, you have a pump that gives you insulin throughout the day, it's preprogrammed. What more could you possibly want as a person with diabetes? Well, most people who don't know somebody with diabetes, or even those who do don't realize that insulin pumps are smart because they're preprogrammed, but they're also dumb. They don't know anything about your glucose. If your blood sugar goes low, by design, the insulin pump will overdose you. A problem? Yes.

These devices are good, they're a step forward, they're the gold standard, but they're not enough. Why is diabetes so hard? It's because the person has to look at the data from the glucose monitor, they have to look at the pump, they have to think about what to do over and over again. No big deal you say. Well, the person with diabetes doesn't get to just sit here and enjoy this talk. Somebody with diabetes in this room is thinking about what happened with the beer or wine they had from the cocktail? What are they going to do for dinner? Are they going to walk? What's the time zone changes doing? They've been sitting around all day, but they've been standing, but then the time zone difference. They're making dozens, if not hundreds of decisions a day that affect their blood sugar. The human has to do all of this, the cognitive burden is really high, and diabetes is hard.

People have to do a lot when living with diabetes, and that's why you see the graphs like this. I shared these graphs for two particular reasons. One is that my doctor in 2013 asked me to share some of my data at my next appointment. I said, "Ok, no problem," went away. As I was coming up to that next appointment, I was like, "Ok, let me track my data." My doctor is going to be looking at it. I want to have a good week, I want to show off all my hard work. Well, this was my good week. The yellow lines are high, the red lines are low. Look how many times I went high then low, then high, then low, or stayed high, or stayed low. That meant, I was having a good week but I was 50%, time and goal range. I felt it, I felt bad every time I was high, every time I was low, every time I had to wake up in the middle of night and take action. It's frustrating for that.

<> The second reason it was so frustrating is how I was able to get my data to my doctor. You see, in 2013, the FDA approved software for my glucose monitor that didn't have a loud enough alarm also did not allow me to get data often in real time because it was only approved for a PC, and I had a Mac. Who here has a Mac? Congratulations, you like me, we're not legally able to access your own data off your own machine, which is mind-boggling because this was 2013. It's crazy, still today, it's really hard to get your diabetes data off these devices.

What I had to do to get my data was actually pull the receiver out of my pocket, press the button, wait a second for the screen to show up, press three buttons to get to the 24-hour screen. Then I would pull my phone out of my pocket, take a picture of the receiver, email it to myself, copy and paste it into Excel, then I printed this out and handed it to my doctor, which is ridiculous. It's so ridiculous, this is the state of diabetes and medical device data that my doctor was, "Ok." Had no problem getting my data this way because he was so used to getting all of these oddball things. It was absolutely incredibly frustrating.

The other reason I was so frustrated is because I couldn't hear the CGM alarm. I've been asking the companies for years, "Hey, Company A, I'm using your product. The CGM is not loud enough. Can you make it louder? Software problem, allow me to change the alarm. Allow me to make it louder." I was told, "It's loud enough for most people," which is not a satisfying answer. I was also told, "We're working on it. It will be out in the next version," which is about the same thing as being told a cure is around the corner in five years. People who have been diagnosed with diabetes in the last 30 years, you hear that and guess what? There is still no cure. Five years from now, who knows what will happen? That's what you get when you hear, "It'll be out in the next version in the healthcare world." It's incredibly frustrating, and I felt like, what could I do? I'm just the patient. These are regulated approved devices, I can't change them.

Problems Are Opportunities to Change Things

Well, something changed for me later that year, thankfully. It made me realize a really powerful lesson that has then helped me feel empowered with regards to my diabetes, but also for the rest of my life. I realized that problems are problems, but you can also view them as opportunities to change things. If you don't like it, try to change it. You can't always change it but even oftentimes, the exploration of the problem, better understanding where does it come from, why is it happening, what can I do, if any, and you may not like the choices, where you may realize, "Oh, hey, there's something that I can do." That's what happened for us, because we realized, "Ok, I can't change this device in my pocket because it's FDA approved, it's manufactured, whatever, I can't change it."

My problem is that I want a louder alarm. What happens if I could get my data to my phone? I could get my phone and other absence software programs to make a louder noise. Well, wait a second, getting my data in real time, I couldn't even get it retrospectively. The idea that I had about a louder alarm just sat there for a while, until something changed at the end of 2013. I saw a tweet on Twitter. Usually, this makes people in nontechnical worlds laugh like, "You use Twitter, that sounds so crazy," but seeing things like this on Twitter have actually changed my life and changed other people's lives, because what I saw was a picture of somebody who had figured out how to reverse engineer the software to pull data off the glucose monitor in real time. I went, "Oh, if he's getting the data off in real-time, that's not something I knew how to do, but I bet we could duct tape together a solution to get the data up to the cloud and down to my phone to make the louder alarm," and that's what we actually did. That was my first encounter with open source and DIY.


When I say DIY, you probably think about home renovation. You want to do it yourself to save money, or it's a fun project or whatever. When we talk about diabetes, it's not because it's fun, some people have fun with it, but for the most part, it's something that you feel like you have to do because there's nothing out there on the commercial market coming from the medical device manufacturers that will do the thing that you need it to do. That's really where this all started for me.

What I did was I asked the gentleman from Twitter, emailed him and said, "Hey, this looks cool. Would you share your code with me?" I say that incredulously because as Wes said, I'm not a programmer, by training. I come from a communications background, and I'd never heard of open source before. The guy said yes, and send his code, that was where my exposure and journey in open source began with somebody saying, "Yes, I'll give you my thing. Go use it, do good with it."

What I was able to do was use that code to get my data up into the cloud and sent to an app called Pushover to make a louder alarm, but I didn't stop there. As soon as we'd freed the data, I just felt like there was a world of possibilities. I was able to do a really simple, ugly, but highly effective web page that allowed me to share my data with my loved ones.

Today, it's very common for all the commercial devices to have a share feature built-in, so you can have your loved ones monitor or follow your data if you choose to share it, which is great, especially for parents of kids, or people who live alone, or people who just want support from their loved ones. In 2013, this did not exist. It was two to three years away in the next version.

Not only I was able to display my data, I also realize, "Hey, I don't want just a louder alarm, I want a smart alarm, because the insulin pump is dumb, my glucose monitor is dumb. They don't know what each other are doing." I want to be able to snooze the alarms so that if I go low, and I actually take action and treat it, it doesn't keep telling me that I'm low, that's not really helpful. I was able to put in buttons and build-in this backend if-this then-that tree that would say, "Ok, if you take action and you're low, don't alarm again for x period of time, unless other action is needed."

This essentially became an open loop system. We were able to move from reactive to predictive. This was huge because historically, what information we had as people with diabetes was right now, and the last bit of data that you could see on your device. You had to paint a picture in your head, "Ok, this is what I've been eating, this is what I've been drinking. This is what I've been doing, this is what I'm going to do next," and do all that math in your head. Offloading that decision making to an algorithm to the computer was fantastic, because now, the system would push alerts to me and say, "Hey, we predict that you're going to go low. If you take action now, you won't go as low or you won't have this low at all." It was really incredibly helpful.

The Components of An Artificial Pancreas

We also realized after several months of iterating and talking about it with other people because we were so helped by that, we wanted to tell everybody, "Hey, we found a solution for the louder alarm. Not just a louder alarm, but smarter alarm, look at the things that we can do that we never thought were possible because we're just patients."

It turns out, we actually had everything we need to also build an artificial pancreas. It was a lot easier than we expected, the hard part was building that algorithm, which was actually easy because we went a step at a time and iteratively built it. By the time we realized that, if you take the same pump in CGM that I have, and you put a computer in the middle with the radio stick and the right radio program, you can close the loop. Let's close the loop, let's do it, so we did it.

Automated Diabetes

What this system means is that I was able to automate most of the diabetes decision-making, because you could put the computer in the middle to read from the CGM, the glucose monitor, it would read from the insulin pump, think about what was happening, have an idea of the insulin activity curves, food is fast, insulin is slow, here's what's going to happen, and it would tell the pump give more or less insulin and response and do it over and over again. A human can still take action. If I'm like, "I want to eat a cookie," or, "I'm eating a salad for lunch," or, "I'm going to go for a run," whether it's a marathon, a sprint, or falling off the mountain, it doesn't matter. It would deal with whatever happened, I say that seriously because I have been using the system now for four and a half years.

I've had the norovirus and the flu, I've run marathons, I've sat on my butt after I broke my ankle. This system was able to handle it all without me having to do all of that heavy lifting, it was absolutely incredible.

These are some of those graphs from before, high, low, all the time, even trying my absolute hardest. Humans are not meant to replace the functions of an organ. Computers are much better suited to this job. How good is this? This is what my first week was like, flatline. It absolutely gives me chills every time I show that, because this isn't just a picture. Each of these pictures represents 10 to 12 uninterrupted peaceful nights of sleep and feeling good when you wake up in the morning.

The best analogy I have to give to people without diabetes is - who here has kids, or has kids in their life? You remember when they're little, three months old, and every night, they cry. They might need a diaper change, they might need to be fed, they might just want to wake up and play, you don't know why, you just have to wake up and deal. Every two to three hours, maybe longer stretches, maybe shorter, ups and downs and whatever, but you hold on to the hope that one day they will sleep through the night. One day, they will grow up and leave home. I assume, I don't have kids, but this is what I've been told.

The difference with type 1 diabetes is there is no promise of longer and longer stretches without a closed loop system. There is no growing up and it getting better. You have type 1 diabetes for the rest of your life, that will not change. The only thing that gives us that hope is this technology. It is absolutely life-changing.


That's why we decided also to open source this system, which I was talking with somebody prior to talk, open sourcing an artificial pancreas, that sounds maybe too crazy or risky or scary. We realized living with diabetes as I've already described is super hard and super risky. The moment you're diagnosed, you're given a vial of insulin that both will save your life and also could kill you no matter how hard you try. You're going to get it wrong, life is going to throw you curveballs, you will go high and low, it doesn't matter. You have diabetes, it's really hard. We actually feel like it's safer for people to use this technology knowing the limitations and the downside of this being a self-built system, partially, because we designed for failure.

We know how bad it feels to have a high or low, so we are very motivated to have this system be safe and always do the right thing, which is to prevent a low blood sugar, and ideally bring the highs down. That's why we decided to share it with other people, because we knew once people heard that this was happening, there's going to be some people were, "Yup, I'm going to do it no matter what. You can tell me not to do it, but I'm going to do it." We felt it was safer to share the safety engineering we had done, the design of the system, the algorithm, so people could bring their wisdom, help us make it better, but also have a better starting place. That's where open APS came from.

What does it look like today? It looks like this, you get a pump, a CGM, and a small rig, as we call it. You may or may not have noticed this hanging on my hip, this is my artificial pancreas. What you see on the right is a display of a remote monitoring tool called Night Scout, which is also an open source tool built by the community. This matters and I bring this up, because on the screen you can see my blood sugar. The blue line up and down is how my insulin delivery has been modulated. Even though the green, which is my blood sugar, it looks relatively flat, the system has made a bunch of decisions ever five minutes responding to the trajectory and the predictions of what's going to happen to achieve the flat line.

It's also really noticeable for another reason, which is the fact that these devices are made by different manufacturers. The pump is made by one company, the CGM is made by the other, and oh, yes, we have this open source closed loop thing talking to both of them. All of that data is displayed. This is really key because in medical device and healthcare - well, in technology, of course, you would see all your data in one place. Think about our financial data, really sensitive data. Who's heard of Mint, who's heard of Wealthfront? You probably have some financial tool that allows you to bring all your accounts into one place and view it. In healthcare, we don't get to do that based on the regulations around the data and the devices in the manufacturers themselves.

Our Data Should Be Interoperable

It's a little bit mind-boggling that we have to use multiple medical devices often, but we're asked to use a different app for every single piece of data, for every single device. These devices should absolutely be interoperable, that's what we are trying to do. As the patient, as the people as the person living with these devices, I want to be able to have one place at a glance to see my data, whether it's on my phone or it's on my watch.

That was actually a big driving force for me. I love to be able to glance down and see what's happening with my blood sugar, be able to just look down and say, "Yup, my blood sugar is rising a little bit because I'm standing on a stage with bright lights in my face, a little bit nervous." Doesn't matter because the system says, "Ok, let me dose a little bit of insulin knowing that yes, you're rising, but at some point, it's going to stop."

We want to do so safely that when my adrenaline rush comes back down, my blood sugar is going to nicely float back down into range and in a safe way. I'm able to see that date on my watch, not because a manufacturer allowed me to, but because I was able to duct tape my data together using things like IFTTT, and the internet, and these open source tools to see all my data from the pump and the CGM that don't know about each other and don't talk to each other.

Not Traditional, But…

I get really frustrated as a result when I get told, "Why are you doing this? Because you're not a programmer, you're not an engineer by trade or for your day job or whatever, and you're not a doctor. Who are you to think that you're telling other people about and how to do this?"

Well, it's really frustrating for a number of reasons. One is, we have so many problems in healthcare to go around, we need more hands. Instead of scaring people away and saying, "You're not this, you're not that. Don't touch that," we should be figuring out how can we leverage everybody's skills, everybody's ideas to make things better. The other reason I get really frustrated is because no, my day job is not that of an engineer or a programmer, but honestly, the moment that you were diagnosed with type 1 diabetes, you become a scientist, you become an engineer. You have to be in order to figure out how to make that vial of insulin that can both save your life and also cause you serious harm, you have to figure out how to get it right.

Every single day, the best you can do is waking up the next day and trying again. It's really hard, we have to develop all these skills and do all these things. Every person with diabetes regardless of their socioeconomic background, their walk of life, where they live in the world, no matter what, people are doing this because we have to. It's brought us opportunities to do even more. Instead of telling people with diabetes or people with healthcare conditions, stop, don't do things, we should figure out how do we bring ideas from these communities into the traditional spaces where there's also innovation, there's also research, there's also development going on that may be blocked, because they don't actually understand the problem that they're trying to solve, or it might be blocked by regulations.

We've seen some beautiful things happen in the diabetes world as a result of us developing our own things, sharing it openly, it's open source and licensed so that individuals can use it, but also so commercial companies can use it. We've seen some great things coming out of companies listening, and looking at the data, and running and saying, "Hey, your system here, these safety clauses, this outperforms our system." Instead of just being, "Ok, we're going to ignore that," this company did the right thing, and the smart thing, and the best thing for patients, which is “Let's write code in our language in our system that does what their system does, since it outperforms ours." That's a really beautiful thing to see happening, but it's taken years to get there. This has been diabetes, and I want to see it happen across all of healthcare.

Traditional Innovation

As you see, the traditional innovation process ignores the consumer. It ignores patients, even though we are the ones who have the most lived real-world experience, we have millions of hours of data showing what works and what doesn't in the real world, but pretty much the system ignores us until they have a product that comes to market. You can say, "Well, there's regulations in healthcare, so of course, you couldn't just bring a piece of a medical device to a product," It's like a car, you don't want just the tire, you want the full thing. Well, the patient community looks at this and says, "The car is a solution. The problem is that we want to go from point A to point B faster, especially if you broke your ankle," walking is hard, walking is slow, you want to go from point A to be faster, but I don't know how to build a car.

I see there's a piece of wood and some wheels here, I can make a skateboard. It's not a car, but it's better than walking. It's easier on my ankle, let's do that. Then somebody else will come along and say, "Well, you've got a skateboard. Did you know if you added this steering mechanism to it, you can make a scooter, and you could steer and have more control over that and go a little bit faster?" "Cool, let's do that." Step by step, as you involve more people, you better understand the problem, you're able to iterate, you're able to make different solutions, and that's what we've done in diabetes with the closed loop, with what we call the artificial pancreas system. I didn't set out to build an artificial pancreas system.

What I wanted to do was make a louder alarm to wake me up at night. I ended up building a system that allows me to sleep so I don't have to wake up. Those alarms are still there as a backup, but I don't use them that much. I use them maybe once every six months, which before, I needed those alarms four times a week. Now, it's once every six months. We've gotten to a self-driving car or self-driving pancreas years before the first commercial system reached the market. Still years before the second system is still not out in the market, it's still not universally accessible worldwide. There's thousands of people who are doing this because it is better than what exists today.

The 1% Exceptions

I question you, when you think about your personal life, when you're thinking about a project or even in your professional life, if you're thinking about customers or people in your company, and you're, "Yes, they're one off. They're the 1%, that's not the main problem.” What if they are actually the undiscovered rule? Instead of ignoring them, instead of brushing them off, what happens if we dig deeper and better understand the situation that we're talking about? What people are complaining about, what they're asking for, there might be something fundamental there that we can do, that we can change. That's what's happened to diabetes, we've been criticized in the open source community for years for a number of reasons.

One of which is not everybody needs to have access to their data. Well, guess what? The same argument was made about finger stick blood glucose testing back in the 1970s. Patients had to advocate to test their blood sugar at home, which is mind-boggling because now, everybody wants CGMs, everybody wants the real-time data. Originally, even finger stick blood glucose testing, which is a fundamental of diabetes care, patients had to fight for that because doctors said, "No, patients will do wrong things if they have their data." This protest about patients knowing what they need and what they want is a tale as old as times, especially in the medical world. I challenge you to think whether it's your profession, your personal life, think about the undiscovered rule there that those 1% or that small population of people actually represents.

Surface and Share Data Openly

The second thing I challenge you to think about is what happens if you take data and share it openly and surface it to new people inside your company or outside in a community? I bet you will be able to come up with more ideas, your own folks will have more inspiration, more ideas, more opportunities for collaboration, regardless of what role people come from. Remember, I'm not a programmer or engineer by training. Do I do programming now? Yes. Have I achieved something that works really well for me and untold for other people too? Yes. If people kept putting me down and saying, "You're not a programmer. Shut up. Go away," we wouldn't have this today.

Instead of focusing on roles, instead of focusing on telling people no, what if we say, "Ok. What can we do together? What ideas would come up?"


I hope you take three things away from my talk today, even if you don't care about diabetes, even if you don't care about healthcare, even if you work in a different space. The first thing is that you don't know what you can do until you try. This whole story was about iterating and me trying and saying, "Well, we don't know, but let's find out. We don't know what this will help. We don't know if we can make a louder alarm, but let's see what can happen." "Oh, hey, here's what happens when we free the data. Let's try something else."

Along the way, our first thing was in PHP, and then our next thing was in a little bit of Python, and then JavaScript. People come along all the time and they're, "Oh, my gosh, your algorithm is in JavaScript. Terrible, you must change it." I'm, "Yes, but it works," If you want to recreate something else and make it better, let's absolutely do that. In the meantime, this works. We were able to do it because that was the language that our collaborators were using, so we figured out how do we make it work. Don't worry too much about what things the languages are in and just try to do it, either learn that language or learn a new language, it's easier than we think when we let go of those preconceptions about what you have to do, and just start trying.

The second thing is perfect is the enemy of done. Anything is going to be better than nothing. Don't wait for it to be perfect, don't wait until you have it all figured out necessarily. Just get started, and try, and do version one. Do alpha testing, do beta testing, know that it's not going to be perfect. For some people, that's going to be better than not having anything at all. For me, we've been iterating on the system now for four and a half years. Is it perfect? No. Do we keep changing it? Yes. Have we learned a lot along the way? Absolutely.

I didn't even want to wait one more night. As soon as we figured out how to do it, we finished my closed loop system at 9 p.m., we got it to talk to the pump. I close my laptop and went to bed with it because the reality of going to sleep without a computer watching over my blood sugars was so scary and so bad in comparison. It didn't matter that wasn't perfect, there were problems with it, we made it better. We're still improving it today, but it was so much better than the status quo of living with diabetes.

The third thing is realizing that yes, small changes are small changes, but if you iterate over time, a lot of those changes are going to be multiplicative and not additive. We think one plus one equals two. We found out in our community in the healthcare world, in the diabetes world, one and one often equals three, and nine and so on and so forth, it's just so much better. I encourage you to think about that, and also don't wait. If you have an idea walking out of this room today or sitting here in the room now, go do it. Our mantra in the diabetes community has been “We are not waiting,” and I ask you to do the same.


See more presentations with transcripts


Recorded at:

Jul 18, 2019