Fix treatment entries.
This commit is contained in:
parent
f2fd1a0acd
commit
c8796bf210
@ -94,6 +94,7 @@ def main():
|
|||||||
entries.append(entry)
|
entries.append(entry)
|
||||||
|
|
||||||
elif comment.get('type') == 'treatment':
|
elif comment.get('type') == 'treatment':
|
||||||
|
print("here")
|
||||||
for t in ( 'long-acting', 'rapid-acting', 'food', 'sport' ):
|
for t in ( 'long-acting', 'rapid-acting', 'food', 'sport' ):
|
||||||
if comment.get(t) is not None:
|
if comment.get(t) is not None:
|
||||||
treatment = {
|
treatment = {
|
||||||
@ -138,6 +139,7 @@ def main():
|
|||||||
(entries[i], entries[i+1]) = calculate_entry_delta(entries[i], entries[i+1])
|
(entries[i], entries[i+1]) = calculate_entry_delta(entries[i], entries[i+1])
|
||||||
|
|
||||||
#pp.pprint(entries)
|
#pp.pprint(entries)
|
||||||
|
#pp.pprint(treatments)
|
||||||
sys.exit(1) # Remove this line to upload!
|
sys.exit(1) # Remove this line to upload!
|
||||||
|
|
||||||
''' Upload data (either treatment or entry) to Nightscout '''
|
''' Upload data (either treatment or entry) to Nightscout '''
|
||||||
@ -240,7 +242,6 @@ def parse_comments(data):
|
|||||||
rscantype = re.compile('\((Sensor|Scan|Blood|Ketone)\)', flags=re.IGNORECASE)
|
rscantype = re.compile('\((Sensor|Scan|Blood|Ketone)\)', flags=re.IGNORECASE)
|
||||||
rrelevant = re.compile('(Sport|Food|Rapid-acting insulin|Long-acting insulin|Direction)(?: \((.*?)(?: g)?\))', flags=re.IGNORECASE)
|
rrelevant = re.compile('(Sport|Food|Rapid-acting insulin|Long-acting insulin|Direction)(?: \((.*?)(?: g)?\))', flags=re.IGNORECASE)
|
||||||
for part in data.get('comment').split('; '):
|
for part in data.get('comment').split('; '):
|
||||||
|
|
||||||
scantype = rscantype.search(part)
|
scantype = rscantype.search(part)
|
||||||
if scantype is not None:
|
if scantype is not None:
|
||||||
if scantype.group(1) == 'Blood':
|
if scantype.group(1) == 'Blood':
|
||||||
@ -254,6 +255,7 @@ def parse_comments(data):
|
|||||||
if relevant is not None:
|
if relevant is not None:
|
||||||
comment_type = relevant.group(1)
|
comment_type = relevant.group(1)
|
||||||
comment_value = relevant.group(2)
|
comment_value = relevant.group(2)
|
||||||
|
print(comment_type)
|
||||||
if comment_type == 'Long-acting insulin':
|
if comment_type == 'Long-acting insulin':
|
||||||
comment['type'] = 'treatment'
|
comment['type'] = 'treatment'
|
||||||
comment['long-acting'] = comment_value
|
comment['long-acting'] = comment_value
|
||||||
@ -281,7 +283,7 @@ def parse_comments(data):
|
|||||||
comment['direction'] = 'FortyFiveDown'
|
comment['direction'] = 'FortyFiveDown'
|
||||||
elif comment_value == 'down-fast':
|
elif comment_value == 'down-fast':
|
||||||
comment['direction'] = 'SingleDown'
|
comment['direction'] = 'SingleDown'
|
||||||
return comment
|
return comment
|
||||||
|
|
||||||
def verify_units(units = None):
|
def verify_units(units = None):
|
||||||
''' Standardise units for output and for the A1c calculations '''
|
''' Standardise units for output and for the A1c calculations '''
|
||||||
@ -342,7 +344,7 @@ def parse_arguments():
|
|||||||
default='mmol/L', choices=(UNIT_MGDL, UNIT_MMOLL),
|
default='mmol/L', choices=(UNIT_MGDL, UNIT_MMOLL),
|
||||||
help=('The measurement units used in the Freestyle Libre reader (mmol/L or mg/dL).'))
|
help=('The measurement units used in the Freestyle Libre reader (mmol/L or mg/dL).'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--timezone', '-tz', action='store', required=False, type=str, dest='tz',
|
'--timezone', '--tz', action='store', required=False, type=str, dest='tz',
|
||||||
default='UTC',
|
default='UTC',
|
||||||
help=('The time zone for which the sensor is set to record dates.'))
|
help=('The time zone for which the sensor is set to record dates.'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user