precog

Client for Precog, a cloud-based analytics platform.

npm install precog
8 downloads in the last week
17 downloads in the last month

Precog Client for JavaScript

Precog is a powerful analytics platform for JSON data. This JavaScript client allows easy streaming, uploading, and querying of data.

Installation

Browser

Include precog.min.js to get a global Precog object:

<script src="precog.min.js"></script>

node.js

Install the precog library:

npm install precog

And load the library:

var precog = require('precog');

Getting Started

  1. Create a new Precog API by specifying your API key.

     var api = new Precog.api({"apiKey": "[MY API KEY]", "analyticsService" : "https://beta.precog.com"});
    
  2. Upload or stream some JSON data into a subdirectory of your base path. Your base path starts with your Precog account ID.

     api.append({path: '/[MY ACCOUNT ID]/test', value: {age: 29, gender: 'male'}});
    
  3. Query your JSON data.

     api.execute({query: 'count(//[MY ACCOUNT ID]/test)'});
    

Documentation

Visit the Precog Developer Center for documentation on the REST API and client libraries.

Development

If you would like to made modifications to the source, you can build a distribution by running the following from the project directory:

npm install

Tests can be run from npm:

npm test

Or by loading test-api.htm under the test directory into a browser.

npm loves you