Repository navigation
Conversation
…e and NightscoutKit for therapy profiles
This was referenced Nov 11, 2026
Open
Author
|
Testing so far, for reviewers. On real phones. Loop ran on an iPhone XS Max with an Omnipod DASH pod. The pod was filled with water and lay on the table, not on a body. LoopFollow ran on a second iPhone, over real APNs, against a test Nightscout.
In the simulator.
Not tested yet: other pumps (Medtronic, Dana, Medtrum), and use over several days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Therapy profiles are named sets of the four therapy schedules (correction range, carb ratios, basal rates and insulin sensitivities) that the user can switch between. They are stored in StoredSettings together with the name of the active profile, so every settings record says which profiles existed and which one was in use. Default always exists and onboarding is unchanged. Editing therapy settings edits the active profile, and the editors say which profile that is. The status screen shows the active profile.
A switch validates the profile against the guardrails and the pump, writes the basal schedule to the pump and then stores the schedules and the active name in one settings change. If the pump write fails nothing changes, and a switch is refused while delivery is suspended. A profile can also be switched to automatically at a weekly start time. That switch is the same validated switch: it waits for a running bolus, retries while delivery is suspended, alerts after 30 minutes and tells the user when it has run.
NightscoutService uploads every profile in one profile document with the active one as defaultProfile, and records each switch as a Profile Switch treatment. TidepoolService sends the profiles as named pump settings schedules. Onboarding can restore all profiles from Nightscout, including a document written by Trio.
Remote switch, save and delete of profiles, and replacing the scheduled starts, are new remote actions with OTP and a required expiration. A save or delete carries a fingerprint of the profile the caregiver saw, so an outdated copy is refused. The active profile and Default can never be deleted. LoopFollow uses these (loopandlearn/LoopFollow#833).
User stories: school days versus weekends, training days, the days before a period, and a sick-day set.
Tested in the simulator and on an iPhone XS Max with Omnipod DASH (a water-filled pod, not on a body), with LoopFollow on a second phone over real APNs. Not tested with other pumps or in daily use.
This branch builds the whole feature; the submodules and the NightscoutKit pin point at the PR commits and need re-pinning once those are merged. PRs: NightscoutKit LoopKit/NightscoutKit#7, LoopKit LoopKit/LoopKit#698, Loop LoopKit/Loop#2680, NightscoutService LoopKit/NightscoutService#48 (and LoopKit/NightscoutService#47 for dev), LoopOnboarding LoopKit/LoopOnboarding#41, TidepoolService LoopKit/TidepoolService#50.
Screenshots and recordings from the simulator with invented data.
Profiles with scheduled switches
Profile detail
Activate, rename, delete
Switch confirmation
New profile
Delete confirmation
Name validation
Status screen: active profile
Status row with next scheduled start
Therapy Settings editing a profile
Scheduled switches
Start editor
Refused while suspended
Remote command notification
Create a profile, switch to it, edit it with the banner
V3-loop-create-switch-edit.mp4