Open avouspierre opened 2 months ago
@avouspierre I made some suggestions to harmonize the texts and also list all shortcuts for the Trio app https://github.com/mountrcg/Trio/commits/dev%2Bshortcuts/
However the Bolus shortcut does not popup the amount dialog in itself as the Add carbs shortcut does.
Q: I see temp override and temp target. I believe currently they're just the temp targets. Are overrides supposed to be what's called a Profile in-app?
Q: I see temp override and temp target. I believe currently they're just the temp targets. Are overrides supposed to be what's called a Profile in-app?
That was one thing I suggested, calling them overrides without temp as they can be also without an end date.
thanks @mountrcg ! I updated the PR with your contribution + 1 more fix for wording
Issues
18 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
@avouspierre the Bolus shortcut when run as shortcut and not integrated as an action does not ask for bolus amount. Instread throws an error. Carbs works fine this way. Could you add that to Bolus as well | Bolus | Carbs |
---|---|---|
@avouspierre the Bolus shortcut when run as shortcut and not integrated as an action does not ask for bolus amount. Instread throws an error. Carbs works fine this way. Could you add that to Bolus as well
Bolus Carbs
![]()
The fix for this is to not mark bolusQuantity
as optional in the BolusIntent
parameter declaration (line 28 of BolusIntent.swift
). After doing this, we must remove the guard
(and matching else{...}
) at line 50 (and below) of the same file.
Will add these notes in a review.
Committed requested changes to the PR and tested on a physical device. Ready to merge in my opinion.
@marionbarker or @bjornoleh or @mountrcg could you give a 👍 and merge if you agree?
I merged dev into dev+shortcuts
locally and built with Xcode.
Then I got the following unstaged changes:
% git diff
diff --git a/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings b/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
index afd4d815..804ff32c 100644
--- a/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
+++ b/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
@@ -538,6 +538,7 @@
}
},
"Amount not correctly defined" : {
+ "extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
So Xcode seems to have added the "extractionState" : "stale",
line on build time.
The app built ok and is running on my phone, but I haven't done any actual testing yet.
Quick comment:
When limiting bolus to insulin recommendation, a more specific info string could be presented in the shortcut.
Tested 1 U bolus:
Recommended was 0,5 U
Response: "A bolus command of 0,5 U of insulin was sent"
Suggestion: Add info to indicate that the bolus was limited to xx U due to the "Limit by insulin suggestion estimation".
Similarly when issuing a bolus above the max bolus limit, it would be good to get a specific response that tells that the bolus was limited to that value.
Another comment: this settings string could possibly be improved/shortened: "Limit by insulin suggestion estimation"
Regarding the uncommitted changes and sync with dev, I opened this PR: https://github.com/avouspierre/Trio/pull/1
I tested briefly in sim mode on an actual phone. All shortcuts work (presets must be defined first). But, there is a critical issue with “New Trio Temptarget”. The TT is not set according to the users units when mmol/L is used. Instead, the mmol/18 value is used. When testing 6 mmol/L as temp target, the result was 0,3 mmol/L
Which unit do you choose in the shortcuts @bjornoleh ?
I tested briefly in sim mode on an actual phone. All shortcuts work (presets must be defined first). But, there is a critical issue with “New Trio Temptarget”. The TT is not set according to the users units when mmol/L is used. Instead, the mmol/18 value is used. When testing 6 mmol/L as temp target, the result was 0,3 mmol/L
Which unit do you choose in the shortcuts @bjornoleh ?
It was not clear that I should change units in the shortcut, I only ran it unmodified first. I had the impression it would get the units from Trio.
But now I also tested to select mmol in the shortcut, and this gave the same result.
@bjornoleh Found the issue and fix it (the temp target should be stored only in mgdL).
Thanks! I also think the default should be Ask Each Time, otherwise users don’t know about this setting.
Even better: read units from Trio settings :-)
Edit: turns out, as long as the Unit
field is empty, the Trio BG units is used:
Configuring this in the shortcut is optional, and probably not needed in most cases.
@bjornoleh Found the issue and fix it (the temp target should be stored only in mgdL).
Fix confirmed!
Tested setting mmol: rendered correctly as mmol with same units in Trio
Also tested setting mg/dL with mmol in Trio, which of course gave 1/18 of the entered target
And changing to mgdL in both Trio and shortcut cave the correct result as well.
Thanks! I also think the default should be Ask Each Time, otherwise users don’t know about this setting.
Even better: read units from Trio settings :-)
Edit: this is already done, please disregard Would it be possible to let the shortcut read the Trio setting for BG units?
Edit: this is already done, please disregard
I still wonder if the shortcut could get units from the app settings. This is a source of potential issues, where a temp target can be set lower than intended. Since the shortcuts can get the bolus recommendation, I would assume it’s possible to get BG units too.
assume
Maybe make an issue for it and target this in a seprate pr?
It works now and your solution is a nice to have.
assume
Maybe make an issue for it and target this in a seprate pr?
It works now and your solution is a nice to have.
Edit: this is already done, please disregard
We could do that, but I would perhaps say that an effective way to avoid TTs being set at 1/18 of the intended value is a little more than "nice to have", there are safety implications, especially when used with "Low Temptarget Lowers Sensitivity". Every TT would effectively be set to the minimum of 80 mg/dL and typically result in sensitivityRatio being set to 1,5.
Added this to the TT and Override Cancel actions:
Minor mini observation:
Setting a TT of 5,5 mmol, the summary is stating that a TT of 6 is set:
It is set correctly in Trio:
Another observation:
If an override with no name is set, the message “No active Override to cancel” is displayed. But the override is correctly cancelled in Trio
An unnamed temp target is cancelled with the correct message.
Another observation:
If an override with no name is set, the message “No active Override to cancel” is displayed. But the override is correctly cancelled in Trio
An unnamed temp target is cancelled with the correct message.
Yep true, if the name is empty it will indeed, will see if I can catch the more cleverly
Minor mini observation:
Setting a TT of 5,5 mmol, the summary is stating that a TT of 6 is set:
I see the Issue, your glucose unit is not correctly recognised, that's why it says '6-'
"Are you sure to create a TempTarget with \(targetChoiceName) \(unitName) for \(durationChoiceName) min at \(dateChoiceName) ?"
Minor mini observation: Setting a TT of 5,5 mmol, the summary is stating that a TT of 6 is set:
I see the Issue, your glucose unit is not correctly recognised, that's why it says '6-'
"Are you sure to create a TempTarget with \(targetChoiceName) \(unitName) for \(durationChoiceName) min at \(dateChoiceName) ?"
I can confirm that manually setting units in the shortcut displays the message correctly for mmol:
However it is strange that the mmol value is correctly converted to mgdL when saved in Trio (target values are always stored as mgdL), but units are not recognised for the message?
However it is strange that the mmol value is correctly converted to mgdL when saved in Trio (target values are always stored as mgdL), but units are not recognised for the message?
I dove in to it yesterday and not sure how to fix but it is releated to you not getting prompted the unit type if you just click the message. It picks the right unit during calculation of the action but the step you showed is before that point. So if you didnt manaully chose a unit it is just not filled yet. But gets filled during execution, a step later. And gets also the right one for calculation. Looking into why I cant use dynamic content (searching for the right unit in settings before execution) in the app intents. So will comeback to this today.
I am getting these uncommitted changes upon build with Xcode. Probably Xcode which disagrees with something here. Should this be committed?
diff --git a/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings b/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
index 161c608..ed9bf3e 100644
--- a/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
+++ b/FreeAPS/Sources/Localizations/ShortcutsDetail/ShortcutsDetail.xcstrings
@@ -367,9 +367,6 @@
}
}
},
- "Activating ${preset}" : {
-
- },
"Add Carbs" : {
"localizations" : {
"de" : {
@@ -410,9 +407,6 @@
}
}
},
- "Adding ${carbQuantity} g at ${dateAdded}" : {
-
- },
"Allow to add carbs" : {
"localizations" : {
"de" : {
@@ -693,9 +687,6 @@
}
}
},
- "Applying ${bolusQuantity} U " : {
-
- },
"Applying ${carbQuantity} g at ${dateAdded}" : {
"extractionState" : "manual",
"localizations" : {
@@ -778,9 +769,6 @@
}
}
},
- "Applying ${preset} override" : {
-
- },
"Are you sure to add %@ g of carbs ?" : {
"localizations" : {
"de" : {
@@ -1147,15 +1135,6 @@
}
}
},
- "Choose the Carb preset ${preset}" : {
-
- },
- "Choose the temporary override ${preset}" : {
-
- },
- "Choose the TempTarget ${preset}" : {
-
- },
"COB" : {
"localizations" : {
"de" : {
@@ -1883,15 +1862,6 @@
}
}
},
- "Immediately activating ${preset}" : {
-
- },
- "Immediately adding ${carbQuantity} g at ${dateAdded}" : {
-
- },
- "Immediately applying ${bolusQuantity} U" : {
-
- },
"Immediately applying ${carbQuantity} g at ${dateAdded}" : {
"extractionState" : "manual",
"localizations" : {
@@ -1974,12 +1944,6 @@
}
}
},
- "Immediately applying ${preset} override" : {
-
- },
- "Immediatly starting ${target} ${unit} TempTarget for ${duration} min" : {
-
- },
"IOB" : {
"localizations" : {
"de" : {
@@ -3359,9 +3323,6 @@
}
}
},
- "Starting ${target} ${unit} TempTarget for ${duration} min" : {
-
- },
"Starting Date" : {
"extractionState" : "manual",
"localizations" : {
the last commit changes some translation sentences and remove others. I pushed a new commit.
If an override with no name is set, the message “No active Override to cancel” is displayed. But the override is correctly cancelled in Trio
@Sjoerd-Bo3
I observe, that the cancellation of the override is somehow shifted by 1 event.
I somehow cannot reproduce consistently the above behaviour.
Hitting Cancel Override twice in succession will lead to:
Hitting a third and fourth time will not trigger the error!?!
So I re-tested all of the above and could not reproduce any of the errors. Could it have been some initial thing as that were the first overrides I activated on a fresh installation?
EDIT: sry I forgot to specify that I tested this: https://github.com/nightscout/Trio/pull/177#issuecomment-2175972637 and not the all issues in thread above
So I re-tested all of the above and could not reproduce any of the errors. Could it have been some initial thing as that were the first overrides I activated on a fresh installation?
Ok, thanks. Can you verify there are no uncommitted changes on build now after the last commit? If so I can give my approval.
However it is strange that the mmol value is correctly converted to mgdL when saved in Trio (target values are always stored as mgdL), but units are not recognised for the message?
I dove in to it yesterday and not sure how to fix but it is releated to you not getting prompted the unit type if you just click the message. It picks the right unit during calculation of the action but the step you showed is before that point. So if you didnt manaully chose a unit it is just not filled yet. But gets filled during execution, a step later. And gets also the right one for calculation. Looking into why I cant use dynamic content (searching for the right unit in settings before execution) in the app intents. So will comeback to this today.
Ref my previous post: Unless there are still tings to do regarding the above.
I merged this PR into the latest alpha and tested on a simulator...
I toggled on Allows to bolus with shortcuts
and left Method to limit the bolus amount
set to Limit by max bolus
. I then opened the Shortcuts app and executed Trio Bolus
and entered 55
. A popup appeared to confirm I wanted to bolus 55U and I hit Continue
to which it alerted A bolus command of 10U of insulin was sent.
In this circumstance, I think the bolus shortcut should fail and no insulin should be delivered, not the maximum allowed amount. For the test above, it could have been someone who meant to type 5.5
instead of 55
and didn't look too closely at the popup confirmation.
Also, here's a couple wording suggestions:
current:
Allows to bolus with shortcuts
suggestion:
Allow bolusing with shortcuts
current:
The application lets you create automations using shortcuts. Go to the Shortcuts application to create new automations.
suggestion: I think this can just be removed entirely. Shortcuts has been in iOS for almost 6 years now, so I don't think it needs an explanation.
I'm a little unsure the best way to phrase the following, but how about
current:
Method to limit the bolus amount
suggestion:
Limit bolus from shortcuts to
current:
Limit by max bolus
suggestion:
Max Bolus
current:
Limit by insulin suggestion estimation
suggestion:
Insulin recommended
Are there any blockers for this to go forward? Was testing successful?
I see some phrasing recommendations - I recommend those either get fixed (@MikePlante1 maybe add them in directly?) or touch those up after initial release?
@aug0211 Phrasing suggestions aren’t crucial, but I think the initial part of my comment about delivering the max when requesting above the max should be addressed.
Trio Carbs
shortcut doesn't seem to work as expected. Testing in a simulator with this PR merged into the latest dev.
Input | Response | |
---|---|---|
1 | Are you sure to add 1 g of carbs ? |
|
30 | Are you sure to add 30 g of carbs ? |
|
59 | Are you sure to add 59 g of carbs ? |
|
❌ | 60 | Are you sure to add 1:00 g of carbs ? |
❌ | 100 | Are you sure to add 1:40 g of carbs ? |
❌ | 200 | Are you sure to add 3:20 g of carbs ? |
❌ | 201 | What is the quantity of the carb to add ? |
Also, Carbs seems to work like Bolus when it comes to exceeding the maximum limit. As in, if I set Max Carbs to 30g and enter 44g in the Carbs shortcut, it prompts to confirm an entry of "30g". I think a better workflow would be for it to just alert you that your entry exceeded the maximum and prompt you to edit your entry. Just like how the Meal and Bolus modules work in the Trio app on the iPhone.
Another test:
https://github.com/nightscout/Trio/assets/82073483/9bcfff09-b8d2-4dd0-9fc2-57b55cf75f2f
Trio Carbs
shortcut doesn't seem to work as expected. Testing in a simulator with this PR merged into the latest dev.| | Input | Response |
| --- | --- | --- |
| | 1 |
Are you sure to add 1 g of carbs ?
|| | 30 |
Are you sure to add 30 g of carbs ?
|| | 59 |
Are you sure to add 59 g of carbs ?
|| ❌ | 60 |
Are you sure to add 1:00 g of carbs ?
|| ❌ | 100 |
Are you sure to add 1:40 g of carbs ?
|| ❌ | 200 |
Are you sure to add 3:20 g of carbs ?
|| ❌ | 201 |
What is the quantity of the carb to add ?
|
I can reproduce this when running locally on a test phone, in Trio, iAPS 4.X and iAPS 3.X.
They all end up having the actual expected action (they enter the amount of carbs entered), except for the 201 case which never logs anything because it keeps asking for an amount.
So this issue is a "display/confirmation" issue, living somewhere in the confirmation code. Will try to take a look next time I can get time.
Another test:
Created and saved two profile overrides: 110% and 120%
Confirmed no override is currently being used in Trio
Activated 110% override from shortcut
Confirmed 110% override is being used in Trio
Activated 120% override from shortcut
Confirmed 120% override is being used in Trio
Canceled override from shortcut
It should have prompted me to cancel the 120% override but instead it prompted to cancel the 110% override
Tapped to confirm the cancelation in the shortcut anyway
Confirmed no override is being used in Trio
Tapped the Cancel Override shortcut again
It prompted me to cancel the 110% override, even though no override was being used
Tapped to confirm the cancelation in the shortcut anyway
Tried to tap Cancel Override again, but this time it correctly informed me I did not have any running overrides.
https://github.com/nightscout/Trio/assets/82073483/9bcfff09-b8d2-4dd0-9fc2-57b55cf75f2f
Couldn't get video to load here but this seems similar to the carb issue - a shortcut confirmation text issue.
I think:
This is an annoying bug, should not stop merging
A quick fix is to just remove the reference in the confirmation text to a specific override and just say "are you sure you'd like to cancel the active override?" or something like this - which IMO is what this shouldn't been anyway, making this fix both simpler to implement and simpler to grok when using.
I can work on and test this in an in vitro device.
Another test:
- Created and saved two profile overrides: 110% and 120%
- Confirmed no override is currently being used in Trio
- Activated 110% override from shortcut
- Confirmed 110% override is being used in Trio
- Activated 120% override from shortcut
- Confirmed 120% override is being used in Trio
- Canceled override from shortcut
- It should have prompted me to cancel the 120% override but instead it prompted to cancel the 110% override
- Tapped to confirm the cancelation in the shortcut anyway
- Confirmed no override is being used in Trio
- Tapped the Cancel Override shortcut again
- It prompted me to cancel the 110% override, even though no override was being used
- Tapped to confirm the cancelation in the shortcut anyway
Tried to tap Cancel Override again, but this time it correctly informed me I did not have any running overrides.
Screen.Recording.2024-07-01.at.3.50.17.PM.mov
Couldn't get video to load here but this seems similar to the carb issue - a shortcut confirmation text issue.
I think:
- This is an annoying bug, should not stop merging
- A quick fix is to just remove the reference in the confirmation text to a specific override and just say "are you sure you'd like to cancel the active override?" or something like this - which IMO is what this shouldn't been anyway, making this fix both simpler to implement and simpler to grok when using.
I can work on and test this in an in vitro device.
Fixed this one and committed.
I kept the originally desired intent of showing the "current" override that was cancelled in the confirmation text.
If we want to switch to the simpler "Override cancelled" confirmation I proposed above, that's a simple 1 line change we can make in the future after merging.
Trio Carbs
shortcut doesn't seem to work as expected. Testing in a simulator with this PR merged into the latest dev.Input Response 1 Are you sure to add 1 g of carbs ?
30 Are you sure to add 30 g of carbs ?
59 Are you sure to add 59 g of carbs ?
❌ 60 Are you sure to add 1:00 g of carbs ?
❌ 100 Are you sure to add 1:40 g of carbs ?
❌ 200 Are you sure to add 3:20 g of carbs ?
❌ 201 What is the quantity of the carb to add ?
I can reproduce this when running locally on a test phone, in Trio, iAPS 4.X and iAPS 3.X.
They all end up having the actual expected action (they enter the amount of carbs entered), except for the 201 case which never logs anything because it keeps asking for an amount.
So this issue is a "display/confirmation" issue, living somewhere in the confirmation code. Will try to take a look next time I can get time.
Fixed this and a few other things in this commit.
@aug0211 Phrasing suggestions aren’t crucial, but I think the initial part of my comment about delivering the max when requesting above the max should be addressed.
Fixed in this commit. Boluses will not be blocked with an alert if they exceed the maximum configured (whether this is pump max bolus or insulin suggestion).
I merged this PR into the latest alpha and tested on a simulator... ... ... Also, here's a couple wording suggestions:
current:
Allows to bolus with shortcuts
suggestion:
Allow bolusing with shortcuts
current:
The application lets you create automations using shortcuts. Go to the Shortcuts application to create new automations.
suggestion: I think this can just be removed entirely. Shortcuts has been in iOS for almost 6 years now, so I don't think it needs an explanation.
I'm a little unsure the best way to phrase the following, but how about
current:
Method to limit the bolus amount
suggestion:
Limit bolus from shortcuts to
current:
Limit by max bolus
suggestion:
Max Bolus
current:
Limit by insulin suggestion estimation
suggestion:
Insulin recommended
Phrasing notes requested in this comment are addressed in this commit.
Thanks @aug0211, it's certainly improved now, but still a bit more to fix I think.
Regarding canceling of overrides, I think it's fine to just say Override cancelled
like you proposed. Your commit fixed it displaying the wrong override initially but there are still problems with it. Maybe look at how TT shortcuts are implemented, because I don't run into these problems with the "Cancel Trio TempTarget" shortcut.
Example 1: Start a new profile override (not a saved override) in the Trio app. Then run the "Cancel Trio Override" shortcut. The shortcut says "No active Override to cancel", even though it actually does cancel the override.
Example 2: Start a saved profile override with a set duration. Wait for the override to expire. Run the "Cancel Trio Override" shortcut and it will say Override 'name' canceled
even though it wasn't running.
Example 3: Create two saved profiles: OA and OB. In the Trio app, start OA and then start OB. Run the "Cancel Trio Override" shortcut and it will say Override 'OB' canceled
. Checking the Trio app confirms there are now no profile overrides running, but if you run the "Cancel Trio Override" shortcut again it will say Override 'OA' Canceled
For the "Trio Bolus" shortcut, when Limit bolus from shortcuts to
is set to Max bolus
, the shortcut works properly when too big of a bolus is requested by telling the user The bolus cannot be larger than the pump setting max bolus
and then not delivering any bolus.
Likewise, when I set Limit bolus from shortcuts to
to Bolus recommended
, with a max bolus setting of 4U, where Insulin Recommended was 1.3U, and I tried to bolus 3U... the Bolus shortcut told me The bolus cannot be larger than the suggested insulin.
and did not deliver any bolus.
The check failed, however, when the Insulin recommended equals the Max Bolus. I entered 120g carbs, which caused the Insulin recommended to be 4U. It would have been higher, but it was capped at 4U because the Max Bolus setting is 4U. I then ran the "Trio Bolus" shortcut and requested a 5U bolus. It asked Are you sure you want to bolus 5 U of insulin ?
and when I selected "Continue" it replied A bolus command of 4 U was sent
.
carbs/fat/protein seem to be properly capped at their max limits in settings. I do find it odd that it seems to pad numbers to one decimal place in the prompts, though. I also don't like how it responds when you don't enter a value for any of the prompts, though. It looks like the prompt should default to 0 if you don't enter anything for carbs, fat, or protein and just hit "done" to move to the next macro prompt, but instead the shortcut just kills itself without any feedback. So if you enter 10 for carbs, hit Done, then it prompts for fat but it looks like 0g is already pre-populated, so you hit Done, and it crashes.
Maybe there should be two shortcuts: Trio Add Carbs
and Trio Add Meal
, the former only prompting for carbs and the latter prompting for carbs, fat, and protein. For the meal entry, though, it should still allow the user to just press Done for any of the values instead of being forced to type 0.
Shortcuts Trio
this PR refactors the shortcuts and adds new shortcuts for Trio.
Refactoring
List of shortcuts available
Some examples described in the picture :
When your iPhone alarm clock is ringing a Profile override is started/canceled. • When you get to your gym a Profile Override is started/canceled. • When you step inside your car (which has CarPlay) a profile override is started/canceled. • When you start an exercise a profile override is started. • When you end an exercise the active profile override is canceled. • .
New UI for config shortcuts :
Detail of the commit (squash all commits about shortcuts) : Refactoring the shortcuts with adding :