burnedikt / diasend-nightscout-bridge

Synchronize your diasend data to nightscout.
MIT License
18 stars 18 forks source link

Basal changes (small micro bolus) #8

Closed funkstille closed 1 year ago

funkstille commented 1 year ago

Would it be possible to adjust the nightspot basal rate according to the change of camAPS? In Diasend they are already reported as basal, f.e.:

        {
            "type": "insulin_basal",
            "created_at": "2022-09-01T15:34:16",
            "value": 0.35,
            "unit": "U\/h",
            "flags": []
        },
burnedikt commented 1 year ago

definitely possible. Right now, we only import the pump settings once per hour or so (which includes the basal rate).

Only question here is, whether this is a temp basal change induced by CamAPS or whether it's the standard basal rate? This is important as there's different ways of importing the basal rate into nightscout (either as a temporary increase / decrease or as a fixed value)

funkstille commented 1 year ago

CamAPS does not use a basal rate at all. It does not care for the basal rate stored in pump. The basal rate in pump is only used if you turn AUTO MODE OFF. If CamAPS in Auto Mode every 10-12 minutes the loop decides the small micro Bolus for the next 20 minutes.

The auto mode off scenario is hardly used by us. So the only time I have a look at the basal rate in pump is when the doctor reminds me to update it from time to time. So we are prepared for an emergency (phone with app broken / stolen).

burnedikt commented 1 year ago

CamAPS does not use a basal rate at all. It does not care for the basal rate stored in pump. The basal rate in pump is only used if you turn AUTO MODE OFF. If CamAPS in Auto Mode every 10-12 minutes the loop decides the small micro Bolus for the next 20 minutes.

yes, sorry. Remembered it incorrectly. It sets basal to 0% and solely uses micro boli, just like you described.


Regarding the original topic: The only difficulty would be to know for how long the basal rate should be at that level. We can obviously import it into nightscout's basal profile starting at 2022-09-01T15:34:16 and leaving that value for the rest of the day, i.e. until 00:00 am, unless another insulin_basal record is received from diasend again (e.g. an hour later or so)

funkstille commented 1 year ago

I checked the data for the last 14 days. The longest time (duration) basal was not changed, was 1 hour and 16 minutes. So your approach should work fine.

Another strange / misleading thing in data records: Often a change in basal ends up in 2 records with same timestamp, see excel export from diasend.

04/09/2022 05:22 | 0,500 04/09/2022 05:22 | 0,550 04/09/2022 05:34 | 0,800 04/09/2022 05:34 | 0,750 04/09/2022 05:42 | 0,600 04/09/2022 05:42 | 0,500 04/09/2022 05:54 | 0,250 04/09/2022 06:06 | 0,200 04/09/2022 06:06 | 0,250

burnedikt commented 1 year ago

10 adds support for importing the insulin_basal data records into nightscout - more specifically into a nightscout profile called Diasend.