pazaan / 600SeriesAndroidUploader

Your Medtronic 600-series pump data, direct to Nightscout
http://pazaan.github.io/600SeriesAndroidUploader/
MIT License
189 stars 312 forks source link

ISO 8601 dateString formatting for uploaded BGs #241

Closed cluckj closed 5 years ago

cluckj commented 5 years ago

Your Environment

Latest (v0.6.1)

Brief Explanation of Issue

dateString field in BG upload to Nightscout has a non-ISO 8601 format, producing errors when used in conjunction with OpenAPS.

Uploader Error Code

(None)

Steps to Reproduce (for bugs)

  1. Use 600SeriesAndroidUploader to upload only BG readings from 6xx pump with sensor to Nightscout
  2. Download entries to OpenAPS rig
  3. Use/rezoning of the non-standard dateString results in a timeshift of BG entries into the future.
  4. COB is not properly calculated or decayed.

Severity Score

4 (for users of OpenAPS)

sulkaharo commented 5 years ago

@clucki can you prove a sample of the data?

sulkaharo commented 5 years ago

Afaik the ISO 8601 Extended notation date time with time zone should work the best for the format

cluckj commented 5 years ago

Retrieved from /api/v1/entries/sgv (uploader is in CET):

"Wed Feb 20 17:02:14 GMT+01:00 2019"    1550678534083    198    "Flat"    
"Wed Feb 20 16:57:14 GMT+01:00 2019"    1550678234319    193    "Flat"    
"Wed Feb 20 16:52:14 GMT+01:00 2019"    1550677934535    184    "Flat"    
"Wed Feb 20 16:47:14 GMT+01:00 2019"    1550677634727    180    "Flat"    
"Wed Feb 20 16:42:14 GMT+01:00 2019"    1550677334955    180    "Flat"    
"Wed Feb 20 16:37:14 GMT+01:00 2019"    1550677034177    177    "Flat"    
"Wed Feb 20 16:32:14 GMT+01:00 2019"    1550676734373    175    "Flat"    
"Wed Feb 20 16:27:14 GMT+01:00 2019"    1550676434607    172    "Flat"    
"Wed Feb 20 16:22:14 GMT+01:00 2019"    1550676134792    171    "Flat"    
"Wed Feb 20 16:17:15 GMT+01:00 2019"    1550675835020    168    "Flat"

Same dataset, pulled via nightscout ns $NIGHTSCOUT_HOST $API_SECRET oref0_glucose_since -1hour (this rig is in EST; uploader's rig is in CET and has the same issue)

[
  {
    "direction": "Flat",
    "dateString": "2019-02-20T13:02:14-05:00",
    "sgv": 198,
    "key600": "CGM8002E722",
    "date": 1550678534083,
    "_id": "5c6d7a3854d39500649984b8",
    "type": "sgv",
    "glucose": 198
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:57:14-05:00",
    "sgv": 193,
    "key600": "CGM8002E5F6",
    "date": 1550678234319,
    "_id": "5c6d791054d3950064996b06",
    "type": "sgv",
    "glucose": 193
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:52:14-05:00",
    "sgv": 184,
    "key600": "CGM8002E4CA",
    "date": 1550677934535,
    "_id": "5c6d77df54d39500649950b7",
    "type": "sgv",
    "glucose": 184
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:47:14-05:00",
    "sgv": 180,
    "key600": "CGM8002E39E",
    "date": 1550677634727,
    "_id": "5c6d76c854d395006499385c",
    "type": "sgv",
    "glucose": 180
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:42:14-05:00",
    "sgv": 180,
    "key600": "CGM8002E272",
    "date": 1550677334955,
    "_id": "5c6d758954d3950064991bfa",
    "type": "sgv",
    "glucose": 180
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:37:14-05:00",
    "sgv": 177,
    "key600": "CGM8002E146",
    "date": 1550677034177,
    "_id": "5c6d745b54d39500649901ee",
    "type": "sgv",
    "glucose": 177
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:32:14-05:00",
    "sgv": 175,
    "key600": "CGM8002E01A",
    "date": 1550676734373,
    "_id": "5c6d733054d395006498e793",
    "type": "sgv",
    "glucose": 175
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:27:14-05:00",
    "sgv": 172,
    "key600": "CGM8002DEEE",
    "date": 1550676434607,
    "_id": "5c6d720354d395006498cd13",
    "type": "sgv",
    "glucose": 172
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:22:14-05:00",
    "sgv": 171,
    "key600": "CGM8002DDC2",
    "date": 1550676134792,
    "_id": "5c6d70d754d395006498b250",
    "type": "sgv",
    "glucose": 171
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:17:15-05:00",
    "sgv": 168,
    "key600": "CGM8002DC96",
    "date": 1550675835020,
    "_id": "5c6d6fac54d39500649897bf",
    "type": "sgv",
    "glucose": 168
  },
  {
    "direction": "Flat",
    "dateString": "2019-02-20T12:12:14-05:00",
    "sgv": 164,
    "key600": "CGM8002DB6A",
    "date": 1550675534249,
    "_id": "5c6d6e8554d395006498769c",
    "type": "sgv",
    "glucose": 164
  }
]
Pogman commented 5 years ago

The v0.6.1 of the uploader does comply with the ISO 8601 standard according the the wiki page on it.

This has been changed to just utc zulu for for the next version...

{
    "_id": {
        "$oid": "5c6da7bd802e52246333ffd6"
    },
    "date": 1550690207612,
    "dateString": "2019-02-20T19:16:47Z",
    "device": "medtronic-600://6213-1077510",
    "direction": "Flat",
    "key600": "CGM85D075CA",
    "pumpMAC600": "0023F745EE10372C",
    "sgv": 114,
    "type": "sgv"
}
Pogman commented 5 years ago

It might be wise to stress a precise and narrow date format on the NS dev guide as ISO 8601 covers quite a wide layout.

Pogman commented 5 years ago

edit: looking at the old code for 0.6.1 the sgv entry just had a readable string format in dateString and the timestamp. Anyhow it's all utc/zulu accross the board going forward.

Pogman commented 5 years ago

Closed - completed and available in 0.7.0 release

sulkaharo commented 5 years ago

😍