At the largest IoT event in North America, 150+ developers had an opportunity to test out a set of new Intelligent Environment Service APIs from GE Current and compete for the $10,000 IoT for Cities Hackathon grand prize.
“IoT is now evolving beyond simply connecting devices to improve experiences – it can be used to save lives.” – Patrick Mahaffey, Managing Director, Ciklum
The winning team from Ciklum developed an app that provides first responders with situational information to respond quickly to a pedestrian experiencing sudden cardiac failure. When every second counts, instead of waiting in a life-or-death situation for “Somebody, call 9-1-1” – emergency crew would have details including a precise location, vital signs, and video of the situation the moment an Automated External Defibrillator (AED) is engaged. The team of 5 developers pieced together an Intel Edison running Predix Machine, GE Current Services, the Pitney Bowes Geocoding API, an Android UI with Cisco Spark, and an Amazon Alexa Skills Kit to provide verbal guidance. They then combined that with some grit and ingenuity to pull it off in 48 hours.
“As easily as you can track an Uber, you can track an ambulance”
Intelligent Environment APIs
The Intelligent Environment APIs are still in Beta and made to work with street light installations provided by a new business unit called Current, powered by GE. Current is a first-of-its kind energy company integrating GE’s LED, Solar, and Energy businesses with the Predix cloud-based platform to deliver needs of commercial, industrial, municipal, and utility customers.
Unless you happen to live in an equipped city and have access permissions, you’ll be working with simulated historical data. We review the Traffic Planning API here but there are many similarities between these complementary APIs:
Pre-Requisites
To get started using these APIs, you’ll need a free Predix account and a basic understanding of Cloud Foundry and the User Account and Authentication (UAA) Service. The How to create secure applications tutorial walks through setting up UAA with a client id and secret. I won’t repeat those steps here and will expect that you know how to create services and bind them to an app. If not, check out the tutorials.
These examples are in Python for illustration and readability but the process flow is similar for other languages. I’ve also removed error checking for brevity, not laziness, definitely not laziness.
First, you’ll need to be able to authenticate your application with UAA and retrieve a token.
def get_client_token(uaa, client, secret):
credentials = base64.b64encode(client + ':' + secret)
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
'Authorization': 'Basic ' + credentials
}
params = {
'client_id': client,
'grant_type': 'client_credentials'
}
response = requests.post(uaa, headers=headers, params=params)
return json.loads(response.text)['access_token']
If you don’t have a client access token with the proper security scope you won’t be able to use many of the APIs we’ll be discussing.
uaa = 'https://my-uaa.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token'
token = get_client_token(uaa, 'myapp', 'mysecret')
Traffic Planning API
Google Maps with a traffic overlay is an application that most are probably already familiar with. Google can accomplish this technical marvel by collecting location data from several sources, most notably any mobile phone users who opted-in for supplying their GPS location. Through collecting this location data and calculating velocity, it is reasonably accurate at predicting traffic density.
The Intelligent Environment Traffic API can be even more precise by monitoring all vehicles with lane, direction, and speed data points. This is possible because the data uses every street light in a city as the source of telemetry data. The lights provided by Current are equipped with sensors and cameras so that not only could you build an app to route drivers, but also detect road debris, accidents, and other traffic conditions.