@justair/justair-library 6.7.0-alpha.34682d2 → 6.8.0-alpha.a3ff0bb

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.
@@ -1 +1 @@
1
- {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AA6JA,iCAmIE;AAuIF,2BAA4D;AA5S5D,qCA4BE;AAGF,+BAAwE;AAvJxE,sCAAoD"}
1
+ {"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../src/models/monitors.js"],"names":[],"mappings":"AA4KA,iCA4IE;AAuIF,2BAA4D;AA1T5D,qCAiCE;AAGF,+BAAwE;AAtKxE,sCAAoD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "6.7.0-alpha.34682d2",
3
+ "version": "6.8.0-alpha.a3ff0bb",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -83,6 +83,16 @@ const correctionSchema = mongoose.Schema(
83
83
  { _id: false } // no separate _id for sub-docs
84
84
  );
85
85
 
86
+ // Upstream/supplier pre-corrections applied to the raw value BEFORE our own
87
+ // `corrections` equations run (e.g. Purple Air's EPA PM2.5 correction).
88
+ const preCorrectionSchema = mongoose.Schema(
89
+ {
90
+ source: { type: String, enum: ["epa"], default: "epa" },
91
+ apply: { type: Boolean, default: false },
92
+ },
93
+ { _id: false } // no separate _id for sub-docs
94
+ );
95
+
86
96
  const correctionHistorySchema = mongoose.Schema(
87
97
  {
88
98
  pollutant: {
@@ -144,6 +154,11 @@ const monitorAuditSchema = mongoose.Schema(
144
154
  type: [correctionHistorySchema],
145
155
  default: [],
146
156
  },
157
+ // Pre-corrections keyed by pollutant. No default — absent until set.
158
+ preCorrections: {
159
+ type: Map,
160
+ of: preCorrectionSchema,
161
+ },
147
162
  deploymentType: String,
148
163
  },
149
164
  {
@@ -257,6 +272,15 @@ const monitorsSchema = mongoose.Schema(
257
272
  type: [correctionHistorySchema],
258
273
  default: [],
259
274
  },
275
+ // Upstream pre-corrections applied BEFORE our `corrections` Map, keyed by
276
+ // pollutant (e.g. "PM2_5" -> Purple Air EPA correction). No default: the
277
+ // field is absent until set, so monitors without one carry nothing.
278
+ // Read with `monitor.preCorrections?.get("PM2_5")?.apply` (absent === off).
279
+ // Query "off" with { $ne: true }, never { $eq: false }.
280
+ preCorrections: {
281
+ type: Map,
282
+ of: preCorrectionSchema,
283
+ },
260
284
  applyCorrections: { type: Boolean, default: false },
261
285
  // Optional readKey for private API access (e.g. PurpleAir)
262
286
  readKey: { type: String, required: false },