Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dexcom_reader.constants.CrcError: Could not parse Calibration with Dexcom G4 connected to USB #16

Open
PieterGit opened this issue May 3, 2017 · 3 comments

Comments

@PieterGit
Copy link

PieterGit commented May 3, 2017

With current oref0@dev and Dexcom G4 connected to USB (CGM=G4-upload) I get the following stack trace.

$ cd ~/myopens-cgm-loop
$ openaps extras
cgm://JSON/nightscout_calibrations/monitor/cal.json
monitor/cal.json  raised  Could not parse Calibration
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 82, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps/cli/__init__.py", line 51, in __call__
    self.run(self.args)
  File "/usr/local/bin/openaps-report", line 75, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps/cli/subcommand.py", line 52, in __call__
    return self.method.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps/reports/invoke.py", line 40, in main
    output = task.method(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps/uses/use.py", line 45, in __call__
    output = self.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/dexcom.py", line 830, in main
    results = super(iter_calibrations, self).main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/dexcom.py", line 420, in main
    for item in candidates:
  File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 301, in iter_records
    records = list(self.ReadDatabasePage(record_type, x))
  File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 267, in GenericRecordYielder
    yield record_type.Create(data, x)
  File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 158, in Create
    return cls(unpacked_data, raw_data)
  File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 180, in __init__
    self.check_crc()
  File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 47, in check_crc
    raise constants.CrcError('Could not parse %s' % self.__class__.__name__)
dexcom_reader.constants.CrcError: Could not parse Calibration

This seems like a dexcom_reader issue. Reading the calibration records with a G4 Dexcom Reader with AndroidUploader app works fine, and the Dexcom G4 can also be read with Dexcom Studio fine. So I think there is a bug in the dexcom_reader logic but I'm incapable of finding the root cause.

@bewest or @LorelaiL or somebody else: Can you help me debug/fix this issue?

References which might be usefull:

@jbwittmer
Copy link

jbwittmer commented May 6, 2017

Getting same error with 3 receivers. I'll append the message and Firmware info for each.

Here's the first (oldest):

pi@Raspi3:/myopenaps-cgm-loop $ openaps use cgm GetFirmwareHeader
{
"DexBootVersion": "3",
"RFVersion": "1.0.0.27",
"ApiVersion": "2.3.0.0",
"ProductName": "Dexcom G4 Receiver",
"SoftwareNumber": "SW10557",
"TestApiVersion": "2.4.0.0",
"SchemaVersion": "1",
"PortVersion": "4.6.4.50",
"FirmwareVersion": "2.0.1.192",
"ProductId": "G4Receiver"
}pi@Raspi3:
/myopenaps-cgm-loop $

]pi@Raspi3:/myopenaps-cgm-loop $ openaps use cgm calibrations
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 63, in
app( )
File "/usr/local/lib/python2.7/dist-packages/openaps/cli/init.py", line 51, in call
self.run(self.args)
File "/usr/local/bin/openaps-use", line 57, in run
output = app(args, self)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/init.py", line 92, in call
return self.method.selected(args)(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/use.py", line 45, in call
output = self.main(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/dexcom.py", line 275, in main
records = self.dexcom.ReadRecords(self.RECORD_TYPE)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 314, in ReadRecords
records.extend(self.ReadDatabasePage(record_type, x))
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 267, in GenericRecordYielder
yield record_type.Create(data, x)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 158, in Create
return cls(unpacked_data, raw_data)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 180, in init
self.check_crc()
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 47, in check_crc
raise constants.CrcError('Could not parse %s' % self.class.name)
dexcom_reader.constants.CrcError: Could not parse Calibration
pi@Raspi3:
/myopenaps-cgm-loop $

@jbwittmer
Copy link

The second receiver gives similar output. Here's the firmware header message:
$ openaps use cgm GetFirmwareHeader
{
"DexBootVersion": "3",
"RFVersion": "1.0.0.27",
"ApiVersion": "2.3.0.0",
"ProductName": "Dexcom G4 Receiver",
"SoftwareNumber": "SW10557",
"TestApiVersion": "2.4.0.0",
"SchemaVersion": "1",
"PortVersion": "4.6.4.50",
"FirmwareVersion": "2.0.1.192",
"ProductId": "G4Receiver"
}pi@Raspi3:~/myope

And here's the output from use cgm calibrations:

pi@Raspi3:~/myopenaps-cgm-loop $ openaps use cgm calibrations
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 63, in
app( )
File "/usr/local/lib/python2.7/dist-packages/openaps/cli/init.py", line 51, in call
self.run(self.args)
File "/usr/local/bin/openaps-use", line 57, in run
output = app(args, self)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/init.py", line 92, in call
return self.method.selected(args)(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/uses/use.py", line 45, in call
output = self.main(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps/vendors/dexcom.py", line 275, in main
records = self.dexcom.ReadRecords(self.RECORD_TYPE)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 314, in ReadRecords
records.extend(self.ReadDatabasePage(record_type, x))
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/readdata.py", line 267, in GenericRecordYielder
yield record_type.Create(data, x)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 158, in Create
return cls(unpacked_data, raw_data)
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 180, in init
self.check_crc()
File "/usr/local/lib/python2.7/dist-packages/dexcom_reader/database_records.py", line 47, in check_crc
raise constants.CrcError('Could not parse %s' % self.class.name)
dexcom_reader.constants.CrcError: Could not parse Calibration
pi@Raspi3:

@PieterGit
Copy link
Author

I think it's ApiVersion 2.3.0.0 related. Here is my info:

# openaps use cgm GetFirmwareHeader
{
  "DexBootVersion": "6",
  "RFVersion": "1.0.0.28",
  "ApiVersion": "2.3.0.0",
  "ProductName": "Dexcom G4 Receiver",
  "SoftwareNumber": "SW10324",
  "TestApiVersion": "2.4.0.0",
  "SchemaVersion": "1",
  "PortVersion": "4.6.4.60",
  "FirmwareVersion": "2.0.1.216",
  "ProductId": "G4Receiver"
}

@danamlewis (or others): Could you post your firmware / api version for which calibrations work fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants