{"action":"created","comment":{"url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/comments/84893118","pull_request_review_id":5640917,"id":84893118,"diff_hunk":"@@ -638,19 +615,170 @@ var buildBasalRecords = function (records) {\n   return postrecords;\n };\n \n+function buildPrimeRecords(records) {\n+\n+  var primeRecords = filterHistory([RECORD_TYPES.PRIME], records);\n+  var postrecords = [];\n+\n+  primeRecords.forEach(function (primedatum) {\n+\n+    console.log('prime:',primedatum.jsDate, common.bytes2hex(primedatum.head), common.bytes2hex(primedatum.date), common.bytes2hex(primedatum.body));\n+\n+    var amount = struct.extractByte(primedatum.head,4) / 10.0;\n+    var fixed  = struct.extractByte(primedatum.head,2) / 10.0;\n+\n+    var type = fixed === 0 ? 'tubing' : 'cannula';\n+\n+    var deviceEvent = cfg.builder.makeDeviceEventPrime()\n+      .with_deviceTime(sundial.formatDeviceTime(primedatum.jsDate))\n+      .with_primeTarget(type)\n+      .with_volume(amount)\n+      .set('index', primedatum.index);\n+\n+    if(type === 'cannula' && fixed !== amount) {\n+      // it's possible to cancel a cannula prime,\n+      // storing the programmed amount in payload for now\n+      deviceEvent.set('payload', {programmedAmount: fixed});\n+    }\n+\n+    cfg.tzoUtil.fillInUTCInfo(deviceEvent, primedatum.jsDate);\n+    deviceEvent = deviceEvent.done();\n+    postrecords.push(deviceEvent);\n+  });\n+  return postrecords;\n+}\n+\n+function buildRewindRecords(records) {\n+\n+  var rewindRecords = filterHistory([RECORD_TYPES.REWIND], records);\n+  var postrecords = [];\n+\n+  rewindRecords.forEach(function (rewinddatum) {\n+\n+    console.log('rewind:',rewinddatum.jsDate, common.bytes2hex(rewinddatum.head), common.bytes2hex(rewinddatum.date), common.bytes2hex(rewinddatum.body));\n+\n+    var deviceEvent = cfg.builder.makeDeviceEventReservoirChange()\n+      .with_deviceTime(sundial.formatDeviceTime(rewinddatum.jsDate))\n+      .set('index', rewinddatum.index);\n+    cfg.tzoUtil.fillInUTCInfo(deviceEvent, rewinddatum.jsDate);\n+\n+    deviceEvent = deviceEvent.done();\n+    postrecords.push(deviceEvent);\n+  });\n+  return postrecords;\n+}\n+\n+function buildTimeChangeRecords(records, mostRecent) {","path":"lib/medtronic/processData.js","position":154,"original_position":154,"commit_id":"449ca08143477c4692e5865ad158f549923e2965","original_commit_id":"449ca08143477c4692e5865ad158f549923e2965","user":{"login":"gniezen","id":418233,"avatar_url":"https://avatars.githubusercontent.com/u/418233?v=3","gravatar_id":"","url":"https://api.github.com/users/gniezen","html_url":"https://github.com/gniezen","followers_url":"https://api.github.com/users/gniezen/followers","following_url":"https://api.github.com/users/gniezen/following{/other_user}","gists_url":"https://api.github.com/users/gniezen/gists{/gist_id}","starred_url":"https://api.github.com/users/gniezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gniezen/subscriptions","organizations_url":"https://api.github.com/users/gniezen/orgs","repos_url":"https://api.github.com/users/gniezen/repos","events_url":"https://api.github.com/users/gniezen/events{/privacy}","received_events_url":"https://api.github.com/users/gniezen/received_events","type":"User","site_admin":false},"body":"Nope, we're still trying to get 530G to upload successfully - so far only the 523 works (as it's the one I have access to).  CGM data will only be addressed in https://trello.com/c/vMtU8xk, which has not been prioritized yet.","created_at":"2016-10-25T12:45:40Z","updated_at":"2016-10-25T12:45:40Z","html_url":"https://github.com/tidepool-org/chrome-uploader/pull/333#discussion_r84893118","pull_request_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333","_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/comments/84893118"},"html":{"href":"https://github.com/tidepool-org/chrome-uploader/pull/333#discussion_r84893118"},"pull_request":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333"}}},"pull_request":{"url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333","id":88820592,"html_url":"https://github.com/tidepool-org/chrome-uploader/pull/333","diff_url":"https://github.com/tidepool-org/chrome-uploader/pull/333.diff","patch_url":"https://github.com/tidepool-org/chrome-uploader/pull/333.patch","issue_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/333","number":333,"state":"open","locked":false,"title":"Medtronic device events","user":{"login":"gniezen","id":418233,"avatar_url":"https://avatars.githubusercontent.com/u/418233?v=3","gravatar_id":"","url":"https://api.github.com/users/gniezen","html_url":"https://github.com/gniezen","followers_url":"https://api.github.com/users/gniezen/followers","following_url":"https://api.github.com/users/gniezen/following{/other_user}","gists_url":"https://api.github.com/users/gniezen/gists{/gist_id}","starred_url":"https://api.github.com/users/gniezen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gniezen/subscriptions","organizations_url":"https://api.github.com/users/gniezen/orgs","repos_url":"https://api.github.com/users/gniezen/repos","events_url":"https://api.github.com/users/gniezen/events{/privacy}","received_events_url":"https://api.github.com/users/gniezen/received_events","type":"User","site_admin":false},"body":"Adds support for:\r\n- alarms\r\n- prime events (cannula/tubing)\r\n- reservoir changes (rewind events)\r\n- status events\r\n- time change events\r\n\r\nFor more detail, see https://trello.com/c/6b5oFTZl\r\n\r\nNote: #328 should be merged first. This PR also includes the code to download the binary blob reviewed in #331.","created_at":"2016-10-11T12:10:16Z","updated_at":"2016-10-25T12:45:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7189ae8bab97c8fe6c7b9541598d3122b4a7c347","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333/commits","review_comments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333/comments","review_comment_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/333/comments","statuses_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/statuses/449ca08143477c4692e5865ad158f549923e2965","head":{"label":"tidepool-org:gniezen/medtronic-device-event","ref":"gniezen/medtronic-device-event","sha":"449ca08143477c4692e5865ad158f549923e2965","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":20790599,"name":"chrome-uploader","full_name":"tidepool-org/chrome-uploader","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/chrome-uploader","description":"A Chrome app for uploading diabetes device data to Tidepool's backend","fork":false,"url":"https://api.github.com/repos/tidepool-org/chrome-uploader","forks_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/forks","keys_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/teams","hooks_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/events","assignees_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/tags","blobs_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/subscription","commits_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/merges","archive_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/downloads","issues_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/releases{/id}","deployments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/deployments","created_at":"2014-06-13T03:12:49Z","updated_at":"2016-10-21T18:38:22Z","pushed_at":"2016-10-25T12:40:33Z","git_url":"git://github.com/tidepool-org/chrome-uploader.git","ssh_url":"git@github.com:tidepool-org/chrome-uploader.git","clone_url":"https://github.com/tidepool-org/chrome-uploader.git","svn_url":"https://github.com/tidepool-org/chrome-uploader","homepage":"","size":7170,"stargazers_count":25,"watchers_count":25,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":8,"forks":24,"open_issues":8,"watchers":25,"default_branch":"master"}},"base":{"label":"tidepool-org:gniezen/medtronic","ref":"gniezen/medtronic","sha":"10cd93cb4128b774f667440f2fde7f8783171cc2","user":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"repo":{"id":20790599,"name":"chrome-uploader","full_name":"tidepool-org/chrome-uploader","owner":{"login":"tidepool-org","id":4390820,"avatar_url":"https://avatars.githubusercontent.com/u/4390820?v=3","gravatar_id":"","url":"https://api.github.com/users/tidepool-org","html_url":"https://github.com/tidepool-org","followers_url":"https://api.github.com/users/tidepool-org/followers","following_url":"https://api.github.com/users/tidepool-org/following{/other_user}","gists_url":"https://api.github.com/users/tidepool-org/gists{/gist_id}","starred_url":"https://api.github.com/users/tidepool-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidepool-org/subscriptions","organizations_url":"https://api.github.com/users/tidepool-org/orgs","repos_url":"https://api.github.com/users/tidepool-org/repos","events_url":"https://api.github.com/users/tidepool-org/events{/privacy}","received_events_url":"https://api.github.com/users/tidepool-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidepool-org/chrome-uploader","description":"A Chrome app for uploading diabetes device data to Tidepool's backend","fork":false,"url":"https://api.github.com/repos/tidepool-org/chrome-uploader","forks_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/forks","keys_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/teams","hooks_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/hooks","issue_events_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/events{/number}","events_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/events","assignees_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/assignees{/user}","branches_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/branches{/branch}","tags_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/tags","blobs_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/statuses/{sha}","languages_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/languages","stargazers_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/stargazers","contributors_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/contributors","subscribers_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/subscribers","subscription_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/subscription","commits_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/contents/{+path}","compare_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/merges","archive_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/downloads","issues_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues{/number}","pulls_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls{/number}","milestones_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/milestones{/number}","notifications_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/labels{/name}","releases_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/releases{/id}","deployments_url":"https://api.github.com/repos/tidepool-org/chrome-uploader/deployments","created_at":"2014-06-13T03:12:49Z","updated_at":"2016-10-21T18:38:22Z","pushed_at":"2016-10-25T12:40:33Z","git_url":"git://github.com/tidepool-org/chrome-uploader.git","ssh_url":"git@github.com:tidepool-org/chrome-uploader.git","clone_url":"https://github.com/tidepool-org/chrome-uploader.git","svn_url":"https://github.com/tidepool-org/chrome-uploader","homepage":"","size":7170,"stargazers_count":25,"watchers_count":25,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":8,"forks":24,"open_issues":8,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333"},"html":{"href":"https://github.com/tidepool-org/chrome-uploader/pull/333"},"issue":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/333"},"comments":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/issues/333/comments"},"review_comments":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333/comments"},"review_comment":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/pulls/333/commits"},"statuses":{"href":"https://api.github.com/repos/tidepool-org/chrome-uploader/statuses/449ca08143477c4692e5865ad158f549923e2965"}}}}
{"actor":{"display_login":"gniezen"}}