@justair/justair-library 4.8.50 → 4.9.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/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -22,10 +22,6 @@ import {
|
|
|
22
22
|
deploymentTypesEnum,
|
|
23
23
|
} from "./models/monitors.js";
|
|
24
24
|
import { organizationsSchema, Organizations } from "./models/organizations.js";
|
|
25
|
-
import {
|
|
26
|
-
referenceMonitorInfoSchema,
|
|
27
|
-
ReferenceMonitorInfo,
|
|
28
|
-
} from "./models/referenceMonitorInfo.js";
|
|
29
25
|
import { lightMonitorSchema, LightMonitors } from "./models/lightmonitors.js";
|
|
30
26
|
import {
|
|
31
27
|
monitorSuppliersSchema,
|
|
@@ -56,6 +52,7 @@ import {
|
|
|
56
52
|
dataCompletenessSchema,
|
|
57
53
|
} from "./models/dataCompleteness.js";
|
|
58
54
|
import { NetworkMetrics, networkMetricsSchema } from "./models/networkMetrics.js";
|
|
55
|
+
import { RateOfChange, rateOfChangeSchema } from "./models/rateOfChange.js";
|
|
59
56
|
import Database from "./config/db.js"; // Import the new Database class
|
|
60
57
|
import CustomLogger from "./config/logger.js";
|
|
61
58
|
|
|
@@ -95,8 +92,6 @@ export {
|
|
|
95
92
|
Monitors,
|
|
96
93
|
organizationsSchema,
|
|
97
94
|
Organizations,
|
|
98
|
-
referenceMonitorInfoSchema,
|
|
99
|
-
ReferenceMonitorInfo,
|
|
100
95
|
usersSchema,
|
|
101
96
|
Users,
|
|
102
97
|
eventsSchema,
|
|
@@ -135,6 +130,8 @@ export {
|
|
|
135
130
|
DataCompleteness,
|
|
136
131
|
networkMetricsSchema,
|
|
137
132
|
NetworkMetrics,
|
|
133
|
+
rateOfChangeSchema,
|
|
134
|
+
RateOfChange,
|
|
138
135
|
// SampleSites related exports
|
|
139
136
|
sampleSitesSchema,
|
|
140
137
|
SampleSites,
|
|
@@ -18,6 +18,7 @@ const monitorSuppliersSchema = mongoose.Schema(
|
|
|
18
18
|
authenticationStructure: [String],
|
|
19
19
|
defaultParameterThresholds: Object,
|
|
20
20
|
defaultCompletenessThresholdCount: Number,
|
|
21
|
+
defaultRateOfChangeThresholds: Object,
|
|
21
22
|
runFrequencyMinutes: { type: Number, default: 5 },
|
|
22
23
|
aqiServiceRunMinute: { type: Number, default: 5 },
|
|
23
24
|
lastSuccessfulRun: Date,
|
package/src/models/monitors.js
CHANGED
|
@@ -265,6 +265,7 @@ const monitorsSchema = mongoose.Schema(
|
|
|
265
265
|
parameterThresholds: Object,
|
|
266
266
|
completionPercentageThresholds: Object,
|
|
267
267
|
anomalyPercentageThresholds: Object,
|
|
268
|
+
rateOfChangeThresholds: Object,
|
|
268
269
|
// A Map, keyed by pollutant (e.g. "PM2_5"), storing Correction sub-docs
|
|
269
270
|
corrections: {
|
|
270
271
|
type: Map,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
const rateOfChangeSchema = mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
monitorId: { type: mongoose.Types.ObjectId, ref: "Monitors" },
|
|
6
|
+
monitorSupplier: String,
|
|
7
|
+
parameter: String,
|
|
8
|
+
hourStart: Date,
|
|
9
|
+
hourEnd: Date,
|
|
10
|
+
previousHourStart: Date,
|
|
11
|
+
previousHourEnd: Date,
|
|
12
|
+
hourlyAvg: { type: Number, default: null },
|
|
13
|
+
previousHourlyAvg: { type: Number, default: null },
|
|
14
|
+
absoluteDifference: Number,
|
|
15
|
+
flags: Object,
|
|
16
|
+
},
|
|
17
|
+
{ timestamps: true }
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
rateOfChangeSchema.index({
|
|
21
|
+
monitorId: 1,
|
|
22
|
+
parameter: 1,
|
|
23
|
+
hourStart: 1,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
rateOfChangeSchema.index({
|
|
27
|
+
monitorId: 1,
|
|
28
|
+
hourStart: 1,
|
|
29
|
+
flags: 1,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const RateOfChange = mongoose.model("RateOfChange", rateOfChangeSchema);
|
|
33
|
+
|
|
34
|
+
export { rateOfChangeSchema, RateOfChange };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
const referenceMonitorInfoSchema = mongoose.Schema({
|
|
4
|
-
bboxStartLat: String,
|
|
5
|
-
bboxStartLong: String,
|
|
6
|
-
bboxEndLat: String,
|
|
7
|
-
bboxEndLong: String,
|
|
8
|
-
parameters: String,
|
|
9
|
-
sponsor: { type: mongoose.Types.ObjectId, ref: 'Organizations' },
|
|
10
|
-
location: Object,
|
|
11
|
-
isActive: { type: Boolean, default: true },
|
|
12
|
-
context: [String]
|
|
13
|
-
}, {
|
|
14
|
-
timestamps: true
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const ReferenceMonitorInfo = mongoose.model('ReferenceMonitorInfo', referenceMonitorInfoSchema);
|
|
18
|
-
|
|
19
|
-
export {referenceMonitorInfoSchema, ReferenceMonitorInfo};
|