Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
brenton_ocallaghan
Active Participant

At the end of March I was approached by my good friend and colleague applebyj with a challenge:


Let’s build an IOT real time healthcare demo for SAPPHIRE


So we did, and in this blog I’m going to talk through the demo that John, myself and of course the Fiori guru dj.adams built in just over 3 weeks in our spare time in the run up to this years SAPPHIRE NOW. You may have seen John's post during SAPPHIRE talking briefly about what we were doing and what we built but this is a bit more of an in-depth look at exactly what we did.


The scenario was simple; for specific attendees of SAPPHIRE, a three day marathon SAP conference event in Orlando, we would equip them with heath sensing biometric sensors and feed that data, in real time, into the SAP HANA database present on the show floor. Finally we would display that data for the world to see in an SAP Fiori (like) user interface which we called Bluefit.


The Components

The demo could be broken down into three areas:


  • The Wearable
    • Our “patients” would wear a Moto360 smartwatch running Android wear and Google Fit. This would allow us to track their step counts, their heart rate and of course their distance travelled.


  • Getting the Data to HANA
    • To get the data from the watch into HANA we had to have a middle man which in our case was a Moto X (2014) smart phone running Android Lollipop. This could act as the middleman retrieving our watch data and then pushing this into SAP HANA.


  • Visualising the data
    • For the data visualisation we utilised raw HANA analytics built at the HANA database level and exposed that data via the XS engine and OData services into a fully fledged Fiori application.


All of this means that as our patients made their way around the showfloor, their watches would track their biometric data, their phones would push that data into our SAP HANA database and finally we could watch this all in real-time via our SAP Fiori front end app.


Technical Deep Dive

Going into a bit more detail - how did we actually build the demo:


Bluefit on the watch

There are many different ways you can approach the building of a fitness/health tracking app on Android-based wearable devices. The first approach we took was to attempt to tap into the raw sensor data from within the watch itself using the provided Android Wear APIs. We had some success in this area and managed to successfully pull the required data. However logging, storing and transmitting that data manually from the watch, while completely possible, was a bit more complicated than this demo required.


During the development it became obvious that there had to be a better way to retrieve our data, and there was. Enter the Google Fit SDK. A component of google play services, it provided us with historical and time aggregated sensor data. For instance the API supported a request for todays step count since midnight to right now without having to manually store sensor data. Perfect for what we required.


Communications between the watch and the phone were achieved using the Google messaging API provided specifically for communicating with Android Wear devices.


Bluefit on the Phone

The Bluefit app on the phone acted as the middleman between our fitness data and SAP HANA. The app was the brain behind the operation ensuring that the fitness data on the watch was kept up to date as well as ensuring that data was being pushed to SAP HANA at regular intervals.


Utilising the Google Fit SDK, the app would keep a log of fitness data throughout the day and then, once every minute or so, post that data to SAP HANA using a standard authenticated HTTP POST.


Little side note: those of you who have every been to a teched/d-Code or SAPPHIRE NOW event will, I’m sure, appreciate the flaky nature of both the WiFi and cell service at these events. As a result of that, the app had to be designed and built to be error resistant. It would hold a record of an entire days worth of data until it could successfully post that data to HANA if it needed to. This meant that no historical data would be lost because of the 25,000 people attempting to use the same wifi during the keynote.


Each post from the phone included the phones serial number to allow us to know which device was sending the data.


Bluefit’s Database and UI

To add a sense of reality to the whole thing, we utilised a 3 node SAP HANA cluster from our good friends at Lenovo which was literally sitting on the show floor to host our demo. Those of you who may have seen our tweets giving the link to our step count leaderboard were literally logging onto a server sitting in the middle of the SAPPHIRE NOW show floor in orlando!


To store, analyse and expose the health data we utilised SAP HANA’s development platform, specifically the XS engine. The database was comprised of a subset of tables from a WHO regulated model we worked on a while back giving us patient data, activity data and, of course, bridges to link our devices posting the data to our patients.


On top of this we built a number of attribute views (joining patient data with device data for example) as well as analytical views to provide an aggregated view of our patient data.


Finally the data was exposed for public consumption through a single OData service on top of which we built a Fiori-like responsive application. This gave two views of the data:


  • Patient Data
    • This view provided us with an individual view of our patient’s data. This included their personal details (gender, height, weight and age) as well as their live biometric data (heart rate, step count and distance).

  • “Stepdown” - the leaderboard
    • Known as “Stepdown” for the conference, this gave us a leaderboard view of our main patients, allowing conference attendees to see how each of our patients were doing compared with each other.

Conclusion

So there you have it. In a little over three weeks from conception to demo we built, mostly in spare time, a fairly simple IOT demo using consumer products, SAP HANA and an analytics based front-end on SAPUI5. The skill set for this demo was not huge either:

  • Watch App
    • Java and Android
    • Knowledge of Android wear APIs
  • Phone App
    • Java and Android
    • Basic networking knowledge and HTTP
  • HANA & UI
    • Native HANA development
    • SAPUI5 Frontend & OData


One of the reasons I find this demo so interesting is because it is becoming increasingly obvious that the topic of IOT is not going away and is going to play a major part in everything that we do going forward. From consumer tech tracking data like this as standard to use cases in the enterprise such as smart grids, health care monitoring and so much more. With the flexibility and raw power of SAP HANA it was a perfect fit for this demo to achieve what we needed and without a huge amount of effort.


If you have any questions about how this demo was built or would like more info - please do comment below and I'll be glad to answer.

16 Comments
Labels in this area