Tutorial: Visualization Request and Client Side Library

Summary

This tutorial presents the VisualizationRequest API as one of the ways to retrieve information stored in the Metacog Platform by instrumented widgets, and how the Client Side Library offer helper methods to interact with the API to build aggregated reports via Javascript.

Target Audience

The intended audience are both the Domain Experts who want to understand what kind of aggregated datasets are available out-of-the-box and the Front End Developers who need to build visually-appealing reports based on those datasets.

How to generate aggregated datasets from your data

Once you have an instrumented widget and your learners start to use it, an amazingly huge amount of rich data will begin to being stored in the Metacog Backend.

Right now, Metacog Platform offers two ways to retrieve information, with more services being under active development. They are:

  • DataRequest API: allows to retrieve the original event streams as they were logged by the widget for a set of filtered sessions.
  • VisualizationRequest API: retrieve agreggated datasets with different views of your data. They are useful for general data-exploration withouth the need to download and process the original event streams.

In this tutorial we are going to focus on the VisualizationRequest API.

Creating a VisualizationRequest

The VisualizationRequest API offers a way to retrieve your data in a meaningful way. The first step is to create a visualization request by Posting to VisualizationRequest, passing the following values:

  • widget_ids:A list of widgets.
  • learner_ids:(This is optional) a list of learners to filter by.
  • data range: the start and end date of the learner sessions you are interested on.
  • email:
  • (optional) The API is asynchronous. You use this field if want to receive an email with the notification of the reports being ready for download, or polling the VisualizationRequest to check the status.
  • reports:A list of the reports to be generated. Check the VisualizationRequest documentation to have a look to all the options available.

This is the body of the data we are going to send:

1
2
3
4
5
6
7
8
9
{
  "reports": ["behavior", "learnogram", "timeToCompletion", "totalNumberOfUsers" ,"kmeans", "scoring"],
  "widget_ids": [
    "chernoff_tutorial"
  ],
  "date_start": "2015-10-01",
  "date_end": "2015-11-17",
  "email": "cesar.pachon@metacog.com"
}

For authentication, we are going to use the public publisher_id(9d10ead1) and application_id(c7f16e0b559f05489e2b900f52f08a99) available for all metacog tutorials and demos, and for the widget_id, we will use chernof_tutorial, that is an instrumented demo widget with complete instrumentation.

You can use the HTML Swagger endpoint to create the request, or use CURL, javascript or any client-side technology that allow you to make HTTP request to a server. This is the equivalent call using CURL:

curl -X POST --header "Content-Type: application/json"
--header "Accept: application/json"
--header "publisher_id: 9d10ead1"
--header "application_id: c7f16e0b559f05489e2b900f52f08a99"
-d "{ \"reports\": [\"behavior\", \"learnogram\", \"timeToCompletion\", \"totalNumberOfUsers\" ,\"kmeans\", \"scoring\"],
\"widget_ids\": [ \"chernoff_tutorial\" ],
\"date_start\": \"2015-10-01\",
\"date_end\": \"2015-11-17\",
\"email\": \"cesar.pachon@metacog.com\"
}" "https://api.metacog.com/VisualizationRequest"

The expected response from the API is a 201 HTTP status code (created), and a JSON object describing the created VisualizationRequest along with its status:

{
"id": "75895360-4c67-472a-a9e9-77ccd3594198",
"publisher_id": "9d10ead1",
"application_id": "c7f16e0b559f05489e2b900f52f08a99",
"request_type": "visualization behavior learnogram timeToCompletion totalNumberOfUsers kmeans scoring",
"widget_ids": ["chernoff_tutorial"],
"learner_ids": [],
"date_start": "2015-10-01",
"date_end": "2015-11-17",
"email": "cesar.pachon@metacog.com",
"status": "QUEUED",
"created_at": 1447766010463000
}

The important fields in the above response are the id and the status. The VisualizationRequest's id identify uniquely this request, and will allow future operations, like status querying and report retrieval.

Waiting for completion

As the VisualizationRequest API is and asynchronous service, the initial state of any VisualizationRequest is "QUEUED". It means that you have two options to know when there is a status change: polling or waiting for notification.

Knowing the DataVisualization Id, you can make use of the GET VisualizationRequest/id/status endpoint to know when the reports are ready for download. These are both the request and the response to our example VisualizationRequest, a couple of minutes after its creation. Notice the new value of Status:

Status Request

CURL Request:

curl -X GET --header "Accept: application/json"
--header "publisher_id: 9d10ead1"
--header "application_id: c7f16e0b559f05489e2b900f52f08a99"
"https://api.metacog.com/VisualizationRequest/75895360-4c67-472a-a9e9-77ccd3594198/status"

JSON response:

{
"jobId": "75895360-4c67-472a-a9e9-77ccd3594198",
"status": "DONE",
"s3Url": {
"behavior": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/BehaviorGraphSpark.log?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=Uitm9wXkczztguXaGb8gGm0sWN0%3D",
"learnogram": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/LearnogramSpark.log?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=4kCFBIHu5oh%2F%2F4eRl1r7RbheMsU%3D",
"timeToCompletion": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/TimeToCompletionSpark.log?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=4thRcIM%2Fqj79UwxeP7hSB5rDPAk%3D",
"totalNumberOfUsers": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/TotalNumberOfUsersSpark.log?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=jJdX5asQ7O2oqj31v7LE%2FFALWkk%3D",
"scoring": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/performance-data.csv?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=6m4r9I3jf1MNpGwesEzbI7lRWjc%3D",
"kmeans": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/kmean-data.csv?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=Zt3Rljk0%2F2ySOr3qBWniz%2FRWQEo%3D",
"MetaData": "https://prod-metacog-downloads.s3.amazonaws.com/75895360-4c67-472a-a9e9-77ccd3594198/metaData.json?x-amz-security-token=AQoDYXdzEHca4AMhr4EarvgSLJtfdY57NMyfHrIW5BRgJugJwh8f%2B%2Blu1PxW4CVY7MQv4zpxYeCsho7Rteaq%2F7xxinI%2BZNUnSVHM6%2BOmOFpnVlfX3PUrWCPzpmI3jL7Kiqqv8icXoxX0tl%2F2eF8XNKyqgI8hF5uIU5D%2F1VcnqsoayALCXU8iYf%2Fz8ts%2BfJIAgZo7mgsgLxmwp5642eRO60feAa5K4Up2m22neqPZZ028dz3Ie9cdT81ioy8T55rIrsvbbs6CxTQIn76vy6AHCIv%2BhWS%2BwRPp%2F55UufuTbgAEWl%2F21T7YfNSYDnVb%2F2efXDCvd5oohNKD69qONFXaeeyDv1cIQHadlsAYL5pk9eXWgrxmLunkyHRiW8ubWMzAN5rEmU3fJddym1HGQpfo7wVN0DSJkkV42o7ihXc7d5K0dnsPdjH1HZ8GKUrplOhRVXrLv%2F%2FgXp%2BK4u2WhMg9ogXFNOGpI3Vm0e0YZ3%2FpF%2BLA6ZtSYzFbnE1zMoN%2B9c3UewEIlH7M0U9suRDDaRnVVkKQ%2B%2BO6Z5QHjkJe%2B3Cm2osyC5LMDZN7i3OQCOXjFGNAEUwU%2FSsMWQnOazWwyq91IYvSBb19TF5Y8SmO7RL%2BBcZZsC3Hu9ynrYtwPeKUfDHb8KXm6j%2F%2B8ApwLDEg4eessgU%3D&AWSAccessKeyId=ASIAIMX6XFGE3YUQOH7A&Expires=1447942289&Signature=ZYHy64G%2FMXQoaXoe%2B%2FoLC9vz21k%3D"
}
}

If you check the parameters we passed when creating the VisualizationRequest, you will notice that we defined an email in the body. That is the second mechanism that Metacog offers to notify for the completion of the aggregated report files: instead of polling the API, you may prefer just to sit, relax and wait until the above information arrives to your inbox, like in the following screenshot:

Report files

Along with the status: DONE attribute, a completed VisualizationRequest will return a list of URLs that points to the requested report files. Notice that these URLs are temporal, so it makes no sense to store them for future access: just trigger again a GET to the VisualizationRequest API and fresh links will be generated for you.

Let's have a look at the different report files available, and what kind of visualizations you can do with them:

Note: You can generate all the visualizations mentioned here visiting this url: https://www.metacog.com/developer/examples

totalNumberOfUsers

This is the report with the higher level of aggregation: it is a CSV format that includes a row by each widget in the request, with the number of sessions available:

Widget,value
chernoff_tutorial,10

timeToCompletion

timeToCompletion is a CSV file that includes a line for each learner-id (different to session-id!) along with the total duration of each session, in minutes.

Widgets,Learner,value
chernoff_tutorial,12c1e613-1352-f888-ffc0-a8dfd02e3639,1.7827666666666666
chernoff_tutorial,1585c51a-d317-341b-ffad-38ab61d13d65,0.7571833333333333
chernoff_tutorial,43dc948e-bbaf-a810-ca82-be1876068ee0,0.0731666666666666
chernoff_tutorial,4cba7928-7ff8-d769-9e51-a94468c072c3,0.07668333333333334
...

behavior

Behavior is a CSV file that counts the total number of times that each event (or feature) is present in all the sessions (like a histogram).

Widget,Behavior,value
chernoff_tutorial,feature_changed,10
chernoff_tutorial,reset,1

learnogram

The learnogram is a special kind of visualization, where you can see all the events of a specific session and the moment and duration of each one. As it includes a record for each event in each session (and the same event can be repeated multiple times by session) learnogram files tend to be large, so be sure to provide filter mechanisms to explore the dataset in a efficient way.

Widgets,Session,Event,value
chernoff_tutorial,1bc49523-aead-855d-ec04-a668319eb3ac,feature_changed, 0
chernoff_tutorial,1bc49523-aead-855d-ec04-a668319eb3ac,feature_changed, 21
chernoff_tutorial,1bc49523-aead-855d-ec04-a668319eb3ac,feature_changed, 13
chernoff_tutorial,1bc49523-aead-855d-ec04-a668319eb3ac,feature_changed, 47
chernoff_tutorial,1bc49523-aead-855d-ec04-a668319eb3ac,feature_changed, 19
...

kmeans

Kmeans Clustering is a kind of visualization where each event in each session is analized and assigned to a cluster, creating zones with similar features. Kmeans CSV file includes a line for each session id and its cluster coordinates and id:

wid,lid,x,y,c
chernoff_tutorial,12c1e613-1352-f888-ffc0-a8dfd02e3639,34.0,3.0,0
chernoff_tutorial,12c1e613-1352-f888-ffc0-a8dfd02e3639,33.0,3.0,0
chernoff_tutorial,12c1e613-1352-f888-ffc0-a8dfd02e3639,228.0,11.0,1
chernoff_tutorial,12c1e613-1352-f888-ffc0-a8dfd02e3639,0.0,1.0,0
...

Other reports

We had covered the basic out-of-the-box reports available to build visualizations. There are two other reports that cover more advanced functionality, and they are MetaData and scoring. We are going to give a brief mention of them, and cover them deeply in further tutorials:

MetaData

If you check the fields available in all the reports, some of them use as key learner-id while others use session-id: it depends on the purpouse of the report. But, what happens if you want to chain a set of reports, let's say, to navigate from the total aggregate to a particular learner and then to a particular learner's session?

MetaData is a JSON file that adds to the original information of the VisualizationRequest object an array of sessionid - learnerid pairs, so it can be used as a lookup table to discover the matches. the relevant part of the JSON object looks like this:

"widget_ids":{
"chernoff_tutorial":[
{"session_id":"12c1e613-1352-f888-ffc0-a8dfd02e3639","learner_id":"1bc49523-aead-855d-ec04-a668319eb3ac"},
{"session_id":"1585c51a-d317-341b-ffad-38ab61d13d65","learner_id":"1a4ff8d6-7730-9b15-81d0-d20a200286a5"},
{"session_id":"43dc948e-bbaf-a810-ca82-be1876068ee0","learner_id":"c4b8fe5e-3682-3dd7-6b61-bab1bb985eac"},
{"session_id":"4cba7928-7ff8-d769-9e51-a94468c072c3","learner_id":"ce36ab29-d911-e55e-125a-eda0235e452f"},
{"session_id":"6b7b1c04-dff9-dd0b-0b46-d96f0cfb04f3","learner_id":"aa06589a-0ed1-4c0f-d068-38afd739ba2d"}
]}

scoring

scoring is a CSV file that pairs sessions with automatic scoring based on the Rubrics and Scoring API's.

We are going to cover Rubrics and Scoring in a next tutorial, and then look again to this particular report.

DataVisualization API and the Client Side Library

The Metacog Client Side Library exposes VisualizationRequest endpoints through javascript methods. They had been used in all the visualizations presented in the previous section. The steps required to use the client side library to request a report involve:

  1. Include the metacog client library:
    1
    	<script src="http://cdn.metacog.com/metacog-api-x.x.x.js"></script>
    

    Be sure to replace the x.x.x with the latest version number, available here!

  2. Initialize the client library in "api" mode:
    1
    2
    3
    4
    5
    6
    7
    Metacog.init({
    		  session: {
    			publisher_id: "9d10ead1",
    			application_id: "c7f16e0b559f05489e2b900f52f08a99"
    		  },
    		  mode: "api"
    		});
    

    "api" mode only requires a session object with valid publisher and application ids. logger, playback and training toolbars are not available, and not external dependencies are required.

  3. Request an existing VisualizationRequest by passing its id:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    Metacog.API.get_visualization_request_status(jobid, function(vizinfo){
        if(vizinfo.status === "DONE"){
              //use vizInfo.s3Urls to access data..
        }
        else{
    	console.log("The given jobid is not in DONE status: "+ vizinfo.status);
    	}
      }, function(status, err){
        console.log("error code "+status + ": " + JSON.parse(err).error);
    	}
     );
    

    Passing the VisualizationRequest id (jobid) to the Metacog.API.get_visualization_request_status will return the VisualizationRequest object and you will be able to check its status. Only if status is "DONE" you can safely continue with the next step.

  4. Obtain the desired file to feed the visualization:
    1
    2
    3
    d3.csv(vizinfo.s3Url.kmeans, function(error, data) {
     //process the data using D3 library..
    });
    

    Use the vizinfo.s3Url object to access to the temporal URL for the different reports. Use your favorite chart library (like D3.js) to create stunning charts!