bewest / decoding-carelink

python serial driver for mm comlink2 protocol
http://bewest.github.io/decoding-carelink
Other
71 stars 52 forks source link

Glucose data decoding issue #121

Open loudnate opened 9 years ago

loudnate commented 9 years ago

Reminder to look into this when I get back from vacation.

$ atomicaps use pump read_glucose_data 0
Traceback (most recent call last):
  File "/usr/local/bin/openaps-use", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/src/openaps/bin/openaps-use", line 63, in <module>
    app( )
  File "/root/src/openaps/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/root/src/openaps/bin/openaps-use", line 57, in run
    output = app(args, self)
  File "/root/src/openaps/openaps/uses/__init__.py", line 92, in __call__
    return self.method.selected(args)(args, app)
  File "/root/src/openaps/openaps/uses/__init__.py", line 31, in __call__
    return self.method(args, app)
  File "/root/src/openaps/openaps/uses/use.py", line 26, in __call__
    output = self.main(args, app)
  File "/root/src/openaps/openaps/vendors/medtronic.py", line 199, in main
    return getattr(self.pump.model, name)(**self.get_params(args))
  File "/root/src/decoding-carelink/decocare/models/__init__.py", line 23, in __call__
    return types.MethodType(self.func, inst)(self.response)
  File "/root/src/decoding-carelink/decocare/models/__init__.py", line 148, in read_glucose_data
    page = cgm.PagedData.Data(response.data, larger=self.larger)
  File "/root/src/decoding-carelink/decocare/cgm/__init__.py", line 83, in Data
    return klass(stream, **kwds)
  File "/root/src/decoding-carelink/decocare/cgm/__init__.py", line 89, in __init__
    if lib.BangInt(crc) != computed:
  File "/root/src/decoding-carelink/decocare/lib.py", line 235, in BangInt
    ( x, y ) = ints
ValueError: need more than 0 values to unpack

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/25215692-glucose-data-decoding-issue?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github).
loudnate commented 9 years ago

This appears to happen when the glucose data page is filled, but no glucose data has been written to the next one. There are no "trailing bytes" of data after it stops, but querying the next page results in an error for a few hours.

loudnate commented 9 years ago

From the CSV:

860,7/31/15,05:35:00,7/31/15 05:35:00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,SensorTimestamp,TIMESTAMP_TYPE=page_end,15311539684,53974585,3376,Paradigm Revel - 723