jwoglom / tconnectsync

Syncs data from Tandem Source (formerly t:connect) to Nightscout for the t:slim X2 and Mobi insulin pumps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parser/tconnect.py does not account for BG therapy event types

jyaw opened this issue · comments

Noticed this error in my first attempts getting tconnectsync running. Seems that when calling split_therapy_events in ciq_therapy_events.py, parser/tconnect.py only allows for "CGM" and "Bolus" event types (data['type']). When I ran on a day of my data, a few records were type "BG". Not sure if this is just a new update in tconnect or what... Probably will need to account for those entries and try to parse them or at least acknowledge that they're there and continue to process known data types...

See below error log from another user (matches my terminal output):
$ tconnectsync --auto-update
2022-08-20 20:17:19 INFO Enabled features: BASAL, BOLUS
Starting auto-update between 2022-08-19 20:17:19.923273 and 2022-08-20 20:17:19.923273
2022-08-20 20:17:20 INFO Logged in to AndroidApi successfully (expiration: 2022-08-21T08:17:20.401Z, in 7 hours, 59 minutes)
2022-08-20 20:17:20 INFO New reported t:connect data. (event index: 817956 last: None)
2022-08-20 20:17:20 INFO Downloading t:connect ControlIQ data
2022-08-20 20:17:20 INFO Logging in to ControlIQApi...
2022-08-20 20:17:21 INFO Reported tconnect software version: t:connect 7.14.0.1
2022-08-20 20:17:24 INFO Logged in to ControlIQApi successfully (expiration: 2022-08-21T08:17:21.513Z, in 7 hours, 59 minutes)
2022-08-20 20:17:25 INFO Downloading t:connect therapy_events
Traceback (most recent call last):
File "/usr/local/bin/tconnectsync", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/tconnectsync/init.py", line 87, in main
sys.exit(u.process(tconnect, nightscout, time_start, time_end, args.pretend, features=args.features))
File "/usr/local/lib/python3.7/dist-packages/tconnectsync/autoupdate.py", line 48, in process
added = process_time_range(tconnect, nightscout, time_start, time_end, pretend, features=features)
File "/usr/local/lib/python3.7/dist-packages/tconnectsync/process.py", line 67, in process_time_range
ciqBolusData, ciqReadingData = split_therapy_events(ciqTherapyEventsData)
File "/usr/local/lib/python3.7/dist-packages/tconnectsync/parser/ciq_therapy_events.py", line 12, in split_therapy_events
event = TConnectEntry.parse_therapy_event(e)
File "/usr/local/lib/python3.7/dist-packages/tconnectsync/parser/tconnect.py", line 204, in parse_therapy_event
raise UnknownTherapyEventException(data)
tconnectsync.parser.tconnect.UnknownTherapyEventException: Unknown therapy event type:

Hey that was a mistake I won't make again 😆 ! Will fix things for people with CGM calibrations in their pull from tconnect...

Resolved in #55