Visualization Dashboard With Couchbase Analytics

DZone's Guide to

Visualization Dashboard With Couchbase Analytics

In the world of Big Data, where we have gogolbytes of information available about all aspects of our applications and the users that are interacting with them, being able to analyze all of this data and provide insightful intelligence is paramount.

Need to build an application around your data? Learn more about dataflow programming for rapid development and greater creativity.

In the world of Big Data, where we have gogolbytes of information available about all aspects of our applications and the users that are interacting with them, being able to analyze all of this data and provide insightful intelligence is paramount. At Couchbase, we are working to build data management platforms that let you take advantage of this data. This will then eventually be accessible from a variety of industry-standard analysis platforms like Tableau, QlikView and Microstrategy as well as next generation NoSQL analytics platforms such as Cloud9 and SlamData, however it is also important that developers have APIs to access the systems that store and analyze this data. With this level of direct access, these developers have the flexibility to build everything from simple dashboards to complete custom reporting for their users.

As of version 2.2.4 of our Node.js SDK, we now have experimental support for performing Couchbase Analytics queries against a cluster. The API is very similar to the existing APIs available for performing N1QL queries in the Node.js SDK.

As you might notice, the difference between our N1QL APIs and the Couchbase Analytics APIs is that with Couchbase Analytics you must perform your queries at the cluster-level and use CbasQuery to instantiate your query object.

Using these new APIs, we have also built a new dashboard demonstration application which pulls together a few well-known libraries in the Node.js world to show how you might turn these new APIs into a useful interface that can display business-specific metrics that are useful to you and your colleagues.

How the Dashboard Works

The dashboard we have put together consists of two separate components. First, a server-side component which is running the Node.js SDK and provides a restful interface. Second, a client-side component which is a simple HTML5 page. The server-side component will serve the client-side component from the root of its web-service to make things easier.

The client-side of the application is a simple HTML and Javascript page which contains a small form allowing you to specify some parameters, a large text section which displays all the queries which have been executed against your Couchbase Analytics cluster, as well as 3 graphs which are used to present the data from your queries. When the page loads, or when you click the update button, we dispatch requests to the server-side application requesting various pieces of information about our travel-sample data. When a reply is received from the server, we then pass this information to Chart.js which generates our graphs.

It simply uses Express to start a web-server which responds to any root requests with the client-side page for this application. It additionally registers a couple of REST endpoints which the application uses to update its graphs. Each of these REST endpoints front-ends a SQL++ query against the Couchbase Analytics cluster and then returns the results of that query back to the client-side of the application to be graphed.

In addition to the RESTful service provided by the server-side application, we have additionally included automatic creation of the necessary Couchbase Analytics shadow buckets for the travel sample and inserting 1000 entries worth of randomly generated flight purchase data to give us something interesting to look at.

Getting the Node.js Release

As with all of our Node.js releases, we have published this version to NPM and it can be installed with a simple invocation of npm:

npm install Couchbase@2.2.4.

We also ship prebuilt binaries as part of our npm release process, allow you to get started with the Node.js SDK without any further hassles (note that Node.js v7.0.0 does not currently have prebuilt binaries of the Couchbase module available and requires a working compiler to install).

Check out the Exaptive data application Studio. Technology agnostic. No glue code. Use what you know and rely on the community for what you don't. Try the community version.