@justair/justair-library 4.8.39 → 4.8.40
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 +1 -1
- package/src/index.js +2 -0
- package/src/models/monitors.js +0 -2
- package/src/models/sampleSites.js +41 -25
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
sampleSiteAuditSchema,
|
|
66
66
|
SampleSiteAudit,
|
|
67
67
|
sampleParametersEnum,
|
|
68
|
+
sampleParameterReferenceConcentrations,
|
|
68
69
|
} from "./models/sampleSites.js";
|
|
69
70
|
|
|
70
71
|
// Samples related imports
|
|
@@ -138,6 +139,7 @@ export {
|
|
|
138
139
|
sampleSiteAuditSchema,
|
|
139
140
|
SampleSiteAudit,
|
|
140
141
|
sampleParametersEnum,
|
|
142
|
+
sampleParameterReferenceConcentrations,
|
|
141
143
|
// Samples related exports
|
|
142
144
|
samplesSchema,
|
|
143
145
|
Samples,
|
package/src/models/monitors.js
CHANGED
|
@@ -15,6 +15,21 @@ const sampleParametersEnum = [
|
|
|
15
15
|
"ZN", // Zinc
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
+
// EPA IRIS chronic inhalation reference concentrations (µg/m³)
|
|
19
|
+
// null = no established inhalation RfC
|
|
20
|
+
const sampleParameterReferenceConcentrations = {
|
|
21
|
+
C6H6: 30,
|
|
22
|
+
PB: 0,
|
|
23
|
+
AS: 0.03,
|
|
24
|
+
CD: 0.01,
|
|
25
|
+
CR: 0.1,
|
|
26
|
+
NI: null,
|
|
27
|
+
BA: null,
|
|
28
|
+
FE: null,
|
|
29
|
+
CU: null,
|
|
30
|
+
ZN: null,
|
|
31
|
+
};
|
|
32
|
+
|
|
18
33
|
const noteSchema = mongoose.Schema({
|
|
19
34
|
note: {
|
|
20
35
|
type: String,
|
|
@@ -122,6 +137,7 @@ sampleSitesSchema.pre('save', function (next) {
|
|
|
122
137
|
next();
|
|
123
138
|
});
|
|
124
139
|
|
|
140
|
+
|
|
125
141
|
// Geographic queries - already exists
|
|
126
142
|
sampleSitesSchema.index({ "location.gps": "2dsphere" }); // use location.gps for geospatial queries
|
|
127
143
|
|
|
@@ -180,18 +196,18 @@ sampleSitesSchema.pre("deleteMany", async function () {
|
|
|
180
196
|
coordinates = doc.gpsLocation.coordinates;
|
|
181
197
|
}
|
|
182
198
|
if (coordinates) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
199
|
+
return {
|
|
200
|
+
sampleSiteId: doc._id,
|
|
201
|
+
sampleSiteCode: doc.code,
|
|
202
|
+
orgId: doc.sponsor,
|
|
203
|
+
timeUpdated: doc.updatedAt,
|
|
204
|
+
sampleSiteLocation: {
|
|
205
|
+
type: "Point",
|
|
206
|
+
coordinates,
|
|
207
|
+
},
|
|
208
|
+
deletedAt: new Date(),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
195
211
|
return null;
|
|
196
212
|
}).filter(Boolean);
|
|
197
213
|
|
|
@@ -244,18 +260,18 @@ sampleSitesSchema.pre("updateMany", async function () {
|
|
|
244
260
|
coordinates = doc.gpsLocation.coordinates;
|
|
245
261
|
}
|
|
246
262
|
if (coordinates) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
263
|
+
return {
|
|
264
|
+
sampleSiteId: doc._id,
|
|
265
|
+
sampleSiteCode: doc.code,
|
|
266
|
+
orgId: doc.sponsor,
|
|
267
|
+
timeUpdated: doc.updatedAt,
|
|
268
|
+
sampleSiteLocation: {
|
|
269
|
+
type: "Point",
|
|
270
|
+
coordinates,
|
|
271
|
+
},
|
|
272
|
+
deletedAt: null, // Not a deletion, so this field is null
|
|
273
|
+
};
|
|
274
|
+
}
|
|
259
275
|
return null;
|
|
260
276
|
}).filter(Boolean);
|
|
261
277
|
|
|
@@ -268,4 +284,4 @@ sampleSitesSchema.pre("updateMany", async function () {
|
|
|
268
284
|
// Create the SampleSites model
|
|
269
285
|
const SampleSites = mongoose.model("SampleSites", sampleSitesSchema);
|
|
270
286
|
|
|
271
|
-
export { sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum };
|
|
287
|
+
export { sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, sampleParameterReferenceConcentrations };
|