How to download my location data?


#1

I would like to make an offering that will tell users how long their commute is (I am a data analyst in healthcare). I can’t do this if I can’t even download my own location data!

Is there a way to download my location data SQL style? Like, where was I between this time and this time on weekdays? I know all my data is ‘mine’ now - but is it just in Rumpel or can I download it?


#2

Hi,

Really sorry for the delay! We got carried away with a few new feature-sets on the next iteration of RumpelLite and more dataplugs to be rolled out very soon…

You certainly can, but just to understand to how much detail to give you, how comfortable are you working with APIs? Everything I write below is covered in the API reference, but some details are specific to location.

As an example, data from a specific “table” can be accessed as by calling:

https://HATNAME.hubofallthings.net/data/table/TABLE_ID/values?pretty=true

To walk you through how to do that exactly in your case will need to do get more technical…

In the above address:

  • HATNAME is the name of your HAT
  • TABLE_ID is the ID of the locations table (different on every HAT, details below on how to look it up)
  • pretty=true just formats the data in a simpler/prettier format

It also takes additional parameters:

  • X-Auth-Token=TOKEN where TOKEN is obtained by authenticating with the HAT. The API documentation probably explains it better than I could rewrite here: http://hub-of-all-things.github.io/doc/?shell#authentication
  • limit=X (optional) where X is an upper limit of how many data points to return in a provided time-frame (default is 1000, very large values will make the request time-out)
  • starttime=Y (optional) so-called Unix time for the start of the time-frame. 0 is the beginning of time which happens to be 00:00:00 UTC on Thursday, 1 January 1970
  • endtime=Z (optional) Unix time for the end of the time-frame

In other words, if there is more data than can be returned in one go, you need to do “paging”. For an example of how Rumpel does it you can take a look at its code: https://github.com/Hub-of-all-Things/Rumpel/blob/master/src/app/locations/locations.service.ts#L47

Now to find the specific Location Table ID you would call: http://HATNAME.hubofallthings.net/data/table?name=locations&source=iphone with the same authentication requirement as above.

Now all that is a little involved, but that’s the price of having any data coming into the HAT and being able to use it at the level of individual values. We are simplifying some of it for the next release of the HAT core and have various tools to simplify working with it across a number of HATs.


#3

To answer the second bit about “SQL style” access, the short answer is no. Allowing generic SQL queries makes it very difficult to control data access and prevent unauthorised leakage in a dynamically-defined environment like the HAT…

However you could imitate your usecase by playing with starttime and endtime values I mentioned in the previous reply to select data from a specific time range. E.g. for last wekend it would be:

  • starttime=1481932800
  • endtime=1482105600

and repeating for every weekend of interest…


#4

Thank you for the details! I am not incredibly familiar with APIs, but I have been learning and this will be a great way to continue. I appreciate the response amidst the development.