vaporous 0.0.2

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.
@@ -0,0 +1,100 @@
1
+ {"deviceFirmware":"v0","deviceId":"Alice","temp":-4.884145154485708,"humidity":36.309763859511605,"energySpend":-63.80296442014473,"timestamp":"2025-09-24T21:28:27.317Z"}
2
+ {"deviceFirmware":"v1","deviceId":"Bob","temp":15.299778766475676,"humidity":4.536791222784473,"energySpend":-51.68928840145118,"timestamp":"2025-09-25T09:06:26.836Z"}
3
+ {"deviceFirmware":"v2","deviceId":"Charlie","temp":32.9446085649371,"humidity":23.779171721924428,"energySpend":27.935477717286517,"timestamp":"2025-09-26T11:08:14.542Z"}
4
+ {"deviceFirmware":"v0","deviceId":"David","temp":13.77366503376949,"humidity":68.89645859097719,"energySpend":80.84071365289262,"timestamp":"2025-09-25T02:33:25.318Z"}
5
+ {"deviceFirmware":"v1","deviceId":"Eve","temp":13.161068788169331,"humidity":76.30145579203199,"energySpend":61.18426155460156,"timestamp":"2025-09-26T04:47:48.973Z"}
6
+ {"deviceFirmware":"v2","deviceId":"Frank","temp":21.002313138306263,"humidity":18.005279221205853,"energySpend":81.76459700973359,"timestamp":"2025-09-25T04:38:14.229Z"}
7
+ {"deviceFirmware":"v0","deviceId":"Grace","temp":16.45060265856003,"humidity":59.05448533995094,"energySpend":30.706763300666182,"timestamp":"2025-09-26T09:07:01.476Z"}
8
+ {"deviceFirmware":"v1","deviceId":"Heidi","temp":28.395747090175476,"humidity":15.021825572942959,"energySpend":61.95923280169751,"timestamp":"2025-09-25T14:04:08.015Z"}
9
+ {"deviceFirmware":"v2","deviceId":"Ivan","temp":-3.588550847305946,"humidity":78.71268450050741,"energySpend":21.26707786109229,"timestamp":"2025-09-25T11:18:23.848Z"}
10
+ {"deviceFirmware":"v0","deviceId":"Judy","temp":21.45592600664559,"humidity":88.16728761791114,"energySpend":15.190010012299552,"timestamp":"2025-09-26T03:14:50.497Z"}
11
+ {"deviceFirmware":"v1","deviceId":"Alice","temp":38.123673317516136,"humidity":93.1722980959392,"energySpend":66.13364858459082,"timestamp":"2025-09-25T03:09:45.704Z"}
12
+ {"deviceFirmware":"v2","deviceId":"Bob","temp":-0.9229810055155845,"humidity":62.13238948947276,"energySpend":-30.46207444391672,"timestamp":"2025-09-26T05:49:53.368Z"}
13
+ {"deviceFirmware":"v0","deviceId":"Charlie","temp":10.329852782190088,"humidity":33.475148499748286,"energySpend":19.717169555095495,"timestamp":"2025-09-26T02:16:41.227Z"}
14
+ {"deviceFirmware":"v1","deviceId":"David","temp":-1.1045625260945577,"humidity":45.82129193371446,"energySpend":88.28740677203555,"timestamp":"2025-09-26T01:08:11.999Z"}
15
+ {"deviceFirmware":"v2","deviceId":"Eve","temp":35.86621842955927,"humidity":10.62490113856942,"energySpend":105.68057174967484,"timestamp":"2025-09-24T22:12:55.026Z"}
16
+ {"deviceFirmware":"v0","deviceId":"Frank","temp":37.314144992164586,"humidity":93.97783475256102,"energySpend":-0.40471927151807563,"timestamp":"2025-09-24T17:00:39.796Z"}
17
+ {"deviceFirmware":"v1","deviceId":"Grace","temp":28.696681891981726,"humidity":24.04243930900887,"energySpend":-89.04248855085372,"timestamp":"2025-09-24T19:49:09.502Z"}
18
+ {"deviceFirmware":"v2","deviceId":"Heidi","temp":6.433206928403315,"humidity":63.91019640963722,"energySpend":36.63706308571983,"timestamp":"2025-09-25T04:56:06.849Z"}
19
+ {"deviceFirmware":"v0","deviceId":"Ivan","temp":25.85656093098538,"humidity":57.79135675708105,"energySpend":-11.446745828773572,"timestamp":"2025-09-25T08:14:04.018Z"}
20
+ {"deviceFirmware":"v1","deviceId":"Judy","temp":-1.7942043671268308,"humidity":55.74188906774653,"energySpend":49.08351625043758,"timestamp":"2025-09-26T10:26:55.482Z"}
21
+ {"deviceFirmware":"v2","deviceId":"Alice","temp":-7.63005881354119,"humidity":16.67876125206824,"energySpend":-63.77218777401553,"timestamp":"2025-09-25T13:40:31.105Z"}
22
+ {"deviceFirmware":"v0","deviceId":"Bob","temp":1.2116695071756993,"humidity":38.347880126627075,"energySpend":102.94707425789767,"timestamp":"2025-09-25T12:25:58.930Z"}
23
+ {"deviceFirmware":"v1","deviceId":"Charlie","temp":39.07203801202451,"humidity":97.18502126611418,"energySpend":-49.00065382465445,"timestamp":"2025-09-25T03:45:04.124Z"}
24
+ {"deviceFirmware":"v2","deviceId":"David","temp":-8.958608373444555,"humidity":24.608520809340632,"energySpend":7.131142263563277,"timestamp":"2025-09-25T07:19:22.342Z"}
25
+ {"deviceFirmware":"v0","deviceId":"Eve","temp":1.0970696904051493,"humidity":54.52168714504495,"energySpend":-11.601685705973765,"timestamp":"2025-09-24T14:39:26.893Z"}
26
+ {"deviceFirmware":"v1","deviceId":"Frank","temp":-9.077161438334251,"humidity":65.19400745545587,"energySpend":99.75198973259296,"timestamp":"2025-09-24T23:46:33.948Z"}
27
+ {"deviceFirmware":"v2","deviceId":"Grace","temp":35.55192194013321,"humidity":19.505213722418162,"energySpend":29.72201498955735,"timestamp":"2025-09-26T04:54:57.328Z"}
28
+ {"deviceFirmware":"v0","deviceId":"Heidi","temp":16.861010891555992,"humidity":68.63970707328086,"energySpend":-25.73748061357334,"timestamp":"2025-09-24T18:23:10.843Z"}
29
+ {"deviceFirmware":"v1","deviceId":"Ivan","temp":-3.3234328046619055,"humidity":49.5726624334811,"energySpend":-89.60903454740003,"timestamp":"2025-09-25T19:30:14.143Z"}
30
+ {"deviceFirmware":"v2","deviceId":"Judy","temp":11.243873888824623,"humidity":12.150764150600658,"energySpend":79.75652527540106,"timestamp":"2025-09-25T01:35:44.044Z"}
31
+ {"deviceFirmware":"v0","deviceId":"Alice","temp":16.275982013136357,"humidity":72.99869145623126,"energySpend":-49.98110525942706,"timestamp":"2025-09-24T22:44:31.133Z"}
32
+ {"deviceFirmware":"v1","deviceId":"Bob","temp":31.077164351739015,"humidity":14.088223541292578,"energySpend":103.40174241551114,"timestamp":"2025-09-26T08:30:50.164Z"}
33
+ {"deviceFirmware":"v2","deviceId":"Charlie","temp":36.10949022955862,"humidity":21.681979003134288,"energySpend":92.58774727629995,"timestamp":"2025-09-25T03:02:46.387Z"}
34
+ {"deviceFirmware":"v0","deviceId":"David","temp":22.05926912557495,"humidity":10.048508208025076,"energySpend":-40.659095176878836,"timestamp":"2025-09-26T03:02:18.563Z"}
35
+ {"deviceFirmware":"v1","deviceId":"Eve","temp":29.210388568972974,"humidity":33.32174239846428,"energySpend":-34.061711758978774,"timestamp":"2025-09-25T12:32:35.664Z"}
36
+ {"deviceFirmware":"v2","deviceId":"Frank","temp":8.28640608299576,"humidity":37.084272708977736,"energySpend":-66.39739067543796,"timestamp":"2025-09-25T22:13:47.063Z"}
37
+ {"deviceFirmware":"v0","deviceId":"Grace","temp":25.836224771246478,"humidity":32.45153750256004,"energySpend":-10.111309543884644,"timestamp":"2025-09-25T03:11:00.831Z"}
38
+ {"deviceFirmware":"v1","deviceId":"Heidi","temp":23.481494886161585,"humidity":60.621683901773906,"energySpend":-22.58346384146118,"timestamp":"2025-09-24T15:14:15.419Z"}
39
+ {"deviceFirmware":"v2","deviceId":"Ivan","temp":-2.484914917318754,"humidity":8.683480700446466,"energySpend":-28.38070880840165,"timestamp":"2025-09-24T17:32:18.722Z"}
40
+ {"deviceFirmware":"v0","deviceId":"Judy","temp":-1.995533137223024,"humidity":90.51446577086165,"energySpend":-52.73084804170477,"timestamp":"2025-09-26T05:51:32.922Z"}
41
+ {"deviceFirmware":"v1","deviceId":"Alice","temp":-14.345796746037623,"humidity":12.021050259084646,"energySpend":61.18202797989602,"timestamp":"2025-09-25T11:31:02.389Z"}
42
+ {"deviceFirmware":"v2","deviceId":"Bob","temp":10.15529672130991,"humidity":22.431936809271804,"energySpend":38.48582067955664,"timestamp":"2025-09-24T21:56:37.235Z"}
43
+ {"deviceFirmware":"v0","deviceId":"Charlie","temp":38.99679594038753,"humidity":45.43908427213843,"energySpend":-30.735774777943362,"timestamp":"2025-09-26T03:47:31.996Z"}
44
+ {"deviceFirmware":"v1","deviceId":"David","temp":38.32705422389901,"humidity":93.66760037116524,"energySpend":-85.43957540099002,"timestamp":"2025-09-25T06:46:14.182Z"}
45
+ {"deviceFirmware":"v2","deviceId":"Eve","temp":31.4405301806366,"humidity":98.432474858168,"energySpend":12.591744107166292,"timestamp":"2025-09-25T10:06:09.266Z"}
46
+ {"deviceFirmware":"v0","deviceId":"Frank","temp":-14.825721242696376,"humidity":62.146555763231206,"energySpend":21.47980885274515,"timestamp":"2025-09-25T07:09:51.888Z"}
47
+ {"deviceFirmware":"v1","deviceId":"Grace","temp":-4.803128940045202,"humidity":83.91430066620688,"energySpend":-17.92418657476641,"timestamp":"2025-09-25T09:31:10.229Z"}
48
+ {"deviceFirmware":"v2","deviceId":"Heidi","temp":6.82567808851249,"humidity":31.1311633572071,"energySpend":106.41847279889711,"timestamp":"2025-09-24T20:39:20.809Z"}
49
+ {"deviceFirmware":"v0","deviceId":"Ivan","temp":3.2367990836348994,"humidity":94.87051395637474,"energySpend":94.0180708697547,"timestamp":"2025-09-25T20:51:34.335Z"}
50
+ {"deviceFirmware":"v1","deviceId":"Judy","temp":-9.097770357468882,"humidity":41.140006073126216,"energySpend":64.54849480242822,"timestamp":"2025-09-26T12:59:00.537Z"}
51
+ {"deviceFirmware":"v2","deviceId":"Alice","temp":18.758850789457234,"humidity":74.22700929595214,"energySpend":-36.79106725554849,"timestamp":"2025-09-26T02:29:48.429Z"}
52
+ {"deviceFirmware":"v0","deviceId":"Bob","temp":20.207032757961194,"humidity":35.55962152124836,"energySpend":3.1466707694120117,"timestamp":"2025-09-25T11:46:13.431Z"}
53
+ {"deviceFirmware":"v1","deviceId":"Charlie","temp":8.823682078235777,"humidity":7.933331483771447,"energySpend":-10.905303952147364,"timestamp":"2025-09-25T01:57:38.866Z"}
54
+ {"deviceFirmware":"v2","deviceId":"David","temp":19.063212196846052,"humidity":2.0061087079006086,"energySpend":-35.95790204782348,"timestamp":"2025-09-25T13:54:29.392Z"}
55
+ {"deviceFirmware":"v0","deviceId":"Eve","temp":37.62832222030859,"humidity":11.206419267857392,"energySpend":-12.395287938071235,"timestamp":"2025-09-26T00:24:06.518Z"}
56
+ {"deviceFirmware":"v1","deviceId":"Frank","temp":10.606054080796156,"humidity":38.40646367749174,"energySpend":90.69560497277749,"timestamp":"2025-09-24T19:31:34.784Z"}
57
+ {"deviceFirmware":"v2","deviceId":"Grace","temp":4.47557962226351,"humidity":60.73502135355716,"energySpend":28.060095793235632,"timestamp":"2025-09-25T13:57:49.354Z"}
58
+ {"deviceFirmware":"v0","deviceId":"Heidi","temp":-4.95880039820312,"humidity":37.20492200926827,"energySpend":11.72438467378835,"timestamp":"2025-09-25T23:54:33.914Z"}
59
+ {"deviceFirmware":"v1","deviceId":"Ivan","temp":7.430391777875627,"humidity":93.80827141410089,"energySpend":-79.27033930018467,"timestamp":"2025-09-25T04:54:35.314Z"}
60
+ {"deviceFirmware":"v2","deviceId":"Judy","temp":21.09282433584181,"humidity":47.675402429414504,"energySpend":-14.276883579607983,"timestamp":"2025-09-25T14:54:23.776Z"}
61
+ {"deviceFirmware":"v0","deviceId":"Alice","temp":12.870484774114807,"humidity":72.20968869679503,"energySpend":-88.12313976908631,"timestamp":"2025-09-26T05:12:14.178Z"}
62
+ {"deviceFirmware":"v1","deviceId":"Bob","temp":-6.6477639092631975,"humidity":42.274231117677914,"energySpend":-68.59791837501433,"timestamp":"2025-09-24T17:13:10.909Z"}
63
+ {"deviceFirmware":"v2","deviceId":"Charlie","temp":4.28842355132214,"humidity":25.467587446117932,"energySpend":75.44022097307044,"timestamp":"2025-09-25T05:58:32.132Z"}
64
+ {"deviceFirmware":"v0","deviceId":"David","temp":-5.433785590325186,"humidity":33.61984737480972,"energySpend":70.0475708489162,"timestamp":"2025-09-26T13:43:17.382Z"}
65
+ {"deviceFirmware":"v1","deviceId":"Eve","temp":17.346702383378897,"humidity":16.218367691016738,"energySpend":-37.71289945610584,"timestamp":"2025-09-24T23:24:12.597Z"}
66
+ {"deviceFirmware":"v2","deviceId":"Frank","temp":4.9619363541306996,"humidity":33.0667870148182,"energySpend":-25.628072073195668,"timestamp":"2025-09-25T16:21:44.611Z"}
67
+ {"deviceFirmware":"v0","deviceId":"Grace","temp":6.345382868533662,"humidity":48.48255607486942,"energySpend":61.16634026849013,"timestamp":"2025-09-25T12:27:35.869Z"}
68
+ {"deviceFirmware":"v1","deviceId":"Heidi","temp":10.712766310158543,"humidity":60.20069816673066,"energySpend":-57.36274270576388,"timestamp":"2025-09-25T02:09:41.683Z"}
69
+ {"deviceFirmware":"v2","deviceId":"Ivan","temp":37.20478177718786,"humidity":61.48403065475972,"energySpend":14.259870497139232,"timestamp":"2025-09-25T05:52:16.452Z"}
70
+ {"deviceFirmware":"v0","deviceId":"Judy","temp":20.251900763689804,"humidity":61.20019447660259,"energySpend":25.935198724227106,"timestamp":"2025-09-25T05:57:56.631Z"}
71
+ {"deviceFirmware":"v1","deviceId":"Alice","temp":29.366706141430434,"humidity":16.482826656973828,"energySpend":26.548286422342386,"timestamp":"2025-09-25T18:18:02.473Z"}
72
+ {"deviceFirmware":"v2","deviceId":"Bob","temp":32.36549856960705,"humidity":65.3802624911241,"energySpend":-63.49156479736245,"timestamp":"2025-09-26T06:32:26.640Z"}
73
+ {"deviceFirmware":"v0","deviceId":"Charlie","temp":-3.8703314451627797,"humidity":72.71552499719212,"energySpend":-65.02785747513406,"timestamp":"2025-09-26T00:23:36.078Z"}
74
+ {"deviceFirmware":"v1","deviceId":"David","temp":-13.359888486351805,"humidity":46.320662566862296,"energySpend":92.67499388597153,"timestamp":"2025-09-25T11:09:14.232Z"}
75
+ {"deviceFirmware":"v2","deviceId":"Eve","temp":4.43801019416253,"humidity":71.29954722727724,"energySpend":4.028701232932477,"timestamp":"2025-09-25T15:37:51.409Z"}
76
+ {"deviceFirmware":"v0","deviceId":"Frank","temp":-13.388979226905509,"humidity":62.3713501848582,"energySpend":-31.73269580883465,"timestamp":"2025-09-24T19:12:18.601Z"}
77
+ {"deviceFirmware":"v1","deviceId":"Grace","temp":2.3927037770459023,"humidity":63.52264804868754,"energySpend":-89.74725331697032,"timestamp":"2025-09-24T15:24:49.464Z"}
78
+ {"deviceFirmware":"v2","deviceId":"Heidi","temp":25.100318178421,"humidity":3.478499867514209,"energySpend":-24.85610779363482,"timestamp":"2025-09-24T16:52:16.982Z"}
79
+ {"deviceFirmware":"v0","deviceId":"Ivan","temp":3.8146459062779456,"humidity":82.90817151025084,"energySpend":-32.202430282071816,"timestamp":"2025-09-26T13:14:27.221Z"}
80
+ {"deviceFirmware":"v1","deviceId":"Judy","temp":13.374752524141684,"humidity":93.55153518038443,"energySpend":-24.821838667054422,"timestamp":"2025-09-25T17:50:27.850Z"}
81
+ {"deviceFirmware":"v2","deviceId":"Alice","temp":-7.1461864262251,"humidity":88.50632138307185,"energySpend":40.80533570785482,"timestamp":"2025-09-25T12:48:24.570Z"}
82
+ {"deviceFirmware":"v0","deviceId":"Bob","temp":33.830147148249594,"humidity":12.242228277831437,"energySpend":28.161688338963586,"timestamp":"2025-09-25T17:10:15.970Z"}
83
+ {"deviceFirmware":"v1","deviceId":"Charlie","temp":21.17598232102032,"humidity":27.604346042224662,"energySpend":-87.75223902226777,"timestamp":"2025-09-24T23:57:03.260Z"}
84
+ {"deviceFirmware":"v2","deviceId":"David","temp":-15.67983115593963,"humidity":7.756938076696862,"energySpend":87.19457004066408,"timestamp":"2025-09-25T02:14:49.463Z"}
85
+ {"deviceFirmware":"v0","deviceId":"Eve","temp":10.419340613243278,"humidity":53.51054438485106,"energySpend":95.0590971163297,"timestamp":"2025-09-25T10:11:36.837Z"}
86
+ {"deviceFirmware":"v1","deviceId":"Frank","temp":-12.010165069267309,"humidity":47.05082193398245,"energySpend":-13.552750462823724,"timestamp":"2025-09-25T04:17:10.531Z"}
87
+ {"deviceFirmware":"v2","deviceId":"Grace","temp":37.23197840589458,"humidity":33.85946659591326,"energySpend":21.649660311995277,"timestamp":"2025-09-25T20:57:36.014Z"}
88
+ {"deviceFirmware":"v0","deviceId":"Heidi","temp":-7.517989841858611,"humidity":35.7848032923535,"energySpend":31.866414568144194,"timestamp":"2025-09-24T23:37:37.676Z"}
89
+ {"deviceFirmware":"v1","deviceId":"Ivan","temp":-15.781846338388624,"humidity":59.619649171574295,"energySpend":38.93040751541554,"timestamp":"2025-09-25T18:57:06.032Z"}
90
+ {"deviceFirmware":"v2","deviceId":"Judy","temp":-10.21636856496923,"humidity":92.20114209528782,"energySpend":-87.61898615825193,"timestamp":"2025-09-25T00:55:04.891Z"}
91
+ {"deviceFirmware":"v0","deviceId":"Alice","temp":35.20148476206871,"humidity":16.70168598001642,"energySpend":-9.422110175077776,"timestamp":"2025-09-25T07:52:18.974Z"}
92
+ {"deviceFirmware":"v1","deviceId":"Bob","temp":18.653621232087374,"humidity":12.492547799339746,"energySpend":37.849391308084364,"timestamp":"2025-09-25T11:42:22.690Z"}
93
+ {"deviceFirmware":"v2","deviceId":"Charlie","temp":4.374268178660955,"humidity":44.53832349689736,"energySpend":9.027879713126183,"timestamp":"2025-09-25T03:18:55.580Z"}
94
+ {"deviceFirmware":"v0","deviceId":"David","temp":21.16587451133512,"humidity":66.52703620471796,"energySpend":18.408726138724276,"timestamp":"2025-09-25T08:24:31.595Z"}
95
+ {"deviceFirmware":"v1","deviceId":"Eve","temp":23.31936723335008,"humidity":95.17594723023012,"energySpend":27.866226171510974,"timestamp":"2025-09-25T08:11:58.394Z"}
96
+ {"deviceFirmware":"v2","deviceId":"Frank","temp":9.070705499691265,"humidity":22.983862002515764,"energySpend":-10.975966991711687,"timestamp":"2025-09-26T07:42:27.122Z"}
97
+ {"deviceFirmware":"v0","deviceId":"Grace","temp":6.531529386607154,"humidity":4.211315047755917,"energySpend":3.7257552750537997,"timestamp":"2025-09-26T10:57:30.076Z"}
98
+ {"deviceFirmware":"v1","deviceId":"Heidi","temp":-12.093024437491922,"humidity":32.66523700895408,"energySpend":58.45786059947912,"timestamp":"2025-09-24T19:08:57.334Z"}
99
+ {"deviceFirmware":"v2","deviceId":"Ivan","temp":33.32451530523848,"humidity":91.70291514315608,"energySpend":57.40707195304327,"timestamp":"2025-09-24T18:24:18.084Z"}
100
+ {"deviceFirmware":"v0","deviceId":"Judy","temp":-13.894747327470103,"humidity":4.851544701753063,"energySpend":-74.64917928719204,"timestamp":"2025-09-25T16:36:23.277Z"}
@@ -0,0 +1,98 @@
1
+ const { Vaporous, By, Aggregation, Window } = require("../../Vaporous")
2
+ const { generateData, dataFolder } = require("./sensor_data")
3
+
4
+ generateData()
5
+
6
+ const main = async () => {
7
+
8
+ const sensors = await new Vaporous()
9
+ // Load folder and files
10
+ .fileScan(dataFolder)
11
+ .fileLoad('\n', event => JSON.parse(event))
12
+
13
+ sensors
14
+ .flatten()
15
+
16
+ // Parse timestamps and make variables accessible
17
+ .eval(event => event._raw)
18
+ .parseTime('timestamp')
19
+ .bin('timestamp', 10000)
20
+ .sort('dsc', 'deviceId')
21
+
22
+ // Create streamstats and eventstats
23
+ .streamstats(
24
+ new Aggregation('temp', 'sum', 'streamBySum'),
25
+ new Aggregation('temp', 'list', 'streamByList'),
26
+ new By('deviceId')
27
+ )
28
+ .streamstats(
29
+ new Aggregation('temp', 'sum', 'streamWindowSum'),
30
+ new Aggregation('temp', 'list', 'streamWindowList'),
31
+ new Window(100)
32
+ )
33
+ .eventstats(
34
+ new Aggregation('temp', 'median', 'eventMedian'),
35
+ new Aggregation('temp', 'count', 'eventCount'),
36
+ new Aggregation('temp', 'sum', 'eventSum'),
37
+ new By('deviceId')
38
+ )
39
+ // Evaluate the accuracy of streamstats and eventstats
40
+ .assert((event, i, { expect }) => {
41
+ if (i === 0) {
42
+ expect(event.streamWindowList.length === 1)
43
+ expect(event.streamByList.length === 1)
44
+ expect(event.streamBySum === event.streamWindowSum)
45
+ expect(event.eventCount === 100)
46
+ } else if (i % 100 === 99) {
47
+ expect(event.streamWindowList.length === 100)
48
+ expect(event.streamByList.length === 100)
49
+ expect(Math.floor(event.streamWindowSum) === Math.floor(event.streamBySum))
50
+ expect(Math.floor(event.streamWindowSum) === Math.floor(event.eventSum))
51
+ expect(event.eventCount === 100)
52
+ } else if (i % 100 === 0) {
53
+ expect(event.streamWindowList.length === 100)
54
+ expect(event.streamByList.length === 1)
55
+ expect(event.eventCount === 100)
56
+ }
57
+ })
58
+ .table(event => ({
59
+ deviation: Math.round((event.temp - event.eventMedian) / event.eventMedian * 100),
60
+ median: event.eventMedian,
61
+ temp: event.temp,
62
+ time: event.timestamp,
63
+ deviceId: event.deviceId,
64
+ variant: ['sensora', 'sensorb', 'sensorc']
65
+ }))
66
+ .output()
67
+ .mvexpand('variant')
68
+ .eval(event => {
69
+ if (event.variant === 'sensorb') event.temp = event.temp - 1
70
+ })
71
+ .output()
72
+ .checkpoint('create', 'temperatureData')
73
+ .toGraph('time', 'temp', 'variant', 'deviceId', {
74
+ y1Type: 'bars',
75
+ stacked: true,
76
+ y2Type: 'lines',
77
+ y2: ['sensorb'],
78
+ sortX: 'asc'
79
+ })
80
+ .build('Raw Temp', 'Table', {
81
+ tab: "Example Table",
82
+ columns: 3
83
+ })
84
+ .build('Temp by device - ', 'LineChart', {
85
+ tab: "Example Graphs",
86
+ columns: 4
87
+ })
88
+
89
+ // .checkpoint('retrieve', 'temperatureData')
90
+ // .toGraph('time', 'deviation', 'deviceId')
91
+ // .build('Offset temp', 'Table')
92
+ // .build('Offset temp', 'LineChart')
93
+ // .sort('asc', '_time')
94
+
95
+ .render()
96
+ }
97
+
98
+ main()
@@ -0,0 +1,2 @@
1
+ node createDataset.js
2
+ node query.js
@@ -0,0 +1,55 @@
1
+ const files = 10;
2
+ const observations = 100;
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const deviceAlias = ['Alice', 'Bob', 'Charlie', 'David', 'Eve', 'Frank', 'Grace', 'Heidi', 'Ivan', 'Judy'];
8
+ const deviceFirmware = ['v0', 'v1', 'v2']
9
+ const dataFolder = __dirname + '/exampleData'
10
+
11
+ const jitter = (base, variance) => {
12
+ return base + (Math.random() * variance * 2) - variance
13
+ }
14
+
15
+ const now = new Date().valueOf()
16
+
17
+ const sensorEvent = (i) => {
18
+ return {
19
+ deviceFirmware: deviceFirmware[i % deviceFirmware.length],
20
+ deviceId: deviceAlias[i % deviceAlias.length],
21
+
22
+ temp: jitter(12, 28),
23
+ humidity: jitter(50, 50),
24
+ energySpend: jitter(10, 100),
25
+
26
+ timestamp: new Date(jitter(now, 24 * 60 * 60 * 1000)).toISOString(),
27
+ }
28
+ }
29
+
30
+
31
+
32
+ const generateData = () => {
33
+ try {
34
+ fs.mkdirSync(dataFolder)
35
+ } catch (err) {
36
+ if (err.code != "EEXIST") throw err;
37
+
38
+ for (let i = 0; i < files; i++) {
39
+ const name = `temp_${i.toString().padStart(1, '0')}_10.jsonStream`
40
+
41
+ const lines = []
42
+ for (let i = 0; i < observations; i++) {
43
+ lines.push(JSON.stringify(sensorEvent(i)))
44
+ }
45
+
46
+ fs.writeFileSync(path.resolve(dataFolder, name), lines.join('\n'))
47
+ }
48
+ }
49
+ }
50
+
51
+ module.exports = {
52
+ sensorEvent,
53
+ generateData,
54
+ dataFolder
55
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "vaporous",
3
+ "version": "0.0.2",
4
+ "description": "Transition data to different structured states for analytical processing",
5
+ "main": "Vaporous.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Kashrian Singh",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "dayjs": "^1.11.18",
13
+ "split2": "^4.2.0"
14
+ }
15
+ }
package/styles.css ADDED
@@ -0,0 +1,79 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap');
2
+
3
+ body {
4
+ font-family: 'Roboto', Arial, sans-serif;
5
+ }
6
+
7
+ /* Chart-specific styles */
8
+ .chart,
9
+ .chart-container,
10
+ canvas,
11
+ svg,
12
+ .chartjs-render-monitor {
13
+ font-family: 'Roboto', Arial, sans-serif !important;
14
+ }
15
+
16
+ body {
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ .tabBar {
22
+ display: flex;
23
+ background: #dcdcdc;
24
+ overflow: hidden;
25
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
26
+ margin-bottom: 8px;
27
+ width: 100%;
28
+ height: 32px;
29
+ }
30
+
31
+ .tabs {
32
+ flex: 1;
33
+ padding: 8px 20px;
34
+ cursor: pointer;
35
+ background: none;
36
+ border: none;
37
+ outline: none;
38
+ font-size: 1rem;
39
+ color: #555;
40
+ transition: background 0.3s, color 0.3s;
41
+ text-align: center;
42
+ }
43
+
44
+ .tabs:not(.selectedTab):hover {
45
+ background: #e0e0e0;
46
+ color: #222;
47
+ }
48
+
49
+ .selectedTab {
50
+ background: #1976d2;
51
+ color: #fff;
52
+ font-weight: bold;
53
+ box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
54
+ transition: background 0.3s, color 0.3s;
55
+ }
56
+
57
+ #content {
58
+ display: flex;
59
+ flex-wrap: wrap;
60
+ padding: 0px;
61
+ }
62
+
63
+ .parentHolder {
64
+ display: flex;
65
+ margin: 2px;
66
+ border: 1px solid #d3d3d3;
67
+ }
68
+
69
+ .parentHolder::after {
70
+ border: 2px solid red;
71
+ /* Change color and width as needed */
72
+ pointer-events: none;
73
+ z-index: 2;
74
+ }
75
+
76
+ .tabContent {
77
+ opacity: 1;
78
+ transition: opacity 0.3s,
79
+ }
@@ -0,0 +1,53 @@
1
+ class Aggregation {
2
+ constructor(field, type, outputField = field, options) {
3
+ this.type = type;
4
+ this.field = field;
5
+ this.outputField = outputField
6
+ this.options = options;
7
+ this.sortable = ['max', 'min', 'percentile', 'median'].includes(type)
8
+ }
9
+
10
+ count(values) {
11
+ return values.length
12
+ }
13
+
14
+ distinctCount(values) {
15
+ return new Set(values).size
16
+ }
17
+
18
+ list(values) {
19
+ return values;
20
+ }
21
+
22
+ values(values) {
23
+ return [...new Set(values)];
24
+ }
25
+
26
+ calculate(statObj) {
27
+ return this[this.type](statObj._statsRaw[this.field])
28
+ }
29
+
30
+ max(values) {
31
+ return values[values.length - 1]
32
+ }
33
+
34
+ min(values) {
35
+ return values[0]
36
+ }
37
+
38
+ percentile(values) {
39
+ const index = Math.round(this.options / 100 * (values.length - 1));
40
+ return values[index]
41
+ }
42
+
43
+ median(values) {
44
+ const index = Math.floor((values.length - 1) / 2);
45
+ return values[index]
46
+ }
47
+
48
+ sum(values) {
49
+ return values.reduce((a, b) => a + b, 0)
50
+ }
51
+ }
52
+
53
+ module.exports = Aggregation
package/types/By.js ADDED
@@ -0,0 +1,7 @@
1
+ class By {
2
+ constructor(bySplit) {
3
+ this.bySplit = bySplit;
4
+ }
5
+ }
6
+
7
+ module.exports = By
@@ -0,0 +1,7 @@
1
+ class Window {
2
+ constructor(size) {
3
+ this.size = size;
4
+ }
5
+ }
6
+
7
+ module.exports = Window;