@justair/justair-library 4.15.0-alpha.d287cce → 5.0.0-alpha.56f07df
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 +60 -2
- package/dist/constants/pollutants.d.ts +609 -0
- package/dist/constants/pollutants.d.ts.map +1 -0
- package/dist/constants/tests/pollutants.test.d.ts +2 -0
- package/dist/constants/tests/pollutants.test.d.ts.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/models/monitors.d.ts +1 -0
- package/dist/models/monitors.d.ts.map +1 -1
- package/dist/models/organizations.d.ts.map +1 -1
- package/dist/models/sampleSites.d.ts +3 -12
- package/dist/models/sampleSites.d.ts.map +1 -1
- package/dist/models/samples.d.ts +3 -12
- package/dist/models/samples.d.ts.map +1 -1
- package/dist/models/tests/enums.test.d.ts +2 -0
- package/dist/models/tests/enums.test.d.ts.map +1 -0
- package/package.json +19 -2
- package/src/constants/pollutants.js +350 -0
- package/src/constants/tests/pollutants.test.js +80 -0
- package/src/index.js +6 -0
- package/src/models/monitors.js +7 -24
- package/src/models/organizations.js +12 -1
- package/src/models/sampleSites.js +6 -24
- package/src/models/samples.js +4 -13
|
@@ -61,6 +61,17 @@ const featureSchema = new Schema({
|
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
const customAlertLevelSchema = new Schema(
|
|
65
|
+
{
|
|
66
|
+
parameter: { type: String },
|
|
67
|
+
startAlertLevel: {
|
|
68
|
+
type: String,
|
|
69
|
+
enum: ["Good", "Moderate", "Unhealthy for SG", "Unhealthy", "Very Unhealthy", "Hazardous"],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{ _id: false }
|
|
73
|
+
);
|
|
74
|
+
|
|
64
75
|
const computeResetTime = (rateLimitType, baseTime = new Date()) => {
|
|
65
76
|
const resetTime = new Date(baseTime);
|
|
66
77
|
|
|
@@ -97,7 +108,7 @@ const organizationsSchema = mongoose.Schema(
|
|
|
97
108
|
orgCode: String,
|
|
98
109
|
orgDescription: String,
|
|
99
110
|
orgLogo: String,
|
|
100
|
-
customAlertLevels: { type: [
|
|
111
|
+
customAlertLevels: { type: [customAlertLevelSchema], default: [{ parameter: "AQI", startAlertLevel: "Unhealthy for SG" }] },
|
|
101
112
|
connectedMonitors: [{ type: mongoose.Types.ObjectId, ref: "Monitors" }],
|
|
102
113
|
communityMessages: [Object],
|
|
103
114
|
weeklyReportData: [Object],
|
|
@@ -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
|
-
|
|
22
|
-
|
|
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: {
|
package/src/models/samples.js
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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(
|