This acts as a web-based CGM (Continuous Glucose Monitor) to allow multiple caregivers to remotely view a patient's glucose data in real time. The server reads a MongoDB which is intended to be data from a physical CGM, where it sends new SGV (sensor glucose values) as the data becomes available. The data is then displayed graphically and blood glucose values are predicted 0.5 hours ahead using an autoregressive second order model. Alarms are generated for high and low values, which can be cleared by any watcher of the data.
Community maintained fork of the original cgm-remote-monitor.
Table of Contents
Clone this repo then install dependencies into the root of the project:
$ npm install
The data being uploaded from the server to the client is from a MongoDB server such as mongolab.
The easiest way to update your version of cgm-remote-monitor to our latest recommended version is to use the update my fork tool. It even gives out stars if you are up to date.
Try the what is my mongo string tool to get a good idea of your
mongo string. You can copy and paste the text in the gray box into your
MONGO_CONNECTION environment variable.
Use the autoconfigure tool to sync an uploader to your config.
The Nightscout API enables direct access to your DData without the need for direct Mongo access.
You can find CGM data in
/api/v1/entries, Care Portal Treatments in
/api/v1/treatments, and Treatment Profiles in
The server status and settings are available from
By default the
/treatments APIs limit results to the the most recent 10 values from the last 2 days.
You can get many more results, by using the
created_at parameters, depending on the type of data you're looking for.
http://localhost:1337 with your base url, YOUR-SITE)
The API is Swagger enabled, so you can generate client code to make working with the API easy. To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.html or review swagger.yaml.
VARIABLE (default) - description
MONGO_CONNECTION- Your mongo uri, for example:
mg/dl) - Choices:
mmol. Setting to
mmolputs the entire server into
mmolmode by default, no further settings needed.
BASE_URL- Used for building links to your sites api, ie pushover callbacks, usually the URL of your Nightscout site you may want https instead of http
ENABLE- Used to enable optional features, expects a space delimited list, such as:
careportal rawbg iob, see plugins below
DISABLE- Used to disable default features, expects a space delimited list, such as:
direction upbat, see plugins below
API_SECRET- A secret passphrase that must be at least 12 characters long, required to enable
PUT; also required for the Care Portal
off) - possible values
off. When on device must be authenticated by entering
API_SECRETto create treatments
These alarm setting effect all delivery methods (browser, pushover, maker, etc), some settings can be overridden per client (web browser)
BG_* ENV's are set, otherwise
predict) - currently 2 alarm types are supported, and can be used independently or combined. The
simplealarm type only compares the current BG to
BG_thresholds above, the
predictalarm type uses highly tuned formula that forecasts where the BG is going based on it's trend.
predictDOES NOT currently use any of the
260) - must be set using mg/dl units; the high BG outside the target range that is considered urgent
180) - must be set using mg/dl units; the top of the target range, also used to draw the line on the chart
80) - must be set using mg/dl units; the bottom of the target range, also used to draw the line on the chart
55) - must be set using mg/dl units; the low BG outside the target range that is considered urgent
on) - possible values
30 60 90 120) - Number of minutes to snooze urgent high alarms, space separated for options in browser, first used for pushover
on) - possible values
30 60 90 120) - Number of minutes to snooze high alarms, space separated for options in browser, first used for pushover
on) - possible values
15 30 45 60) - Number of minutes to snooze low alarms, space separated for options in browser, first used for pushover
on) - possible values
15 30 45) - Number of minutes to snooze urgent low alarms, space separated for options in browser, first used for pushover
30 60 90 120) - Number of minutes to snooze urgent alarms (that aren't tagged as high or low), space separated for options in browser, first used for pushover
30 60 90 120) - Number of minutes to snooze warning alarms (that aren't tagged as high or low), space separated for options in browser, first used for pushover
entries) - The collection used to store SGV, MBG, and CAL records from your CGM device
treatments) -The collection used to store treatments entered in the Care Portal, see the
ENABLEenv var above
devicestatus) - The collection used to store device status information such as uploader battery
1337) - The port that the node.js application will listen on.
SSL_KEY- Path to your ssl key file, so that ssl(https) can be enabled directly in node.js
SSL_CERT- Path to your ssl cert file, so that ssl(https) can be enabled directly in node.js
SSL_CA- Path to your ssl ca file, so that ssl(https) can be enabled directly in node.js
60) - Number of seconds to wait in between database checks
12)- possible values
off) - possible values
never) - possible values
Nightscout) - Usually name of T1
default) - possible values
on) - possible values
15) - minutes since the last reading to trigger a warning
on) - possible values
30) - minutes since the last reading to trigger a urgent alarm
SHOW_PLUGINS- enabled plugins that should have their visualizations shown, defaults to all enabled
en) - language of Nightscout. If not available english is used
log) - The type of scaling used for the Y axis of the charts system wide.
log(logarithmic) option will let you see more detail towards the lower range, while still showing the full CGM range.
linearoption has equidistant tick marks, the range used is dynamic so that space at the top of chart isn't wasted.
log-dynamicis similar to the default
logoptions, but uses the same dynamic range and the
Plugins are used extend the way information is displayed, how notifications are sent, alarms are triggered, and more.
The built-in/example plugins that are available by default are listed below. The plugins may still need to be enabled by adding to the
ENABLE environment variable.
These can be disabled by setting the
DISABLE env var, for example
delta(BG Delta) - Calculates and displays the change between the last 2 BG values.
direction(BG Direction) - Displays the trend direction.
upbat(Uploader Battery) - Displays the most recent battery status from the uploader phone.
errorcodes(CGM Error Codes) - Generates alarms for CGM codes
1 2 3 4 5 6 7 8) - By default the needs calibration (blood drop) and other codes below 9 generate an info level notification, set to a space separate list of number or
off) - By default there are no warning configured, set to a space separate list of numbers or
9 10) - By default the hourglass and ??? generate an urgent alarm, set to a space separate list of numbers or
ar2(Forcasting using AR2 algorithm) - Generates alarms based on forecasted values.
false) - to forecast using
rawbgvalues when standard values don't trigger an alarm.
2) - to adjust size of cone, use
0for a single line.
simplealarms(Simple BG Alarms) - Uses
BG_LOWthresholds to generate alarms.
rawbg(Raw BG) - Calculates BG using sensor and calibration records from and displays an alternate BG values and noise levels.
iob(Insulin-on-Board) - Adds the IOB pill visualization in the client and calculates values that used by other plugins. Uses treatments with insulin doses and the
sensfields from the treatment profile.
cob(Carbs-on-Board) - Adds the COB pill visualization in the client and calculates values that used by other plugins. Uses treatments with carb doses and the
sensfields from the treatment profile.
bwp(Bolus Wizard Preview) - This plugin in intended for the purpose of automatically snoozing alarms when the CGM indicates high blood sugar but there is also insulin on board (IOB) and secondly, alerting to user that it might be beneficial to measure the blood sugar using a glucometer and dosing insulin as calculated by the pump or instructed by trained medicare professionals. The values provided by the plugin are provided as a reference based on CGM data and insulin sensitivity you have configured, and are not intended to be used as a reference for bolus calculation. The plugin calculates the bolus amount when above your target, generates alarms when you should consider checking and bolusing, and snoozes alarms when there is enough IOB to cover a high BG. Uses the results of the
target_lowfields from the treatment profile. Defaults that can be adjusted with extended setting
0.50) - If
BWP_WARNa warning alarm will be triggered.
1.00) - If
BWP_URGENTan urgent alarm will be triggered.
10) - minutes to snooze when there is enough IOB to cover a high BG.
0.10) If BG is higher then the
BWP_SNOOZEalarms will be snoozed for
cage(Cannula Age) - Calculates the number of hours since the last
Site Changetreatment that was recorded.
false) - Set to
trueto enable notifications to remind you of upcoming cannula change.
44) - If time since last
CAGE_INFO, user will be warned of upcoming cannula change
48) - If time since last
CAGE_WARN, user will be alarmed to to change the cannula
72) - If time since last
CAGE_URGENT, user will be issued a persistent warning of overdue change.
treatmentnotify(Treatment Notifications) - Generates notifications when a treatment has been entered and snoozes alarms minutes after a treatment. Default snooze is 10 minutes, and can be set using the
basal(Basal Profile) - Adds the Basal pill visualization to display the basal rate for the current time. Also enables the
bwpplugin to calculate correction temp basal suggestions. Uses the
basalfield from the treatment profile. Also uses the extended setting:
none) - Possible values are
bridge(Share2Nightscout bridge) - Glucose reading directly from the Share service, uses these extended settings:
BRIDGE_USER_NAME- Your user name for the Share service.
BRIDGE_PASSWORD- Your password for the Share service.
1500002.5 minutes) - The time to wait between each update.
1) - The maximum number of records to fetch per update.
3) - Changes max count during the very first update only.
3) - How many failures before giving up.
1400) - The time window to search for new data per update (default is one day in minutes).
mmconnect(MiniMed Connect bridge) - Transfer real-time MiniMed Connect data from the Medtronic CareLink server into Nightscout (read more)
MMCONNECT_USER_NAME- Your user name for CareLink Connect.
MMCONNECT_PASSWORD- Your password for CareLink Connect.
600001 minute) - Number of milliseconds to wait between requests to the CareLink server.
32) - Maximum number of total seconds to spend retrying failed requests before giving up.
24) - Maximum number of recent sensor glucose values to send to Nightscout on each request.
MMCONNECT_VERBOSE- Set this to "true" to log CareLink request information to the console.
MMCONNECT_STORE_RAW_DATA- Set this to "true" to store raw data returned from CareLink as
type: "carelink_raw"database entries (useful for development).
Some plugins support additional configuration using extra environment variables. These are prefixed with the name of the plugin and a
_. For example setting
MYPLUGIN_EXAMPLE_VALUE=1234 would make
extendedSettings.exampleValue available to the
Plugins only have access to their own extended settings, all the extended settings of client plugins will be sent to the browser.
In addition to the normal web based alarms, there is also support for Pushover based alarms and notifications.
To get started install the Pushover application on your iOS or Android device and create an account.
Using that account login to Pushover, in the top left you’ll see your User Key, you’ll need this plus an application API Token/Key to complete this setup.
Pushover is configured using the following Environment Variables:
* `ENABLE` - `pushover` should be added to the list of plugin, for example: `ENABLE="pushover"`. * `PUSHOVER_API_TOKEN` - Used to enable pushover notifications, this token is specific to the application you create from in [Pushover](https://pushover.net/), ***[additional pushover information](#pushover)*** below. * `PUSHOVER_USER_KEY` - Your Pushover user key, can be found in the top left of the [Pushover](https://pushover.net/) site, this can also be a pushover delivery group key to send to a group rather than just a single user. This also supports a space delimited list of keys. To disable `INFO` level pushes set this to `off`. * `PUSHOVER_ALARM_KEY` - An optional Pushover user/group key, will be used for system wide alarms (level > `WARN`). If not defined this will fallback to `PUSHOVER_USER_KEY`. A possible use for this is sending important messages and alarms to a CWD that you don't want to send all notification too. This also support a space delimited list of keys. To disable Alarm pushes set this to `off`. * `PUSHOVER_ANNOUNCEMENT_KEY` - An optional Pushover user/group key, will be used for system wide user generated announcements. If not defined this will fallback to `PUSHOVER_USER_KEY` or `PUSHOVER_ALARM_KEY`. This also support a space delimited list of keys. To disable Announcement pushes set this to `off`. * `BASE_URL` - Used for pushover callbacks, usually the URL of your Nightscout site, use https when possible. * `API_SECRET` - Used for signing the pushover callback request for acknowledgments. If you never want to get info level notifications (treatments) use `PUSHOVER_USER_KEY="off"` If you never want to get an alarm via pushover use `PUSHOVER_ALARM_KEY="off"` If you never want to get an announcement via pushover use `PUSHOVER_ANNOUNCEMENT_KEY="off"` If only `PUSHOVER_USER_KEY` is set it will be used for all info notifications, alarms, and announcements For testing/development try [localtunnel](http://localtunnel.me/).
In addition to the normal web based alarms, and pushover, there is also integration for IFTTT Maker.
With Maker you are able to integrate with all the other IFTTT Channels. For example you can send a tweet when there is an alarm, change the color of hue light, send an email, send and sms, and so much more.
makershould be added to the list of plugin, for example:
MAKER_KEY- Set this to your secret key that you located in step 2, for example:
MAKER_KEY="abcMyExampleabc123defjt1DeNSiftttmak-XQb69p"This also support a space delimited list of keys.
MAKER_ANNOUNCEMENT_KEY- An optional Maker key, will be used for system wide user generated announcements. If not defined this will fallback to
MAKER_KEY. A possible use for this is sending important messages and alarms to a CWD that you don't want to send all notification too. This also support a space delimited list of keys.
Plugins can create custom events, but all events sent to maker will be prefixed with
ns-. The core events are:
ns-event- This event is sent to the maker service for all alarms and notifications. This is good catch all event for general logging.
ns-allclear- This event is sent to the maker service when an alarm has been ack'd or when the server starts up without triggering any alarms. For example, you could use this event to turn a light to green.
ns-info- Plugins that generate notifications at the info level will cause this event to also be triggered. It will be sent in addition to
ns-warning- Alarms at the warning level with cause this event to also be triggered. It will be sent in addition to
ns-urgent- Alarms at the urgent level with cause this event to also be triggered. It will be sent in addition to
Some of the plugins make use of a treatment profile that can be edited using the Profile Editor, see the link in the Settings drawer on your site.
Treatment Profile Fields:
timezone(Time Zone) - time zone local to the patient. Should be set.
units(Profile Units) - blood glucose units used in the profile, either "mgdl" or "mmol"
dia(Insulin duration) - value should be the duration of insulin action to use in calculating how much insulin is left active. Defaults to 3 hours.
carbs_hr(Carbs per Hour) - The number of carbs that are processed per hour, for more information see #DIYPS.
carbratio(Carb Ratio) - grams per unit of insulin.
sens(Insulin sensitivity) How much one unit of insulin will normally lower blood glucose.
basalThe basal rate set on the pump.
target_high- Upper target for correction boluses.
target_low- Lower target for correction boluses.
Some example profiles are here.
Easy to emulate on the commandline:
echo 'MONGO_CONNECTION=mongodb://sally:firstname.lastname@example.org:99999/nightscout' >> my.env echo 'MONGO_COLLECTION=entries' >> my.env
From now on you can run using
$ env $(cat my.env) PORT=1337 node server.js
Your hosting provider probably has a way to set these through their GUI.
Optionally, use Vagrant with the
setup.sh to install OS and node packages to
a virtual machine.
host$ vagrant up host$ vagrant ssh vm$ setup.sh
The setup script will install OS packages then run
The Vagrant VM serves to your host machine only on 192.168.33.10, you can access the web interface on http://192.168.33.10:1337
cgm-remote-monitor - web app to broadcast cgm readings Copyright (C) 2015 The Nightscout Foundation, http://www.nightscoutfoundation.org. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.