@justair/justair-library 4.8.39 → 4.8.41
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/src/models/samples.js +17 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
Samples,
|
|
74
74
|
samplesAuditSchema,
|
|
75
75
|
SamplesAudit,
|
|
76
|
+
sampleParameterReferenceConcentrations,
|
|
76
77
|
} from "./models/samples.js";
|
|
77
78
|
|
|
78
79
|
export function createLoggerInstance({ DATADOG_API_KEY, APPLICATION_NAME }) {
|
|
@@ -143,4 +144,5 @@ export {
|
|
|
143
144
|
Samples,
|
|
144
145
|
samplesAuditSchema,
|
|
145
146
|
SamplesAudit,
|
|
147
|
+
sampleParameterReferenceConcentrations,
|
|
146
148
|
};
|
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 };
|
package/src/models/samples.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
2
|
|
|
3
|
+
// EPA IRIS chronic inhalation reference concentrations (µg/m³)
|
|
4
|
+
// null = no established inhalation RfC
|
|
5
|
+
// Moved here from sampleSites.js because reference concentrations are directly related to sample validation and comparison logic, not site metadata. Centralizing them in the samples model improves maintainability and keeps sample-related constants together.
|
|
6
|
+
const sampleParameterReferenceConcentrations = {
|
|
7
|
+
C6H6: 30,
|
|
8
|
+
PB: 0,
|
|
9
|
+
AS: 0.03,
|
|
10
|
+
CD: 0.01,
|
|
11
|
+
CR: 0.1,
|
|
12
|
+
NI: null,
|
|
13
|
+
BA: null,
|
|
14
|
+
FE: null,
|
|
15
|
+
CU: null,
|
|
16
|
+
ZN: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
3
19
|
// Samples Audit Schema
|
|
4
20
|
const samplesAuditSchema = mongoose.Schema(
|
|
5
21
|
{
|
|
@@ -162,4 +178,4 @@ samplesSchema.pre("updateMany", async function () {
|
|
|
162
178
|
|
|
163
179
|
// Create the SampleSites model
|
|
164
180
|
const Samples = mongoose.model("Samples", samplesSchema);
|
|
165
|
-
export { samplesSchema, Samples, SamplesAudit, samplesAuditSchema };
|
|
181
|
+
export { samplesSchema, Samples, SamplesAudit, samplesAuditSchema, sampleParameterReferenceConcentrations };
|