New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vizabi/reader-ddfservice

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vizabi/reader-ddfservice

Vizabi reader for a DDF Service

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
4
Weekly downloads
 
Created
Source

Vizabi DDF Service Reader

This Vizabi DDF Service Reader is used to connect your Vizabi visualization to data that is published by a DDF Service.

Usage

To use the reader include the script:

<script src="reader-ddfservice.js"></script>

Then simply create an instance and pass it to Vizabi.

var ddfReader = DDFServiceReader.getReader();
Vizabi.stores.dataSources.createAndAddType("ddfBW", ddfReader)

Next define a data specification, e.g. like this:

const data = {
    modelType: "ddfBW",
    name: "unhcr" // e.g. version could also be in here
}

And use that in the config of your Vizabi visualization:

var config = {
markers: {
    marker_destination: {
    data: {
        locale: "en",
        source: data,
        space: ["asylum_residence", "time"]
    },
    ...
    ...
    ...

Options

Options for the reader can be given as object argument to DDFServiceReader.getReader():

var ddfReader = DDFServiceReader.getReader({service: 'http://localhost:3001'}); //reader config that's not dataset specific goes here

For now service is the only option with reader scope.

In addition a dataset specific configuration object must be supplied in the init() call. Vizabi supplies the config of a data source, as shown above. The supported options are:

{
    name: "unhcr",          // the name of the dataset, the only property that is mandatory
    version: "2019111203",   // a version string, if absent the default version supplied by the service will be used
    service: "http://localhost:3001" // it's possible to pass the service URL in here too.
}

Usage without vizabi

jsfiddle example

var ddfReader = DDFServiceReader.getReader();


ddfReader.init({
  service: 'https://big-waffle.gapminder.org', 
  name: "wdi-master"
});


ddfReader.read({
  select: {
    key: ["geo", "time"], 
    value: ["sh_sta_brtc_zs"]
  }, 
  where: {
    geo: {"$in": ["rwa"]}},
    from: "datapoints"
  })
  .then(console.log);

FAQs

Package last updated on 03 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc