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.
Files changed (58) hide show
  1. package/.github/copilot-instructions.md +36 -0
  2. package/README.md +153 -140
  3. package/columnar/columnar.html +258 -0
  4. package/columnar/columnar.js +1055 -0
  5. package/columnar/icons/columnar.svg +38 -0
  6. package/fileSystem/filesystem.html +299 -0
  7. package/fileSystem/filesystem.js +170 -0
  8. package/gitlab/gitlab.html +191 -0
  9. package/gitlab/gitlab.js +248 -0
  10. package/gitlab/icons/gitlab.svg +17 -0
  11. package/lib/AlphaBeta.js +32 -0
  12. package/lib/GraphDB.js +40 -9
  13. package/lib/MinMax.js +17 -0
  14. package/lib/Tree.js +64 -0
  15. package/lib/objectExtensions.js +28 -5
  16. package/lib/timeDimension.js +36 -0
  17. package/lib/typedInput.js +18 -2
  18. package/logisticRegression/icons/logisticregression.svg +22 -0
  19. package/logisticRegression/logisticRegression.html +136 -0
  20. package/logisticRegression/logisticRegression.js +83 -0
  21. package/package.json +21 -9
  22. package/test/02-graphdb.js +46 -0
  23. package/test/columnar.js +509 -0
  24. package/test/data/.config.nodes.json +114 -70
  25. package/test/data/.config.nodes.json.backup +104 -71
  26. package/test/data/.config.runtime.json +2 -1
  27. package/test/data/.config.runtime.json.backup +2 -1
  28. package/test/data/.config.users.json +3 -2
  29. package/test/data/.config.users.json.backup +3 -2
  30. package/test/data/.flow.json.backup +1545 -369
  31. package/test/data/flow.json +1457 -270
  32. package/test/data/package-lock.json +11 -11
  33. package/test/data/shares/.config.nodes.json +611 -0
  34. package/test/data/shares/.config.nodes.json.backup +589 -0
  35. package/test/data/shares/.config.runtime.json +5 -0
  36. package/test/data/shares/.config.runtime.json.backup +4 -0
  37. package/test/data/shares/.config.users.json +33 -0
  38. package/test/data/shares/.config.users.json.backup +33 -0
  39. package/test/data/shares/.flow.json.backup +230 -0
  40. package/test/data/shares/.flow_cred.json.backup +3 -0
  41. package/test/data/shares/flow.json +267 -0
  42. package/test/data/shares/flow_cred.json +3 -0
  43. package/test/data/shares/package.json +6 -0
  44. package/test/data/shares/settings.js +544 -0
  45. package/test/dataAnalysisExtensions.js +93 -93
  46. package/test/logisticRegression.js +379 -0
  47. package/test/transform.js +11 -11
  48. package/test/transformConfluence.js +4 -2
  49. package/test/transformNumPy.js +3 -1
  50. package/test/transformXLSX.js +4 -2
  51. package/test/transformXML.js +4 -2
  52. package/test-runner.js +400 -0
  53. package/test.parq +0 -0
  54. package/test_select.js +37 -0
  55. package/testing/test.js +8 -7
  56. package/transform/transform.html +23 -2
  57. package/transform/transform.js +239 -283
  58. 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
- * 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
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
- * autocorrelation
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
- * distances
61
+
62
+ * distances
60
63
  * distance(s) minimum between points
61
64
  * distance(s) maximum between points
62
65
 
63
-
64
66
  ![Data Analysis](documentation/DataAnalysis.JPG "Data Analysis")
65
67
 
66
68
  example:
@@ -69,9 +71,18 @@ example:
69
71
 
70
72
  ![Data Analysis Pearson R example](documentation/DataAnalysisTestPearsonR.JPG "Data Analysis PearsonR example")
71
73
 
72
-
73
74
  ![Data Analysis example](documentation/DataAnalysisTest.JPG "Data Analysis example")
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
- * Define / Define Empty / Create / Create Like/ clone
83
- * Add / Add Row to Row / Add to Cell / Add Row / Subtract Cell
84
- * Multiple / Multiple Cell / Divide Cell / Divide Row
85
- * Transpose
86
- * Adjoint
87
- * Cofactor
88
- * Complement Minor
89
- * Identity
90
- * Inverse
91
- * Determinant
92
- * Backward Substitution
93
- * Forward Elimination
94
- * Gaussian Elimination
95
- * Reduced Row EchelonForm
96
- * Row Echelon Form
97
- * Nearly Equals / Is Square / Get Cell
98
- * Sum Row
99
- * Swap Rows
100
- * To Array Object
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
  ![Matrix](documentation/matrix.jpg "Matrix")
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
- * Array to
115
- * CSV
116
- * HTML
117
- * ISO8385
118
- * Messages
119
- * xlsx / xlsx object (excel uses [xlsx][7])
120
- * AVRO to JSON (uses [avsc][6])
121
- * Buffer to compressed
122
- * Confluence to JSON
123
- * Compressed to
124
- * Buffer
125
- * String
126
- * JSON
127
- * CSV to
128
- * Array
129
- * HTML
130
- * Messages
131
- * CSVWithHeader to
132
- * Array
133
- * HTML
134
- * JSON
135
- * Date to
136
- * is between
137
- * ISO string
138
- * locale string
139
- * range limit
140
- * ISO8385 to Array
141
- * ISO8385 to JSON
142
- * JSON to
143
- * Array
144
- * Confluence
145
- * CSV
146
- * AVRO (uses [avsc][6])
147
- * ISO8385
148
- * Messages
149
- * String
150
- * xlsx / xlsx object (excel uses [xlsx][7])
151
- * XML (uses [fast-xml-parser][4])
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
- * is between
154
- * range limit
155
- * path
156
- * Basename
157
- * Dirname
158
- * Extname
159
- * Format
160
- * Is Absolute
161
- * Join
162
- * Parse
163
- * Normalize
164
- * Resolve
165
- * snappy compress (uses [snappy][5], must install separately)
166
- * snappy uncompress (uses [snappy][5], must install separately)
167
- * String to
168
- * Append
169
- * Array By Delimiter
170
- * At
171
- * Camelize
172
- * Capitalize
173
- * Compressed
174
- * Char At
175
- * Char Code At"
176
- * Code Point At
177
- * Concat
178
- * Date
179
- * Delimiter On Case
180
- * _ to space
181
- * _ to space Capitilize
182
- * Drop square bracket prefix
183
- * Ends With
184
- * Float
185
- * Get Word
186
- * Integer
187
- * is Between
188
- * Lower Case
189
- * Number
190
- * Prepend
191
- * JSON
192
- * Range Limit
193
- * Split
194
- * Starts With
195
- * Timestamp
196
- * Title
197
- * Title Grammatical
198
- * Trim
199
- * Trim End
200
- * Trim Start
201
- * Upper Case
202
- * Xml String Encode
203
-
204
-
205
- * xlsx / xlsx object to array/JSON (excel uses [xlsx][7])
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
  ![Transform AVRO](documentation/transformArvo.jpg "Transform AVRO example")
215
224
 
216
- For Confluence schema contains a list of schemas in form {"<schema id>",<schema>}
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
  ![Test](documentation/Test.JPG "Test")
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
  ![Load Injector](documentation/loadInjector.png "Load Injector")
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
  ![Spawn Process](documentation/SpawnProcess.JPG "Spawn Process")
336
345
 
@@ -340,19 +349,26 @@ Test example:
340
349
 
341
350
  ------------------------------------------------------------
342
351
 
343
- # Install
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
- # Tests
358
+ ## Tests
350
359
 
351
360
  Test/example flow in test/generalTest.json
352
361
 
353
362
  ------------------------------------------------------------
354
363
 
355
- # Version
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"