Spot - framework

Build Status Codacy Badge Codacy Badge js-semistandard-style

Group, bin, combine, and aggregate high dimensional datasets for interactive visual analytics. Define simple (lower dimensional) cross sections of your data, called filters. Filters partition (bin) the data and can do aggregations (sums, averages, standard deviations, etc). The result is returned as a simple array which you can plot or analyze (see also the other SPOT projects). All filters are linked and update automatically.

Using a single API, it can run fully client side, via crossfilter, or it can use a PostgreSQL database using the spot-server.

How to install

  1. download and install node.js
  2. clone this repository:
     git clone https://github.com/NLeSC/spot-framework.git && cd spot
  3. install dependencies:
     npm install

Example usage


// get a new Spot instance
var Spot = require('./src/me');
var spot = new Spot();

// add a dataset
var dataset = spot.datasets.add({
  name: 'My data'
});

// add some data to the dataset
dataset.crossfilter.add([
  { firstName: 'John', lastName: 'Smith', age: 35 },
  { firstName: 'Mary', lastName: 'Smith', age: 49 },
  { firstName: 'Little', lastName: 'Smith', age: 8 },
  { firstName: 'Dee', lastName: 'Jones', age: 5 },
  { firstName: 'Doo', lastName: 'Jones', age: 9 }
]);

// Have SPOT scan the dataset:
// 1. it auto-detects 'firstName', 'lastName', and 'age' attributes
// 2. it creates the corresponding Facets
dataset.scan();

// make the dataset active
spot.toggleDataset(dataset);

var dataview = spot.dataview;

// add a filter
var filter = dataview.filters.add({
  title: 'filter one'
});

// ... that partitions the data on 'lastName'
filter.partitions.add([
  { facetName: 'lastName', rank: 1 }
]);

filter.partitions.forEach(function (partition) {
  partition.setGroups();
});

// ... and that takes the average over the 'age'
filter.aggregates.add([
  { facetName: 'age', rank: 1, operation: 'avg' }
]);

// initialize the filter
filter.initDataFilter();

// listen to data
filter.on('newData', function () {
  console.log('data: ', filter.data);
});

dataview.getData();

Documentation

The spot documentation can be found here.

Credits

Jisk Attema, the Netherlands eScience Center