@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "4.8.39",
3
+ "version": "4.8.40",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
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,
@@ -3,12 +3,10 @@ const parametersEnum = [
3
3
  "NO2",
4
4
  "SO2",
5
5
  "PM2.5",
6
- "PM2_5",
7
6
  "PM10",
8
7
  "Temperature",
9
8
  "Humidity",
10
9
  "OZONE",
11
- "O3",
12
10
  "VOC",
13
11
  "CO",
14
12
  "NO",
@@ -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
- return {
184
- sampleSiteId: doc._id,
185
- sampleSiteCode: doc.code,
186
- orgId: doc.sponsor,
187
- timeUpdated: doc.updatedAt,
188
- sampleSiteLocation: {
189
- type: "Point",
190
- coordinates,
191
- },
192
- deletedAt: new Date(),
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
- return {
248
- sampleSiteId: doc._id,
249
- sampleSiteCode: doc.code,
250
- orgId: doc.sponsor,
251
- timeUpdated: doc.updatedAt,
252
- sampleSiteLocation: {
253
- type: "Point",
254
- coordinates,
255
- },
256
- deletedAt: null, // Not a deletion, so this field is null
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 };