Node-Red nodes for various functions:
- Data Analysis - statistical metrics that has real time option
- 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.
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 Pearson R Data Analysis Pearson R](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/DataAnalysisPearsonR.JPG)
A set of data analysis functions that can be run over an array of data
Single value metrics:
- Average/Mean
- Maximum
- Median
- Minimum
- Range
- Standard Deviation
- Skewness
- Sum
- Variance
Array metrics:
- Deltas
- Deltas Normalised
- Moving Average Simple (SMA)
- Moving Average Cumulative (CMA)
- Moving Average Weighted (WMA)
- Moving Average Exponential (EMA/EWMA)
- Normalise
- Standardization (Z-score Normalization)
![Data Analysis Data Analysis](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/DataAnalysis.JPG)
example:
![Data Analysis Realtime example Data Analysis Realtime example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/DataAnalysisTestRealtime.JPG)
![Data Analysis PearsonR example Data Analysis Pearson R example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/DataAnalysisTestPearsonR.JPG)
![Data Analysis example Data Analysis example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/DataAnalysisTest.JPG)
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
- ARVO 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 CSV
- JSON to ARVO
- JSON to ISO8385
- JSON to Messages
- JSON to String
- 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
- snappy uncompress
Example ARVO with schema
![Transform ARVO example Transform ARVO](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/transformArvo.JPG)
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 Test](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/Test.JPG)
example:
![Test example Test example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/TestTest.JPG)
after run
![Test example run Test example run](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/TestTestRun.JPG)
append
Append file(s) to payload. Cached to maximise performance.
Require can be used to find file.
![append append](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/append.JPG)
Test example:
![append example append example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/appendTest.JPG)
Levenshtein Distance
The levenshtein distance between two character strings.
![Levenshtein Distance Levenshtein Distance](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/levenshteinDistance.JPG)
Load Injector
Inject messages for a set period of time with varying think time.
Primary purpose is testing and useful for load/stress testing.
![Load Injector Load Injector](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/LoadInjector.JPG)
Test example:
![Load Injector example Load Injector example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/LoadInjectorTest.JPG)
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 Monitor Flow](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/MonitorFlow.JPG)
Test example:
![Monitor Flow example Monitor Flow example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/MonitorFlowTest.JPG)
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 Spawn Process](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/SpawnProcess.JPG)
Test example:
![Spawn Process example Spawn Process example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/SpawnProcessTest.JPG)
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 Host Available](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/hostAvailable.JPG)
Test example:
![Host Available example Host Available example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/hostAvailableTest.JPG)
os
The metrics from node.js os
![os os](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/os.JPG)
Test example:
![os example os example](https://github.com/peterprib/node-red-contrib-prib-functions/raw/HEAD/documentation/osTest.JPG)
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.11.0 Transform for ARVO and snappy. Add JSON to CSV
0.10.2 Transform validate for array source, bug fixes on transform and add improvements to array to messages. Added node for levenshtein distance.
0.10.1 Real time weighted moving average, levenshtein Distance, for test allow testing of "infinity","-infinity" and "NaN" in JSON.
0.10.0 Many fixes to transform. Array and csv to various forms work. Added test to validate.
Improved test to allow for escape to put special characters into a string.
0.9.6 Enhance transform with csv ignore lead or trailing lines.
Add Array and CSV to Messages. Add in topic override
0.9.5 Enhance transform with path and setting source and target
0.9.4 Outlier allowed to set number of deviations if median and reset or set stats
0.9.1 Add outlier detection
0.9.0 Add Pearson R realtime metrics
0.8.1 Add the tests for realtime metrics
0.8.0 Add realtime metrics to data analysis
0.7.1
- fix json to table html and minor code improvements.
turn off debug mode on spawn process.
clear down timer on close for host available
0.7.0
0.6.0
- add Spawn Process
- improve experimental transform with json to table html
0.5.0
- test node add select property tested for result
- dataAnalysis add property analysed
- add experimental transform
0.4.0 Add test, monitor flow, data analysis
0.0.1 base
Author
Peter Prib