nightscout / nightguard

iOS and WatchOS Client for the Nightscout CGM System
GNU Affero General Public License v3.0
243 stars 158 forks source link

Update past data from nightscout #309

Closed poml88 closed 2 months ago

poml88 commented 3 months ago

Is there any specific reason, why NG is not pulling past data from NS if there has been no network for a while? The data in NS is there, NG just seems to care about the current value(s). I'll attach some screen shots.

IMG_1106

incoming-D1E21BF0-DA25-4EAB-B48B-3200276F00AE

dhermanns commented 2 months ago

It reads all data starting from the last item already read today:

https://github.com/nightscout/nightguard/blob/master/nightguard/external/NightscoutService.swift#L354

So normally It should catch up all missed data.

poml88 commented 2 months ago

Hm, ok, well, it doesn't. :)

dhermanns commented 2 months ago

Would expect that you had some broken data so it could read only some values. As soon it has one value retrieved, it won't catch up older ones. Could be a manual measurement as well.

poml88 commented 2 months ago

Hm... Well, it happens everytime after network interruption. Maybe it depends on how the data is inserted into NS. So if network comes back, maybe first the libre3 will send the most recent value to LLU, which is then uploaded into NS. NG sees that and downloads it. Then the libre3 will send the historical data to LLU and they are added to NS. But NG "thinks" it is already at the latest data. Something like this...

dhermanns commented 2 months ago

Yes - that would explain it. And maybe why I didn't recognize this. I'm using xdrip to catch and upload the bg values. This could be the reason also, why some people experience missing values in uploaded healthkit data.

You can simply verify this thesis by removing the optimization and get always the data starting from midnight. You will get duplicates, but shouldn't experience any more gaps.