MarkMpn / AutotuneWeb

A web interface for running Autotune
45 stars 31 forks source link

Original Basal Rates not transfering #20

Closed mikebash closed 5 years ago

mikebash commented 5 years ago

I'm noticing an issue where the Autotune Web results that are e-mailed do not have the correct basal rates for the evening. In the screenshots attached, you'll notice that the 8PM basal rate change is not reflected but the 11PM change is.

This could be user error but I believe everything is set up correctly. See the attached images showing the basal rates in Nightscout and the basal rates in the e-mail.

For additional background we are using the Jojo-Beeps branch of Loop that automatically updates our Nightscout profile when basal changes are made within the Loop app.

Happy to provide more context if helpful. I did try changing the basal rates in Nightscout manually this morning (resetting them to match the correct basal profile in Loop) but that change also did not accurately reflect in the Autotune e-mail.

Please let me know if you think this is software related or user related.

image image image

MarkMpn commented 5 years ago

There seems to be an error with how the profile has been saved in NS. I'm not sure where this error has come from, but the basal rates part of your profile is stored as:

"basal": [
  {
    "value": 0.45,
    "time": "00:00",
    "timeAsSeconds": 0
  },
  {
    "value": 0.4,
    "timeAsSeconds": 25200,
    "time": "07:00"
  },
  {
    "time": "20:00",
    "timeAsSeconds": 73800,
    "value": 0.8
  },
  {
    "time": "23:00",
    "value": 0.45,
    "timeAsSeconds": 82800
  }
]

Your 8pm entry has timeAsSeconds set to 73800, which is actually 8:30pm.

As Autotune will only produce recommendations aligned to hours, the email formatting only looks to the changes on full hours, not half hours.

I'd suggest deleting the 8pm entry and recreating it to see if that produces the correct timeAsSeconds.

mikebash commented 5 years ago

Mark - thank you for your note. It helped me diagnose where the issue was (should have caught this myself). As you mention, Nightscout was showing the right times but using the wrong times. When I looked back at my son's basal rates in Loop, I found that I had set the evening change to 8:30. So the transfer from Loop to Nightscout altered the time to 8PM not 8:30. I have resolved all of this within the Loop app and will likely submit a comment on the Jojo branch to highlight this issue. Thank you for your help.