Firebase on the wot.io Data Service Exchange
One of the key benefits wot.io provides is interoperability between different connected device platforms. One really interesting advantage of the wot.io architecture is that it allows developers to take both IoT data from connected devices as well as data from web-based feeds and combine them in interesting ways using dynamic data services like Firebase.
For this application, we're going to use Firebase's ability to store and sync data in realtime and subscribe to changes in their FAA (Federal Aviation Administration) dataset which shows the latest airport delay and status updates in realtime.
Separately, we'll create our own custom Firebase dataset, based off the FAA data, where we store points of interests around delayed airports and expand the scope of those interests based on the severity of the delay.
Making Lemonade from the Lemons of Others
It's no surprise that hotels want to predict demand to help them fill rooms to maximize their profits. When flights are delayed or canceled, an immediate opportunity is created for hotels near the affected airports to reach a collection of new hotel customers. When flights are delayed, travelers may miss their connections at hubs, or worse, have their flight canceled until the following day. The inconvenienced flyers will need to decide if they will wait it out at the airport or book a room in a nearby hotel.
If only the hotels knew about the delays and the dilemma facing the travelers, maybe they could sway them toward opting for a night's stay with some type of discount...
We'll show how we can combine data services in the wot.io operating environment to help predict when a person may be delayed so that hotels nearby with available rooms can connect.
But of course, it doesn't end with hotels. After all, wot.io is a data service exchange. Other parties like taxis and or Uber may be interested in the same information to predict a potential surge in ridership, and route vehicles to the area as necessary. Or discount travel services like Expedia or Kayak may wish to use the data to rate and sort hotels - enticing the same delayed flyers to use their services instead. Naturally, in addition to the delay information, the sorting algorithm for presenting these options to an end customer would typically employ custom business logic based on different revenue sharing rates, etc.—business logic that can, once again, be readily represented as composable data services like scriptr, for example.
Above is a block diagram giving an overview of the solution we'll be describing in the following sections.
Using Firebase as a Data Source
You can view the FAA data by pointing your browser to the FAA Firebase feed. You can see that at the time of this post, MSP (Minneapolis International) was experiencing a weather-based delay.
We can subscribe to notifications whenever the delay information changes and route the data through the wot.io data service exchange into a service like scriptr where we can run custom business logic.
Augment the Data with Scriptr
In this case, we wrote a quick script take the incoming airport notifications and fetch the geolocation data for that airport using the Google Maps API.
In addition to being useful on its own, we can further augment the now geo-located airport information with a list of nearby attractions using the Google's Places API. In fact, in this case we have modeled the type of business logic that a travel service like Expedia might use by targeting different types of places and offers based on the delay severity. So a short delay might target a discounted drink offer at a nearby bar, while a longer delay might result in an offer for an overnight stay at a nearby hotel.
A key point that should not be missed is that the location lookup script didn't have to know about the hotel lookup script. In other words, wot.io's data routing architecture allows us to decouple the flow of data from the execution of the data services. If tomorrow we decided that we also wanted to send the geotagged airport delays to another data service like Hortonworks Enterprise Hadoop for archival and analytics on how to optimize our travel company offerings for seasonal trends in travel delays, we wouldn't have to modify the logic in the airport script at all.
Using Firebase as a Data Store
Like many of the data services in the wot.io data service exchange, Firebase supports both read and write interactions. With our newly augmented data set that mashes up the FAA data with Google's location and point-of-interest data, we can use the wot.io Firebase adapter to route the data back into a brand new collection of our own in Firebase.
Custom Applications and wot.io
Many times, end-to-end IoT solutions will include custom user-facing applications in addition to the sorts of behind-the-scenes data services we have discussed thus far. Not a problem—to wot.io, they're just another data service!
As an example, we created a fictitious consumer-facing web application for the hotel and discount travel brands, transportation services, and restaurants and bars. This application can send and receive information to and from wot.io using Web Sockets for near realtime connections to our new dataset in Firebase as well as any other data services on the exchange. In this case, it's just a simple web application written using node.js. When delays are encountered and the business logic dictates that hotels should be offered, each hotel gets its own dynamically generated page with buttons for the customer to act on.
And of course, wot.io connectivity is hardly limited to web applications. Here is a native Android mobile application for taxi fleet managers to use for monitoring and deploying their vehicles based on airport delay information. Not only does this application illustrate how mobile applications can connect to the wot.io data service exchange as easily as web applications, but it also illustrates how multiple parties may use the similar data for different purposes.
Although we've "flown through this post" rather quickly (sorry, I couldn't resist), hopefully we've demonstrated how wot.io's composable data service architecture provides significant power and flexibility by connecting to multiple systems and providing data services that can manipulate IoT and web-based data in near realtime fashion. This simple demo also shows the value of pulling data from multiple sources, transforming it, and creating a new stream of data that becomes useful in brand new ways of its own.
So good luck on your next trip, and we hope you don't experience any delays!