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

Add separate setting for sigmoid adjustment factor #114

Merged
merged 5 commits into from
May 5, 2024

Conversation

MikePlante1
Copy link
Contributor

@MikePlante1 MikePlante1 commented Apr 15, 2024

Marked as Draft until oref changes from nightscout/trio-oref#21 are merged and the minified files replacements are added to this PR or branch.

Addresses issue #106 by using separate variables for Adjustment Factor when using Logarithmic DynamicISF vs Sigmoid DynamicISF. Defaults AF to 0.8 for Logarithmic and 0.5 for Sigmoid.

This adds a new setting for Adjustment Factor so Logarithmic DynamicISF can default to 0.8 and Sigmoid DynamicISF can default to 0.5. This prevents new users from starting DynamicISF in Logarithmic mode with a default of 0.5 which seems to often lead to prolonged highs for many people. Also helpful for those who switch between Logarithmic and Sigmoid depending on their situation.

Screenshot 2024-04-14 at 10 10 05 AM

@MikePlante1
Copy link
Contributor Author

I tested it more thorougly and everything seems to work as expected on both an iPhone 15 simulator (iOS 17.4) and on a physical testing iPhone SE 2nd gen (iOS 16.2). Both tests used a Pump and Glucose Simulator. Both had been running for over 24 hrs off and on so they had >24 hours of TDD data.

Checking with both Sigmoid toggled on and then off and leaving the default values, theAutosens ratios in the popup display exactly matched the expected values from plugging the variables into the Desmos graph for Dynamic ISF. Updating the Adjustment Factor and Sigmoid Adjustment Factor in Preferences also produced the expected Autosens ratios.

@avouspierre
Copy link
Contributor

If correctly understood, the (log) adjustement factor is not used when sigmoid is selected. Perhaps deactivate the adjustement factor when sigmoid function toggle. And idem for sigmoid adjustement factor only to display when sigmoid is toggled On.

@MikePlante1
Copy link
Contributor Author

If correctly understood, the (log) adjustement factor is not used when sigmoid is selected. Perhaps deactivate the adjustement factor when sigmoid function toggle. And idem for sigmoid adjustement factor only to display when sigmoid is toggled On.

This could be something to consider post-v1.0.0 but since the Preferences menu is dynamically generated it's not a simple change. Post-v1.0.0 release, I think the entire Preferences menu should get an overhaul.

@MikePlante1 MikePlante1 changed the title (Draft) Add separate setting for sigmoid adjustment factor Add separate setting for sigmoid adjustment factor Apr 23, 2024
@dnzxy
Copy link
Contributor

dnzxy commented Apr 23, 2024

How about picking the dynamic menu from current iAPS, making adjustments there (add that distinct AF for Sig) and also incorporate Pierre‘s suggestion. Subsequently, you could remove those settings there from the "Open APS" settings, as they aren’t really openAPS ones.

Just thinking out loud here.

My personal 2 cents: there shouldn’t even be a Signoid curve dynISF.

@bjornoleh
Copy link
Contributor

I wouldn't want to scrap Sigmoid. I like the adjustability and profile ISF compatibility (outside of the scope here though :-) )

@flyingpie101
Copy link

How about picking the dynamic menu from current iAPS, making adjustments there (add that distinct AF for Sig) and also incorporate Pierre‘s suggestion. Subsequently, you could remove those settings there from the "Open APS" settings, as they aren’t really openAPS ones.

Just thinking out loud here.

My personal 2 cents: there shouldn’t even be a Signoid curve dynISF.

Out of curiosity, with a statistically relevant population of users using sigmoid, why shouldnt there be Sigmoid ?

@dnzxy
Copy link
Contributor

dnzxy commented Apr 24, 2024

How about picking the dynamic menu from current iAPS, making adjustments there (add that distinct AF for Sig) and also incorporate Pierre‘s suggestion. Subsequently, you could remove those settings there from the "Open APS" settings, as they aren’t really openAPS ones.
Just thinking out loud here.
My personal 2 cents: there shouldn’t even be a Signoid curve dynISF.

Out of curiosity, with a statistically relevant population of users using sigmoid, why shouldnt there be Sigmoid ?

Not relevant here, feel free to bring it up on Discord ☺️

bjornoleh pushed a commit that referenced this pull request Apr 26, 2024
Brings in nightscout/trio-oref#21

oref0 branch: separate_adjustment_factors - git version: 969586d
@marionbarker
Copy link
Contributor

Successful test that patch appears to works for alpha.

The same patch files work for alpha as well as dev branch:

  • I applied the patch from PR 114 to alpha, commit aa55271 (Merge pull request 120 from MikePlante1/disable-smb-schedule).
  • I built successfully over an existing app on a test phone using NS as CGM and MDT 515 pump.
  • I observed the preference screen before and after (saved screen shots but will only post upon request.)
    • New row: sigmoid adjustment factor is added with this patch.

bjornoleh and others added 3 commits May 2, 2024 22:01
and brings in "tddAdjBasal pop-up correction" nightscout/trio-oref#22

oref0 branch: dev - git version: fa373c9

Last commits:
fa373c9 Merge pull request 22 from nightscout/tmhastings-tddAdjBasal
fc0ae69 tddAdjBasal pop-up correction
487bcbb Merge pull request 21 from MikePlante1/separate_adjustment_factors
@MikePlante1
Copy link
Contributor Author

Thanks @bjornoleh for the PR.

I built this to my real looping phone, previously running alpha, and I noticed everything in the preferences menu was reset to defaults.

Copy link
Contributor

@bjornoleh bjornoleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works as intended.

⚠️Please note, as @MikePlante1 said above, Preferences will be reset when building this branch, or building dev after this is merged. Please screenshot your settings before building!

@MikePlante1 MikePlante1 requested review from Sjoerd-Bo3 and JeremyStorring and removed request for mountrcg and dnzxy May 4, 2024 01:06
@marionbarker
Copy link
Contributor

I tested this again on a test phone with the new commits. (Prior comment was for a version that not have all the commits).

  • confirmed most preferences are reset to default
  • capture many screen shots just in case - available upon request

before-after-pr-114-fresh-build

@marionbarker marionbarker self-requested a review May 4, 2024 22:55
Copy link
Contributor

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a code review and this appears correct, but I have one question:

  • In open-iaps-oref/lib/determine-basal/determine-basal.js, I see reference to 24h_14d average
  • There was a change (in logging?) from 7 day average to 10 day average in open-iaps-oref/lib/profile/index.js
  • I saw some conversation going past about this - just pointing this out so the folks that know can say thumbs up or down.

@MikePlante1
Copy link
Contributor Author

I did a code review and this appears correct, but I have one question:

  • In open-iaps-oref/lib/determine-basal/determine-basal.js, I see reference to 24h_14d average
  • There was a change (in logging?) from 7 day average to 10 day average in open-iaps-oref/lib/profile/index.js
  • I saw some conversation going past about this - just pointing this out so the folks that know can say thumbs up or down.

That's kinda outside the scope of this PR, but it seems that iAPS doesn't use 14 days of TDD history but rather just 10 days. It probably would make sense to rename the variables, but ultimately, I'd like to change DynamicISF to be more in line with how AAPS implements it, but I think that should be a post v1 PR since it seems this is how its been in iAPS for a while now, even if the variable names are wrong.

@marionbarker marionbarker self-requested a review May 4, 2024 23:39
Copy link
Contributor

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Mike's explanation of variables, I can approve this.

@bjornoleh
Copy link
Contributor

Tested and works as intended.

⚠️Please note, as @MikePlante1 said above, Preferences will be reset when building this branch, or building dev after this is merged. Please screenshot your settings before building!

Merging this now with the warning above about preferences being reset even building after this merge.

@bjornoleh bjornoleh merged commit c010fa6 into nightscout:dev May 5, 2024
@MikePlante1 MikePlante1 deleted the separate_adjustment_factors branch May 5, 2024 17:02
@MikePlante1 MikePlante1 mentioned this pull request May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants