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-prib-functions

v0.22.0

Published

Node-RED added node functions.

Downloads

681

Readme

node-red-contrib-prib-functions

Node-Red nodes for various functions:

  • Data Analysis - statistical metrics that has real time option
  • Matrix
  • Transform
  • Test
  • Load Injector
  • Monitor Flow
  • append
  • Spawn Process
  • Host Available
  • node.js os metrics
  • Levenshtein Distance

Data Analysis

Real time metrics which are recalculated on single of data point and posted in msg.result. Key and value can be selected from msg.payload. Includes lag (seasonal) along with delta(defference). Sending message with topic"@stats" places message with all stats on second port. If realtime metrics then a third port is shown where the message is sent if it is an outlier being outside 3 standard deviations from mean. This can be changed to median and number of deviations.

Data Analysis Realtime Data Analysis Pearson R

A set of data analysis functions that can be run over an array of data

Single value metrics:

  • autocorrelation
  • Autocovariance
  • Average/Mean
  • Maximum
  • Median
  • Minimum
  • Range
  • Standard Deviation
  • Skewness
  • Sum
  • Variance

Array metrics:

  • Deltas
  • Deltas Normalised
  • difference
  • difference seasonal
  • difference seasonal second order
  • Moving Average Simple (SMA)
  • Moving Average Cumulative (CMA)
  • Moving Average Weighted (WMA)
  • Moving Average Exponential (EMA/EWMA)
  • Normalise
  • Standardization (Z-score Normalization)

Array data

  • distances
  • distance(s) minimum between points
  • distance(s) maximum between points

Data Analysis

example:

Data Analysis Realtime example

Data Analysis Pearson R example

Data Analysis example


Matrix

Define a matrix and perform various functions

  • Define / Define Empty / Create / Create Like/ clone
  • Add / Add Row to Row / Add to Cell / Add Row / Subtract Cell
  • Multiple / Multiple Cell / Divide Cell / Divide Row
  • Transpose
  • Adjoint
  • Cofactor
  • Complement Minor
  • Identity
  • Inverse
  • Determinant
  • Backward Substitution
  • Forward Elimination
  • Gaussian Elimination
  • Reduced Row EchelonForm
  • Row Echelon Form
  • Nearly Equals / Is Square / Get Cell
  • Sum Row
  • Swap Rows
  • To Array Object

Matrix


Transform

Translates a selected msg property to a target property. Messages generates a message for each row or record.

Transformations:

  • Array to CSV
  • Array to HTML
  • Array to ISO8385
  • Array to Messages
  • Array to xlsx / xlsx object (excel uses xlsx)
  • AVRO to JSON (uses avsc)
  • Buffer to comprossed
  • Confluence to JSON
  • Compressed to Buffer
  • Compressed to String
  • COmpressed to JSON
  • CSV to Array
  • CSV to HTML
  • CSV to Messages
  • CSVWithHeader to Array
  • CSVWithHeader to HTML
  • CSVWithHeader to JSON
  • ISO8385 to Array
  • ISO8385 to JSON
  • JSON to Array
  • JSON to Confluence
  • JSON to CSV
  • JSON to AVRO (uses avsc)
  • JSON to ISO8385
  • JSON to Messages
  • JSON to String
  • JSON to xlsx / xlsx object (excel uses xlsx)
  • JSON to XML (uses fast-xml-parser)
  • String to JSON
  • path to Basename
  • path to Dirname
  • path to Extname
  • path to Format
  • path to Is Absolute
  • path to Join
  • path to Parse
  • path to Normalize
  • path to Resolve
  • snappy compress (uses snappy, must install separately)
  • snappy uncompress (uses snappy, must install separately)
  • xlsx / xlsx object to array/JSON (excel uses xlsx)
  • XML to JSON (uses fast-xml-parser)

Note, snappy needs to be installed separately as can have issues with auto install as build binaries.

With xlsx object one can use the function in xlsx against the object in functions node.

Example AVRO with schema

Transform AVRO

For Confluence schema contains a list of schemas in form {"",}


Test

Allows a test case for a message to allow simple testing of nodes. Injects a new message via mouse or message. Message sent to first port which can be consumed by other nodes and returned back to node in a loop. The Test node then checks against detailed expected payload result.

Test

example:

Test example

after run

Test example run


append

Append file(s) to payload. Cached to maximise performance. Require can be used to find file.

append

Test example:

append example


Levenshtein Distance

The levenshtein distance between two character strings.

Levenshtein Distance


Load Injector

Inject messages for a set period of time with varying think time. Primary purpose is testing and useful for load/stress testing.

Has 3 extra data types

  1. generated id - Unique id for each message
  2. generated data - string text generated using dummy-json
  3. generated json - json generated using dummy-json

Load Injector

Test example:

Load Injector example


Monitor Flow

Add on wire between two flows to see message rates in status line. Rate sampled every second and provides rate last second / 10 seconds / 1 minute / 5 minutes.

Monitor Flow

Test example:

Monitor Flow example


Host Available

Test if host is available sending msg to up or down port so action can be taken. Message only sent on state change or if message is sent which doesn't have topic refreshHostAvailable. This topic forces a check rather than time check which can be set.

Host Available

Test example:

Host Available example


Monitor System

System monitoring metrics

Monitor System

Test example:

Monitor System example


os

The metrics from node.js os

os

Test example:

os example


Spawn Process

Spawn process as per node.js manual with ability to set working directory, environment variables and argument passed to process. STDOUT and STDERR are sent as individual messages. RC port is sent a message on closure. Takes in messages that starts a process with ability to add environment values. Message can be sent to kill the process.

Spawn Process

Test example:

Spawn Process example


Install

Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-prib-functions

Tests

Test/example flow in test/generalTest.json


Version

0.22.0 Add autocovariance + autocorealationship to real time data analystics, improves test

0.21.0 Add lag/seasonal to real time data analystics

0.20.3 Add difference + monitor system

0.19.0 Improve load injector, fix bug in test comparing buffers, add compression tranforms

0.18.0 Add matrix node

0.17.0 Add finished wire to load injector

Author

Peter Prib