Adding Lyumjev to Loop – the Quick and Dirty Version
Lyumjev was added as an option to FreeAPS, as of v2.2 (201). (This choice will not carry over if you subsequently build Loop – you will need to select a model supported by Loop.)
In the current Master version of Loop, Lyumjev fast-acting insulin is not listed in Settings as an insulin choice. Here are the instructions for customizing your Loop app to add Lyumjev:
The instructions here will only modify the Loop app on your phone.
You will need to make changes to the Loop code in your Xcode app and then rebuild to your phone.
If you download new code, you will have to repeat the customization.
Here is a general Customization how-to page to help you if you’ve never implemented a customization before.
Background
There are three parameters used by ExponentialInsulinModelPreset.swift to differentiate between humalogNovologAdult, humalogNovologChild, and Fiasp.
They are named in the code (typical abbreviation)
- effectDelay (ED)
- peakActivitity (PT)
- actionDuration (DIA)
NOTE: This modification only works for the master and automatic-bolus branch for Loop or for FreeAPS. It will not work for the dev branch. (I only tested it on Loop automatic-bolus branch, Workspace build). It should work for zip downloads as well as Workspace builds.
There is some disagreement on the best parameters. The ones I gathered from zulipchat are:
- ED = 5 min
- PT = 62 min
- DIA = between 270 and 315 min
WARNING
Do not make the DIA too short – symptom is unexpected low BG from insulin stacking: Loop thinks the insulin is done, but it’s not.
Do not make the DIA too long- symptom is unexpected high BG: Loop thinks insulin is still working, but it’s all gone.
Making the Change
The fastest and easiest way to do this is to change one of the models you are not using for Lyumjev and not bother to rename the model. The example shown in the figure below used the humalogNovologAdult model.
The text directions (for what is shown in the figure below) are:
- Open Xcode
- Find the file: Loop / LoopCore / Insulin / ExponentialInsulinModelPreset.swift
- Modify lines 14, 23, 34 and 45
- Build Loop to your phone (mine was already unplugged in the image below)
Line 14 from // MARK: – Model generation to
// MARK: - Model generation; Modify humalogNovologAdult to Lyumjev
Line 23 from return .minutes(360) to
return .minutes(300)
Line 34 from return .minutes(75) to
return .minutes(62)
Line 45 from return .minutes(10) to
return .minutes(5)
Updated Insulin Models
Remember – this is a local change, just on your phone after doing the customization above and rebuilding to your phone
If you select Loop -> Settings -> Insulin Model, you can clearly see that the Rapid-Acting — Adults model is different. On the left (top) is Fiasp – with 6 hour DIA, in the middle is Lyumjev with 5 hour DIA and on the right (bottom) is what you get setting Walsh to 300 min (5 hours). It’s pretty clear that Walsh is not a good idea. It will probably not even be offered in the next release of Loop. The easiest place to see the differences in the Fiasp and Lyumjev models are when neither is selected, e.g., in the Walsh image.