summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Martin <s.martin49@gmail.com>2017-09-23 10:16:44 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-09-25 16:12:06 +0200
commit043dcbf08f547d1b51c20177ccc69634081b852b (patch)
tree94bb0bdd51fdb3940eab6781fa1fb468dd02101b
parentglucometer.py: restrict sorting choices to the common reading fields (diff)
downloadglucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar.gz
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar.bz2
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar.lz
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar.xz
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.tar.zst
glucometerutils-043dcbf08f547d1b51c20177ccc69634081b852b.zip
-rw-r--r--glucometerutils/common.py4
-rw-r--r--glucometerutils/drivers/accuchek_reports.py2
-rw-r--r--glucometerutils/drivers/fsinsulinx.py2
-rw-r--r--glucometerutils/drivers/fslibre.py4
-rw-r--r--glucometerutils/drivers/fsoptium.py2
-rw-r--r--glucometerutils/drivers/fsprecisionneo.py2
-rw-r--r--glucometerutils/drivers/otultra2.py2
-rw-r--r--glucometerutils/drivers/otultraeasy.py2
-rw-r--r--glucometerutils/drivers/otverio2015.py2
-rw-r--r--glucometerutils/drivers/sdcodefree.py2
10 files changed, 12 insertions, 12 deletions
diff --git a/glucometerutils/common.py b/glucometerutils/common.py
index 0fcda80..dae8c8c 100644
--- a/glucometerutils/common.py
+++ b/glucometerutils/common.py
@@ -59,10 +59,10 @@ def convert_glucose_unit(value, from_unit, to_unit=None):
_ReadingBase = collections.namedtuple(
'_ReadingBase', ['timestamp', 'value', 'meal', 'comment', 'measure_method'])
-class Reading(_ReadingBase):
- """Constructor for the reading object.
+class GlucoseReading(_ReadingBase):
def __new__(cls, timestamp, value, meal=NO_MEAL, comment='',
measure_method=BLOOD_SAMPLE):
+ """Constructor for the glucose reading object.
Args:
timestamp: (datetime) Timestamp of the reading as reported by the meter.
diff --git a/glucometerutils/drivers/accuchek_reports.py b/glucometerutils/drivers/accuchek_reports.py
index 6b69214..2ae41ba 100644
--- a/glucometerutils/drivers/accuchek_reports.py
+++ b/glucometerutils/drivers/accuchek_reports.py
@@ -128,7 +128,7 @@ class Device(object):
if record[_RESULT_CSV_KEY] is None:
continue
- yield common.Reading(
+ yield common.GlucoseReading(
self._extract_datetime(record),
common.convert_glucose_unit(float(record[_RESULT_CSV_KEY]),
_UNIT_MAP[record[_UNIT_CSV_KEY]]),
diff --git a/glucometerutils/drivers/fsinsulinx.py b/glucometerutils/drivers/fsinsulinx.py
index 2d3cf2c..90abc7e 100644
--- a/glucometerutils/drivers/fsinsulinx.py
+++ b/glucometerutils/drivers/fsinsulinx.py
@@ -73,4 +73,4 @@ class Device(freestyle.FreeStyleHidDevice):
raw_reading.year + 2000, raw_reading.month, raw_reading.day,
raw_reading.hour, raw_reading.minute)
- yield common.Reading(timestamp, raw_reading.value)
+ yield common.GlucoseReading(timestamp, raw_reading.value)
diff --git a/glucometerutils/drivers/fslibre.py b/glucometerutils/drivers/fslibre.py
index 34679cb..c8b8c5e 100644
--- a/glucometerutils/drivers/fslibre.py
+++ b/glucometerutils/drivers/fslibre.py
@@ -158,7 +158,7 @@ def _parse_arresult(record):
else:
comment_parts.append('Rapid-acting insulin')
- return common.Reading(
+ return common.GlucoseReading(
_extract_timestamp(parsed_record),
parsed_record['value'],
comment='; '.join(comment_parts))
@@ -198,7 +198,7 @@ class Device(freestyle.FreeStyleHidDevice):
# The reading is considered invalid, so ignore it.
continue
- yield common.Reading(
+ yield common.GlucoseReading(
_extract_timestamp(parsed_record),
parsed_record['value'],
comment='(Sensor)')
diff --git a/glucometerutils/drivers/fsoptium.py b/glucometerutils/drivers/fsoptium.py
index e811863..121d8d6 100644
--- a/glucometerutils/drivers/fsoptium.py
+++ b/glucometerutils/drivers/fsoptium.py
@@ -271,4 +271,4 @@ class Device(serial.SerialDevice):
# The reading, if present, is always in mg/dL even if the glucometer is
# set to mmol/L.
- yield common.Reading(timestamp, value)
+ yield common.GlucoseReading(timestamp, value)
diff --git a/glucometerutils/drivers/fsprecisionneo.py b/glucometerutils/drivers/fsprecisionneo.py
index 42e652d..504dad7 100644
--- a/glucometerutils/drivers/fsprecisionneo.py
+++ b/glucometerutils/drivers/fsprecisionneo.py
@@ -77,4 +77,4 @@ class Device(freestyle.FreeStyleHidDevice):
raw_reading.year + 2000, raw_reading.month, raw_reading.day,
raw_reading.hour, raw_reading.minute)
- yield common.Reading(timestamp, raw_reading.value)
+ yield common.GlucoseReading(timestamp, raw_reading.value)
diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py
index 183638e..e9f60bb 100644
--- a/glucometerutils/drivers/otultra2.py
+++ b/glucometerutils/drivers/otultra2.py
@@ -325,5 +325,5 @@ class Device(serial.SerialDevice):
# OneTouch2 always returns the data in mg/dL even if the glucometer is set
# to mmol/L, so there is no conversion required.
- yield common.Reading(
+ yield common.GlucoseReading(
date, float(line_data['value']), meal=meal, comment=comment)
diff --git a/glucometerutils/drivers/otultraeasy.py b/glucometerutils/drivers/otultraeasy.py
index 01717f9..6a4bfd2 100644
--- a/glucometerutils/drivers/otultraeasy.py
+++ b/glucometerutils/drivers/otultraeasy.py
@@ -319,4 +319,4 @@ class Device(serial.SerialDevice):
timestamp = _convert_timestamp(record_response.data[2:6])
value, = _STRUCT_TIMESTAMP.unpack_from(record_response.data, 6)
- yield common.Reading(timestamp, float(value))
+ yield common.GlucoseReading(timestamp, float(value))
diff --git a/glucometerutils/drivers/otverio2015.py b/glucometerutils/drivers/otverio2015.py
index d272b5c..9dc9393 100644
--- a/glucometerutils/drivers/otverio2015.py
+++ b/glucometerutils/drivers/otverio2015.py
@@ -264,7 +264,7 @@ class Device(object):
unused_const5, unused_const6) = _STRUCT_RECORD.unpack(
response)
- return common.Reading(
+ return common.GlucoseReading(
_convert_timestamp(timestamp), float(value), meal=_MEAL_CODES[meal_flag])
def get_readings(self):
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py
index 5bcdab2..8b07ab5 100644
--- a/glucometerutils/drivers/sdcodefree.py
+++ b/glucometerutils/drivers/sdcodefree.py
@@ -197,7 +197,7 @@ class Device(serial.SerialDevice):
r = parse_reading(rpkt)
meal = _MEAL_FLAG[r.meal_flag]
- yield common.Reading(
+ yield common.GlucoseReading(
datetime.datetime(
2000 + r.year, r.month, r.day, r.hour, r.minute),
r.value, meal=meal)