unabsorbedinsulin: variable size record
Closed this issue · 1 comments
bewest commented
UnabsorbedInsulin
The head is two bytes, there is no date/time, making it a unique record.
Given a record header of 0x5c 0x08
, the total record length is 8
, and there are 6
bytes in the body:
# two byte header
#8 byte record size
bytearray([ 0x5c, 0x08,
# means body of 6 bytes
0x32, 0x4e, 0x04,
0x26, 0x58, 0x04, ])
Each unabsorbed record is a 3 byte record encoding the amount
, age
, and curve
.
The amount
needs to be divided by the pump model's strokes per unit in order to determine the number of units of insulin.
In the above example, since there are 6 bytes in the body, we know that there are 2 records:
>>> print pformat(rec.parse( UnabsorbedInsulinBolus._test_1 ))
[{'age': 78, 'amount': 1.25, 'curve': 4},
{'age': 88, 'amount': 0.95, 'curve': 4}]
The body should always be a multiple of three bytes, thus the record size in general will always be the 2 byte header + some multiple of 3.
bewest commented
Closing this for now.