@justair/justair-library 4.15.0 → 5.0.0-alpha.e9d14dc

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/README.md CHANGED
@@ -32,6 +32,53 @@ npm set //registry.npmjs.org/:_authToken=YOUR_ACCESS_TOKEN
32
32
  import { Monitors, Measurements, createLoggerInstance, Database } from '@justair/justair-library';
33
33
  ```
34
34
 
35
+ ## Constants
36
+
37
+ The library exposes two entry points — one for Node.js services (models + constants) and one
38
+ constants-only entry for browser environments like JustAir-Client.
39
+
40
+ ### Backend services
41
+
42
+ ```javascript
43
+ import { PARAMETERS, HEAVY_METALS } from '@justair/justair-library';
44
+
45
+ // Use .id for string comparisons and DB queries
46
+ measurements.find({ parameter: PARAMETERS.PM2_5.id });
47
+
48
+ // Use .label for user-facing display
49
+ console.log(PARAMETERS.PM2_5.label); // "PM₂.₅"
50
+
51
+ // Use .type to filter by category
52
+ const gases = Object.values(PARAMETERS).filter(p => p.type === 'Gas');
53
+
54
+ // Access health data for a sample parameter
55
+ console.log(HEAVY_METALS.AS.rfc); // 0.03
56
+ console.log(HEAVY_METALS.AS.impacts); // "Short-term exposure..."
57
+ ```
58
+
59
+ ### JustAir-Client (browser)
60
+
61
+ Use the constants-only entry point — no Mongoose dependency:
62
+
63
+ ```javascript
64
+ import { PARAMETERS, HEAVY_METALS } from '@justair/justair-library/constants';
65
+ ```
66
+
67
+ ### Object shape
68
+
69
+ Each constant is an object with the following fields:
70
+
71
+ | Field | Type | Description |
72
+ |---|---|---|
73
+ | `id` | `string` | System-facing identifier stored in the database (e.g. `"PM2_5"`) |
74
+ | `label` | `string` | Short user-facing name with Unicode subscripts (e.g. `"PM₂.₅"`) |
75
+ | `name` | `string` | Full descriptive name (e.g. `"Particulate Matter 2.5 (PM₂.₅)"`) |
76
+ | `unit` | `string` | Measurement unit (e.g. `"µg/m³"`) |
77
+ | `type` | `string` | Category: `"Particulate Matter"`, `"Gas"`, `"Volatile Organic Compound"`, `"Weather"`, `"Heavy Metal"`, `"Heavy Metal - Essential Nutrient"` |
78
+ | `rfc` | `number \| null` | EPA IRIS chronic inhalation reference concentration (µg/m³) |
79
+ | `origin` | `string \| null` | Description of pollution source |
80
+ | `impacts` | `string \| null` | Human health impact description |
81
+
35
82
  ## Development Workflow
36
83
 
37
84
  ### Testing locally (fast iteration)
@@ -0,0 +1,610 @@
1
+ export namespace PARAMETERS {
2
+ namespace PM1 {
3
+ let id: string;
4
+ let label: string;
5
+ let name: string;
6
+ let unit: string;
7
+ let type: string;
8
+ let rfc: any;
9
+ let origin: any;
10
+ let impacts: any;
11
+ }
12
+ namespace PM2_5 {
13
+ let id_1: string;
14
+ export { id_1 as id };
15
+ let label_1: string;
16
+ export { label_1 as label };
17
+ let name_1: string;
18
+ export { name_1 as name };
19
+ let unit_1: string;
20
+ export { unit_1 as unit };
21
+ let type_1: string;
22
+ export { type_1 as type };
23
+ let rfc_1: any;
24
+ export { rfc_1 as rfc };
25
+ let origin_1: string;
26
+ export { origin_1 as origin };
27
+ let impacts_1: string;
28
+ export { impacts_1 as impacts };
29
+ }
30
+ namespace PM10 {
31
+ let id_2: string;
32
+ export { id_2 as id };
33
+ let label_2: string;
34
+ export { label_2 as label };
35
+ let name_2: string;
36
+ export { name_2 as name };
37
+ let unit_2: string;
38
+ export { unit_2 as unit };
39
+ let type_2: string;
40
+ export { type_2 as type };
41
+ let rfc_2: any;
42
+ export { rfc_2 as rfc };
43
+ let origin_2: string;
44
+ export { origin_2 as origin };
45
+ let impacts_2: string;
46
+ export { impacts_2 as impacts };
47
+ }
48
+ namespace BC {
49
+ let id_3: string;
50
+ export { id_3 as id };
51
+ let label_3: string;
52
+ export { label_3 as label };
53
+ let name_3: string;
54
+ export { name_3 as name };
55
+ let unit_3: string;
56
+ export { unit_3 as unit };
57
+ let type_3: string;
58
+ export { type_3 as type };
59
+ let rfc_3: any;
60
+ export { rfc_3 as rfc };
61
+ let origin_3: any;
62
+ export { origin_3 as origin };
63
+ let impacts_3: any;
64
+ export { impacts_3 as impacts };
65
+ }
66
+ namespace BrC {
67
+ let id_4: string;
68
+ export { id_4 as id };
69
+ let label_4: string;
70
+ export { label_4 as label };
71
+ let name_4: string;
72
+ export { name_4 as name };
73
+ let unit_4: string;
74
+ export { unit_4 as unit };
75
+ let type_4: string;
76
+ export { type_4 as type };
77
+ let rfc_4: any;
78
+ export { rfc_4 as rfc };
79
+ let origin_4: any;
80
+ export { origin_4 as origin };
81
+ let impacts_4: any;
82
+ export { impacts_4 as impacts };
83
+ }
84
+ namespace UFP {
85
+ let id_5: string;
86
+ export { id_5 as id };
87
+ let label_5: string;
88
+ export { label_5 as label };
89
+ let name_5: string;
90
+ export { name_5 as name };
91
+ let unit_5: string;
92
+ export { unit_5 as unit };
93
+ let type_5: string;
94
+ export { type_5 as type };
95
+ let rfc_5: any;
96
+ export { rfc_5 as rfc };
97
+ let origin_5: any;
98
+ export { origin_5 as origin };
99
+ let impacts_5: any;
100
+ export { impacts_5 as impacts };
101
+ }
102
+ namespace O3 {
103
+ let id_6: string;
104
+ export { id_6 as id };
105
+ let label_6: string;
106
+ export { label_6 as label };
107
+ let name_6: string;
108
+ export { name_6 as name };
109
+ let unit_6: string;
110
+ export { unit_6 as unit };
111
+ let type_6: string;
112
+ export { type_6 as type };
113
+ let rfc_6: any;
114
+ export { rfc_6 as rfc };
115
+ let origin_6: string;
116
+ export { origin_6 as origin };
117
+ let impacts_6: string;
118
+ export { impacts_6 as impacts };
119
+ }
120
+ namespace NO {
121
+ let id_7: string;
122
+ export { id_7 as id };
123
+ let label_7: string;
124
+ export { label_7 as label };
125
+ let name_7: string;
126
+ export { name_7 as name };
127
+ let unit_7: string;
128
+ export { unit_7 as unit };
129
+ let type_7: string;
130
+ export { type_7 as type };
131
+ let rfc_7: any;
132
+ export { rfc_7 as rfc };
133
+ let origin_7: any;
134
+ export { origin_7 as origin };
135
+ let impacts_7: any;
136
+ export { impacts_7 as impacts };
137
+ }
138
+ namespace NO2 {
139
+ let id_8: string;
140
+ export { id_8 as id };
141
+ let label_8: string;
142
+ export { label_8 as label };
143
+ let name_8: string;
144
+ export { name_8 as name };
145
+ let unit_8: string;
146
+ export { unit_8 as unit };
147
+ let type_8: string;
148
+ export { type_8 as type };
149
+ let rfc_8: any;
150
+ export { rfc_8 as rfc };
151
+ let origin_8: string;
152
+ export { origin_8 as origin };
153
+ let impacts_8: string;
154
+ export { impacts_8 as impacts };
155
+ }
156
+ namespace SO2 {
157
+ let id_9: string;
158
+ export { id_9 as id };
159
+ let label_9: string;
160
+ export { label_9 as label };
161
+ let name_9: string;
162
+ export { name_9 as name };
163
+ let unit_9: string;
164
+ export { unit_9 as unit };
165
+ let type_9: string;
166
+ export { type_9 as type };
167
+ let rfc_9: any;
168
+ export { rfc_9 as rfc };
169
+ let origin_9: any;
170
+ export { origin_9 as origin };
171
+ let impacts_9: any;
172
+ export { impacts_9 as impacts };
173
+ }
174
+ namespace CO {
175
+ let id_10: string;
176
+ export { id_10 as id };
177
+ let label_10: string;
178
+ export { label_10 as label };
179
+ let name_10: string;
180
+ export { name_10 as name };
181
+ let unit_10: string;
182
+ export { unit_10 as unit };
183
+ let type_10: string;
184
+ export { type_10 as type };
185
+ let rfc_10: any;
186
+ export { rfc_10 as rfc };
187
+ let origin_10: any;
188
+ export { origin_10 as origin };
189
+ let impacts_10: any;
190
+ export { impacts_10 as impacts };
191
+ }
192
+ namespace CO2 {
193
+ let id_11: string;
194
+ export { id_11 as id };
195
+ let label_11: string;
196
+ export { label_11 as label };
197
+ let name_11: string;
198
+ export { name_11 as name };
199
+ let unit_11: string;
200
+ export { unit_11 as unit };
201
+ let type_11: string;
202
+ export { type_11 as type };
203
+ let rfc_11: any;
204
+ export { rfc_11 as rfc };
205
+ let origin_11: any;
206
+ export { origin_11 as origin };
207
+ let impacts_11: any;
208
+ export { impacts_11 as impacts };
209
+ }
210
+ namespace CH4 {
211
+ let id_12: string;
212
+ export { id_12 as id };
213
+ let label_12: string;
214
+ export { label_12 as label };
215
+ let name_12: string;
216
+ export { name_12 as name };
217
+ let unit_12: string;
218
+ export { unit_12 as unit };
219
+ let type_12: string;
220
+ export { type_12 as type };
221
+ let rfc_12: any;
222
+ export { rfc_12 as rfc };
223
+ let origin_12: any;
224
+ export { origin_12 as origin };
225
+ let impacts_12: any;
226
+ export { impacts_12 as impacts };
227
+ }
228
+ namespace H2S {
229
+ let id_13: string;
230
+ export { id_13 as id };
231
+ let label_13: string;
232
+ export { label_13 as label };
233
+ let name_13: string;
234
+ export { name_13 as name };
235
+ let unit_13: string;
236
+ export { unit_13 as unit };
237
+ let type_13: string;
238
+ export { type_13 as type };
239
+ let rfc_13: any;
240
+ export { rfc_13 as rfc };
241
+ let origin_13: any;
242
+ export { origin_13 as origin };
243
+ let impacts_13: any;
244
+ export { impacts_13 as impacts };
245
+ }
246
+ namespace VOC {
247
+ let id_14: string;
248
+ export { id_14 as id };
249
+ let label_14: string;
250
+ export { label_14 as label };
251
+ let name_14: string;
252
+ export { name_14 as name };
253
+ let unit_14: string;
254
+ export { unit_14 as unit };
255
+ let type_14: string;
256
+ export { type_14 as type };
257
+ let rfc_14: any;
258
+ export { rfc_14 as rfc };
259
+ let origin_14: any;
260
+ export { origin_14 as origin };
261
+ let impacts_14: any;
262
+ export { impacts_14 as impacts };
263
+ }
264
+ namespace T {
265
+ let id_15: string;
266
+ export { id_15 as id };
267
+ let label_15: string;
268
+ export { label_15 as label };
269
+ let name_15: string;
270
+ export { name_15 as name };
271
+ let unit_15: string;
272
+ export { unit_15 as unit };
273
+ let type_15: string;
274
+ export { type_15 as type };
275
+ let rfc_15: any;
276
+ export { rfc_15 as rfc };
277
+ let origin_15: any;
278
+ export { origin_15 as origin };
279
+ let impacts_15: any;
280
+ export { impacts_15 as impacts };
281
+ }
282
+ namespace RH {
283
+ let id_16: string;
284
+ export { id_16 as id };
285
+ let label_16: string;
286
+ export { label_16 as label };
287
+ let name_16: string;
288
+ export { name_16 as name };
289
+ let unit_16: string;
290
+ export { unit_16 as unit };
291
+ let type_16: string;
292
+ export { type_16 as type };
293
+ let rfc_16: any;
294
+ export { rfc_16 as rfc };
295
+ let origin_16: any;
296
+ export { origin_16 as origin };
297
+ let impacts_16: any;
298
+ export { impacts_16 as impacts };
299
+ }
300
+ namespace DP {
301
+ let id_17: string;
302
+ export { id_17 as id };
303
+ let label_17: string;
304
+ export { label_17 as label };
305
+ let name_17: string;
306
+ export { name_17 as name };
307
+ let unit_17: string;
308
+ export { unit_17 as unit };
309
+ let type_17: string;
310
+ export { type_17 as type };
311
+ let rfc_17: any;
312
+ export { rfc_17 as rfc };
313
+ let origin_17: any;
314
+ export { origin_17 as origin };
315
+ let impacts_17: any;
316
+ export { impacts_17 as impacts };
317
+ }
318
+ namespace WS {
319
+ let id_18: string;
320
+ export { id_18 as id };
321
+ let label_18: string;
322
+ export { label_18 as label };
323
+ let name_18: string;
324
+ export { name_18 as name };
325
+ let unit_18: string;
326
+ export { unit_18 as unit };
327
+ let type_18: string;
328
+ export { type_18 as type };
329
+ let rfc_18: any;
330
+ export { rfc_18 as rfc };
331
+ let origin_18: any;
332
+ export { origin_18 as origin };
333
+ let impacts_18: any;
334
+ export { impacts_18 as impacts };
335
+ }
336
+ namespace WD {
337
+ let id_19: string;
338
+ export { id_19 as id };
339
+ let label_19: string;
340
+ export { label_19 as label };
341
+ let name_19: string;
342
+ export { name_19 as name };
343
+ let unit_19: string;
344
+ export { unit_19 as unit };
345
+ let type_19: string;
346
+ export { type_19 as type };
347
+ let rfc_19: any;
348
+ export { rfc_19 as rfc };
349
+ let origin_19: any;
350
+ export { origin_19 as origin };
351
+ let impacts_19: any;
352
+ export { impacts_19 as impacts };
353
+ }
354
+ }
355
+ export namespace HEAVY_METALS {
356
+ export namespace C6H6 {
357
+ let id_20: string;
358
+ export { id_20 as id };
359
+ let label_20: string;
360
+ export { label_20 as label };
361
+ let name_20: string;
362
+ export { name_20 as name };
363
+ let unit_20: string;
364
+ export { unit_20 as unit };
365
+ let type_20: string;
366
+ export { type_20 as type };
367
+ let rfc_20: number;
368
+ export { rfc_20 as rfc };
369
+ let origin_20: string;
370
+ export { origin_20 as origin };
371
+ let impacts_20: string;
372
+ export { impacts_20 as impacts };
373
+ }
374
+ export namespace AS {
375
+ let id_21: string;
376
+ export { id_21 as id };
377
+ let label_21: string;
378
+ export { label_21 as label };
379
+ let name_21: string;
380
+ export { name_21 as name };
381
+ let unit_21: string;
382
+ export { unit_21 as unit };
383
+ let type_21: string;
384
+ export { type_21 as type };
385
+ let rfc_21: number;
386
+ export { rfc_21 as rfc };
387
+ let origin_21: string;
388
+ export { origin_21 as origin };
389
+ let impacts_21: string;
390
+ export { impacts_21 as impacts };
391
+ }
392
+ export namespace BA {
393
+ let id_22: string;
394
+ export { id_22 as id };
395
+ let label_22: string;
396
+ export { label_22 as label };
397
+ let name_22: string;
398
+ export { name_22 as name };
399
+ let unit_22: string;
400
+ export { unit_22 as unit };
401
+ let type_22: string;
402
+ export { type_22 as type };
403
+ let rfc_22: any;
404
+ export { rfc_22 as rfc };
405
+ let origin_22: string;
406
+ export { origin_22 as origin };
407
+ let impacts_22: string;
408
+ export { impacts_22 as impacts };
409
+ }
410
+ export namespace BE {
411
+ let id_23: string;
412
+ export { id_23 as id };
413
+ let label_23: string;
414
+ export { label_23 as label };
415
+ let name_23: string;
416
+ export { name_23 as name };
417
+ let unit_23: string;
418
+ export { unit_23 as unit };
419
+ let type_23: string;
420
+ export { type_23 as type };
421
+ let rfc_23: number;
422
+ export { rfc_23 as rfc };
423
+ let origin_23: string;
424
+ export { origin_23 as origin };
425
+ let impacts_23: string;
426
+ export { impacts_23 as impacts };
427
+ }
428
+ export namespace CO_1 {
429
+ let id_24: string;
430
+ export { id_24 as id };
431
+ let label_24: string;
432
+ export { label_24 as label };
433
+ let name_24: string;
434
+ export { name_24 as name };
435
+ let unit_24: string;
436
+ export { unit_24 as unit };
437
+ let type_24: string;
438
+ export { type_24 as type };
439
+ let rfc_24: any;
440
+ export { rfc_24 as rfc };
441
+ let origin_24: string;
442
+ export { origin_24 as origin };
443
+ let impacts_24: string;
444
+ export { impacts_24 as impacts };
445
+ }
446
+ export { CO_1 as CO };
447
+ export namespace NI {
448
+ let id_25: string;
449
+ export { id_25 as id };
450
+ let label_25: string;
451
+ export { label_25 as label };
452
+ let name_25: string;
453
+ export { name_25 as name };
454
+ let unit_25: string;
455
+ export { unit_25 as unit };
456
+ let type_25: string;
457
+ export { type_25 as type };
458
+ let rfc_25: any;
459
+ export { rfc_25 as rfc };
460
+ let origin_25: string;
461
+ export { origin_25 as origin };
462
+ let impacts_25: string;
463
+ export { impacts_25 as impacts };
464
+ }
465
+ export namespace CD {
466
+ let id_26: string;
467
+ export { id_26 as id };
468
+ let label_26: string;
469
+ export { label_26 as label };
470
+ let name_26: string;
471
+ export { name_26 as name };
472
+ let unit_26: string;
473
+ export { unit_26 as unit };
474
+ let type_26: string;
475
+ export { type_26 as type };
476
+ let rfc_26: number;
477
+ export { rfc_26 as rfc };
478
+ let origin_26: string;
479
+ export { origin_26 as origin };
480
+ let impacts_26: string;
481
+ export { impacts_26 as impacts };
482
+ }
483
+ export namespace CR {
484
+ let id_27: string;
485
+ export { id_27 as id };
486
+ let label_27: string;
487
+ export { label_27 as label };
488
+ let name_27: string;
489
+ export { name_27 as name };
490
+ let unit_27: string;
491
+ export { unit_27 as unit };
492
+ let type_27: string;
493
+ export { type_27 as type };
494
+ let rfc_27: number;
495
+ export { rfc_27 as rfc };
496
+ let origin_27: string;
497
+ export { origin_27 as origin };
498
+ let impacts_27: string;
499
+ export { impacts_27 as impacts };
500
+ }
501
+ export namespace PB {
502
+ let id_28: string;
503
+ export { id_28 as id };
504
+ let label_28: string;
505
+ export { label_28 as label };
506
+ let name_28: string;
507
+ export { name_28 as name };
508
+ let unit_28: string;
509
+ export { unit_28 as unit };
510
+ let type_28: string;
511
+ export { type_28 as type };
512
+ let rfc_28: number;
513
+ export { rfc_28 as rfc };
514
+ let origin_28: string;
515
+ export { origin_28 as origin };
516
+ let impacts_28: string;
517
+ export { impacts_28 as impacts };
518
+ }
519
+ export namespace FE {
520
+ let id_29: string;
521
+ export { id_29 as id };
522
+ let label_29: string;
523
+ export { label_29 as label };
524
+ let name_29: string;
525
+ export { name_29 as name };
526
+ let unit_29: string;
527
+ export { unit_29 as unit };
528
+ let type_29: string;
529
+ export { type_29 as type };
530
+ let rfc_29: any;
531
+ export { rfc_29 as rfc };
532
+ let origin_29: string;
533
+ export { origin_29 as origin };
534
+ let impacts_29: string;
535
+ export { impacts_29 as impacts };
536
+ }
537
+ export namespace MN {
538
+ let id_30: string;
539
+ export { id_30 as id };
540
+ let label_30: string;
541
+ export { label_30 as label };
542
+ let name_30: string;
543
+ export { name_30 as name };
544
+ let unit_30: string;
545
+ export { unit_30 as unit };
546
+ let type_30: string;
547
+ export { type_30 as type };
548
+ let rfc_30: number;
549
+ export { rfc_30 as rfc };
550
+ let origin_30: string;
551
+ export { origin_30 as origin };
552
+ let impacts_30: string;
553
+ export { impacts_30 as impacts };
554
+ }
555
+ export namespace SE {
556
+ let id_31: string;
557
+ export { id_31 as id };
558
+ let label_31: string;
559
+ export { label_31 as label };
560
+ let name_31: string;
561
+ export { name_31 as name };
562
+ let unit_31: string;
563
+ export { unit_31 as unit };
564
+ let type_31: string;
565
+ export { type_31 as type };
566
+ let rfc_31: any;
567
+ export { rfc_31 as rfc };
568
+ let origin_31: string;
569
+ export { origin_31 as origin };
570
+ let impacts_31: string;
571
+ export { impacts_31 as impacts };
572
+ }
573
+ export namespace CU {
574
+ let id_32: string;
575
+ export { id_32 as id };
576
+ let label_32: string;
577
+ export { label_32 as label };
578
+ let name_32: string;
579
+ export { name_32 as name };
580
+ let unit_32: string;
581
+ export { unit_32 as unit };
582
+ let type_32: string;
583
+ export { type_32 as type };
584
+ let rfc_32: any;
585
+ export { rfc_32 as rfc };
586
+ let origin_32: string;
587
+ export { origin_32 as origin };
588
+ let impacts_32: string;
589
+ export { impacts_32 as impacts };
590
+ }
591
+ export namespace ZN {
592
+ let id_33: string;
593
+ export { id_33 as id };
594
+ let label_33: string;
595
+ export { label_33 as label };
596
+ let name_33: string;
597
+ export { name_33 as name };
598
+ let unit_33: string;
599
+ export { unit_33 as unit };
600
+ let type_33: string;
601
+ export { type_33 as type };
602
+ let rfc_33: any;
603
+ export { rfc_33 as rfc };
604
+ let origin_33: string;
605
+ export { origin_33 as origin };
606
+ let impacts_33: string;
607
+ export { impacts_33 as impacts };
608
+ }
609
+ }
610
+ //# sourceMappingURL=pollutants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollutants.d.ts","sourceRoot":"","sources":["../../src/constants/pollutants.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pollutants.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollutants.test.d.ts","sourceRoot":"","sources":["../../../src/constants/tests/pollutants.test.js"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -66,5 +66,7 @@ import { Samples } from "./models/samples.js";
66
66
  import { samplesAuditSchema } from "./models/samples.js";
67
67
  import { SamplesAudit } from "./models/samples.js";
68
68
  import { sampleParameterReferenceConcentrations } from "./models/samples.js";
69
- export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, eventsSchema, Events, lightMonitorSchema, LightMonitors, monitorSuppliersSchema, MonitorSuppliers, contextsSchema, Contexts, parametersSchema, Parameters, announcementSchema, Announcements, jobsSchema, Jobs, apiKeySchema, ApiKey, UsageMetrics, usageMetricsSchema, Audit, auditSchema, EventsAudit, eventsAuditSchema, MonitorAudit, monitorAuditSchema, parametersEnum, deploymentTypesEnum, AlertsAudit, Alerts, alertsSchema, alertsAuditSchema, Features, featuresSchema, dataCompletenessSchema, DataCompleteness, networkMetricsSchema, NetworkMetrics, rateOfChangeSchema, RateOfChange, sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, samplesSchema, Samples, samplesAuditSchema, SamplesAudit, sampleParameterReferenceConcentrations };
69
+ import { PARAMETERS } from "./constants/pollutants.js";
70
+ import { HEAVY_METALS } from "./constants/pollutants.js";
71
+ export { Database, adminSchema, Admin, configurationsSchema, Configurations, measurementsSchema, Measurements, monitorRequestsSchema, MonitorRequests, monitorsSchema, Monitors, organizationsSchema, Organizations, usersSchema, Users, eventsSchema, Events, lightMonitorSchema, LightMonitors, monitorSuppliersSchema, MonitorSuppliers, contextsSchema, Contexts, parametersSchema, Parameters, announcementSchema, Announcements, jobsSchema, Jobs, apiKeySchema, ApiKey, UsageMetrics, usageMetricsSchema, Audit, auditSchema, EventsAudit, eventsAuditSchema, MonitorAudit, monitorAuditSchema, parametersEnum, deploymentTypesEnum, AlertsAudit, Alerts, alertsSchema, alertsAuditSchema, Features, featuresSchema, dataCompletenessSchema, DataCompleteness, networkMetricsSchema, NetworkMetrics, rateOfChangeSchema, RateOfChange, sampleSitesSchema, SampleSites, sampleSiteAuditSchema, SampleSiteAudit, sampleParametersEnum, samplesSchema, Samples, samplesAuditSchema, SamplesAudit, sampleParameterReferenceConcentrations, PARAMETERS, HEAVY_METALS };
70
72
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA4EA;;;iBAEC;yBAtBwB,oBAAoB;qBADxB,gBAAgB;4BAvDF,mBAAmB;sBAAnB,mBAAmB;qCAI/C,4BAA4B;+BAA5B,4BAA4B;mCAM5B,0BAA0B;6BAA1B,0BAA0B;sCAI1B,6BAA6B;gCAA7B,6BAA6B;+BAQ7B,sBAAsB;yBAAtB,sBAAsB;oCACsB,2BAA2B;8BAA3B,2BAA2B;4BAQ3C,mBAAmB;sBAAnB,mBAAmB;6BAM/C,oBAAoB;uBAApB,oBAAoB;mCAbuB,2BAA2B;8BAA3B,2BAA2B;uCAItE,8BAA8B;iCAA9B,8BAA8B;+BACI,sBAAsB;yBAAtB,sBAAsB;iCAClB,wBAAwB;2BAAxB,wBAAwB;mCAQnB,2BAA2B;8BAA3B,2BAA2B;2BAC5C,kBAAkB;qBAAlB,kBAAkB;6BACd,oBAAoB;uBAApB,oBAAoB;6BACR,0BAA0B;mCAA1B,0BAA0B;sBA/BpE,0BAA0B;4BAA1B,0BAA0B;4BA2B1B,oBAAoB;kCAApB,oBAAoB;6BAfpB,sBAAsB;mCAAtB,sBAAsB;+BAAtB,sBAAsB;oCAAtB,sBAAsB;4BAyBtB,oBAAoB;uBAApB,oBAAoB;6BAApB,oBAAoB;kCAApB,oBAAoB;yBACc,sBAAsB;+BAAtB,sBAAsB;uCAIxD,8BAA8B;iCAA9B,8BAA8B;qCACgB,4BAA4B;+BAA5B,4BAA4B;mCAChC,0BAA0B;6BAA1B,0BAA0B;kCAWpE,yBAAyB;4BAAzB,yBAAyB;sCAAzB,yBAAyB;gCAAzB,yBAAyB;qCAAzB,yBAAyB;8BASzB,qBAAqB;wBAArB,qBAAqB;mCAArB,qBAAqB;6BAArB,qBAAqB;uDAArB,qBAAqB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA6EA;;;iBAEC;yBAvBwB,oBAAoB;qBADxB,gBAAgB;4BAvDF,mBAAmB;sBAAnB,mBAAmB;qCAI/C,4BAA4B;+BAA5B,4BAA4B;mCAM5B,0BAA0B;6BAA1B,0BAA0B;sCAI1B,6BAA6B;gCAA7B,6BAA6B;+BAQ7B,sBAAsB;yBAAtB,sBAAsB;oCACsB,2BAA2B;8BAA3B,2BAA2B;4BAQ3C,mBAAmB;sBAAnB,mBAAmB;6BAM/C,oBAAoB;uBAApB,oBAAoB;mCAbuB,2BAA2B;8BAA3B,2BAA2B;uCAItE,8BAA8B;iCAA9B,8BAA8B;+BACI,sBAAsB;yBAAtB,sBAAsB;iCAClB,wBAAwB;2BAAxB,wBAAwB;mCAQnB,2BAA2B;8BAA3B,2BAA2B;2BAC5C,kBAAkB;qBAAlB,kBAAkB;6BACd,oBAAoB;uBAApB,oBAAoB;6BACR,0BAA0B;mCAA1B,0BAA0B;sBA/BpE,0BAA0B;4BAA1B,0BAA0B;4BA2B1B,oBAAoB;kCAApB,oBAAoB;6BAfpB,sBAAsB;mCAAtB,sBAAsB;+BAAtB,sBAAsB;oCAAtB,sBAAsB;4BAyBtB,oBAAoB;uBAApB,oBAAoB;6BAApB,oBAAoB;kCAApB,oBAAoB;yBACc,sBAAsB;+BAAtB,sBAAsB;uCAIxD,8BAA8B;iCAA9B,8BAA8B;qCACgB,4BAA4B;+BAA5B,4BAA4B;mCAChC,0BAA0B;6BAA1B,0BAA0B;kCAYpE,yBAAyB;4BAAzB,yBAAyB;sCAAzB,yBAAyB;gCAAzB,yBAAyB;qCAAzB,yBAAyB;8BASzB,qBAAqB;wBAArB,qBAAqB;mCAArB,qBAAqB;6BAArB,qBAAqB;uDAArB,qBAAqB;2BAlBa,2BAA2B;6BAA3B,2BAA2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AAiLA,iCA0HE;AA6IF,2BAA4D;AAzS5D,qCA4BE;AAGF,+BAAwE;AA7KxE,sCAsBE"}
1
+ {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AA6JA,iCA0HE;AA6IF,2BAA4D;AAzS5D,qCA4BE;AAGF,+BAAwE;AAvJxE,sCAA+C"}
@@ -3,16 +3,7 @@ export const SampleSites: any;
3
3
  export const sampleSiteAuditSchema: any;
4
4
  export const SampleSiteAudit: any;
5
5
  export const sampleParametersEnum: string[];
6
- export namespace sampleParameterReferenceConcentrations {
7
- let C6H6: number;
8
- let PB: number;
9
- let AS: number;
10
- let CD: number;
11
- let CR: number;
12
- let NI: any;
13
- let BA: any;
14
- let FE: any;
15
- let CU: any;
16
- let ZN: any;
17
- }
6
+ export const sampleParameterReferenceConcentrations: {
7
+ [k: string]: any;
8
+ };
18
9
  //# sourceMappingURL=sampleSites.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AA8EA,oCAmDE;AA2JF,8BAAqE;AApOrE,wCAgBE;AAGF,kCAAiF;AAvEjF,4CAWE"}
1
+ {"version":3,"file":"sampleSites.d.ts","sourceRoot":"","sources":["../../src/models/sampleSites.js"],"names":[],"mappings":"AA4DA,oCAmDE;AA2JF,8BAAqE;AApOrE,wCAgBE;AAGF,kCAAiF;AAnDjF,4CAAuD;AAIvD;;EAEE"}
@@ -2,16 +2,7 @@ export const samplesSchema: any;
2
2
  export const Samples: any;
3
3
  export const SamplesAudit: any;
4
4
  export const samplesAuditSchema: any;
5
- export namespace sampleParameterReferenceConcentrations {
6
- let C6H6: number;
7
- let PB: number;
8
- let AS: number;
9
- let CD: number;
10
- let CR: number;
11
- let NI: any;
12
- let BA: any;
13
- let FE: any;
14
- let CU: any;
15
- let ZN: any;
16
- }
5
+ export const sampleParameterReferenceConcentrations: {
6
+ [k: string]: any;
7
+ };
17
8
  //# sourceMappingURL=samples.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AA6CA,gCAkBE;AAoIF,0BAAyD;AAzJzD,+BAAwE;AAvBxE,qCAoBE"}
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/models/samples.js"],"names":[],"mappings":"AAoCA,gCAkBE;AAoIF,0BAAyD;AAzJzD,+BAAwE;AAvBxE,qCAoBE;AAzBF;;EAEE"}
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "4.15.0",
3
+ "version": "5.0.0-alpha.e9d14dc",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./src/index.js",
10
+ "./constants": "./src/constants/pollutants.js"
11
+ },
8
12
  "scripts": {
9
13
  "test": "echo \"Error: no test specified\" && exit 1",
10
14
  "build": "tsc",
@@ -0,0 +1,350 @@
1
+ // Parameters measured by air quality sensors in real time.
2
+ // These correspond to the values stored in Monitors.parameters and used across the platform.
3
+ export const PARAMETERS = {
4
+ PM1: {
5
+ id: "PM1",
6
+ label: "PM₁",
7
+ name: "Particulate Matter 1 (PM₁)",
8
+ unit: "µg/m³",
9
+ type: "Particulate Matter",
10
+ rfc: null,
11
+ origin: null,
12
+ impacts: null,
13
+ },
14
+ PM2_5: {
15
+ id: "PM2_5",
16
+ label: "PM₂.₅",
17
+ name: "Particulate Matter 2.5 (PM₂.₅)",
18
+ unit: "µg/m³",
19
+ type: "Particulate Matter",
20
+ rfc: null,
21
+ origin: "Tiny particles that can penetrate deep into lungs and bloodstream, originating from vehicle emissions, industrial processes, and wildfires.",
22
+ impacts: "Can cause respiratory and cardiovascular illnesses, exacerbate asthma, and increase mortality risk with prolonged exposure.",
23
+ },
24
+ PM10: {
25
+ id: "PM10",
26
+ label: "PM₁₀",
27
+ name: "Particulate Matter 10 (PM₁₀)",
28
+ unit: "µg/m³",
29
+ type: "Particulate Matter",
30
+ rfc: null,
31
+ origin: "Larger particles including dust, dirt, soot, and smoke from various sources like construction and natural activities.",
32
+ impacts: "Can worsen respiratory diseases including asthma and COPD, particularly with short-term exposure.",
33
+ },
34
+ BC: {
35
+ id: "BC",
36
+ label: "Black Carbon",
37
+ name: "Total Black Carbon (BC)",
38
+ unit: "ng/m³",
39
+ type: "Particulate Matter",
40
+ rfc: null,
41
+ origin: null,
42
+ impacts: null,
43
+ },
44
+ BrC: {
45
+ id: "BrC",
46
+ label: "Brown Carbon",
47
+ name: "Total Brown Carbon (BrC)",
48
+ unit: "ng/m³",
49
+ type: "Particulate Matter",
50
+ rfc: null,
51
+ origin: null,
52
+ impacts: null,
53
+ },
54
+ UFP: {
55
+ id: "UFP",
56
+ label: "Ultra Fine Particles",
57
+ name: "Ultra Fine Particles (UFP)",
58
+ unit: "pt/cm³",
59
+ type: "Particulate Matter",
60
+ rfc: null,
61
+ origin: null,
62
+ impacts: null,
63
+ },
64
+ O3: {
65
+ id: "O3",
66
+ label: "O₃",
67
+ name: "Ozone (O₃)",
68
+ unit: "ppm",
69
+ type: "Gas",
70
+ rfc: null,
71
+ origin: "Harmful smog component formed when pollution reacts with sunlight, especially problematic on hot, sunny days.",
72
+ impacts: "Can irritate lungs, intensify asthma and chronic bronchitis, and increase heart problems and mortality rates.",
73
+ },
74
+ NO: {
75
+ id: "NO",
76
+ label: "NO",
77
+ name: "Nitric Oxide (NO)",
78
+ unit: "ppb",
79
+ type: "Gas",
80
+ rfc: null,
81
+ origin: null,
82
+ impacts: null,
83
+ },
84
+ NO2: {
85
+ id: "NO2",
86
+ label: "NO₂",
87
+ name: "Nitrogen Dioxide (NO₂)",
88
+ unit: "ppb",
89
+ type: "Gas",
90
+ rfc: null,
91
+ origin: "Harmful gas from cars, power plants, and industrial equipment that contributes to smog and acid rain.",
92
+ impacts: "Can cause respiratory problems, worsen asthma and bronchitis, and increase heart-related health risks.",
93
+ },
94
+ SO2: {
95
+ id: "SO2",
96
+ label: "SO₂",
97
+ name: "Sulfur Dioxide (SO₂)",
98
+ unit: "ppb",
99
+ type: "Gas",
100
+ rfc: null,
101
+ origin: null,
102
+ impacts: null,
103
+ },
104
+ CO: {
105
+ id: "CO",
106
+ label: "CO",
107
+ name: "Carbon Monoxide (CO)",
108
+ unit: "ppm",
109
+ type: "Gas",
110
+ rfc: null,
111
+ origin: null,
112
+ impacts: null,
113
+ },
114
+ CO2: {
115
+ id: "CO2",
116
+ label: "CO₂",
117
+ name: "Carbon Dioxide (CO₂)",
118
+ unit: "ppm",
119
+ type: "Gas",
120
+ rfc: null,
121
+ origin: null,
122
+ impacts: null,
123
+ },
124
+ CH4: {
125
+ id: "CH4",
126
+ label: "CH₄",
127
+ name: "Methane (CH₄)",
128
+ unit: "ppm",
129
+ type: "Volatile Organic Compound",
130
+ rfc: null,
131
+ origin: null,
132
+ impacts: null,
133
+ },
134
+ H2S: {
135
+ id: "H2S",
136
+ label: "H₂S",
137
+ name: "Hydrogen Sulfide (H₂S)",
138
+ unit: "ppm",
139
+ type: "Volatile Organic Compound",
140
+ rfc: null,
141
+ origin: null,
142
+ impacts: null,
143
+ },
144
+ VOC: {
145
+ id: "VOC",
146
+ label: "VOC",
147
+ name: "Volatile Organic Compounds (VOC)",
148
+ unit: "ppm",
149
+ type: "Volatile Organic Compound",
150
+ rfc: null,
151
+ origin: null,
152
+ impacts: null,
153
+ },
154
+ T: {
155
+ id: "T",
156
+ label: "Temperature",
157
+ name: "Temperature (T)",
158
+ unit: "°F",
159
+ type: "Weather",
160
+ rfc: null,
161
+ origin: null,
162
+ impacts: null,
163
+ },
164
+ RH: {
165
+ id: "RH",
166
+ label: "Humidity",
167
+ name: "Relative Humidity (RH)",
168
+ unit: "%",
169
+ type: "Weather",
170
+ rfc: null,
171
+ origin: null,
172
+ impacts: null,
173
+ },
174
+ DP: {
175
+ id: "DP",
176
+ label: "Dew Point",
177
+ name: "Dew Point (DP)",
178
+ unit: "°F",
179
+ type: "Weather",
180
+ rfc: null,
181
+ origin: null,
182
+ impacts: null,
183
+ },
184
+ WS: {
185
+ id: "WS",
186
+ label: "Wind Speed",
187
+ name: "Wind Speed (WS)",
188
+ unit: "mph",
189
+ type: "Weather",
190
+ rfc: null,
191
+ origin: null,
192
+ impacts: null,
193
+ },
194
+ WD: {
195
+ id: "WD",
196
+ label: "Wind Direction",
197
+ name: "Wind Direction (WD)",
198
+ unit: "°",
199
+ type: "Weather",
200
+ rfc: null,
201
+ origin: null,
202
+ impacts: null,
203
+ },
204
+ };
205
+
206
+ // Parameters analyzed from physical air samples in a laboratory.
207
+ // These correspond to SampleSites.parameters and are not measured by real-time sensors.
208
+ // Note: CO here is Cobalt, not Carbon Monoxide — see PARAMETERS.CO for Carbon Monoxide.
209
+ export const HEAVY_METALS = {
210
+ C6H6: {
211
+ id: "C6H6",
212
+ label: "Benzene",
213
+ name: "Benzene (C₆H₆)",
214
+ unit: "ppb",
215
+ type: "Volatile Organic Compound",
216
+ rfc: 30,
217
+ origin: "Benzene is a gas released when coal, oil, and gasoline are burned. It's found in car exhaust, at gas stations, and anywhere fossil fuels are burned.",
218
+ impacts: "Breathing in benzene for a short time can cause dizziness, drowsiness, or headaches. It may irritate the eyes, skin, or breathing passages. In extreme cases with very high exposure, it can cause loss of consciousness. Regular exposure over a long period can harm the blood, reducing red blood cell count and potentially causing serious blood disorders.",
219
+ },
220
+ AS: {
221
+ id: "AS",
222
+ label: "Arsenic",
223
+ name: "Arsenic (As)",
224
+ unit: "µg/m³",
225
+ type: "Heavy Metal",
226
+ rfc: 0.03,
227
+ origin: "Arsenic is naturally in rocks and soil. It gets into the air through dust blown by wind, metal factories, pesticides, and can leak into groundwater.",
228
+ impacts: "Short-term exposure to high amounts can cause nausea, vomiting, problems with blood cells, irregular heartbeat, and tingling in the nerves. Long-term exposure may cause skin discoloration or thickening (especially on the palms and feet), damage blood vessels, and increase the risk of skin, liver, bladder, and lung cancers.",
229
+ },
230
+ BA: {
231
+ id: "BA",
232
+ label: "Barium",
233
+ name: "Barium (Ba)",
234
+ unit: "µg/m³",
235
+ type: "Heavy Metal",
236
+ rfc: null,
237
+ origin: "This metal comes from mining operations, industrial facilities, and burning coal and oil.",
238
+ impacts: "Breathing barium dust can irritate the nose, throat, and lungs. It may cause coughing, difficulty breathing, and temporary increases in blood pressure. Over many years of high exposure, barium can affect heart and kidney function.",
239
+ },
240
+ BE: {
241
+ id: "BE",
242
+ label: "Beryllium",
243
+ name: "Beryllium (Be)",
244
+ unit: "µg/m³",
245
+ type: "Heavy Metal",
246
+ rfc: 0.02,
247
+ origin: "Beryllium occurs naturally in rocks, soil, coal, and oil. It gets into the air through mining and industrial processing, burning coal or fuel oil, and tobacco smoke.",
248
+ impacts: "Short-term exposure to high levels can cause lung inflammation, coughing, and difficulty breathing. Long-term exposure can cause permanent lung scarring, reduced lung capacity, shortness of breath, and fatigue. It has also been linked to an increased risk of lung cancer.",
249
+ },
250
+ CO: {
251
+ id: "CO",
252
+ label: "Cobalt",
253
+ name: "Cobalt (Co)",
254
+ unit: "µg/m³",
255
+ type: "Heavy Metal",
256
+ rfc: null,
257
+ origin: "This metal is a naturally occurring metal found throughout the environment. It gets into the air through industrial processing, manufacturing of metal alloys and pigments, and burning of coal and fuel oil.",
258
+ impacts: "Short-term exposure to high levels can cause coughing, wheezing, and shortness of breath. Long-term exposure may lead to reduced lung function, asthma, and lung scarring. It can also affect the heart and cause skin or respiratory allergic reactions in some people. Some studies suggest a possible link to lung cancer with prolonged exposure.",
259
+ },
260
+ NI: {
261
+ id: "NI",
262
+ label: "Nickel",
263
+ name: "Nickel (Ni)",
264
+ unit: "µg/m³",
265
+ type: "Heavy Metal",
266
+ rfc: null,
267
+ origin: "Nickel occurs naturally in the earth's crust. It enters the air through oil and coal combustion, metal refining, manufacturing facilities, and sewage sludge incineration.",
268
+ impacts: "Breathing nickel over long periods can irritate the lungs, cause reduced lung function, and trigger asthma-like symptoms. Skin contact with nickel is the most common source of reactions, causing rash and itching on the hands and forearms. Long-term inhalation exposure to certain forms of nickel — particularly those found in refinery dust — has been linked to an increased risk of lung and nasal cancers.",
269
+ },
270
+ CD: {
271
+ id: "CD",
272
+ label: "Cadmium",
273
+ name: "Cadmium (Cd)",
274
+ unit: "µg/m³",
275
+ type: "Heavy Metal",
276
+ rfc: 0.01,
277
+ origin: "Cadmium is released when coal and oil are burned, waste is incinerated, or metals are processed. It's used in batteries, paints, metal coatings, and some plastics.",
278
+ impacts: "Breathing cadmium can irritate and damage the lungs immediately. Over time, cadmium builds up in the kidneys and can cause kidney damage and increase the likelihood of developing kidney stones. Some research shows it may increase lung cancer risk with long-term exposure.",
279
+ },
280
+ CR: {
281
+ id: "CR",
282
+ label: "Chromium",
283
+ name: "Chromium (Cr)",
284
+ unit: "µg/m³",
285
+ type: "Heavy Metal",
286
+ rfc: 0.1,
287
+ origin: "Chromium is naturally in rocks, soil, plants, and volcanic dust. Industries like steel making, metal plating, leather tanning, and improper waste disposal release it into the environment.",
288
+ impacts: "Certain forms of chromium can irritate the nose, throat, and lungs when inhaled. It can also cause skin rashes or irritation upon contact. Long-term exposure to high levels has been linked to respiratory problems and an increased risk of lung cancer.",
289
+ },
290
+ PB: {
291
+ id: "PB",
292
+ label: "Lead",
293
+ name: "Lead (Pb)",
294
+ unit: "µg/m³",
295
+ type: "Heavy Metal",
296
+ rfc: 0, // 0 = no safe level of exposure (not the same as null/unmeasured)
297
+ origin: "Lead comes from old paint containing lead, contaminated soil, water pipes made with lead, factory emissions, and from when leaded gasoline was used.",
298
+ impacts: "Lead is especially dangerous for children. Even small amounts can harm brain development, affecting learning, behavior, and growth. There is no safe level of lead exposure for children. For adults, long-term exposure can contribute to high blood pressure, kidney problems, and reproductive issues.",
299
+ },
300
+ FE: {
301
+ id: "FE",
302
+ label: "Iron",
303
+ name: "Iron (Fe)",
304
+ unit: "µg/m³",
305
+ type: "Heavy Metal - Essential Nutrient",
306
+ rfc: null,
307
+ origin: "Iron is naturally in soil, water, and dust. Airborne iron often comes from factories, construction sites, and wear on roads from vehicles.",
308
+ impacts: "The human body needs iron to function properly. However, breathing iron-rich dust over long periods can cause coughing or lung irritation. Consuming too much iron can cause stomach problems, vomiting, and in severe cases, organ damage.",
309
+ },
310
+ MN: {
311
+ id: "MN",
312
+ label: "Manganese",
313
+ name: "Manganese (Mn)",
314
+ unit: "µg/m³",
315
+ type: "Heavy Metal - Essential Nutrient",
316
+ rfc: 0.05,
317
+ origin: "Manganese occurs naturally in rocks, soil, and water. It enters the air through steel and iron production, mining operations, power plants, and coke ovens.",
318
+ impacts: "Manganese is an essential nutrient at low levels, but breathing elevated concentrations over time can affect the nervous system. Long-term exposure may slow reaction time, reduce hand steadiness, and impair coordination. At higher levels, it can cause tremors, difficulty walking, muscle stiffness, and mood or behavioral changes. Prolonged exposure may also lead to coughing and bronchitis.",
319
+ },
320
+ SE: {
321
+ id: "SE",
322
+ label: "Selenium",
323
+ name: "Selenium (Se)",
324
+ unit: "µg/m³",
325
+ type: "Heavy Metal - Essential Nutrient",
326
+ rfc: null,
327
+ origin: "Selenium occurs naturally in rocks, soil, and water. It enters the air through metal industries, mining, and selenium-recovery processes. Food and drinking water are the most common sources of everyday exposure.",
328
+ impacts: "Selenium is an essential nutrient at low levels, but exposure to elevated concentrations can be harmful. Breathing selenium dust or compounds can irritate the nose, throat, and lungs, causing coughing, nosebleeds, and difficulty breathing. Long-term exposure to high levels through food or water has been associated with skin discoloration, hair and nail loss, tooth decay, and reduced mental alertness.",
329
+ },
330
+ CU: {
331
+ id: "CU",
332
+ label: "Copper",
333
+ name: "Copper (Cu)",
334
+ unit: "µg/m³",
335
+ type: "Heavy Metal - Essential Nutrient",
336
+ rfc: null,
337
+ origin: "Copper occurs naturally in soil and water. Mining, factories, and burning waste release it into the air.",
338
+ impacts: "Breathing copper dust or fumes can irritate the nose, throat, and lungs, causing coughing or temporary flu-like symptoms. Long-term exposure to high airborne copper levels may lead to ongoing respiratory irritation and sometimes liver or kidney effects.",
339
+ },
340
+ ZN: {
341
+ id: "ZN",
342
+ label: "Zinc",
343
+ name: "Zinc (Zn)",
344
+ unit: "µg/m³",
345
+ type: "Heavy Metal - Essential Nutrient",
346
+ rfc: null,
347
+ origin: "Zinc is common in soil, water, and air. It's released from metal production, waste burning, and wear from vehicle tires and brakes.",
348
+ impacts: "The body needs zinc, but breathing high levels of zinc dust or fumes can irritate the throat and lungs. Consuming too much zinc over long periods can cause nausea, interfere with copper absorption in the body, and disrupt immune function.",
349
+ },
350
+ };
@@ -0,0 +1,68 @@
1
+ import { PARAMETERS, HEAVY_METALS } from "../pollutants.js";
2
+
3
+ const REQUIRED_FIELDS = ["id", "label", "name", "unit", "type"];
4
+ const VALID_TYPES = [
5
+ "Particulate Matter",
6
+ "Gas",
7
+ "Volatile Organic Compound",
8
+ "Weather",
9
+ "Heavy Metal",
10
+ "Heavy Metal - Essential Nutrient",
11
+ ];
12
+
13
+ function sharedAssertions(constants) {
14
+ const entries = Object.entries(constants);
15
+
16
+ test("has no duplicate ids", () => {
17
+ const ids = Object.values(constants).map((p) => p.id);
18
+ expect(new Set(ids).size).toBe(ids.length);
19
+ });
20
+
21
+ test.each(entries)("%s: key matches id", (key, pollutant) => {
22
+ expect(key).toBe(pollutant.id);
23
+ });
24
+
25
+ test.each(entries)("%s: has all required fields", (key, pollutant) => {
26
+ for (const field of REQUIRED_FIELDS) {
27
+ expect(pollutant).toHaveProperty(field);
28
+ }
29
+ });
30
+
31
+ test.each(entries)("%s: id is a non-empty string with no dots or spaces", (key, pollutant) => {
32
+ expect(typeof pollutant.id).toBe("string");
33
+ expect(pollutant.id.length).toBeGreaterThan(0);
34
+ expect(pollutant.id).not.toContain(".");
35
+ expect(pollutant.id).not.toContain(" ");
36
+ });
37
+
38
+ test.each(entries)("%s: label is a non-empty string", (key, pollutant) => {
39
+ expect(typeof pollutant.label).toBe("string");
40
+ expect(pollutant.label.length).toBeGreaterThan(0);
41
+ });
42
+
43
+ test.each(entries)("%s: name is a non-empty string", (key, pollutant) => {
44
+ expect(typeof pollutant.name).toBe("string");
45
+ expect(pollutant.name.length).toBeGreaterThan(0);
46
+ });
47
+
48
+ test.each(entries)("%s: unit is a non-empty string", (key, pollutant) => {
49
+ expect(typeof pollutant.unit).toBe("string");
50
+ expect(pollutant.unit.length).toBeGreaterThan(0);
51
+ });
52
+
53
+ test.each(entries)("%s: type is a recognized value", (key, pollutant) => {
54
+ expect(VALID_TYPES).toContain(pollutant.type);
55
+ });
56
+
57
+ test.each(entries)("%s: rfc is a number or null", (key, pollutant) => {
58
+ expect(pollutant.rfc === null || typeof pollutant.rfc === "number").toBe(true);
59
+ });
60
+ }
61
+
62
+ describe("PARAMETERS", () => {
63
+ sharedAssertions(PARAMETERS);
64
+ });
65
+
66
+ describe("HEAVY_METALS", () => {
67
+ sharedAssertions(HEAVY_METALS);
68
+ });
package/src/index.js CHANGED
@@ -55,6 +55,7 @@ import { NetworkMetrics, networkMetricsSchema } from "./models/networkMetrics.js
55
55
  import { RateOfChange, rateOfChangeSchema } from "./models/rateOfChange.js";
56
56
  import Database from "./config/db.js"; // Import the new Database class
57
57
  import CustomLogger from "./config/logger.js";
58
+ import { PARAMETERS, HEAVY_METALS } from "./constants/pollutants.js";
58
59
 
59
60
  // SampleSites related imports
60
61
  import {
@@ -144,4 +145,7 @@ export {
144
145
  samplesAuditSchema,
145
146
  SamplesAudit,
146
147
  sampleParameterReferenceConcentrations,
148
+ // Pollutant constants
149
+ PARAMETERS,
150
+ HEAVY_METALS,
147
151
  };
@@ -1,27 +1,7 @@
1
1
  import mongoose from "mongoose";
2
- const parametersEnum = [
3
- "NO2",
4
- "SO2",
5
- "PM2.5",
6
- "PM2_5",
7
- "PM10",
8
- "Temperature",
9
- "Humidity",
10
- "OZONE",
11
- "O3",
12
- "VOC",
13
- "CO",
14
- "NO",
15
- "PM1",
16
- "WS",
17
- "WD",
18
- "WS And Direction",
19
- "DP",
20
- "CO2",
21
- "CH4",
22
- "H2S",
23
- "BC",
24
- ];
2
+ import { PARAMETERS } from "../constants/pollutants.js";
3
+
4
+ const parametersEnum = Object.keys(PARAMETERS);
25
5
 
26
6
  const deploymentTypesEnum = {
27
7
  STATIONARY: "stationary",
@@ -1,34 +1,16 @@
1
1
  import mongoose from "mongoose";
2
2
  import { customAlphabet } from 'nanoid';
3
+ import { HEAVY_METALS } from "../constants/pollutants.js";
4
+
3
5
  const generateSiteCode = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 8);
4
6
 
5
- const sampleParametersEnum = [
6
- "C6H6", // Benzene
7
- "PB", // Lead
8
- "AS", // Arsenic
9
- "CD", // Cadmium
10
- "CR", // Chromium
11
- "NI", // Nickel
12
- "BA", // Barium
13
- "FE", // Iron
14
- "CU", // Copper
15
- "ZN", // Zinc
16
- ];
7
+ const sampleParametersEnum = Object.keys(HEAVY_METALS);
17
8
 
18
9
  // EPA IRIS chronic inhalation reference concentrations (µg/m³)
19
10
  // 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
- };
11
+ const sampleParameterReferenceConcentrations = Object.fromEntries(
12
+ Object.entries(HEAVY_METALS).map(([key, p]) => [key, p.rfc])
13
+ );
32
14
 
33
15
  const noteSchema = mongoose.Schema({
34
16
  note: {
@@ -1,20 +1,11 @@
1
1
  import mongoose from "mongoose";
2
+ import { HEAVY_METALS } from "../constants/pollutants.js";
2
3
 
3
4
  // EPA IRIS chronic inhalation reference concentrations (µg/m³)
4
5
  // 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
- };
6
+ const sampleParameterReferenceConcentrations = Object.fromEntries(
7
+ Object.entries(HEAVY_METALS).map(([key, p]) => [key, p.rfc])
8
+ );
18
9
 
19
10
  // Samples Audit Schema
20
11
  const samplesAuditSchema = mongoose.Schema(