npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-ckants

v1.1.1

Published

nodes used to interact with CKAN Timeseries extension

Downloads

14

Readme

node-red-contrib-ckants

CKANTS Node

CKANTS nodes help interfacing with CKAN Timeseries extension https://github.com/namgk/ckan-timeseries. If you don't have a CKAN instance or don't want to install the Timeseries extension, you can create an account at http://hub.urbanopus.net and publish your data there for free (data quota applied).

Currently the collection has three nodes:

  • a Create node for creating a new CKAN Timeseries resource
  • an Insert node for pushing data to the created resource
  • a Search node for querying data from the resource

All these nodes require CKANTS Credentials to be configured. The Credentials includes

  • a CKAN host url, the CKAN host needs to have the CKAN Timeseries extension installed (refer to its repo)
  • a CKAN user token, which is the CKAN API Key and can be found at the bottom left corner of CKAN user profile page: http://<ckan host>/user/<username>

CKANTS Credentials

Create Node

This node creates a new CKAN Timeseries resource in the datastore database.

It requires a Package ID, which is a name of a CKAN dataset. Recall in CKAN, actual data records are stored in CKAN Resources and CKAN Resources are grouped into packages called CKAN dataset. A dataset can be created on CKAN web interface by an authorized user.

The resource name is optional, if left blank, CKAN will named it "Undefined"

With this node, you can define the schema of the data to be stored in the CKAN datastore.

CKANTS Create

In this example, we create a resource name "Buses" that holds the real-time data of all public buses in Vancouver, BC. The resource is held in a dataset called "Vancouver-BC".

It currently has two fields, an Address and a Latitude fields. The dropdown menu to the left of the field name helps choosing the field types. Supported types according to CKAN are: text, int, float, bool, json, date, time, timez, timestamp, timestampz.

After properly configure the node, you deploy the node by clicking Deploy on Node-RED. The actual create request will be sent by clicking the trigger button of the create node.

If the operation is success, you will find the newly created resource with its ID shown in the Debug tab:

CKANTS Created

IMPORTANT! Keep this resource ID safe somewhere since we are going to use it in subsequent insert and search operations.

Insert Node

This node pushes the message payload it receives to a corresponding resource. Its configuration only has a Resource ID which specifies the destined CKAN Resource of the data

CKANTS Insert

In order to actually push the data, in this example we create a new function node and a inject node for triggering. The function node crafts a message payload that has the exact data according to the data schema created by Create Node.

The function node looks like this:

Crafting data

IMPORTANT! The Insert node receives an array of records, not an object.

The insert flow looks like this:

Insert flow

After clicking the trigger, you will find a success status as follow:

Insert success

Search Node

This node helps send a query to CKAN Timeseries. Similar to the Insert node, it requires a resource ID where the data is stored.

Search

The other two optional query parameters are fromtime and totime. These parameters are used to query for data based on time frame when the data is recorded in the database. Format of fromtime and totime follows ISO 8601 standard and a custom format. The custom format is a quick and easy way to specify which time frame of data to be returned relatively to the current moment.

Custom formats look like:

  • last 2m --> will be translated to a timestamp from 2 minutes ago relatively to the current time
  • last 2d,2m --> last 2 days and 2 minutes
  • last 2h,2s,2m --> last 2 hours, 2 minutes and 2 seconds
  • ...

The whole flow looks like this:

Search flow

When triggered, the query will be sent to CKAN Timeseries Datastore and results be forward to the Debugger node.

Search result