Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Draft) Merge dev into main #2

Draft
wants to merge 525 commits into
base: legacy-iaps-233
Choose a base branch
from
Draft

(Draft) Merge dev into main #2

wants to merge 525 commits into from

Conversation

tmhastings
Copy link
Contributor

@tmhastings tmhastings commented Mar 5, 2024

todo:

  • address outstanding issues
  • adequate testing in vitro and in vivo
  • bump version
  • reset alive branch to main

Trio trio

expand details

This app splits from Artificial-Pancreas/iAPS at v2.3.3 on the main branch and this commit. Very minimal UI changes were made in this initial update, but while it may look and for the most part seem the same as iAPS v2.3.3, you can see from the number of commits and files/lines of code changed in this PR that there are extensive changes under the hood. These changes were done to ensure it is truly open source, peer-reviewed and tested, to keep it in line with updates from Loop's submodules (the stuff that connects your pump, CGM, and services), to fix some bugs, and to add a few new features.

The Team

expand details

Trio is a collaborative project set up by members of the DIY community who welcome a peer reviewed, Open Source iOS implementation of the Oref/APS algorithm.

The team consists of:

  • Software architects
  • Developers
  • Code reviewers
  • Designers
  • Testers
  • Documentation specialists
  • Project managers / agile coaches
Anyone who wants to contribute is welcome to join the team!

The Name

expand details

“Trio” is inspired by several joint efforts:

  • Algorithm/CGM/Pump: the three components that make up your DIY loop
  • Basal/CR/ISF: the three main settings that, when tuned, treat your TxD
  • Carbs/Fat/Protein: the three main food components that impact your blood glucose
  • FAX/iAPS/Trio: the three stages of Oref/APS leading to the birth of Trio
  • In true DIY fashion, make the Trio definition individualized to you

Hosted by The Nightscout Foundation

expand details

The most obvious change is that the repository location has changed to be housed by Nightscout and AndroidAPS. The Nightscout Foundation has a long track record of facilitating innovation in DIY diabetes technology and stoking collaboration between many developers and projects. This will keep Trio in the hands of the community rather than a single individual, and ensure all development is peer-reviewed and tested before being released.

New Bundle ID

expand details

If you're currently using iAPS, another big change is the app's Bundle ID, which is now org.nightscout.TEAMID.trio. This means Trio will not overwrite the iAPS app on your iPhone, but all settings must be re-entered and all devices re-connected. Trio will need about 24 hours of data before the dynamic features can be enabled.

If you're using Omnipod DASH or Eros, you will have to pair a new pod to start using Trio, but all other devices can transfer mid-session.

New App Group

expand details

Instead of using the Loop's App Group, group.com.TEAMID.loopkit.LoopGroup, Trio uses its own, group.org.nightscout.TEAMID.trio.trio-app-group. This prevents settings from being retained when deleting and reinstalling Trio while Loop or iAPS is also installed. You still need to delete xDrip4iOS to completely reset settings, though.

New Icons

expand details

New icons have been created as a symbol of the name Trio. (by @tmhastings), plus some old ones (by @tqb43)
logos

Default Setting Changes

expand details

  • Default CGM: None (instead of Nightscout)
  • Show high/low lines on main chart: On (instead of Off)
  • High value for main chart lines and statistics: 180 (instead of 145)
  • Sensitivity Raises Target: Off (instead of On)
  • Minimum Safety Threshold: 60 (instead of 65, which keeps it more in line with Oref0)
(by @MikePlante1 with input from @bjornoleh and many others)

Sigmoid Adjustment Factor

expand details

With Dynamic ISF toggled on, the effects of Adjustment Factor vary drastically between having Sigmoid turned on and off. Because of this, we've split the Adjustment Factor in two and given Sigmoid its own setting. This allows Adjustment Factor to be defaulted to 0.8 with Sigmoid turned off and to 0.5 with Sigmoid turned on. (by @MikePlante1)

sigmoid settings

External Insulin & Glucose

expand details

External insulin entry (to log non-pump insulin, eg. from an insulin pen) has been moved to the History screen rather than the Bolus screen. External insulin entries will display a warning if amount is larger than Max Bolus setting and will not be allowed if over three times the Max Bolus setting. The History screen also now displays if a bolus was an SMB or External, and uses swipe gestures to delete entries. (by @BrianWieder with many cherry picks from @dnzxy)

History (Treatments) History (Glucose)
historyInsulin glucoseHistory
Log External Insulin Log Glucose
maxExternalBolus logGlucose

Distinguish Manual Glucose Readings

expand details

Manually entered glucose readings are now more noticeable in both the history and the main chart. (by @mountrcg)

Chart History
chart history

Edit Profile Overrides & Temp Targets

expand details

Swiping left on a saved profile override or temp target now gives you the option to edit or delete. Selecting to edit will open a new page where you can change the name and/or any of the settings. (by @dsnallfot)

Option to Edit/Delete Editing a Profile Override
edit or delete delete

LoopKit Submodules

expand details

The code that's used to connect to pumps, CGMs, and other things was taken from their implementations in Loop. This update changes where that code is housed from within this app to point to the code in @LoopKit or @loopandlearn's repositories. This allows for a better development as it makes it easy to see the differences between the code used in Trio vs the code being used in LoopKit and allows updates in the LoopKit repo to easily be pulled into Trio. (by @bjornoleh with help from @marionbarker and @bjornoleh)

Oref

expand details

This part is rather technical. Oref (the algorithm from OpenAPS that drives Trio) is written in the JavaScript programming language. In order to perform well in an iOS app, the algorithm is implemented in a minimized format. Until the algorithm is rewritten into the Swift programming language, it needs to be like this to ensure performance. The source code used to build the minimized files is now included in this repo as well as a separate repo trio-oref. This work is quite extensive and has been done and peer-reviewed by several contributors: (beautified/reconstructed by @JeremyStorring and updated by @bjornoleh, @mountrcg, @avouspierre, @MikePlante1, @tmhastings)

Schedule SMBs Off in Profile Overrides

expand details

The Schedule when SMBs are Off option in profile overrides has been improved to make it easier to understand and use. Now, if you want to disable SMBs for the entire time the override is active, toggle on Always Disable SMBs, but if you want to specify a timeframe for SMBs to be disabled, you can toggle off Always Disable SMBs toggle on Schedule when SMBs are Off and set the timeframe. Note that setting a timeframe of 22-6 would disable SMBs from 22:00 (10PM) through 5:59 as long as the override is active during that time.

schedule SMBs off

Restart Bug Squashed

expand details

Since the beginning of FAX, there was a bug where restarting a phone could potentially cause a loss of pump or cgm connection. This was especially detrimental for Omnipod users, as there's no way to reconnect it after it's lost. The fix for this from LoopKit has now been added to Trio. (by @dnzxy, @kskandis, @avouspierre)

Apple Health Fix

expand details

The 2.3.3 version of iAPS had a bug with Apple Health. This part of the code was re-written and fixed (by @AndreasStokholm), then thoroughly tested and peer-reviewed by the team. Feel free to toggle Apple Health back on if you'd like.

Fix Multiple Meal Entry Bug

expand details

Some people have had the app freeze while entering a meal and mistakenly entered the same meal multiple times without realizing it. The Save and continue is now disabled as soon as it’s pressed to prevent that from happening. (by @MikePlante1)

Omnipod Fixes

expand details

Code has been updated to avoid triggering the Critical Pod Fault 049 (0x31) error which caused a pod poss. (by @marionbarker and @itsmojo)

Fix mmol/L Glucose Target Bug

expand details

The bug causing glucose target to not be settable to certain mmol/L values has been fixed. (cherry-picked from @Jon-b-m by @Sjoerd-Bo3)

Tidepool Integration

expand details

Tidepool can now be uploaded to directly from Trio instead of using Apple Health and the Tidepool app on your iPhone. Note that if both are enabled, you will see duplicate entries in Tidepool, and even after turning one off, you could still see up to a week of duplicate data. (by @avouspierre)

Tidepool

Dexcom Share Integration

expand details

Dexcom Share has been fixed so it can now be used as a CGM source. Also, if you use Dexcom G6 as your CGM and you enter your Dexcom Share credentials at the bottom in ⚙️ > CGM > CGM Configuration, missed readings should backfill in Trio from Dexcom Share. Keep in mind, though, when you change G6 transmitters Trio will continue to pull readings from Dexcom Share causing you to rely on internet for readings until you update your G6 Transmitter ID in Trio. (by @avouspierre)

Meal Settings

expand details

There is a new section in settings called Meal Settings. In it, you'll find Max Carbs (which used to be in Pump Settings), Max Fat, Max Protein, and the Fat and Protein Conversion Settings that used to be found in it's own section. (by @bjornoleh)

⚙️ Meal Settings
meal settings1 meal settings2

Max Macros

expand details

  • Two new settings added: Max Fat & Max Protein
    • Both are defaulted to 250g to match Max Carbs' default
  • Label of Carbohydrate limit changed to Limit Per Entry for Meal Settings
  • Shortened grams to g for the meal entry screen
  • If carbs, fat, or protein exceed their limit:
    • Changes g to ⚠️
    • Disables submit button, changes text to red, and replaces with warning
PR.226.mov

Max Bolus

expand details

Manually entering a bolus larger than the Max Bolus setting used to just deliver the max bolus amount, but now this setting prevents the bolus from being delivered until the amount is lower than the max setting. (cherry-picked from @Jon-b-m and modified by @MikePlante1 with input from @bjornoleh)

Also now displays the value read from the pump instead of from settings to ensure the correct value is shown. Important for Medtronic pumps and in the future for Dana pumps. (by @bastiaanv and ported by @dnzxy)

Max Bolus

Live Activities (Dynamic Island & Lockscreen Widget)

expand details

Live Activities have been added to show relevant data without opening Trio. This displays glucose, delta, and trend on the lock screen (iOS 16.2+) as well as in the Dynamic Island (iPhone 14+). Optionally, a glucose graph and current IOB & COB can also be displayed. Consistently updated every 5 minutes with every loop cycle. (cherry-picked from @nas10, @polscm32 and ported by @MikePlante1)

Turn Live Activity on and switch between display options by going to ⚙️ > Notifications

Live Activity Screenshot
Lockscreen (simple) LA lockscreen simple
Lockscreen (detailed) LA lockscreen detailed
Dynamic Island LA dynamic island
Dynamic Island
(long press)
LA Dynamic Island graph

Dexcom ONE+

expand details

Added support for Dexcom ONE+ (taken from this Zulip discussion)

Nightscout Menu Updated

expand details

The menu for Nightscout has been updated to include sub-menus. The new Fetch Treatments toggle controls whether Trio will fetch carbs and temp targets from Nightscout. The duplicate Remote Control toggle has also been removed from Preferences. (by @dsnallfot)

⚙️ > Nightscout Connect
Nightscout Connect
Upload Fetch and Remote Control
Upload Fetch and Remote Control

Import Settings From Nightscout

expand details

Fixed this so it now also works for mg/dL. Also now allows importing from settings saved to Nightscout from Loop and will use the center of your correction range from Loop for the target range in Trio. (by @kskandis and @MikePlante1)

Settings imported:

  • Basal Profile
  • Target Glucose
  • Insulin Sensitivities
  • Carb Ratio
  • DIA

Improve Nightscout Uploads

expand details

Previously, only enacted loop cycles were uploaded to Nightscout, which caused information gaps from loop cycles that were just suggested but not actually enacted for one reason or another. Now suggested loop cycles will also be uploaded as well. (by @bjornoleh and suggested by @scottleibrand)

Fat & Protein Upload to Nightscout

expand details

Fat & Protein are now uploaded to Nightscout when you announce them in Trio. (by @aug0211) image

FPU Conversion

expand details

Oref ignores any carb entry less than 1.0g. This used to happen when Interval In Minutes was set low and/or the amount of fat and protein was small. Now, the carb entries that were converted from fat & protein are saved to ensure they are always at least 1g each and not ignored by oref. (by @dnzxy)

For example, with the default Meal Settings, 10g of protein and 5g of fat used to converted into 7 entries of 0.7g carbs. Now, it will be converted into 5 entries of 1g carbs.

Statistics Range

expand details

The statistics screen now includes the high and low values in the normal range instead of the high and low ranges. This matches the colors of the glucose dots that were already being used on the Statistics screen. (by @MikePlante1)

For this example in a simulator, I kept high/low to the default 70/180 and manually entered these values:

Readings
glucose values
Trio (standing) Trio (laying)
new standing new laying
iAPS 2.3.3 (standing) iAPS 2.3.3 (laying)
old standing old laying

Pump Status Icons

expand details

New icons are displayed when your pod status has a warning or critical message. This will help highlight when a problem occurs with the pump to help make the user aware of the issue. (by @avouspierre)

Pump Warning Pump Critical
Pump Warning Pump Critical

Display icons/buttons when no pump/CGM is selected

expand details

When there is no pump or CGM selected, a button is displayed that will take you to the selection screen for pump or CGM. This does not affect instances where a pump or CGM *is* selected and just not paired. (by @avouspierre)

When Omnipod is removed as a pump source, it will now display Add pump rather than the erroneous No pod warning. (by @kskandis)

no pump cgm

Confirm Bolus Faster on Apple Watch

expand details

An option has been added in ⚙️ > Watch to require less of a turn of the Apple Watch crown to confirm a bolus. (by @MikePlante1, who likes to confirm boluses with his nose)

Screen.Recording.2024-06-18.at.2.05.20.PM.mov

Hide Keyboard Button for Meal Notes

expand details

There is now a button to dismiss the keyboard when the textfield for Note is selected in the meal entry screen.

Dismiss keyboard

Eventual Glucose Rounding for mmol/L

expand details

Eventual Glucose now rounds to 1 decimal place for mmol/L users instead of 2 on the main screen as well as the watch app.

Screenshot 2024-07-15 at 10 14 06 PM

Tests Enabled

expand details

Added ability to run tests on Trio and submodules. (by @avouspierre)

Browser Build Updates

expand details

Browser Build updated to new Apple/GitHub standards. (by @bjornoleh) TestFlight Expiration is now displayed in Settings. (by @bjorkert) Gemfile updated. (by @mountrcg)

Guardrails

expand details

Guardrails to prevent preferences from being set outside a reasonable range can now be set in the code, although no guardrails have been added yet at this time. (by @JeremyStorring)

To add a guardrail, add minVal and/or maxVal to the type in FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift. For example, to restrict Minimum Safety Threshold from 60-120, use the following:


Field(
    displayName: NSLocalizedString("Minimum Safety Threshold (mg/dL)", comment: "Minimum Safety Threshold"),
        type: .decimal(keypath: \.threshold_setting, minVal: 60, maxVal: 120),
        infoText: NSLocalizedString(
            "All insulin will be suspended if your glucose is predicted to drop below the safety threshold.\n\nMust be set between 60-120 mg/dL.\nTo convert from mmol/L, multiply by 18.\n\nNote: Basal may be resumed if there's negative IOB and glucose is rising faster than predicted.",
        comment: "Minimum Safety Threshold"
    ),
    settable: self
)

Removed Stats Upload

expand details

Removed the option to upload Statistics to Nightscout, since it is no longer compatible with the website this feature was added for before. (by @MikePlante1)

List of individual PRs included in this large PR:

expand details

Go Team!🎉

expand details

Thank you to the following developers who have added commits to this PR and the initial version of Trio: @AndreasStokholm, @avouspierre, @bjorkert, @bjornoleh, @BrianWieder, @dnzxy, @dsnallfot, @JeremyStorring, @kskandis, @kylmcw, @lifeguardz, @marionbarker, @MikePlante1, @mountrcg, @polscm32, @Sjoerd-Bo3, @tmhastings

A heartfelt thank you to everyone who has played a crucial role behind the scenes with their valuable contributions in discussions, project management, coaching, documentation, testing, and more:

  • Dana Lewis (@danamlewis) and Scott Leibrand (@scottleibrand) for their unwavering support and guidance regarding our Oref inquiries.
  • Tim Street for his invaluable insights into the implementation of Oref code.
  • Tim Gunn (@Tornado-Tim) for his dedicated efforts in setting up and maintaining the Nightscout hosting of the Trio repository.
  • Auggie Fisher (@aug0211) for generously sharing the Discord server for Trio and providing ongoing support for both current and future developments of Trio's caregiver implementation.
  • Pete Wilkins (@petewilkins) for optimizing the Trio Discord home base throughout development and in anticipation of future discussions.
  • Marion Barker (@marionbarker) for her invaluable contributions, including creating the Build Scripts for Trio, enhancing documentation, and offering expertise in various areas not fully reflected on Github.
  • Mike Plante (@MikePlante1) for getting involved in many different aspects of the release and development.
  • Sjoerd Bozon (@Sjoerd-Bo3) and Bjørn Ole (@bjornoleh) for their tireless efforts in driving collaboration and continuously advancing the project.
  • Kelsey Huss (@kelseyhuss) for stepping up without hesitation to communicate progress to the community.
  • Theresa Hastings (@tmhastings) for pulling all the strings, getting the right people involved and spending much of her days on this project one way or another. Without you this would never have happened!
  • Tom Barrows (@tqb43) for sharing your branding and logo expertise and providing support to users in the Facebook group.
  • Magnus Reintz (@t1dude) for his consistent availability (🦇) and invaluable assistance with Facebook community management, clear language and translation management.
  • Jonas Hummelstrand for his commitment to maintaining open communication on Facebook, even during challenging times.
  • Dan (@dnzxy) for consistently fostering discourse aimed at enhancing and enriching the DIY community and Trio project.
  • To Dan, Marvin, Andreas, Mike, Tom, Magnus, Kelsey, and Theresa, Trio owes you its inception. Your proactive approach and DIY spirit didn't just recognize the critical safety aspect but also reshaped the implementation of Oref on iOS. Your bold actions turned necessity into reality. Thank you for your invaluable contributions.

kelseyhuss
kelseyhuss previously approved these changes Mar 6, 2024
@tmhastings tmhastings changed the title Document Update for Main Branch (Draft) Document Update for Main Branch Mar 6, 2024
@MikePlante1 MikePlante1 changed the title (Draft) Document Update for Main Branch (Draft) Merge dev into main Mar 8, 2024
bjornoleh pushed a commit that referenced this pull request May 1, 2024
Merge pull request #2 from nightscout/alpha
MikePlante1 and others added 18 commits May 7, 2024 00:51
in Shortcuts, HealthKit, FileStorageTests, and URLs
Re-write of the Contribute section.
lingering from LA cherry picks
This reverts a few lines from commit 08e6a80.
oref0 branch: dev - git version: e023125

Last commits:
e023125 Replace Open-iAPS with Trio (#23)
Rename directory for copy of .js files to trio-oref, update oref0 source files after updating script for Trio
rename Trio
update Discord url
Update Issue templates for GitHub
This ports Artificial-Pancreas/iAPS#272 into Open-iAPS.

This is part of #47

Co-Authored-By: Deniz Cengiz <[email protected]>
Sjoerd-Bo3 and others added 30 commits June 26, 2024 20:29
…constraint error - fix clear button not working as expected - make cursor right adjusted when tapping in the Textfield
Only display if the selected CGM disables the toggle in Nightscout > Upload.
direct user where to flip Upload Glucose toggle
feat(issuemanagement): automatically adding the project to the issue types bug and needs triage
Eventual BG with 1 decimal in the app and in the watch app
fix(projectmanagment): only run in nightscout repo, use of general token, rename
update submodule MinimedKit, update SHA, no change to code
Rework DecimalTextField Struct and Toolbar
* Add app group `group.$(BUNDLE_IDENTIIFER).trio-app-group` to Trio

* Update testflight.md regarding Trio app group

Co-Authored-By: Marion Barker <[email protected]>

* Fix wrong CGMBLEKit SHA checked out for submodule

* Update with latest dev; update submodules; resolve merge conflict leftover

* Update testflight.md

* Address review feedback: fix small typos, add bullet point

* Address review feedback: Remove sections; add beta tester hint for app group

---------

Co-authored-by: Marion Barker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet