Tag: launch center pro

Quick Tracking for Quantified Self

This one is nerdy, even for me. Consider yourself warned.

I wanted to start tracking some data points. I was using FitBit for step and weight tracking, MyFitnessPal to track calories, and mood and environment using Reporter. But there were other things. What time does my daughter’s bus arrive in the morning? How often did I use my rescue inhaler? Neither were things where I needed to provide any more input beyond “event happened”. I’m slowly consolidating my data into a Google Docs spreadsheet, and so I decided these two could go in there as well. The spreadsheet has columns for time, type of record (event, weight, location, etc), a description, and latitude and longitude. 

Bus Arrivals

First up was the bus arrival. While my daughter gets on the bus, I tap an action in Launch Center Pro. That action hits the following URL:


Basically, it tells Drafts to create a draft of “event ||| bus arrival” and call the ifttt action in Drafts, then hand control back to Launch Center Pro. 

The ifttt action in Drafts looks like this:

drafts://x-callback-url/create?text={{!ifttt}}%0A[[draft]]&action={{List in Reminders}}&afterSuccess=Delete

This takes the text of the draft and dumps it into Reminders in the ifttt list. Once it’s done, it deletes the draft, so things stay tidy. 

Finally, I have an IFTTT recipe that takes items in the ifttt list in Reminders, and adds them to my lifelog Google spreadsheet, prepended by the creation date. That recipe can be found at https://ifttt.com/recipes/160434-lifelog-text-via-reminders

Rescue Inhaler

For this, I thought I’d add a location aspect, because while the bus always stops in nearly the same place, I might need my inhaler anywhere. If I see a pattern, maybe I should avoid those places. So, I inserted Pythonista into the equation to get the location data. First up, the Lauch Center Pro Action:


This calls the Pythonista script ifttt.py with the argument “rescue inhaler”. I won’t pretend it’s a good script, but it works. I borrowed a lot of it liberally and if someone recognizes their code here, please let me know so I can give credit for it. Any issues in it are my doing. 


import console
import clipboard
import sys
import webbrowser
import urllib
def getLocation():
import location
import datetime
import time
“Returns current location and timestamp in readable format”
rating = sys.argv[1]
current = location.get_location()
address = ‘event|||’ + rating + ‘|||’ +  repr(current[‘latitude’]) + “|||” + repr(current[‘longitude’])
loctime =  address 
return loctime
# clipboard.set(getLocation())
draftUrl = getLocation()
draftUrl = “drafts://x-callback-url/create?text=” + draftUrl + “&action=ifttt&x-success=launchpro://”

It takes the incoming argument (“rescue inhaler”), gets the latitude and longitude where the phone is now, and mashes it all together with a triple pipe separating them. (The triple pipe is how IFTTT knows how to separate the columns on text headed to Google Spreadsheets.) It then calls the ifttt Drafts action noted above, and the process goes out as described before.