Fix loop prediction error
miriamkw opened this issue · 0 comments
miriamkw commented
The first step to make sure that we are using pyloopkit correctly and fetching correct predictions, is to run the example_nightscout.py
and verify with out Loop app in real time. Currently the predictions are slightly off.
Possible solutions:
- When fetching data from nightscout, scheduled basal rate deliveries are not written as a treatment, so we have to manually add those samples in the dataframe. This is a TO DO!
- There might be a time offset problem, because Python does in some situations convert automatically to your local timezone
- I see in the plot that it seems like the trajectories start from a different time, just sligthly. maybe some are using glucose as reference, while others use "now-time"
- Basal rates in U and not U/hr? I am confident that the units written in the repo are correct, but maybe pyloopkit is expecting U.
- Basal rates giving string instead of number to pyloopkit?
- Have I included enough hours of data for retrospective correction?
- The newest basal rates are not registered in data, because new basal rates are written when changed (after checking, this did not make a difference on predictions and hence is not a problem (when adding sheduled). However, if the current is temp, it might make a difference.)
- When we compare data between nightsout and tidepool we see that the basal data is sligtly different: tidepool has derived the basal rate from the delivered units and duration of sample, while nightscout has directly used the “programmed basal” feature, which is not perfectly correlated with delivered basal in units, probably because of the basal delivery algorithm of the hardware. Which one does pyloopkit use for predictions? Programmed basal or delivered basal?