nightscout / Trio

MIT License
64 stars 259 forks source link

Rework History Sheet #140

Closed BrianWieder closed 3 months ago

BrianWieder commented 3 months ago
Sjoerd-Bo3 commented 3 months ago

I think that per guidelines, the “add” needs to be the same colour as the icon? And the fontsize looks a little off or something? Is that the standard?

Good work though Brian!

Sjoerd-Bo3 commented 3 months ago

Or maybe we can make a plus within the droplet and + before the syringe icon (integrated into one icon)

dnzxy commented 3 months ago

To conform with guidelines, it‘d need to look like this; the addition of Add Glucose here is not guideline conform, but I personally think it’s an okay deviation because it adds clarity.

image

Sjoerd-Bo3 commented 3 months ago

To conform with guidelines, it‘d need to look like this; the addition of Glucose here is not guideline conform, but I personally think it’s an okay deviation because it adds clarity.

image

So it also needs the plus? When we have already “add glucose”? Seems excessive, but if it says that. Lets indeed just go with the guidelines, makes it more coherent.

dnzxy commented 3 months ago

Technically the entire label is not conform and at the + is it, but I‘d rather go with something that comes close and looks, and adds clarity 😊

Sjoerd-Bo3 commented 3 months ago

Technically the entire label is not conform and at the + is it, but I‘d rather go with something that comes close and looks, and adds clarity 😊

Also agree on that😂, indeed let’s get it like your proposal.

bjornoleh commented 3 months ago

Displays SMB as the type of treatment on the insulin history page instead of Bolus, with SMB next to the amount

Could we also get this differentiation displayed in NS? I think this was also introduced in iAPS around the same time as the other changes that are brought in here.

bjornoleh commented 3 months ago

Displays SMB as the type of treatment on the insulin history page instead of Bolus, with SMB next to the amount

Could we also get this differentiation displayed in NS? I think this was also introduced in iAPS around the same time as the other changes that are brought in here.

This was added to iAPS here: https://github.com/Artificial-Pancreas/iAPS/commit/24c5abb58ec706024e3e7fc2a9b662e06378421e

And then apparently refactored for 3.0 here: https://github.com/Artificial-Pancreas/iAPS/blame/main/FreeAPS/Sources/APS/Storage/PumpHistoryStorage.swift#L214

marionbarker commented 3 months ago

Successful test.

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

The previous requested changes have not been implemented, but the good news it same PR changes work for dev and alpha. Behavior is as previously reported.

BrianWieder commented 3 months ago

Updated the add buttons to match the proposal in https://github.com/nightscout/Open-iAPS/pull/140#issuecomment-2089590193 (though I personally think that "Log Insulin/Glucose" would be more accurate), and upload SMB treatment types to Nightscout. (Also rebased onto the updated dev branch)

image
bjornoleh commented 3 months ago

Thanks for adding the SMB/bolus distinction to NS entries!

though I personally think that "Log Insulin/Glucose" would be more accurate

I can agree that “Log” is better than “Add”, especially for bolus. The insulin is not added from or by the app, but simply logged after an external bolus. “Log” might be less ambiguous.

dnzxy commented 3 months ago

Great job @BrianWieder , thank you!

@bjornoleh relating to your comment: Glucose is added though, as it will be taken into consideration by the algorithm and also „overrides“ the current sensor value. Same for external insulin entries. You are adding to IOB by entering the entry; that thought (adding insulin not given by the pump but to be considered by the AID) is at the core of that logic by the way. Add is a pretty accurate description 😊

dnzxy commented 3 months ago

@BrianWieder would you also care to add the 2 tab vs. 3 tab option for history or is that too far outside the scope of this PR for your taste? Just asking because you have titled it "Rework History Sheet" 😊 Either is fine.

BrianWieder commented 3 months ago

@dnzxy I still think that log is a more straightforward term for insulin and glucose.

If I externally added insulin (for example via injection by pen), that insulin is already on board me, I am just logging it in Open-iAPS so the system can take it into account.

For glucose the same logic can apply, I am logging it in the app so the system can use it as a more recent datapoint over the CGM.

BrianWieder commented 3 months ago

@BrianWieder would you also care to add the 2 tab vs. 3 tab option for history or is that too far outside the scope of this PR for your taste? Just asking because you have titled it "Rework History Sheet" 😊 Either is fine.

You are referring to https://github.com/Artificial-Pancreas/iAPS/pull/411?

If so, I can work on it, but it wouldn't be until early next week, as I am traveling this weekend.

dnzxy commented 3 months ago

Yeah I guess we can discuss this endlessly 😂 I consider "Add" the correct term because I am adding it to the data metrics for the AID to consider. Opposed to that, I wouldn’t accept "Dose" or "Bolus" or anything that would imply administering of insulin. We mean the same thing, we use different semantics with it 😊

For what it’s worth: these labels were discussed for a few days on the old discord and there were a bunch of people that went for "Add" while others didn’t need any label and others liked the simple unit + plus icon.

Comes down to personal preference I think 😊

Edit to add: Loop does not have any label with this and only uses the 100% iOS conform + icon. But in the context it uses this, you are within the insulin history, so there are not two actions in the same header nav item depending by tab like it is used for Open-iAPS.

dnzxy commented 3 months ago

You are referring to Artificial-Pancreas/iAPS#411?

If so, I can work on it, but it wouldn't be until early next week, as I am traveling this weekend.

Yes, essentially that 👍 Although you might be able to find a more elegant solution depending on how you go about it. Could totally also be done in a later PR, I think this one looks great and is feature-complete.

bjornoleh commented 3 months ago

I think it would be great to land this in its current form. I suppose it can be merged before we open up, as this is basically well tested code? I feel the 2/3 tab thing can wait a little longer :-)

marionbarker commented 3 months ago

Tested with the latest commits.

First graphic is the treatments screen and add insulin screen.

pr-140-history-treatments

Second graphic is the glucose screen and add glucose screen.

pr-140-history-glucose

marionbarker commented 3 months ago

I'm seeing some odd behavior. Might be just me. All my testing was done by applying a patch for this PR. Tonight I did some testing where I commited this PR (along with others to a local branch).

Then every time I opened xcode to build, the PumpHistoryEvent.swift file would be modified. Here's the diff I would see. I kept restoring the file, but thought I should report it.

% git diff
diff --git a/FreeAPS/Sources/Models/PumpHistoryEvent.swift b/FreeAPS/Sources/Models/PumpHistoryEvent.swift
index 0c606875..5aaed4dc 100644
--- a/FreeAPS/Sources/Models/PumpHistoryEvent.swift
+++ b/FreeAPS/Sources/Models/PumpHistoryEvent.swift
@@ -46,7 +46,7 @@ struct PumpHistoryEvent: JSON, Equatable {

 enum EventType: String, JSON {
     case bolus = "Bolus"
-    case SMB = "SMB"
+    case SMB
     case mealBolus = "Meal Bolus"
     case correctionBolus = "Correction Bolus"
     case snackBolus = "Snack Bolus"
BrianWieder commented 3 months ago

Weirdly I am seeing that as well. I thought that maybe it was just my laptop being weird, but now that I look at it again, I think it may be code formatting. My guess is that = "SMB" is redundant since the the enum case name being SMB implies the string value to be SMB. Will test and if that is correct will update the PR.

BrianWieder commented 3 months ago

Looks like removing the = "SMB" works as though it is there, so I removed it in order to prevent a future diff if XCode tries to format it. I also rebased again to the updated dev.

BrianWieder commented 3 months ago

@dnzxy After some more thought I updated the "Add Insulin" and "Add Glucose" buttons to "Log Insulin" and "Log Glucose". This matches the confirmation button on the next screen to log external insulin:

Also asked a non-technical/non-diabetic friend what their first instinct an "Add Insulin" button would do, and they thought it would take action and inject more insulin, and that log is more clear that it would not instruct the pump to bolus/inject more insulin.

What do you think?

dnzxy commented 3 months ago

I can still only point to the many discussions that happened months ago on the JBM iAPS server, those resulted in „Add“.

Ultimately, I don’t see this as a blocking issue, so I‘m okay with either 😊

bjornoleh commented 3 months ago

Tested the branch after merging dev into the branch (merges cleanly). Everything works as expected, including SMB distinction in both app and NS. Well done! I will approve this as is, just wanted to mention that we now have Log Glucose +, while the Title of the next screen is still Add Glucose. Maybe thats intentional, and I don't care too much either way :-)

image

image

MikePlante1 commented 3 months ago

we now have Log Glucose +, while the Title of the next screen is still Add Glucose. Maybe thats intentional, and I don't care too much either way :-)

imo, these should match before merging.

I can still only point to the many discussions that happened months ago on the JBM iAPS server, those resulted in „Add“.

I looked for a bit but couldn’t find a suggestion to use “Log”. I do prefer “Log” myself, but “Add” is perfectly acceptable as well.

BrianWieder commented 3 months ago

just wanted to mention that we now have Log Glucose +, while the Title of the next screen is still Add Glucose

Good catch, updated all references to add glucose/insulin to log glucose/insulin in DataTableRootView as well. Simulator Screenshot - iPhone 15 - 2024-05-11 at 15 29 56

dnzxy commented 3 months ago

I looked for a bit but couldn’t find a suggestion to use “Log”. I do prefer “Log” myself, but “Add” is perfectly acceptable as well.

That was my point, more or less. It was never once suggested by the great many discussion participants. Both are perfectly acceptable and Brian has gone with "Log", which is fine 😊

marionbarker commented 3 months ago

For reference, Loop uses “log”. Scroll down to the graphic in this section.

https://loopkit.github.io/loopdocs/loop-3/features/#non-pump-insulin

MikePlante1 commented 3 months ago

Should the Log Insulin + view match the Log Glucose + view?

ie: Title lower and larger, and say Log External Insulin. And the confirm button changed to Save? Or the other view changed to Log glucose?

Current:

Screenshot 2024-05-12 at 11 11 54 AM Screenshot 2024-05-12 at 11 11 44 AM
BrianWieder commented 3 months ago

Should the Log Insulin + view match the Log Glucose + view?

Good point, updated Log Insulin + view to match.

MikePlante1 commented 3 months ago

Everything looks good to me now. I'm ready to merge this if you are, @BrianWieder and @dnzxy?

BrianWieder commented 3 months ago

SGTM, will let you merge whenever you are ready.