From a36c0dea9079a8268b30249fdc5bb1d04ce97110 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 29 Jan 2017 21:50:17 +0000 Subject: dexcom_dumper: send USER_EVENT_DATA records when doing remote update --- dexcom_reader/dexcom_dumper.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dexcom_reader/dexcom_dumper.py b/dexcom_reader/dexcom_dumper.py index 7edb067..3ac21c0 100644 --- a/dexcom_reader/dexcom_dumper.py +++ b/dexcom_reader/dexcom_dumper.py @@ -8,7 +8,7 @@ from sys import stdout, stderr from datetime import timedelta, datetime from time import sleep from itertools import islice, takewhile -from database_records import GenericTimestampedRecord, EGVRecord +from database_records import GenericTimestampedRecord, EGVRecord, EventRecord # from pytz import UTC # Since the dependency is external, don't import unless needed from optparse import OptionParser @@ -197,7 +197,8 @@ def poll_remote(): if n == 0: send_ping(now) if r: - for t in ['METER_DATA', 'INSERTION_TIME']: # TODO: track how long this takes & adjust sleep accordingly + for t in ['METER_DATA', 'INSERTION_TIME', 'USER_EVENT_DATA']: + # TODO: track how long this takes & adjust sleep accordingly try: remote_update(t) except: @@ -296,6 +297,16 @@ class JSON_CGM(JSON_Time): op['record'] = [getattr(o, 'glucose_special_meaning'), []] return op + elif isinstance(o, EventRecord): + op={} + for k in o.BASE_FIELDS: + op[k] = getattr(o, k) + if o.event_sub_type: + op['record'] = [o.event_type + '_' + str(o.event_sub_type), []] + else: + op['record'] = [o.event_type, o.event_value] + return op + elif isinstance(o, GenericTimestampedRecord): op={} record={} -- cgit v1.2.3