nightscout / trio-oref

MIT License
8 stars 3 forks source link

Conversion of rT variables in oref #29

Open mountrcg opened 2 weeks ago

mountrcg commented 2 weeks ago

Describe the bug in determine-basal starting at https://github.com/nightscout/trio-oref/blob/d1dfb7099d59e4f7779e5fc5c75f8ca299d91ef2/lib/determine-basal/determine-basal.js#L1552 several rT.variables are converted into the users choice of glucose unit. Due to this ISF e.g. will only be updated in Trio to the new unit after a new loop, as it is converted in oref and not in Trio.

Expected behavior All oref results should be passed in mg/dL and only the rT.reason should contain converted glucose related variables. In Trio those values would be saved in mg/dL and the conversion if needed would be done in Trio. Therefore no additional Loop is needed after changing glucose unit.

Additional context fix would need an oref and trio PR for:

  1. ISF
  2. deviation
  3. BGI

I am not sure though whether 2 & 3 are needed in Trio.

mountrcg commented 2 weeks ago

PR #30 and https://github.com/nightscout/Trio/pull/327 addressed that issue and I tested that fix successfully!

As Trio does not show ISF anywhere on UI, only watch can be used to review the changes. Old sitiuation - ISF is only shown converted after a new loop original state ISF after unit change, no new loop after new loop
Simulator Screenshot - Dev 13 mini - 2024-06-24 at 09 27 37 Simulator Screenshot - Dev 13 mini - 2024-06-24 at 09 27 59 Simulator Screenshot - Dev 13 mini - 2024-06-24 at 09 32 58
Simulator Screenshot - Apple Watch Series 7 (45mm) - 2024-06-24 at 09 27 39 Simulator Screenshot - Apple Watch Series 7 (45mm) - 2024-06-24 at 09 28 01 Simulator Screenshot - Apple Watch Series 7 (45mm) - 2024-06-24 at 09 32 52
After change, ISF is immediatly converted after changing units on phone. As it can be seen the popup still shows units from last loop, watch already has ISF converted. original state ISF after unit change, no new loop
Simulator Screenshot - Dev 13 mini - 2024-06-24 at 08 57 34 Simulator Screenshot - Dev 13 mini - 2024-06-24 at 08 57 47
Simulator Screenshot - Apple Watch Series 7 (45mm) - 2024-06-24 at 08 57 35 Simulator Screenshot - Apple Watch Series 7 (45mm) - 2024-06-24 at 08 57 49