{"action":"created","issue":{"url":"https://api.github.com/repos/openaps/oref0/issues/1047","repository_url":"https://api.github.com/repos/openaps/oref0","labels_url":"https://api.github.com/repos/openaps/oref0/issues/1047/labels{/name}","comments_url":"https://api.github.com/repos/openaps/oref0/issues/1047/comments","events_url":"https://api.github.com/repos/openaps/oref0/issues/1047/events","html_url":"https://github.com/openaps/oref0/issues/1047","id":335815895,"node_id":"MDU6SXNzdWUzMzU4MTU4OTU=","number":1047,"title":"Autotune: support AndroidAPS data format from NS","user":{"login":"scottleibrand","id":6982790,"node_id":"MDQ6VXNlcjY5ODI3OTA=","avatar_url":"https://avatars1.githubusercontent.com/u/6982790?v=4","gravatar_id":"","url":"https://api.github.com/users/scottleibrand","html_url":"https://github.com/scottleibrand","followers_url":"https://api.github.com/users/scottleibrand/followers","following_url":"https://api.github.com/users/scottleibrand/following{/other_user}","gists_url":"https://api.github.com/users/scottleibrand/gists{/gist_id}","starred_url":"https://api.github.com/users/scottleibrand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottleibrand/subscriptions","organizations_url":"https://api.github.com/users/scottleibrand/orgs","repos_url":"https://api.github.com/users/scottleibrand/repos","events_url":"https://api.github.com/users/scottleibrand/events{/privacy}","received_events_url":"https://api.github.com/users/scottleibrand/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-26T13:19:36Z","updated_at":"2018-07-09T21:04:22Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Currently autotune does not recognize AndroidAPS temp basal records or bolus records from NS.  Some examples are below.\r\n\r\nI don't think there's enough information in the percent temp basal records to run autotune: we need some way to tell for sure what the neutral basal was at the time that each temp basal was recorded. I don't think that exists in the treatments collection, and I'm not sure how we'd infer it from profile switch records that might not even occur on the same day...\r\n\r\n```\r\n  {\r\n    \"_id\": \"5af5d81311c3561028ad2cb9\",\r\n    \"eventType\": \"Temp Basal\",\r\n    \"duration\": 30,\r\n    \"percent\": -100,\r\n    \"pumpId\": \"redacted\",\r\n    \"created_at\": \"2018-05-11T17:50:49Z\",\r\n    \"enteredBy\": \"openaps://AndroidAPS\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null,\r\n    \"insulin\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5d6fe11c3561028ad2cb5\",\r\n    \"eventType\": \"Temp Basal\",\r\n    \"created_at\": \"2018-05-11T17:45:53Z\",\r\n    \"enteredBy\": \"openaps://AndroidAPS\",\r\n    \"pumpId\": \"redacted\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null,\r\n    \"insulin\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5ca1111c3561028ad2c99\",\r\n    \"eventType\": \"Bolus Wizard\",\r\n    \"insulin\": 0.95,\r\n    \"created_at\": \"2018-05-11T16:51:16Z\",\r\n    \"date\": 1526057476000,\r\n    \"isSMB\": false,\r\n    \"pumpId\": \"redacted\",\r\n    \"glucose\": 7.5,\r\n    \"glucoseType\": \"Manual\",\r\n    \"boluscalc\": {\r\n      \"profile\": \"<\"redacted\">\",\r\n      \"eventTime\": \"2018-05-11T16:50:51Z\",\r\n      \"targetBGLow\": 5.5,\r\n      \"targetBGHigh\": 5.5,\r\n      \"isf\": 10,\r\n      \"ic\": 24,\r\n      \"iob\": 0.30700000000000005,\r\n      \"bolusiobused\": true,\r\n      \"basaliobused\": true,\r\n      \"bg\": 7.5,\r\n      \"insulinbg\": 0.2,\r\n      \"insulinbgused\": true,\r\n      \"bgdiff\": 2,\r\n      \"insulincarbs\": 1,\r\n      \"carbs\": 24,\r\n      \"cob\": 0,\r\n      \"insulincob\": 0,\r\n      \"othercorrection\": 0.2,\r\n      \"insulinsuperbolus\": 0,\r\n      \"insulintrend\": -0.124,\r\n      \"insulin\": 0.9500000000000001\r\n    },\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5ca3211c3561028ad2c9a\",\r\n    \"eventType\": \"Meal Bolus\",\r\n    \"carbs\": 24,\r\n    \"created_at\": \"2018-05-11T16:51:06Z\",\r\n    \"date\": 1526057466000,\r\n    \"isSMB\": false,\r\n    \"pumpId\": \"redacted\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"insulin\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5c56211c3561028ad2c89\",\r\n    \"eventType\": \"Temp Basal\",\r\n    \"duration\": 15,\r\n    \"percent\": 30,\r\n    \"pumpId\": \"redacted\",\r\n    \"created_at\": \"2018-05-11T16:30:52Z\",\r\n    \"enteredBy\": \"openaps://AndroidAPS\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null,\r\n    \"insulin\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5c1c711c3561028ad2c80\",\r\n    \"eventType\": \"Correction Bolus\",\r\n    \"insulin\": 0.1,\r\n    \"created_at\": \"2018-05-11T16:15:54Z\",\r\n    \"date\": 1526055354000,\r\n    \"isSMB\": true,\r\n    \"pumpId\": \"redacted\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5c1c711c3561028ad2c7f\",\r\n    \"eventType\": \"Temp Basal\",\r\n    \"duration\": 30,\r\n    \"percent\": -90,\r\n    \"pumpId\": \"redacted\",\r\n    \"created_at\": \"2018-05-11T16:15:51Z\",\r\n    \"enteredBy\": \"openaps://AndroidAPS\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null,\r\n    \"insulin\": null\r\n  },\r\n  {\r\n    \"_id\": \"5af5c0a311c3561028ad2c7a\",\r\n    \"eventType\": \"Temp Basal\",\r\n    \"duration\": 15,\r\n    \"percent\": 120,\r\n    \"pumpId\": \"redacted\",\r\n    \"created_at\": \"2018-05-11T16:11:00Z\",\r\n    \"enteredBy\": \"openaps://AndroidAPS\",\r\n    \"NSCLIENT_ID\": \"redacted\",\r\n    \"carbs\": null,\r\n    \"insulin\": null\r\n  },\r\n```"},"comment":{"url":"https://api.github.com/repos/openaps/oref0/issues/comments/403619898","html_url":"https://github.com/openaps/oref0/issues/1047#issuecomment-403619898","issue_url":"https://api.github.com/repos/openaps/oref0/issues/1047","id":403619898,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzYxOTg5OA==","user":{"login":"philipgo","id":29184757,"node_id":"MDQ6VXNlcjI5MTg0NzU3","avatar_url":"https://avatars3.githubusercontent.com/u/29184757?v=4","gravatar_id":"","url":"https://api.github.com/users/philipgo","html_url":"https://github.com/philipgo","followers_url":"https://api.github.com/users/philipgo/followers","following_url":"https://api.github.com/users/philipgo/following{/other_user}","gists_url":"https://api.github.com/users/philipgo/gists{/gist_id}","starred_url":"https://api.github.com/users/philipgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipgo/subscriptions","organizations_url":"https://api.github.com/users/philipgo/orgs","repos_url":"https://api.github.com/users/philipgo/repos","events_url":"https://api.github.com/users/philipgo/events{/privacy}","received_events_url":"https://api.github.com/users/philipgo/received_events","type":"User","site_admin":false},"created_at":"2018-07-09T21:04:22Z","updated_at":"2018-07-09T21:04:22Z","author_association":"CONTRIBUTOR","body":"Our AndroidAPS entries look different and contain an absolute basal value (What causes the difference? @MilosKozak ). I think the only change necessary in order to make Autotune process AAPS entries would be to accept the term \"absolute\" in addition to \"rate\" in the [IOB calculation from temp basals](https://github.com/openaps/oref0/blob/66c610afa64bb249d215122a1732391c771ce7a1/lib/iob/index.js#L48)\r\n\r\nAndroidAPS temp basal entry:\r\n```\r\n{ \r\n    \"_id\" : ObjectId(\"5a62aa948985f800113082a2\"), \r\n    \"eventType\" : \"Temp Basal\", \r\n    \"duration\" : NumberInt(15), \r\n    \"absolute\" : 0.48400000000000004, \r\n    \"created_at\" : \"2018-01-20T02:33:56Z\", \r\n    \"enteredBy\" : \"openaps://AndroidAPS\", \r\n    \"NSCLIENT_ID\" : 12345678.0\r\n}\r\n``` \r\nOpenAPS temp basal entry\r\n```\r\n{ \r\n    \"_id\" : ObjectId(\"5b439d146d3c1ce2083cec12\"), \r\n    \"duration\" : NumberInt(30), \r\n    \"raw_duration\" : {\r\n        \"_type\" : \"TempBasalDuration\", \r\n        \"_description\" : \"TempBasalDuration 2018-07-09T19:34:37 head[2], body[0] op[0x16]\", \r\n        \"timestamp\" : \"2018-07-09T19:34:37+02:00\", \r\n        \"_body\" : \"\", \r\n        \"_head\" : \"1601\", \r\n        \"duration (min)\" : NumberInt(30), \r\n        \"_date\" : \"65e2134912\"\r\n    }, \r\n    \"timestamp\" : \"2018-07-09T19:34:37+02:00\", \r\n    \"absolute\" : 0.35, \r\n    \"rate\" : 0.35, \r\n    \"raw_rate\" : {\r\n        \"_type\" : \"TempBasal\", \r\n        \"temp\" : \"absolute\", \r\n        \"_description\" : \"TempBasal 2018-07-09T19:34:37 head[2], body[1] op[0x33]\", \r\n        \"timestamp\" : \"2018-07-09T19:34:37+02:00\", \r\n        \"_body\" : \"00\", \r\n        \"_head\" : \"330e\", \r\n        \"rate\" : 0.35, \r\n        \"_date\" : \"65e2134912\"\r\n    }, \r\n    \"eventType\" : \"Temp Basal\", \r\n    \"medtronic\" : \"mm://openaps/mm-format-ns-treatments/Temp Basal\", \r\n    \"created_at\" : \"2018-07-09T19:34:37+02:00\", \r\n    \"enteredBy\" : \"openaps://medtronic/722\"\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"philipgo"}}