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 non-pump insulin dialog #271

Merged
merged 10 commits into from
Oct 29, 2023

Conversation

dnzxy
Copy link
Contributor

@dnzxy dnzxy commented Oct 22, 2023

  • New entry dialog to add non-pump insulin in history view
  • Removes Add bolus without actually bolusing functionality from the bolus entry dialog
  • New dialog adds ability to back-date insulin entries
  • Backdating is limited to past dates up to current date

This feature was inititally proposed through PR #236. Please see that PR for user feedback (about a dozen people have tested this) and test feedback. Many users requests a button with text and icon, so I added it back (it was removed from 236).

Non-Pump Insulin Dialog  
image image
image image
image image
image image

* New entry dialog to add non-pump insulin in history view
* Removes `Add bolus without actually bolusing` functionality from the bolus entry dialog
* New dialog adds ability to back-date insulin entries
* Backdating is limited to past dates up to current date
@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 25, 2023

  1. Adding insulin belongs in the insulin section, not in the pump history. We already have an insulin button for this. The current insulin view has lots of room for improvement.
  2. If you want to change the UI here you can add a top row to the list with a small button for future entries. Please see Daniel's post in Discord as an inspiration and my comments about new glucose view in other PR.

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 26, 2023

Here are some working quick drafts of how I think the data table could be designed:
image
image
image
image
image

They have swipe to delete.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 26, 2023

Hi @Jon-b-m , thanks for the feedback. I'll reply one by one.

  1. Adding insulin belongs in the insulin section, not in the pump history. We already have an insulin button for this. The current insulin view has lots of room for improvement.

I have to strongly disagree with this notion due to various reasons. I'll list them below.

  1. The current bolus entry view (you refer to it as insulin section) is for performing boluses from the connected pump/pod via the connected pump/pod controller, so the phone and iAPS. This means, the bolus entry view holds everything that the phone as a pump controller does there, so any insulin entry and bolus calculation should live there.
  2. Non-pump insulin is not administered via the phone and the pump, so it doesn’t really belong in the bolus entry view.
  3. The current notion and action, “add without bolusing“, is a trap that can cause confusion simply by tapping the wrong button. This could be improved, probably, but as said before, the user action of adding non-pump insulin shouldn't live in the bolus entry view.
  4. Most importantly, the main culprit users currently see with the entry, is that we have no ability to back date entries and I think it’s really bad UI to display a datepicker in the bolus screen when you are administering insulin from the pump at time of entry. It can cause a lot of confusion to suddenly be able to change the timestamp of insulin that is now being dosed from the pump/pod.
  5. Looking at use cases, you mostly record non-pump insulin when you have to have an injection by pen (often after pump fail), so you will already be in the history section to delete faulty / leaky entries that were given by pump/pod. It feels natural to also be able to add non-pump insulin here.
  6. The bolus entry view is for making an action from the connected pump. History is for viewing and deleting treatments and glucose. Adding non-pump insulin there as a historical record is in line with how manual BGs are added. In both cases, this should be possible for both the current time or a past time, as one will not always be able to log it right away when taking the bolus or measuring the finger stick BG.
  7. The current implementation/suggestion of a new non-pump insulin entry dialog that lives in History has now been tested by a dozen iAPS users and they have been testing it for up to a month now. Among them are @MikePlante1, @AndreasStokholm, @bjornoleh, @mountrcg, @t1dude, @tqb43, @flyingpie101 to just name a few. The entire feedback from testers has been in favor of the new entry dialog and how it helps them in their daily routine.
  8. To my personal surprise, @dsnallfot, who has also been a tester and who you have mentioned has provided some inspirational stuff on Discord, even adapted most of the features, that were initially suggested by PR UI/UX improvements: Reworked History and Manual Glucose Dialog, added Non-Pump Insulin Entry, Various other Additions #236, including the non-pump insulin entry dialog, to tweak many parts of the iAPS UI/UX. He has received praise from school nurses, other caregivers and grandparents (so elderly, probably not-so-techy users), for how it eases their use of the iAPS and makes caring for @dsnallfot 's diabetic child much easier.

Let's please listen to our user base and to the feedback they have provided us with.

  1. If you want to change the UI here you can add a top row to the list with a small button for future entries. Please see Daniel's post in Discord as an inspiration and my comments about new glucose view in other PR.

I really like the button placement as a first "header" row, as you had already suggested for PR #272 and will add this accordingly 🤓

The future entry filtering was dropped from the initial PR #236 , because it is giving issues with deleting entries (index offset) and because we had agreed, that FPU entries will be gone once we can refactor iAPS to make use of a fat-and-protein model and record meals rather than carbohydrates and carb-equivalents for fat and protein. Do you still think it's a valid addition? If so, I can look into it again 👍

@LiroyvH
Copy link
Contributor

LiroyvH commented Oct 26, 2023

@dnzxy @Jon-b-m
Seems this is in a bit of a stalemate, if I understand correctly the debate is a bit about where this should be situated and both ideas have their own arguments/pros & cons.

I'm curious if this idea is acceptable as hybrid solution:
1.) Rename the "Enact Bolus" title of the window you get when you tap the drop of insulin to "Add Insulin".
2.) Similar to the "History" window, we make it tabbed and have two tabs: "iAPS" and "External (or whatever.). Then:

  • In the "iAPS" tab, selected by default, you see (similar to how it is now) the Bolus Recommendation, the bolus field and can tap "Enact bolus". We remove the "add insulin without actually bolusing", as anything administered outside of iAPS should be added in the External-tab going forward.
  • In the "External" tab, we implement dnzxy's proposal and view of how the external bolus entries should look and work (I think they look great.). We call it "Log external bolus" rather than "Log non-pump insulin". (Why? Because it could still be pump insulin if it concerns Medtronic users whom are not using Event History who gave a bolus through the pump itself.)
  • Finally, there is an event in dev called "non-pump insulin" which should also be renamed to "external insulin" then.

Done. Everything is now:
1.) In the same place, you have a one-stop shop by pressing the insulin button at the bottom of the screen.
2.) A cleaner interface with less clutter.
3.) As a bonus, we should move the (i)nformation button in the iAPS window to live right next to "insulin recommendation" instead of using up a full row of its own. (Ok I admit I'm just sneaking this one in here because I don't like that waste of space. :P)

Would that be workable/acceptable for everyone and solve the stalemate? Then we have everything in one place (insulin button), BUT we still have it clearly separated from each other; each with their own benefits as outlined above/as requested by the users to be clear like this.

-edit- Modified "manual" to "external", because "manual" is already in use for when you "manually" add a bolus in the interface compared to SMB's ("automatic") and such.

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 26, 2023

Yes, I like this idea, but I also have another solution in mind, a simpler. I will post here soon.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 26, 2023

I can work with this idea, too. If you agree it’s something you will accept, I‘ll start on it.

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 26, 2023

I can agree about the danger of inadvertently adding external instead of new directly to pump. With this in mind I will accept change of this button to the history list.

This would work for me :
image

This way it's (more) coherent with the current dev glucose list.

The "Display Future" here changes to "Hide Future" when displaying future. Hiding future is selected as default in my working test here.

As you can see the amount of insulin is to the very right, to improve readability and to make the external insulin button more intuitive.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 26, 2023

Okay, I can adjust my PR accordingly and update the code. So we will keep with the dialog. I don’t think reshuffling the layout like this makes the info easily graspable. I think the layout proposed in #273 makes sense in this regard. Give me the chance to rework this please and I will ping you with the changes ready.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 26, 2023

Please also keep in mind that this is step 1 of 2. Step 2 is still to provide users with a 3 tab layout. I will just bring that in when we are done with PR #271 , #272 , #273 and others.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 26, 2023

Hi @Jon-b-m discussed changes have been pushed.

Header Header
image image
image image

This PR still uses the "old" way of deleting things (not swipe-to-delete, but ⓧ icon). So we should probably get PR #273 merged first. Then I can update this one and PR #272 and then those to can get in 🚀

* Change button style and add a header row to list
* Add conditional filtering for future entries
* Add filter button that changes text
@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 26, 2023

I don't like that row you suggested. it looks sort of half baked compared to my suggestion.

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 26, 2023

I have swipe to delete and the hide and show future entries already implemented in above suggestion. So you'll need to "compete" with this.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 27, 2023

Swipe to delete is part of PR #273. You have asked that I split the big PR up in as small parts as possible. This only PR only adds the new dialog and now the header row. The other fixes deletion.

The row is the same to yours for about 98% of it. I used other icons (was not able to find that booklet icon you used for „Display Future“ in SFSymbols) and I use the same font size and (+) icon for the elements as are currently in dev for the glucose tab. It’s just consistent.

If we merge #273, I will pull in dev to this PR, update it, then it will hold swipe on delete.

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 27, 2023

The row is the same to yours for about 98% of it. I used other icons (was not able to find that booklet icon you used for „Display Future“ in SFSymbols) and I use the same font size and (+) icon for the elements as are currently in dev for the glucose tab. It’s just consistent.

it's all in the details. It just doesn't look good for a number of reasons. I used the Image(systemName: "book.pages") and for the insulin I used symbol "syringe". I used caption for text, to not distract from the import part, the data table entries, as it's implemented in glucose table in dev. With text in .secondary style, same as dev.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 27, 2023

The row is the same to yours for about 98% of it. I used other icons (was not able to find that booklet icon you used for „Display Future“ in SFSymbols) and I use the same font size and (+) icon for the elements as are currently in dev for the glucose tab. It’s just consistent.

it's all in the details. It just doesn't look good for a number of reasons. I used the Image(systemName: "book.pages") and for the insulin I used symbol "syringe". I used caption for text, to not distract from the import part, the data table entries, as it's implemented in glucose table in dev. With text in .secondary style, same as dev.

Did you see in the screenshots, that I am actually using two different calendar icons, one with a small ⊖ for "hide" and the other with a small ⊕ for "show"? The official Apple Symbols app does not find any symbol for books.pages and when I use it in Swift, it renders an empty image.

Symbol issues  
image image

Can we keep the ⊕ for the insulin button, to keep it consistent with the glucose one? With current changes looks like so:

Proposed changes  
image image

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 27, 2023

Just Add and the syringe look much better and cleaner

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 27, 2023

Are you using latest Xcode?

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 27, 2023

You need to update your symbols app

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 28, 2023

Just Add and the syringe look much better and cleaner

Added ✅ although I cannot verify.

Running Xcode 15.0.1 here on macOS Ventura 13.6 which cannot show that in Xcode and I seem to be running latest Symbol Explorer app for Ventura, but that icon is new and part of Sonoma. Will update now, I trust you that it works, so pushed anyways 👍

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 28, 2023

@Jon-b-m I updated to latest macOS Sonoma and the icon still did not show. I then realized that the "issue" lies with iOS 17 vs. iOS 16 and earlier. I am always building to an iOS 16.4 iPhone 14 (to verify backward compatibility of the things we add), and it seems like the new icon book.pages is simply not available pre iOS 17.

So honestly, we cannot use it. Please let me know, what icon to change it for. I suggest using the logic that I initially had added, with the calendars with varying (-) and (+) symbols. Those icons are calendar.badge.minus and calendar.badge.plus. I am happy for your ideas, though.

iOS 17.0.1 build iOS 16.4
image image

* Invert default to false (Jon initially said this to be default)
* Add comment to describe default
* Fix condition for treatment list data population
@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 28, 2023

Sorry. In that case use your current calendar option.

@dnzxy
Copy link
Contributor Author

dnzxy commented Oct 28, 2023

Sorry. In that case use your current calendar option.

Updated 👍

@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 28, 2023

Text, Labels, Section etc don't need LocalizedString wrapper.
Only needed when doing string interpolation and when string used as variables.
We already have localised strings for this warning, so it's better to use same localised string.

* Removed unnecessary NSLocalizedString wrappers
* Remove obsolete `.alert()` that was blocking FPU and carb deletion alert
@Jon-b-m
Copy link
Member

Jon-b-m commented Oct 29, 2023

change when to display warning message to:
let amountWarningCondition = state.nonPumpInsulinAmount > state.maxBolus
so that we always see why the button gets disabled when too high

@Jon-b-m Jon-b-m merged commit 73a341d into Artificial-Pancreas:dev Oct 29, 2023
@dnzxy dnzxy deleted the nonpump-insulin-dialog branch November 10, 2023 00:57
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.

3 participants