Using Siri Shortcuts to Track Insulin Doses

In reference to...

I've had type 1 diabetes for four years now, and if there's one thing I've learned so far, it's just how much cognitive space the disease takes up. Seriously. On any given day, there are so many extra decisions, actually about 180 of them per day, according to Stanford Medicine, that a person with diabetes needs to make in order to help keep their blood sugars stable.

Throughout the day, to keep my blood sugars within a healthy range, I have to give myself between 8-12 separate doses of insulin, a hormone that's normally produced by the pancreas to regulate the amount of glucose in the bloodstream. Being a type 1 diabetic means that essentially, your pancreas has lost the ability to produce this hormone for you, and you must provide it yourself, which is why injections are needed. For each dose, where the number of units given is determined by the type of carbohydrate consumed, present fat content, activity (past and future), stress, insulin previously taken, and maybe 32 other points of reference (only being sort of sarcastic here), I must then keep track of three different points: when I administered the insulin, how many units I gave, and when the dose will likely peak—and that's just for one injection!

Abandoning My Notebook

For a while, I was tracking all of this information inside of a small notebook that I'd keep on me, but it just didn't feel like the best solution, as I wasn't able to see or do much with the data which I was recording. I had no easy way to track averages or see how I was trending. I found myself also always forgetting to reference the time near the supposed peak, to check and see how my sugar levels were and to gauge whether I needed more insulin or not.

My good friend [Matthew Cassinelli]( used to work with the Workflow team, which was acquired by Apple in 2017. If you're not familiar, Workflow was a really powerful way to build automations right on your iPhone or iPad, in a way that was both easy and incredibly user-friendly. What many people were writing snippets of code to do, Workflow allowed users to assemble visual block-style elements to achieve the same goal. With the release of iOS 12, Apple announced that the work the Workflow team had done was now shipping with iOS, but under the new name "Siri Shortcuts". Thinking of Matt and knowing of how powerful Siri Shortcuts could be, I wanted to see if there was a better way to keep track of each insulin dose and the context that goes along with them.

Building the Shortcut

Each iPhone with iOS 13 has access to the Shortcuts app. If you're not sure where it's located, just pull down Spotlight Search, type in "Shortcuts", and you should see it! If it was deleted, it's always able to be downloaded agin from the App Store.

To build this shortcut, the first thing you'll want to do is to click either the blue "+" button at the top right, or tap "Create Shortcut" located on the page itself.

For the shortcut that I was building, when run, I wanted to be asked two questions regarding the insulin dose I was about to take: the **dose** value and if I wanted to set a **timer**. I wanted to query the dose as my thinking was that I could likely capture that information and then send the value to Apple Health, within the insulin category. Setting a timer would allow me to be notified after a period of time, after taking the dose, for when the insulin would peak (that is, when it would be most active).

Once you've tapped to create a new shortcut, you'll be prompted to add a new "Action". Actions are the fundamental building blocks of shortcuts—they're what allow you *do* something within the shortcut.

The List Action

The first action that I wanted to add is what's known as a *List Action*. List actions allow you to create ordered lists of data, which are then able to be used within a later step of the shortcut. I wanted to use a list to ask myself how many units of insulin I was taking and then log the value I tapped on into Apple Health. It's rare that I take more than 7 units of insulin at a time, so for my list, I just added values 1-7 to select from. Definitely add whichever values are most relevant for you!

Now, to use this list that I just created, an action known as *Choose from List* is needed. Basically, this creates a small piece of UI which allows you, the user, to select one of the items from the list.

Ok, so far, we have our list that we created by using the List action and we have created a small piece of UI, from the Choose from List action, which allows us to actually tap on an option within the list.

Apple Health

The next part to this shortcut is to take the value chosen from the insulin dose list and to store it within Apple Health. Thankfully, Siri Shortcuts makes this super easy! For this, we'll need to add another action, called *Log from Health Sample*, and its within this action that we have the ability to choose what type of data we want to log. By tapping on "Type", we're now able to search for and select "Insulin Delivery". After that's selected the Action prompts us for a bit more information. We can now specify the value, the reason, and the date, that is, the time given. Hey, we're getting there!

Let's start with the "value" of insulin. We don't want to specify an exact numerical value here, because with each dose, the amount could and likely will change, which is why the list above was created. Shortcuts allows for us to insert the chosen list item into this spot. Tapping on the "value" entry reveals a few variables that we can select from, which sit on top of the keypad. Tapping on the variable named "Chosen Item" allows for the selected list item to populate here each time the shortcut is run.

This shortcut is meant only for tracking fast-acting insulin, or insulin I use to bolus with, so for the next field, "Reason", I selected "Bolus". For those who aren't familiar with diabetes, the term bolus just references the many doses of fast-acting insulin that's given to prevent high glucose numbers after eating. Finally, for the last field, "Date", Shortcuts provides an easy variable to use here, too. tapping on the field and selecting "Current Date" will add the current date and time to each dose within Apple Health.

At this point, if the shortcut were to run, you'd be able to tap on a numeric value of insulin and have it be sent right into Apple Health. Boom!

Running a Timer

Ok, so the last step to this shortcut is the ability to choose whether or not I'd like to set a timer after an insulin dose is given. I mentioned earlier that it's really important for me to know when the insulin dose reaches its peak, and having a timer automatically set has been so useful for just that. Each body is different, but for me, I've noticed that I'll start to notice my glucose dropping right at around 65-70 minutes after administering the shot, so, that's the time value I'll be using for my timer.

To create a timer in our shortcut, there's an action we can use. For me, though, I didn't just want to automatically set a timer each time I add an entry. I might be heading to bed after a dose, or perhaps in a place where a timer going off would be disruptive. So, I wanted to be given the option to either start the countdown timer or to see at what time it would have gone off, if I had chosen to set one.

By using the *Choose from Menu* action, you're able to set both a prompt as well as the options that you want to appear. In this case, I wanted the prompt to read "Would you like to set a timer?", with the options either being "Yes" or "No". Using the *Choose from Menu* action automatically inserts the responses into the shortcut, so that different actions can be taken based on which one was chosen.

Underneath the response "Yes", I added the *Start Timer* action, which allows you to specify how long the timer should be. If I tap yes in the prompt, my timer on my iPhone starts. Easy enough!

Finally, underneath the response "No", I added an action called *Adjust Date*, which gives you the option to add a set amount oof time to a variable. Because I wanted to see what time it would be in 65 minutes from now, I set that variable to be "Current Date". To then view what this time would be, a last action is needed. For this, we can use one called *Show Result*, where the variable that we want to see is "Adjusted Date".

Wrap Up

With that, the shortcut is finished! Honestly, I had so much fun creating this little thing and it's helped me out tremendously. As I mentioned at the top, anything I can do to save a bit of thinking space when it comes to managing diabetes is incredibly helpful and useful to me. While this shortcut won't solve it all, it can make it a bit easier to help you track your insulin doses.

I've been using this now for about 3 months, and it's so amazing to be able to peek into the Apple Health app and quickly see dosages at either the day, week, or month views and then to be able to see averages over time. Storing this information means that I can begin to overlay insulin doses on top of glucose data, which comes from my continuous glucose monitor, the [Dexcom G6](, allowing me to better understand and compare the data.

Admittedly before jumping into this project, I had never used Siri Shortcuts before, and I was pretty intimidated by it. If you're feeling the same, I'd encourage you to at least give it a try! If for any reason you're not able to get the shortcut to work, below is a link which will allow you to copy it right to your phone.

iCloud, Log Humalog

Enjoy this post? I'd love to hear. Say hi!