node-red-contrib-prib-functions 0.23.2 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +36 -0
- package/README.md +153 -140
- package/columnar/columnar.html +258 -0
- package/columnar/columnar.js +1055 -0
- package/columnar/icons/columnar.svg +38 -0
- package/fileSystem/filesystem.html +299 -0
- package/fileSystem/filesystem.js +170 -0
- package/gitlab/gitlab.html +191 -0
- package/gitlab/gitlab.js +248 -0
- package/gitlab/icons/gitlab.svg +17 -0
- package/lib/AlphaBeta.js +32 -0
- package/lib/GraphDB.js +40 -9
- package/lib/MinMax.js +17 -0
- package/lib/Tree.js +64 -0
- package/lib/objectExtensions.js +28 -5
- package/lib/timeDimension.js +36 -0
- package/lib/typedInput.js +18 -2
- package/logisticRegression/icons/logisticregression.svg +22 -0
- package/logisticRegression/logisticRegression.html +136 -0
- package/logisticRegression/logisticRegression.js +83 -0
- package/package.json +21 -9
- package/test/02-graphdb.js +46 -0
- package/test/columnar.js +509 -0
- package/test/data/.config.nodes.json +114 -70
- package/test/data/.config.nodes.json.backup +104 -71
- package/test/data/.config.runtime.json +2 -1
- package/test/data/.config.runtime.json.backup +2 -1
- package/test/data/.config.users.json +3 -2
- package/test/data/.config.users.json.backup +3 -2
- package/test/data/.flow.json.backup +1545 -369
- package/test/data/flow.json +1457 -270
- package/test/data/package-lock.json +11 -11
- package/test/data/shares/.config.nodes.json +611 -0
- package/test/data/shares/.config.nodes.json.backup +589 -0
- package/test/data/shares/.config.runtime.json +5 -0
- package/test/data/shares/.config.runtime.json.backup +4 -0
- package/test/data/shares/.config.users.json +33 -0
- package/test/data/shares/.config.users.json.backup +33 -0
- package/test/data/shares/.flow.json.backup +230 -0
- package/test/data/shares/.flow_cred.json.backup +3 -0
- package/test/data/shares/flow.json +267 -0
- package/test/data/shares/flow_cred.json +3 -0
- package/test/data/shares/package.json +6 -0
- package/test/data/shares/settings.js +544 -0
- package/test/dataAnalysisExtensions.js +93 -93
- package/test/logisticRegression.js +379 -0
- package/test/transform.js +11 -11
- package/test/transformConfluence.js +4 -2
- package/test/transformNumPy.js +3 -1
- package/test/transformXLSX.js +4 -2
- package/test/transformXML.js +4 -2
- package/test-runner.js +400 -0
- package/test.parq +0 -0
- package/test_select.js +37 -0
- package/testing/test.js +8 -7
- package/transform/transform.html +23 -2
- package/transform/transform.js +239 -283
- package/transform/xlsx2.js +74 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Node-RED Contrib Functions
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
This is a Node-RED contrib package providing custom nodes for data analysis, matrix operations, transformations, monitoring, and utilities. Nodes process messages in real-time, supporting statistical metrics, data transformations, and system monitoring.
|
|
5
|
+
|
|
6
|
+
## Architecture
|
|
7
|
+
- **Node Structure**: Each node resides in its own directory containing:
|
|
8
|
+
- `.js`: Backend logic using Node-RED's API (e.g., `dataAnalysis/dataAnalysis.js`)
|
|
9
|
+
- `.html`: Frontend configuration UI with typed inputs (e.g., `dataAnalysis/dataAnalysis.html`)
|
|
10
|
+
- `icons/`: Custom node icons
|
|
11
|
+
- **Shared Libraries**: `lib/` holds common utilities like `common.js` (dynamic property evaluation), `objectExtensions.js` (array extensions), and domain-specific modules
|
|
12
|
+
- **Data Flow**: Nodes typically input `msg.payload`, output results to multiple ports (primary results, details/stats, outliers)
|
|
13
|
+
|
|
14
|
+
## Key Patterns
|
|
15
|
+
- **Node Registration**: Follow `RED.nodes.registerType('NodeName', function(config) { this.on('input', (msg) => { ... }); })`
|
|
16
|
+
- **Configuration Properties**: Use defaults like `dataProperty: {value:"msg.payload"}`, leverage typedInput for dynamic paths
|
|
17
|
+
- **Error Handling**: Call `node.error(message)` and update status: `node.status({fill:"red",shape:"ring",text:"shortMsg"})`
|
|
18
|
+
- **Logging**: Instantiate `const logger = new (require("node-red-contrib-logger"))("NodeName")`; use `logger.sendInfo()` for debugging
|
|
19
|
+
- **Real-time Accumulation**: Store data in `node.dataPoint[key]` objects, recalculate metrics on each input (e.g., running averages, deltas)
|
|
20
|
+
- **Dynamic Evaluation**: Use `evalInFunction(node, 'propertyName')` from `lib/common.js` to access msg/flow/global properties safely
|
|
21
|
+
- **Outlier Detection**: For realtime nodes, check against mean/median ± N standard deviations, output to third port
|
|
22
|
+
|
|
23
|
+
## Development Workflow
|
|
24
|
+
- **Testing**: Run `npm test` (mocha on `test/dataAnalysisE*.js`); use `node-red-node-test-helper` for node testing
|
|
25
|
+
- **Local Development**: `npm run startNodeRed` launches test Node-RED instance with flows in `test/data/`
|
|
26
|
+
- **Dependencies**: `npm ci` installs; requires Node >=22.15.0, Node-RED >=4.0.9; external libs like `avsc` (AVRO), `xlsx` (Excel), `fast-xml-parser` (XML)
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
- **Data Analysis**: Accumulates arrays/objects, computes stats (avg, stddev, autocorrelation); realtime mode detects outliers beyond 3σ
|
|
30
|
+
- **Transform**: Converts formats (JSON↔CSV↔XLSX↔AVRO) using dedicated libraries; supports path operations and string manipulations
|
|
31
|
+
- **Matrix**: Performs linear algebra (inverse, determinant, Gaussian elimination) on 2D arrays
|
|
32
|
+
|
|
33
|
+
## Deployment
|
|
34
|
+
- Automated npm publish on GitHub release via `.github/workflows/npmpublish.yml`
|
|
35
|
+
- Set `NODE_AUTH_TOKEN` secret for publishing</content>
|
|
36
|
+
<parameter name="filePath">c:\Users\peter\repros\node-red-contrib-prib-functions\.github\copilot-instructions.md
|
package/README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
[Node-Red][1] nodes for various functions:
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
5
|
+
* Data Analysis - statistical metrics that has real time option
|
|
6
|
+
* Matrix
|
|
7
|
+
* Transform
|
|
8
|
+
* Test
|
|
9
|
+
* Load Injector
|
|
10
|
+
* Monitor Flow
|
|
11
|
+
* append
|
|
12
|
+
* Spawn Process
|
|
13
|
+
* Host Available
|
|
14
|
+
* node.js os metrics
|
|
15
|
+
* Levenshtein Distance
|
|
16
16
|
|
|
17
17
|
------------------------------------------------------------
|
|
18
18
|
|
|
@@ -30,7 +30,8 @@ being outside 3 standard deviations from mean. This can be changed to median and
|
|
|
30
30
|
A set of data analysis functions that can be run over an array of data
|
|
31
31
|
|
|
32
32
|
Single value metrics:
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
* Autocorrelation
|
|
34
35
|
* Autocovariance
|
|
35
36
|
* Average/Mean
|
|
36
37
|
* Maximum
|
|
@@ -43,6 +44,7 @@ Single value metrics:
|
|
|
43
44
|
* Variance
|
|
44
45
|
|
|
45
46
|
Array metrics:
|
|
47
|
+
|
|
46
48
|
* Deltas
|
|
47
49
|
* Deltas Normalised
|
|
48
50
|
* difference
|
|
@@ -56,11 +58,11 @@ Array metrics:
|
|
|
56
58
|
* Standardization (Z-score Normalization)
|
|
57
59
|
|
|
58
60
|
Array data
|
|
59
|
-
|
|
61
|
+
|
|
62
|
+
* distances
|
|
60
63
|
* distance(s) minimum between points
|
|
61
64
|
* distance(s) maximum between points
|
|
62
65
|
|
|
63
|
-
|
|
64
66
|

|
|
65
67
|
|
|
66
68
|
example:
|
|
@@ -69,9 +71,18 @@ example:
|
|
|
69
71
|
|
|
70
72
|

|
|
71
73
|
|
|
72
|
-
|
|
73
74
|

|
|
74
75
|
|
|
76
|
+
------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
## logistic regression
|
|
79
|
+
|
|
80
|
+
Perform logistic regression by setting up model with fit then using the model in other nodes to do prediction probability or class
|
|
81
|
+
------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
## columnar store
|
|
84
|
+
|
|
85
|
+
Store data into a columnar store with sql select access
|
|
75
86
|
|
|
76
87
|
------------------------------------------------------------
|
|
77
88
|
|
|
@@ -79,26 +90,25 @@ example:
|
|
|
79
90
|
|
|
80
91
|
Define a matrix and perform various functions
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
* Define / Define Empty / Create / Create Like/ clone
|
|
94
|
+
* Add / Add Row to Row / Add to Cell / Add Row / Subtract Cell
|
|
95
|
+
* Multiple / Multiple Cell / Divide Cell / Divide Row
|
|
96
|
+
* Transpose
|
|
97
|
+
* Adjoint
|
|
98
|
+
* Cofactor
|
|
99
|
+
* Complement Minor
|
|
100
|
+
* Identity
|
|
101
|
+
* Inverse
|
|
102
|
+
* Determinant
|
|
103
|
+
* Backward Substitution
|
|
104
|
+
* Forward Elimination
|
|
105
|
+
* Gaussian Elimination
|
|
106
|
+
* Reduced Row EchelonForm
|
|
107
|
+
* Row Echelon Form
|
|
108
|
+
* Nearly Equals / Is Square / Get Cell
|
|
109
|
+
* Sum Row
|
|
110
|
+
* Swap Rows
|
|
111
|
+
* To Array Object
|
|
102
112
|
|
|
103
113
|

|
|
104
114
|
|
|
@@ -107,103 +117,102 @@ Define a matrix and perform various functions
|
|
|
107
117
|
## Transform
|
|
108
118
|
|
|
109
119
|
Translates a selected msg property to a target property.
|
|
110
|
-
Messages generates a message for each row or record.
|
|
120
|
+
Messages generates a message for each row or record.
|
|
111
121
|
|
|
112
122
|
Transformations:
|
|
113
123
|
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
124
|
+
* Array to
|
|
125
|
+
* CSV
|
|
126
|
+
* HTML
|
|
127
|
+
* ISO8385
|
|
128
|
+
* Messages
|
|
129
|
+
* xlsx / xlsx object (excel uses [xlsx][7])
|
|
130
|
+
* AVRO to JSON (uses [avsc][6])
|
|
131
|
+
* Buffer to compressed
|
|
132
|
+
* Confluence to JSON
|
|
133
|
+
* Compressed to
|
|
134
|
+
* Buffer
|
|
135
|
+
* String
|
|
136
|
+
* JSON
|
|
137
|
+
* CSV to
|
|
138
|
+
* Array
|
|
139
|
+
* HTML
|
|
140
|
+
* Messages
|
|
141
|
+
* CSVWithHeader to
|
|
142
|
+
* Array
|
|
143
|
+
* HTML
|
|
144
|
+
* JSON
|
|
145
|
+
* Date to
|
|
146
|
+
* is between
|
|
147
|
+
* ISO string
|
|
148
|
+
* locale string
|
|
149
|
+
* range limit
|
|
150
|
+
* ISO8385 to Array
|
|
151
|
+
* ISO8385 to JSON
|
|
152
|
+
* JSON to
|
|
153
|
+
* Array
|
|
154
|
+
* Confluence
|
|
155
|
+
* CSV
|
|
156
|
+
* AVRO (uses [avsc][6])
|
|
157
|
+
* ISO8385
|
|
158
|
+
* Messages
|
|
159
|
+
* String
|
|
160
|
+
* xlsx / xlsx object (excel uses [xlsx][7])
|
|
161
|
+
* XML (uses [fast-xml-parser][4])
|
|
152
162
|
* Number
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*
|
|
206
|
-
* XML to JSON (uses [fast-xml-parser][4])
|
|
163
|
+
* is between
|
|
164
|
+
* range limit
|
|
165
|
+
* path
|
|
166
|
+
* Basename
|
|
167
|
+
* Dirname
|
|
168
|
+
* Extname
|
|
169
|
+
* Format
|
|
170
|
+
* Is Absolute
|
|
171
|
+
* Join
|
|
172
|
+
* Parse
|
|
173
|
+
* Normalize
|
|
174
|
+
* Resolve
|
|
175
|
+
* snappy compress (uses [snappy][5], must install separately)
|
|
176
|
+
* snappy uncompress (uses [snappy][5], must install separately)
|
|
177
|
+
* String to
|
|
178
|
+
* Append
|
|
179
|
+
* Array By Delimiter
|
|
180
|
+
* At
|
|
181
|
+
* Camelize
|
|
182
|
+
* Capitalize
|
|
183
|
+
* Compressed
|
|
184
|
+
* Char At
|
|
185
|
+
* Char Code At"
|
|
186
|
+
* Code Point At
|
|
187
|
+
* Concat
|
|
188
|
+
* Date
|
|
189
|
+
* Delimiter On Case
|
|
190
|
+
* _ to space
|
|
191
|
+
* _ to space Capitilize
|
|
192
|
+
* Drop square bracket prefix
|
|
193
|
+
* Ends With
|
|
194
|
+
* Float
|
|
195
|
+
* Get Word
|
|
196
|
+
* Integer
|
|
197
|
+
* is Between
|
|
198
|
+
* Lower Case
|
|
199
|
+
* Number
|
|
200
|
+
* Prepend
|
|
201
|
+
* JSON
|
|
202
|
+
* Range Limit
|
|
203
|
+
* Split
|
|
204
|
+
* Starts With
|
|
205
|
+
* Timestamp
|
|
206
|
+
* Title
|
|
207
|
+
* Title Grammatical
|
|
208
|
+
* Trim
|
|
209
|
+
* Trim End
|
|
210
|
+
* Trim Start
|
|
211
|
+
* Upper Case
|
|
212
|
+
* Xml String Encode
|
|
213
|
+
|
|
214
|
+
* xlsx / xlsx object to array/JSON (excel uses [xlsx][7])
|
|
215
|
+
* XML to JSON (uses [fast-xml-parser][4])
|
|
207
216
|
|
|
208
217
|
Note, snappy needs to be installed separately as can have issues with auto install as build binaries.
|
|
209
218
|
|
|
@@ -213,13 +222,13 @@ Example AVRO with schema
|
|
|
213
222
|
|
|
214
223
|

|
|
215
224
|
|
|
216
|
-
For Confluence schema contains a list of schemas in form {"
|
|
225
|
+
For Confluence schema contains a list of schemas in form {"\<schema id\>",\<schema\>}
|
|
217
226
|
|
|
218
227
|
------------------------------------------------------------
|
|
219
228
|
|
|
220
229
|
## Test
|
|
221
230
|
|
|
222
|
-
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.
|
|
231
|
+
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.
|
|
223
232
|
|
|
224
233
|

|
|
225
234
|
|
|
@@ -260,11 +269,11 @@ Inject messages for a set period of time with varying think time.
|
|
|
260
269
|
Primary purpose is testing and useful for load/stress testing.
|
|
261
270
|
|
|
262
271
|
Has 3 extra data types
|
|
272
|
+
|
|
263
273
|
1. generated id - Unique id for each message
|
|
264
274
|
2. generated data - string text generated using [dummy-json][3]
|
|
265
275
|
3. generated json - json generated using [dummy-json][3]
|
|
266
276
|
|
|
267
|
-
|
|
268
277
|

|
|
269
278
|
|
|
270
279
|
Test example:
|
|
@@ -300,7 +309,7 @@ Test example:
|
|
|
300
309
|
|
|
301
310
|
------------------------------------------------------------
|
|
302
311
|
|
|
303
|
-
## Monitor System
|
|
312
|
+
## Monitor System
|
|
304
313
|
|
|
305
314
|
System monitoring metrics
|
|
306
315
|
|
|
@@ -330,7 +339,7 @@ Spawn process as per node.js manual with ability to set working directory, envir
|
|
|
330
339
|
and argument passed to process. STDOUT and STDERR are sent as individual messages.
|
|
331
340
|
RC port is sent a message on closure.
|
|
332
341
|
Takes in messages that starts a process with ability to add environment values.
|
|
333
|
-
Message can be sent to kill the process.
|
|
342
|
+
Message can be sent to kill the process.
|
|
334
343
|
|
|
335
344
|

|
|
336
345
|
|
|
@@ -340,19 +349,26 @@ Test example:
|
|
|
340
349
|
|
|
341
350
|
------------------------------------------------------------
|
|
342
351
|
|
|
343
|
-
|
|
352
|
+
## Install
|
|
344
353
|
|
|
345
354
|
Run the following command in the root directory of your Node-RED install
|
|
346
355
|
|
|
347
356
|
npm install node-red-contrib-prib-functions
|
|
348
357
|
|
|
349
|
-
|
|
358
|
+
## Tests
|
|
350
359
|
|
|
351
360
|
Test/example flow in test/generalTest.json
|
|
352
361
|
|
|
353
362
|
------------------------------------------------------------
|
|
354
363
|
|
|
355
|
-
|
|
364
|
+
## Version
|
|
365
|
+
|
|
366
|
+
0.26.0 add columnar store node with sql query capabilty
|
|
367
|
+
|
|
368
|
+
0.24.0 add in logistic regression
|
|
369
|
+
|
|
370
|
+
0.23.3 Removes bug in test, more translation
|
|
371
|
+
|
|
356
372
|
0.23.0 Removes bug in test, more translation
|
|
357
373
|
|
|
358
374
|
0.22.0 Add autocovariance + autocorealationship to real time data analystics, improves test
|
|
@@ -367,8 +383,7 @@ Test/example flow in test/generalTest.json
|
|
|
367
383
|
|
|
368
384
|
0.17.0 Add finished wire to load injector
|
|
369
385
|
|
|
370
|
-
|
|
371
|
-
# Author
|
|
386
|
+
## Author
|
|
372
387
|
|
|
373
388
|
[Peter Prib][3]
|
|
374
389
|
|
|
@@ -385,5 +400,3 @@ Test/example flow in test/generalTest.json
|
|
|
385
400
|
[6]: https://www.npmjs.com/package/avsc "avsc"
|
|
386
401
|
|
|
387
402
|
[7]: https://www.npmjs.com/package/xlsx "xlsx"
|
|
388
|
-
|
|
389
|
-
[8]: https://www.npmjs.com/package/dummy-json "dummy-json"
|