diff options
-rw-r--r-- | glucometerutils/common.py | 7 | ||||
-rw-r--r-- | glucometerutils/drivers/otultra2.py | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/glucometerutils/common.py b/glucometerutils/common.py index a9968c2..32402a6 100644 --- a/glucometerutils/common.py +++ b/glucometerutils/common.py @@ -16,6 +16,11 @@ UNIT_MMOLL = 'mmol/L' VALID_UNITS = [UNIT_MGDL, UNIT_MMOLL] +# Constants for meal information +NO_MEAL = '' +BEFORE_MEAL = 'Before Meal' +AFTER_MEAL = 'After Meal' + # Constants for date format DATETIME_12HR = '12 hours' DATETIME_24HR = '24 hours' @@ -54,7 +59,7 @@ _ReadingBase = collections.namedtuple( '_ReadingBase', ['timestamp', 'value', 'meal', 'comment']) class Reading(_ReadingBase): - def __new__(cls, timestamp, value, meal='', comment=''): + def __new__(cls, timestamp, value, meal=NO_MEAL, comment=''): """Constructor for the reading object. Args: diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py index f44450a..b72c4eb 100644 --- a/glucometerutils/drivers/otultra2.py +++ b/glucometerutils/drivers/otultra2.py @@ -17,9 +17,9 @@ from glucometerutils.drivers import lifescan_common # The following two hashes are taken directly from LifeScan's documentation _MEAL_CODES = { - 'N': '', - 'B': 'Before Meal', - 'A': 'After Meal', + 'N': common.NO_MEAL, + 'B': common.BEFORE_MEAL, + 'A': common.AFTER_MEAL, } _COMMENT_CODES = { |