decocare Package

decocare Package

decocare - a pure python module for serial communication with insulin pumps.

This module implements the communication protocol necessary to audit or command MM insulin pumps. Tested with 515, and 522.

See:

errors Module

exception decocare.errors.AckError[source]

Bases: decocare.errors.StickError

exception decocare.errors.BadDeviceCommError[source]

Bases: decocare.errors.AckError

exception decocare.errors.StickError[source]

Bases: exceptions.Exception

tests Module

class decocare.records.tests.BW722(head, larger=False)[source]

Bases: decocare.records.bolus.BolusWizard

decode()[source]
class decocare.records.tests.TestSaraBolus[source]
bolus_1_ok = {'bg': 103, 'bg_target_low': 100, 'sensitivity': 60, 'bg_target_high': 120, 'unabsorbed_insulin_total': 0.5, 'correction_estimate': 0, 'unabsorbed_insulin_count': 2, 'carb_ratio': 12, 'food_estimate': 1, 'carb_input': 13, 'bolus_estimate': 1}
bw_1_bytes = bytearray(b'[g\xa1Q\x0e\x04\r\rP\x00x<d\x00\x00(\x00\x00\x14\x00(x')
bw_2_bytes = bytearray(b'[\xfc\xb7T\x0f\x04\r\x00P\x00x<dX\x00\x00\x00\x00\x1c\x00<x')
cal_bg_bytes = bytearray(b'\n\xfc\xb4T/\x04\r')
csv_breakdown = '\n 9/4/13 14:17:33,,,,,,,Normal,1.0,1.0,,,,,,,,,,,,,,,,,,,,,BolusNormal\n "AMOUNT=1\n CONCENTRATION=null\n PROGRAMMED_AMOUNT=1\n ACTION_REQUESTOR=pump\n ENABLE=true\n IS_DUAL_COMPONENT=false\n UNABSORBED_INSULIN_TOTAL=0.5"\n 11345487207,52554138,86,Paradigm Revel - 723\n\n 9/4/13 14:17:33,,,,,,,,,,,,,,,1.0,120,100,12,60,13,103,0,1,0.5,,,,,,BolusWizardBolusEstimate,"BG_INPUT=103\n BG_UNITS=mg dl\n CARB_INPUT=13\n CARB_UNITS=grams\n CARB_RATIO=12\n INSULIN_SENSITIVITY=60\n BG_TARGET_LOW=100\n BG_TARGET_HIGH=120\n BOLUS_ESTIMATE=1\n CORRECTION_ESTIMATE=0\n FOOD_ESTIMATE=1\n UNABSORBED_INSULIN_TOTAL=0.5\n UNABSORBED_INSULIN_COUNT=2\n ACTION_REQUESTOR=pump"\n 11345487208,52554138,87,Paradigm Revel - 723\n\n 9/4/13 14:17:33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UnabsorbedInsulin,"BOLUS_ESTIMATE_DATUM=11345487208\n INDEX=0\n AMOUNT=1.7\n RECORD_AGE=121\n INSULIN_TYPE=null\n INSULIN_ACTION_CURVE=180"\n 11345487209,52554138,88,Paradigm Revel - 723\n\n 9/4/13 14:17:33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UnabsorbedInsulin,"BOLUS_ESTIMATE_DATUM=11345487208\n INDEX=1\n AMOUNT=1.5\n RECORD_AGE=331\n INSULIN_TYPE=null\n INSULIN_ACTION_CURVE=180"\n 11345487210,52554138,89,Paradigm Revel - 723\n\n 9/4/13 15:20:52,,,,,,,,,,,,,,,,,,,,,,,,,,252,,,,CalBGForPH,"AMOUNT=252, ACTION_REQUESTOR=pump"\n 11345487206,52554138,85,Paradigm Revel - 723\n\n 9/4/13 15:20:55,,,,,,,Normal,1.5,1.5,,,,,,,,,,,,,,,,,,,,,BolusNormal,"AMOUNT=1.5\n CONCENTRATION=null\n PROGRAMMED_AMOUNT=1.5\n ACTION_REQUESTOR=pump\n ENABLE=true\n IS_DUAL_COMPONENT=false\n UNABSORBED_INSULIN_TOTAL=0.7"\n 11345487201,52554138,80,Paradigm Revel - 723\n\n 9/4/13 15:20:55,,,,,,,,,,,,,,,1.5,120,100,12,60,0,252,2.2,0,0.7,,,,,,BolusWizardBolusEstimate,"BG_INPUT=252\n BG_UNITS=mg dl\n CARB_INPUT=0\n CARB_UNITS=grams\n CARB_RATIO=12\n INSULIN_SENSITIVITY=60\n BG_TARGET_LOW=100\n BG_TARGET_HIGH=120\n BOLUS_ESTIMATE=1.5\n CORRECTION_ESTIMATE=2.2\n FOOD_ESTIMATE=0\n UNABSORBED_INSULIN_TOTAL=0.7\n UNABSORBED_INSULIN_COUNT=3\n ACTION_REQUESTOR=pump"\n 11345487202,52554138,81,Paradigm Revel - 723\n\n 9/4/13 15:20:55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UnabsorbedInsulin,"BOLUS_ESTIMATE_DATUM=11345487202\n INDEX=0\n AMOUNT=1\n RECORD_AGE=64\n INSULIN_TYPE=null\n INSULIN_ACTION_CURVE=180"\n 11345487203,52554138,82,Paradigm Revel - 723\n\n 9/4/13 15:20:55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UnabsorbedInsulin,"BOLUS_ESTIMATE_DATUM=11345487202\n INDEX=1\n AMOUNT=1.7\n RECORD_AGE=184\n INSULIN_TYPE=null\n INSULIN_ACTION_CURVE=180"\n 11345487204,52554138,83,Paradigm Revel - 723\n\n 9/4/13 15:20:55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UnabsorbedInsulin,"BOLUS_ESTIMATE_DATUM=11345487202\n INDEX=2\n AMOUNT=1.5\n RECORD_AGE=394\n INSULIN_TYPE=null\n INSULIN_ACTION_CURVE=180"\n 11345487205,52554138,84,Paradigm Revel - 723\n 9/4/13 16:11:57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,CurrentSensorMissedDataTime,TIME=1800000,11345487185,52554138,64,Paradigm Revel - 723\n '
hexdump = '\n 5b 67\n a1 51 0e 04 0d\n 0d 50 00 78\n 3c 64 00 00 28 00 00 14 00 28 78\n 5c 08 44 79 c0 3c 4b d0\n 01 00 28 00 28 00 14 00\n a1 51 4e 04 0d\n 0a fc\n b4 54 2f 04 0d\n 5b fc\n b7 54 0f 04 0d\n 00 50 00 78\n 3c 64 58 00 00 00 00 1c 00 3c 78\n 5c 0b 28 40 c0 44 b8 c0 3c 8a d0\n 01 00 3c 00 3c 00 1c 00\n b7 54 4f 04 0d\n '
classmethod test_cal_bg(klass)[source]
>>> TestSaraBolus.test_cal_bg( )
CalBGForPH 2013-09-04T15:20:52 head[2], body[0] op[0x0a]
{
  "amount": 252
}
decocare.records.tests.big_days(x=0)[source]

# page 17, RECORD 11 >>> parse_date( big_days(0) ).isoformat( ) ‘2012-11-20T21:53:41’

# page 17, ~ RECORD 12 >>> parse_date( big_days(1) ).isoformat( ) ‘2012-11-20T22:07:38’

>>> parse_date( big_days(2) ).isoformat( )
'2012-11-20T21:53:41'
>>> parse_date( big_days(3) ).isoformat( )
'2012-11-20T22:07:38'

# page 16, RECORD ~15 >>> parse_date( big_days(4) ).isoformat( ) ‘2012-11-25T16:41:34’

>>> parse_date( big_days(5) ).isoformat( )
'2012-11-25T13:54:32'

# page 15 >>> parse_date( big_days(6) ).isoformat( ) ‘2012-11-29T20:25:37’

# page 0 >>> parse_date( big_days(7) ).isoformat( ) ‘2012-12-20T14:59:02’

>>> parse_date( big_days(8) ).isoformat( )
'2012-12-20T15:28:25'
decocare.records.tests.decode_wizard(data)[source]

BYTE 01: 02: 03: 04: 05: 06: 07: 08: 09: 10: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:

decocare.records.tests.dictlines(d)[source]
decocare.records.tests.unsolved_bolus_wizard()[source]

# >>> unsolved_bolus_wizard( )

Table Of Contents

Previous topic

decocare

This Page