GroveStreams: Basic Data Upload

HR_Sample

Click the image to see it in all its glory.

Having used the sample GroveStreams Arduino code to simulate a temperature sensor, my next step has been to verify how data can be sent to the GroveStreams chart generator for a new data stream; a simulated heart-rate.

The GroveStreams API accepts data as an http request. Here is an example:

PUT http:/grovestreams.com/api/feed?&compTmplId=temp&compId=00:16:3e:58:cb:71&compName=HeartRate&org=a123432-33433-21231&api_key=abcde8999993737373-92390-323923&s1=78

Two things about the above string:

1. The org is a series of hexadecimal numbers unique to your company
2. The api_key is a series of hexadecimal numbers which unique to the user account.
3. I’ve placed bogus numbers in the two entries.

Breaking this down by parameter, it looks like this:

PUT http:/grovestreams.com/api/feed?
&compTmplId=temp
&compId=00:16:3e:58:cb:71
&compName=HeartRate
&org=a123432-33433-21231
&api_key=abcde8999993737373-92390-323923
&s1=78

where the first line is the GroveStreams url, followed by

compTmplId  – the “component template ID”
compId – the “component ID”
compName- the “component name”, in this case “HeartRate”
org – Organization ID (used to identify the organization)
api_key – used to identify your user account
s1 = in this case, the “stream identifier”…. an arbitrary name for the data stream.

The s1 at the end actually contains the data… in this case a heart-rate of 78 beats per minute.

Sending this requires data to be sent using an HTTP PUT.  This is different than the a conventional GET or  POST that would be sent from a normal web page in a browser, so you can’t just paste this into the address box of a web browser and expect it to work.  So, to allow this, I downloaded a FireFox plug-in called HTTP_Requestor. This allows you to place the string in a box, and send the request to GroveStreams using PUT.

Using he HTTP_Requestor,  you can manually add a single data point at a time to a GroveStream chart.  On the back-end, you need to create the component which accepts the data and prepares it for display.

The GroveStreams API will accept data once every ten seconds.  If you attempt to send data more often than that, it won’t be accepted, and the GroveStreams server will generate an error message to that effect:

{"message":"Feed PUT call limit has been exceeded for address 297.23.21.12. 
One call every 10 seconds is allowed.
 ","errCode":"RATE_LIMIT_EXCEEDED","success":false}

The ten-second rule is enforced by your public IP address. If I understand this correctly then, a set of devices behind a firewall cannot independently send data points to the GroveStream server. These need to be aggregated and packaged to be sent together.  The server will accept multiple data points, (possibly paired with time stamps), so that you can display data at shorter intervals than ten seconds. In other words, you could package ten (or a hundred) values in a single call to the server… but you just can’t send more than one call to the server every ten seconds.  This might have implications, then for our heart-rate monitor…if we had originally expected to be able to monitor multiple patients’  heart-rate in near real time; we would have an current copy of the heart-rate only every ten seconds, even though we were displaying a reading taken roughly every second.

Despite the above limitation, it looks as if it may be possible to simultaneously display, say ten heart-rates on a single web page.

Advertisements
Tagged with: , , , , , ,
Posted in Personal Technology, Sensors, Technology, Technology-Enabled Home, Telemedicine
One comment on “GroveStreams: Basic Data Upload
  1. Mike M says:

    The 10 second limit can also be avoided by including the X-Forwarded-For http header field and setting it to an IP address that is unique within your network behind your outward facing router. The GroveStreams Arduino sample demonstrates its usage.

    Also, the org parameter is no longer required. The GroveStreams organization is implied from the organization the api_key belongs to. This change was made to simplify development and save some bytes on small devices.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: