creepymonster / nightscout-to-libreview

Transfer your diabetes data from Nightscout to LibreView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No treatments (food or insulin) found

Puderzo opened this issue · comments

Hi @creepymonster!

Thank you for an awesome script! I'm using a long chain of Libre2->Juggluco->Juggluco server->Juggluco->xDrip+->Nightscout to get my son's CGM data out, and I've been looking for a way to automate data extract to LibreView for the medical staff. After watching your Youtube instruction video, I finally got the script working, but as written it only finds glucose entries, no food or insulin entries. I found that my Nightscout treatment entries, which have been synced from xDrip+, don't appear to have an eventType, and therefore these rows don't find any data:

entries url https://xxx/api/v1/treatments.json?find[created_at][$gte]=2022-12-01&find[created_at][$lte]=2023-01-01&find[eventType]=Meal%20Bolus&count=131072&token=xxx
entries url https://xxx/api/v1/treatments.json?find[created_at][$gte]=2022-12-01&find[created_at][$lte]=2023-01-01&find[eventType]=Carb%20Correction&count=131072&token=xxx
insulin entries url https://xxx/api/v1/treatments.json?find[created_at][$gte]=2022-12-01&find[created_at][$lte]=2023-01-01&find[eventType]=Correction%20Bolus&count=131072&token=xxx
insulin entries url https://xxx/api/v1/treatments.json?find[created_at][$gte]=2022-12-01&find[created_at][$lte]=2023-01-01&find[eventType]=Bolus&count=131072&token=xxx

I changed the code to remove the &find[eventType]=<...> part, and then I got these entries for this month (I missed yesterday altogether and have no entries from that day):

[{"_id":"7409705a8d2144d59e3f024f","timestamp":1669998601317,"eventType":"","enteredBy":"xdrip","uuid":"7409705a-8d21-44d5-9e3f-024ffb94f0aa","carbs":18,"insulinInjections":"[]","created_at":"2022-12-02T16:30:01.000Z","sysTime":"2022-12-02T18:30:01.317+0200","utcOffset":0,"insulin":null},
{"_id":"c6a92cc32f0d4dd2abc69a60","timestamp":1669993201077,"eventType":"","enteredBy":"xdrip","uuid":"c6a92cc3-2f0d-4dd2-abc6-9a603323bdce","carbs":55,"insulin":2.5,"insulinInjections":"[]","created_at":"2022-12-02T15:00:01.000Z","sysTime":"2022-12-02T17:00:01.077+0200","utcOffset":0},
{"_id":"f0d2d5d899934fe0893576c0","timestamp":1669984201114,"eventType":"","enteredBy":"xdrip","uuid":"f0d2d5d8-9993-4fe0-8935-76c07acf7639","carbs":30,"insulin":1.5,"insulinInjections":"[]","created_at":"2022-12-02T12:30:01.000Z","sysTime":"2022-12-02T14:30:01.114+0200","utcOffset":0},
{"_id":"a49c871f7f9c450087c07145","timestamp":1669971601088,"eventType":"","enteredBy":"xdrip","uuid":"a49c871f-7f9c-4500-87c0-7145f20df858","carbs":40,"insulin":2,"insulinInjections":"[]","created_at":"2022-12-02T09:00:01.000Z","sysTime":"2022-12-02T11:00:01.088+0200","utcOffset":0},
{"_id":"077b8aa17aa74f8b8fd16305","timestamp":1669962601130,"eventType":"","enteredBy":"xdrip","uuid":"077b8aa1-7aa7-4f8b-8fd1-6305c19d3da6","carbs":40,"insulin":2.5,"insulinInjections":"[]","created_at":"2022-12-02T06:30:01.000Z","sysTime":"2022-12-02T08:30:01.130+0200","utcOffset":0}]

As I changed the URL code for both food and insulin to practically be the same (as my treatments all are of the same eventType, and contain the same data), I now get equal amounts of food and insulin as "responses", but they seem to be correctly entered into LibreView anyway:

transferLibreView
glucose entries 157
food entries 5
insulin entries 5
transferLibreView, response undefined

--

So to sum this up, I suggest a parameter or something with which one could select not to specify treatment types, if some other service (e.g. xDrip+), which doesn't specify them, is used to enter treatment values.

Also, I would like a way to automate running this as a service, perhaps once a day syncing that day's entries, without needing input from me. As far as I can see, it now needs my input every time I want to run it. I could probably change the code for this, but I would think that this would be something that the community could also be interested in.

Can you link the youtube guide for help me? Thanks a lot @Puderzo

Can you link the youtube guide for help me? Thanks a lot @Puderzo

Here you go: https://www.youtube.com/watch?v=NEzG2By10B4

I found it in one of the closed issues :)