Charting Real-Time Polling with MicroStrategy SDK and Third-Party API

September 16, 2016

I obviously had to jump on the election bandwagon and play with the data and tinker with how we present it! I have been accused far too often about having an opinion that potentially offends everyone but I shall refrain from that and speak only about the technology :).

 

We are inundated with polling data every single day and I thought it would be interesting to capture the volatility of this data over a period of time. We did some research of some suitable REST API that could be used as a data source and also a charting library that is simple and elegant. We found an API that gave us the response in JSON and XML (among other formats) and then wrote a utility to convert the XML response to an appropriate JSON format that the charting library accepts. We then leveraged MicroStrategy’s Visualization SDK to package this as a custom widget is called - General Election Polls (not very original but hey, I am not a marketer!).

 

 

Data Source

While there are a few polling sources that we can extract data from, we chose HuffPost Polling which has its own REST API. This REST API exclusively tracks the current US presidential candidates. It can be invoked like any REST API via an HTTP request and the JSON or XML (depending on your choice) response includes daily poll numbers for all candidates including third-party candidates. For our example, we included only the two main candidates - Clinton and Trump.

 

Presenting the API Response via a MicroStrategy Report

We then used MicroStrategy’s XQuery reporting capabilities to call the API and generate a report that retrieves data in real time. We included this dataset in a dashboard and built our own custom widget.

 

Custom Widget

For the widget we wrote a Java utility that handles the data returned from the dataset in the dashboard and generated a JSON object that can be passed over to the client-side JavaScript. The client-side JavaScript then uses this custom JSON and a third-party library to render the chart. For the third-party library we used amCharts that has a pretty cool time series slider. This allows us to track the poll numbers of the candidates over a period of time.

 

So, why should you care?

Other than the fact that it is incredibly cool, it has a great use case for anyone who is trying to pull real-time data. The data is not sitting in a warehouse but is retrieved at run-time by invoking a REST API call. This custom plugin will enable you to leverage MicroStrategy built-in query capabilities to call REST APIs along with their Visualization SDK’s ability to integrate third-party charting libraries into MicroStrategy’s widget library. This will allow you to build widgets for data retrieved by invoking *any* REST APIs. For instance think of a stock trading application, wouldn't it be great to pull real-time information from say Yahoo! Finance.

 

Thoughts? Comments? I'd love to hear about how you see this being valuable to your use cases. I can be reached at sushil.muzumdar@the3i.com.

 

Photo by: DonkeyHotey (https://www.flickr.com/photos/donkeyhotey/)

 

Please reload

Contact us!

If you are interested in learning more about Third I, please fill out the form below and we'll have one of our specialists contact you directly.

 

FOLLOW US

  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

VISIT US

CONTACT US

info@the3i.com
(703) 272 8209

PRIVACY POLICY     |     Copyright ©  2018 Third I, Inc. All rights reserved.