Fix treatment entries.
This commit is contained in:
parent
f2fd1a0acd
commit
c8796bf210
@ -94,6 +94,7 @@ def main():
|
||||
entries.append(entry)
|
||||
|
||||
elif comment.get('type') == 'treatment':
|
||||
print("here")
|
||||
for t in ( 'long-acting', 'rapid-acting', 'food', 'sport' ):
|
||||
if comment.get(t) is not None:
|
||||
treatment = {
|
||||
@ -138,6 +139,7 @@ def main():
|
||||
(entries[i], entries[i+1]) = calculate_entry_delta(entries[i], entries[i+1])
|
||||
|
||||
#pp.pprint(entries)
|
||||
#pp.pprint(treatments)
|
||||
sys.exit(1) # Remove this line to upload!
|
||||
|
||||
''' 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)
|
||||
rrelevant = re.compile('(Sport|Food|Rapid-acting insulin|Long-acting insulin|Direction)(?: \((.*?)(?: g)?\))', flags=re.IGNORECASE)
|
||||
for part in data.get('comment').split('; '):
|
||||
|
||||
scantype = rscantype.search(part)
|
||||
if scantype is not None:
|
||||
if scantype.group(1) == 'Blood':
|
||||
@ -254,6 +255,7 @@ def parse_comments(data):
|
||||
if relevant is not None:
|
||||
comment_type = relevant.group(1)
|
||||
comment_value = relevant.group(2)
|
||||
print(comment_type)
|
||||
if comment_type == 'Long-acting insulin':
|
||||
comment['type'] = 'treatment'
|
||||
comment['long-acting'] = comment_value
|
||||
@ -342,7 +344,7 @@ def parse_arguments():
|
||||
default='mmol/L', choices=(UNIT_MGDL, UNIT_MMOLL),
|
||||
help=('The measurement units used in the Freestyle Libre reader (mmol/L or mg/dL).'))
|
||||
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',
|
||||
help=('The time zone for which the sensor is set to record dates.'))
|
||||
parser.add_argument(
|
||||
|
Loading…
Reference in New Issue
Block a user