mddub / minimed-connect-to-nightscout

Send Medtronic pump and CGM data to Nightscout.
MIT License
19 stars 99 forks source link

support for carelink.minimed.eu (european minimed site) #2

Open PieterGit opened 8 years ago

PieterGit commented 8 years ago

is it possible to use this uploader for nightscout with the european portal? i noticed the URL of Carelink website is hardcoded and cannot be set to https://carelink.minimed.eu.

I replaced the URL in carelink.js to carelink.minimed.eu, but I get errors in Nightscout. timestamp1 Logging in to Carleink timestamp2 POST https://carelink.minimed.eu/patient/j_security_check ... MiniMed Connect error: Error: read ECONNRESET

Can I help you to make this uploader also work for European Carelink users?

PieterGit commented 8 years ago

I think it's caused by the fact that the CARELINK_JSON_BASE_URL gives a 404 on the European site. Is it also possible to use the CSV download option? According to Firefox I think it's possible to download the CSV with (Cookie and customerID blanked out

curl "https://carelink.minimed.eu/patient/main/selectCSV.do?t=11" -H "Host: carelink.minimed.eu" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8" -H "Accept-Language: nl,en-US;q=0.7,en;q=0.3" --compressed -H "Referer: https://carelink.minimed.eu/patient/main/reports.do" -H "Cookie: XXX" -H "Connection: keep-alive" --data "report=11&listSeparator="%"2C&customerID=XXX&datePicker2=01-12-2015&datePicker1=12-01-2016"

mddub commented 8 years ago

Good idea, thanks for looking into this. It would be possible to use the csv, though the logic in transform.js would need to be totally different for that data source.

  1. Does the csv include Connect pump status data like active insulin, reservoir, battery, etc., or is it only SGV records?

    If it's just SGVs, I wonder if it would make more sense to write something new based on @bewest's https://github.com/bewest/mmcsv. It seems like you would just need to run that regularly and then transform the SGV entries into Nightscout entries (and probably do some cleanup like adding timezone).

  2. Is there a CareLink Connect tab at the top of the EU portal?

    connect

    Last I heard, the Connect hadn't been officially released in EU. If that isn't part of the site, that explains why there's no JSON endpoint to get the data. If it's there, maybe it just uses a different URL? Is there a reason you can't use or register an account on the US site?

mavster commented 8 years ago

I've been using this with Azure for Nightscout and have SGVs running great (thank you!), but I'm wondering how I get to see other values such as active insulin, reservoir level, battery levels, etc. on the Nightscout website. Do I need to change my Mongo setup, or are there more plugins to add to Azure?

My Mongo collection data example (shown below) shows the data:

{ "_id": { "$oid": "56f9131336f7e2bcf915f950" }, "date": 1459163911941, "dateString": "2016-03-28T11:18:31.941Z", "type": "carelink_raw", "data": { "lastSensorTSAsString": "Mar 28, 2016 22:09:00", "lastSensorTS": 0, "bgunits": "MMOL_L", "medicalDeviceTimeAsString": "Mar 28, 2016 22:12:00", "kind": "Main", "version": 1, "currentServerTime": 1459163923146, "lastConduitTime": 0, "lastConduitUpdateServerTime": 1459163911941, "lastMedicalDeviceDataUpdateServerTime": 1459163911941, "firstName": "", "lastName": "", "conduitSerialNumber": "0", "conduitBatteryLevel": 100, "conduitBatteryStatus": "FULL", "conduitInRange": true, "conduitMedicalDeviceInRange": true, "conduitSensorInRange": true, "medicalDeviceFamily": "PARADIGM", "sensorState": "NORMAL", "medicalDeviceSerialNumber": "", "medicalDeviceTime": 0, "sMedicalDeviceTime": "Mar 28, 2016 22:12:00", "reservoirLevelPercent": 50, "reservoirAmount": 65, "medicalDeviceBatteryLevelPercent": 50, "sensorDurationHours": 1, "timeToNextCalibHours": 7, "calibStatus": "LESS_THAN_NINE_HRS", "bgUnits": "MMOL_L", "timeFormat": "HR_12", "lastSensorTime": 0, "sLastSensorTime": "Mar 28, 2016 22:09:00", "medicalDeviceSuspended": false, "lastSGTrend": "NONE", "lastSG": { "sg": 149, "datetime": "Mar 28, 2016 22:09:00", "timeChange": false, "kind": "SG", "version": 1 }, "lastAlarm": { "code": 105, "datetime": "Mar 26, 2016 07:45:44", "type": "ALARM", "flash": false, "kind": "Alarm", "version": 1 }, "activeInsulin": { "amount": 0, "datetime": "Mar 28, 2016 22:12:00", "kind": "Insulin", "version": 1 }, "sgs": [ { "sg": 143, "datetime": "Mar 28, 2016 21:44:00", "timeChange": false, "kind": "SG", "version": 1 }, { "sg": 145, "datetime": "Mar 28, 2016 21:49:00", "timeChange": false, "kind": "SG", "version": 1 }, { "sg": 146, "datetime": "Mar 28, 2016 21:54:00", "timeChange": false, "kind": "SG", "version": 1 }, { "sg": 148, "datetime": "Mar 28, 2016 21:59:00", "timeChange": false, "kind": "SG", "version": 1 }, { "sg": 149, "datetime": "Mar 28, 2016 22:04:00", "timeChange": false, "kind": "SG", "version": 1 }, { "sg": 149, "datetime": "Mar 28, 2016 22:09:00", "timeChange": false, "kind": "SG", "version": 1 } ], "limits": [ { "index": 0, "highLimit": 270, "lowLimit": 52, "kind": "Limits", "version": 1 } ] } }

mddub commented 8 years ago

If you switch to the dev branch of cgm-remote monitor and set the environment variable DEVICESTATUS_ADVANCED="true", you can view pump reservoir and battery level with the pump plugin, and pump-reported IOB with the iob plugin. You can set alerts for the reservoir and battery level, too.

How to run dev branch: https://github.com/nightscout/cgm-remote-monitor/wiki/Deploy-a-test-branch

Plugin details: https://github.com/nightscout/cgm-remote-monitor/tree/dev#pump-pump-monitoring

mavster commented 8 years ago

OK thanks. I'm a bit uncomfortable running the dev branch just in case something is broken as development is going on. When will these changes be folded into the Master?

mddub commented 8 years ago

The beta just started last week, so shouldn't be long. You can use the dev branch to run a second instance of cgm-remote-monitor if you don't want to mess up your main installation.

http://nightscout.github.io/pages/test-beta/?branch=0.9-beta2

bogdangorescu commented 7 years ago

PROBLEM SOLVED: For EUROPEAN (!) server, follow this "guide":

  1. Edit your
    node_modules/minimed-connect-to-nightscout/transform.js file and replace the content of the parsePumpTimefunction with the following: return Date.parse(timestamp);

    1. Edit your node_modules/minimed-connect-to-nightscout/carelink.js file and then search and replace “minimed.com” with “minimed.eu” (without the quotes, obviously!)

That's all, folks! Bogdan