dexcom_reader
dexcom_reader copied to clipboard
dexcom_reader.constants.CrcError: Could not parse Calibration with Dexcom G4 connected to USB
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:
- https://github.com/nightscout/android-uploader/blob/master/core/src/main/java/com/nightscout/core/dexcom/records/CalRecord.java
- https://github.com/openaps/dexcom_reader/blob/master/dexcom_reader/database_records.py
- commit of cal_set https://github.com/openaps/dexcom_reader/commit/cf10d70fe0c724286d6e84c869d63eefd077e331
- https://github.com/nightscout/android-uploader/blob/master/core/src/test/java/com/nightscout/core/dexcom/CalRecordTest.java
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
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
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?