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

Insulin Management within Profile #3853

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from

Conversation

Philoul
Copy link
Contributor

@Philoul Philoul commented Feb 26, 2025

This PR is a first step to replace dia management within profile (deprecated in profile interface) by a global insulin management within profile:

  • ICfg is fully included within ProfileSealed, PureProfile, SingleProfile, json import/export...
  • Profile migration (using profile's dia and Current selected InsulinPlugin for peak value) has been included within MainApp (but this migration should be completed in the next step, see below)
  • Dialogs (ProfileViewer) and ProfilePlugin has been updated to show Insulin Name, peak and dia
  • Autotune plugin has also been updated to use Profile insulin during run.
  • All unit test has been updated and passed

Within this first step when a profileswitch is done, it will use Insulin Recorded within profile (dia and peak), so it will no more use current InsulinPlugin peak value.
A clone Profile will also clone insulin included into source profile (this will be improved on next step)
A new profile will use CurrentInsulin (concerning peak)
UI concerning dia value is still within ProfilePlugin (will be moved to InsulinPlugin in next step).

Next steps I have in mind:

  • Replace the 4 current InsulinPlugins by one unique InsulinPlugin (and finish Migration code within MainApp). This plugin will allow the user to manage his single or various insulins (pump, pens)
  • Update ProfilePlugin to replace DIA +/- User Interface by Insulin selection menu
  • Include Insulin selection for external bolus
  • Check AAPSClient / AAPS synchro (both direction, with the same or different versions...)
  • Remove old InsulinPlugin

@Philoul
Copy link
Contributor Author

Philoul commented Feb 27, 2025

Note, this PR will replace draft PR #3782

@olorinmaia
Copy link
Contributor

I will try to help test this PR by adding it to my test rig. Virtual pump though but still useful?

@olorinmaia
Copy link
Contributor

I have setup AAPS test-rig with Ultra-Rapid Oref.

If I change DIA on AAPSClient and save, the following happen:
Peak changes from 55 -> 75 min
Insulin changes from Ultra-Rapid Oref to Rapid-Acting Oref
Profile switching from AAPSClient after changing DIA then seem to set wrong insulin type / peak on AAPS.

@Philoul
Copy link
Contributor Author

Philoul commented Mar 1, 2025

If I change DIA on AAPSClient and save, the following happen:

Did you install this PR on both sides (master loop and AAPSClient)?

  • insulin management is different so update should currently be done on both sides (but good catch, I will have check AAPSClient sync in both directlions, and probably improve management...)
  • profile's insulin is currently not managed within old insulin plugin

This PR is only a first step, (working locally), but I didn't test NSClient synchro.

  • in target solution you can't change dia from profile, you change insulin

@Philoul
Copy link
Contributor Author

Philoul commented Mar 1, 2025

A new item has been added in my todo list, Check AAPS <=> Syncho (insulin sync and profile sync, with same or different versions...).

@olorinmaia
Copy link
Contributor

I built AAPSClient with same branch👍

Since AAPSClient can't select which insulintype in config builder, it could be that it reverts to some default value when changing DIA and saving, but it's sending both DIA and INS type to AAPS, since AAPS is updated. So there is probably some choice we need to make here. Do we want AAPSClient to be able to change INS also? I don't see a problem with that, but it would make sense if it was part of the actual profile dialog then perhaps instead of config builder, but that was next step right?

@Philoul
Copy link
Contributor Author

Philoul commented Mar 1, 2025

Do we want AAPSClient to be able to change INS also?

Good question, to be discussed...
In my mind changing insulin type (replace one insulin by another insulin) can only be done in AAPS, and should normaly be synchronized with a reservoir/pod change (replace insulin within pump by another one).

  • So this kind of change should normaly be limited to AAPS app only

The other modification can be update of an existing insulin (without changing insulin within pump).

  • this should be done from insulin plugin only (to adjust peak/dia) with a modification of one existing insulin.
  • Then all profiles using the modified insulin should be updated, with new values automatically (one confirmation popup for all), when updated insulin is saved within insulinPlugin
    Again, this should probably not be available from NSClient with insulinPlugin hidden.

Finally, a ProfileSwitches managed within AAPS UI (Overview, Activity, Automation, SMS...) should only be available between profiles sharing the same insulin.

  • To be able to select a profile with a different insulin compared to insulin included into current running profile, you should manage PS from ProfilePlugin (with a dedicated warning/confirmation if insulin included into new selected profile is different...)

That's why I included within future InsulinPlugin a tab to list and show the profiles using selected insulin 😉.

Again these are my thoughts, but of course opened to discuss on UI, features...

@Philoul
Copy link
Contributor Author

Philoul commented Mar 2, 2025

@olorinmaia I now included the proposed InsulinPlugin (unique) to manage all type of insulin.
So you select insulin within profilePlugin (no more DIA setting within ProfilePlugin)
Be carefull, I didn't remove previous 4 insulinPlugin, so you should select manually InsulinPlugin to test everything
I'm not sure how AAPSClient will work (able or not to select an insulin...)
Tell me if you see strange things on AAPS, and other strange things in AAPSClient...

@olorinmaia
Copy link
Contributor

@Philoul I've tested your latest commits, and it seem to be working fine, with some minor issues with deleting / saving insulin profiles. I really like this approach that you can have multiple insulin profiles and can change this in your profile. We however use only Fiasp, but I understand the need for it. It simplify UX abit also, by being able to set all this in profile.

I'm wondering though, if we should hide the possibility to change Insulin Profile in AAPSClient, and only show What InsType, Peak, DIA is set for each profile when activated. If this is to be changed, it should be done on AAPS. Today in AAPSClient you can change DIA, but not insulintype or peak. One could say we take something from AAPSClient, but we also give more information as you now can see ins type, dia and peak when you open profile.

Problem is that changes to Insulin profiles seem to sync very slow with AAPSClient, which could lead to issues. It seem to sync whenever AAPS is restarted. If that could be improved I see less issues with Insulin Profiles being available to change on AAPSClient.

You can try to add a few new Insulin Profiles on AAPS and delete a few, and then activate profile. And notice that on AAPSClient, you won't see it, until you restart AAPS and wait some.

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.

2 participants