Skip to content

Commit

Permalink
Merge branch 'master' into darinkrauss/dexcom
Browse files Browse the repository at this point in the history
  • Loading branch information
Darin Krauss committed Nov 7, 2017
2 parents 7ad3005 + 63b175f commit a5b5d77
Show file tree
Hide file tree
Showing 33 changed files with 3,796 additions and 386 deletions.
10 changes: 9 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"stage-0",
"react"
],
"retainLines": true,
"plugins": ["add-module-exports"],
"env": {
"production": {
Expand All @@ -19,11 +20,18 @@
},
"test": {
"plugins": [
["resolver", { "resolveDirs": [ "app/node_modules" ]}],
[ "module-resolver", {
"root": ["./app/node_modules"],
"alias": {
"node-hid": "./app/node_modules/node-hid",
"serialport": "./app/node_modules/serialport"
}
} ],
["webpack-loaders", { "config": "webpack.config.test.js", "verbose": false }],
"babel-plugin-rewire",
["transform-define", {
"__TEST__": "true",
"__VERSION_SHA__": "abcd",
"__DEBUG__": false
}]
]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ coverage

_book/
web/

\.vscode/
11 changes: 10 additions & 1 deletion app/actions/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import _ from 'lodash';


import * as actionTypes from '../constants/actionTypes';
import * as actionSources from '../constants/actionSources';
import * as metrics from '../constants/metrics';
Expand Down Expand Up @@ -285,8 +284,18 @@ export function loginRequest() {
}

export function loginSuccess(results) {
const rollbar = require('../utils/rollbar');
const { user, profile, memberships } = results;
const isClinicAccount = personUtils.userHasRole(user, 'clinic');
// the rewire plugin messes with default export in tests
rollbar.configure && rollbar.configure({
payload: {
person: {
id: user.userid,
username: user.username,
}
}
});
return {
type: actionTypes.LOGIN_SUCCESS,
payload: { user, profile, memberships },
Expand Down
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import rollbar from './utils/rollbar';
import _ from 'lodash';
import React from 'react';
import { render } from 'react-dom';
Expand Down
26 changes: 25 additions & 1 deletion app/main.development.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
import { app, BrowserWindow, Menu, shell, ipcMain } from 'electron';
/* global __ROLLBAR_POST_TOKEN__ */
import { app, BrowserWindow, Menu, shell, ipcMain, crashReporter } from 'electron';
import os from 'os';
import open from 'open';
import { autoUpdater } from 'electron-updater';
import * as chromeFinder from 'chrome-launcher/chrome-finder';
import { sync as syncActions } from './actions';
import debugMode from '../app/utils/debugMode';
import Rollbar from 'rollbar/src/server/rollbar';

let rollbar;
if(process.env.NODE_ENV === 'production') {
rollbar = new Rollbar({
accessToken: __ROLLBAR_POST_TOKEN__,
captureUncaught: true,
captureUnhandledRejections: true,
payload: {
environment: 'electron_main_process'
}
});
}

crashReporter.start({
productName: 'Uploader',
companyName: 'Tidepool',
submitURL: '',
uploadToServer: false
});

console.log('Crash logs can be found in:',crashReporter.getCrashesDirectory());
console.log('Last crash report:', crashReporter.getLastCrashReport());

let menu;
let template;
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tidepool-uploader",
"productName": "tidepool-uploader",
"version": "2.1.1",
"version": "2.2.0",
"description": "Tidepool Project Universal Uploader",
"main": "./main.js",
"author": {
Expand Down
8 changes: 8 additions & 0 deletions app/reducers/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const devices = {
source: {type: 'device', driverId: 'AbbottFreeStyleLite'},
enabled: {mac: false, win: true}
},
abbottfreestylelibre: {
instructions: '(Unsupported) Plug in meter with micro-USB cable',
key: 'abbottfreestylelibre',
name: 'Abbott FreeStyle Libre (Beta)',
showDriverLink: {linux: false, mac: false, win: false},
source: {type: 'device', driverId: 'AbbottFreeStyleLibre'},
enabled: {linux: true, mac: true, win: true}
},
bayercontournext: {
instructions: 'Plug meter into USB port',
key: 'bayercontournext',
Expand Down
33 changes: 33 additions & 0 deletions app/utils/rollbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* global __VERSION_SHA__ */

import Rollbar from 'rollbar/dist/rollbar.umd';

let rollbar = new Rollbar({
accessToken: '1843589282464f4facd43f794c8201a8',
captureUncaught: true,
payload: {
environment: 'electron_renderer',
client: {
javascript: {
code_version: __VERSION_SHA__,
guess_uncaught_frames: true
}
}
},
// to deal with URI's as local filesystem paths, we use the "many domain" transform:
// https://rollbar.com/docs/source-maps/#using-source-maps-on-many-domains
transform: function(payload) {
var trace = payload.body.trace;
if (trace && trace.frames) {
for (var i = 0; i < trace.frames.length; i++) {
var filename = trace.frames[i].filename;
if (filename) {
trace.frames[i].filename = 'http://dynamichost/dist/bundle.js';
}
}
}
}
}
);

export default rollbar;
5 changes: 3 additions & 2 deletions docs/checklists/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Checklists for the implementation of drivers for reading data from diabetes devices currently supported or in development.

* [Abbott FreeStyle (BGM)](abbottFreeStyleLite.md)
* [Abbott FreeStyle Lite & Freedom Lite (BGM)](abbottFreeStyleLite.md)
* [Abbott FreeStyle Libre (CGM & BGM data)](abbottFreeStyleLibre.md)
* [Abbott Precision Xtra (blood glucose & ketone meter)](abbottPrecisionXtra.md)
* [Animas Vibe (CGM data)](animasCGM.md)
* [Animas Ping and Vibe Insulin Pumps](animasPingAndVibe.md)
Expand All @@ -11,4 +12,4 @@ Checklists for the implementation of drivers for reading data from diabetes devi
* [Insulet OmniPod Insulin Delivery System](insuletOmniPod.md)
* [OneTouch VerioIQ (BGM)](oneTouchVerioIQ.md)
* [Tandem Insulin Pumps](tandem.md)
* [Tandem G4 (CGM data)](tandemCGM.md)
* [Tandem G4 (CGM data)](tandemCGM.md)
147 changes: 147 additions & 0 deletions docs/checklists/abbottFreeStyleLibre.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
## Checklist for CGM Implementation

(Key:

- `[x]` available in data protocol/documented in spec and implemented
- `[-]` available in data protocol/documented in spec but *not* yet implemented
- `[?]` unknown whether available in data protocol/documented in spec; *not* yet implemented
- `*[ ]` TODO: needs implementation!
- `[ ]` unavailable in data protocol and/or not documented in spec and not yet implemented)

### Required if Present

#### CBG

- `[x]` cbg values
- `[ ]` units of cbg values (read from device, not hard-coded)
- `[x]` out-of-range values (LO or HI)
- `[x]` out-of-range value thresholds (e.g., often 40 for low and 400 for high on CGMs)

Device-specific? (Add any device-specific notes/additions here.)
- internal glucose unit is always mg/dL for this device, independent of display unit
- out-of-range thresholds are 41 mg/dL and 499 mg/dL
- out-of-range measurements are reported as values 40 or 500 respectively

#### Device Events
- `[ ]` calibrations
- `[ ]` calibration value
- `[ ]` units of calibration value (read from device, not hard-coded)
- `[x]` time changes (presence of which is also in the [BtUTC section](#bootstrapping-to-utc) below)
- `[x]` device display time `from` (before change) and `to` (result of change)
- `[x]` agent of change (`automatic` or `manual`)
- `[ ]` timezone
- `[ ]` reason for change (read from device)

Device-specific? (Add any device-specific notes/additions here.)
- device does not need calibration

#### Settings

- `[x]` units preference for BG display
- `[x]` units of data being uploaded (will be mutated to mmol/L storage units if not mmol/L)
- `[x]` transmitter ID
- `[ ]` low alert settings
- `[ ]` enabled
- `[ ]` level/threshold
- `[ ]` snooze threshold
- `[ ]` high alert settings
- `[ ]` enabled
- `[ ]` level/threshold
- `[ ]` snooze threshold
- `[ ]` rate-of-change alerts
- `[ ]` fall rate alert
- `[ ]` enabled
- `[ ]` rate threshold for alerting
- `[ ]` rise rate alert
- `[ ]` enabled
- `[ ]` rate threshold for alerting
- `[ ]` out-of-range alerts
- `[ ]` enabled
- `[ ]` snooze time between alerts
- `[ ]` predictive alerts
- `[ ]` low prediction
- `[ ]` enabled
- `[ ]` time sensitivity (minutes to predicted low for alerting)
- `[ ]` high prediction
- `[ ]` enabled
- `[ ]` time sensitivity (minutes to predicted high for alerting)
- `[ ]` calibration alerts/reminders
- `[ ]` pre-reminder
- `[ ]` overdue alert

Settings history:

- `[ ]` device stores all changes to settings OR
- `[x]` device only returns current settings at time of upload

No Tidepool data model (yet): volume and/or vibrate mode of all alerts (can/should go in `payload`).

Device-specific? (Add any device-specific notes/additions here.)

#### "Bootstrapping" to UTC

- `[x]` index
- `[ ]` UTC timestamp (*Hey, one can dream!*) OR
- `[x]` internal timestamp or persistent log index (across device communication sessions) to order all pump events (regardless of type), independent of device display time OR
- `[ ]` ephemeral log index (does not persist across device communication sessions) to order all pump events (regardless of type), independent of device display time
- `[x]` date & time settings changes

Device-specific? (Add any device-specific notes/additions here.)

### No Tidepool Data Model Yet

> **NB:** You can and should add to this section if there are other data types documented in the device's data protocol specification but not part of Tidepool's data model (yet).
- `[-]` activity/exercise
- `[-]` food (e.g., Dexcom allows logging carb events)
- `[-]` notes/other events
- `[-]` insulin (rapid acting, long term)

### Tidepool ingestion API

Choose one of the following:

- `[x]` legacy "jellyfish" ingestion API
- `*[ ]` platform ingestion API

### Known implementation issues/TODOs

*Use this space to describe device-specific known issues or implementation TODOs **not** contained in the above datatype-specific sections.*


## Checklist for Blood Glucose Meter Implementation

### Required if Present

- `[x]` smbg values
- `[ ]` units of smbg values (read from device, not hard-coded)
- `[x]` out-of-range values (LO or HI)
- `[x]` out-of-range value thresholds (e.g., often 20 for low and 600 for high on BGMs)
- `[x]` date & time settings changes
- `[x]` blood ketone values
- `[ ]` units of blood ketone values (read from device, not hard-coded)
- `[x]` ketone out-of-range values
- `[x]` ketone out-of-range value thresholds

Device-specific? (Add any device-specific notes/additions here.)
- internal glucose unit is always mg/dL for this device, independent of display unit
- glucose out-of-range thresholds are 41 mg/dL and 499 mg/dL
- glucose out-of-range measurements are reported as values 40 or 500 respectively
- ketone out-of-range upper threshold is 8.0 mmol/L

### No Tidepool Data Model Yet

- `[x]` control (solution) tests (whether marked in UI or auto-detected) - until we have a data model, these should be discarded
- `[-]` device settings, other than date & time (e.g., target blood glucose range)
- `[-]` tag/note (e.g., pre- vs. post-meal)

### Tidepool ingestion API

Choose one of the following:

- `[x]` legacy "jellyfish" ingestion API
- `*[ ]` platform ingestion API

### Known implementation issues/TODOs

*Use this space to describe device-specific known issues or implementation TODOs **not** contained in the above datatype-specific sections.*
4 changes: 0 additions & 4 deletions docs/checklisttemplates/CGMChecklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,4 @@ Choose one of the following:

### Known implementation issues/TODOs

Add any device-specific known issues or implementation TODOs here in checklist format.

### Known implementation issues/TODOs

*Use this space to describe device-specific known issues or implementation TODOs **not** contained in the above datatype-specific sections.*
9 changes: 9 additions & 0 deletions lib/core/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var insuletOmniPod = require('../drivers/insulet/insuletDriver');
var oneTouchUltra2 = require('../drivers/onetouch/oneTouchUltra2');
var oneTouchVerioIQ = require('../drivers/onetouch/oneTouchVerioIQ');
var abbottFreeStyleLite = require('../drivers/abbott/abbottFreeStyleLite');
var abbottFreeStyleLibre = require('../drivers/abbott/abbottFreeStyleLibre');
var bayerContourNext = require('../drivers/bayer/bayerContourNext');
var animasDriver = require('../drivers/animas/animasDriver');
var medtronicDriver = require('../drivers/medtronic/medtronicDriver');
Expand All @@ -59,6 +60,7 @@ device._deviceDrivers = {
'OneTouchUltra2': oneTouchUltra2,
'OneTouchVerioIQ': oneTouchVerioIQ,
'AbbottFreeStyleLite': abbottFreeStyleLite,
'AbbottFreeStyleLibre': abbottFreeStyleLibre,
'BayerContourNext': bayerContourNext,
'Animas': animasDriver,
'Medtronic': medtronicDriver
Expand All @@ -71,6 +73,7 @@ device._deviceComms = {
'OneTouchUltra2': serialDevice,
'OneTouchVerioIQ': serialDevice,
'AbbottFreeStyleLite': serialDevice,
'AbbottFreeStyleLibre': hidDevice,
'Tandem': serialDevice,
'BayerContourNext': hidDevice,
'Animas': serialDevice,
Expand Down Expand Up @@ -120,6 +123,12 @@ device._driverManifests = {
{vendorId: 1027, productId: 24577} // FTDI cable
]
},
'AbbottFreeStyleLibre': {
mode: 'HID',
usb: [
{vendorId: 6753, productId: 13904}
]
},
'BayerContourNext': {
mode: 'HID',
usb: [
Expand Down
Loading

0 comments on commit a5b5d77

Please sign in to comment.