nightscout / minimed-connect-to-nightscout

Community edition of original
MIT License
47 stars 138 forks source link

minimed-connect-to-nightscout

MiniMed Connect is a device which communicates with a Medtronic insulin pump over 916MHz radio to gather data about pump status. This data may include readings from an Enlite continuous glucose monitor (CGM). The Connect forwards pump data via Bluetooth LE to a proprietary app running on an iPhone. The iPhone app uploads the data to Medtronic's servers, enabling authorized users to view it on the Medtronic CareLink Connect website.

Nightscout is an open source, DIY project that allows real-time access to CGM data on any platform. The core of the Nightscout project is cgm-remote-monitor, a web service which can receive and broadcast CGM data using a Mongo database. Various other software projects communicate with an instance of cgm-remote-monitor, either to transmit data from a CGM device, or to display that CGM data on a computer, smartphone/tablet, or smartwatch.

minimed-connect-to-nightscout is a web scraper which sends data from Medtronic CareLink Connect to Nightscout. It does so by posing as a web browser, logging into CareLink Connect, periodically downloading pump status data from the Medtronic server, and uploading that data to a Nightscout server.

Prerequisites

Installation on Azure

The easiest installation mode is to set up an instance of Nightscout cgm-remote-monitor on Azure and enable the mmconnect plugin. This module is packaged with Nightscout 0.8.2+ and can pull data from CareLink Connect as part of the web server process. Follow this guide.

Installation on Heroku

Another turnkey installation option is to run this on a Heroku worker dyno. You may find this more reliable than Azure. Follow the Share2 Bridge instructions for Heroku, substituting this repo for share2nightscout-bridge.

Deploy

Installation in general

  1. Install Node.
  2. Clone this repository.
  3. npm install to install dependencies.
  4. Set environment variables (see below).
  5. npm start and leave it running.

Required environment variables

Optional environment variables

Currently supported data

Understanding of the current data is based mostly on this analysis.

API

run.js demonstrates how to use the key API features in production. A minimal example would look like:

var mmcns = require('minimed-connect-to-nightscout');
var client = mmcns.carelink.Client({username: 'username', password: 'password'});
client.fetch(function(err, data) {
  if (!err) {
    var transformed = mmcns.transform(data);
    mmcns.nightscout.upload(transformed.entries, 'https://your.ns.host/api/v1/entries.json', 'api-secret', callback);
    // ...or:
    mmcns.nightscout.upload(transformed.devicestatus, 'https://your.ns.host/api/v1/devicestatus.json', 'api-secret', callback);
    // ...or use `transformed.entries` and `transformed.devicestatus` directly
  }
});

Contributing

File an issue if you'd like to give feedback, request an enhancement, or report a bug.

Pull requests are welcome, provided they include tests. See test/ for examples. Run npm test to run the suite.

Much of the Medtronic HTTP interaction is based on the excellent work by @bewest and @ianjorgensen on mmcsv.

Disclaimer

This project is intended for educational and informational purposes only. It relies on a series of fragile components and assumptions, any of which may break at any time. It is not FDA approved and should not be used to make medical decisions. It is neither affiliated with nor endorsed by Medtronic, and may violate their Terms of Service.