Skip to content

Commit fc5a950

Browse files
feat: new EventID field
1 parent 72b19fb commit fc5a950

11 files changed

Lines changed: 53 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Targets `3.0.0`. Introduces **Groundwater support** to the DataStream schema.
3131
- `MonitoringLocationVerticalUnit`: `ft`, `m`
3232
- `SampleCollectionEquipmentName`: `Air line`, `Bailer`, `Hydrasleeve`, `Snap sampler`, `Tubing`, `Water level meter`, `Wetted tape`
3333
- `CharacteristicName`: `Water level elevation`, `Water level in well, depth from a reference point`
34+
- **`EventID` field** — optional free-text identifier (max 255 characters) for grouping observations by field sampling event; available for all data types. No conditional logic or validation checks beyond the standard single-line string pattern.
3435

3536
### Breaking
3637

schemas/data/src/backend.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
"$ref": "./definitions.json#/definitions/WellOpenIntervalBottomUnitLoose",
129129
"transform": ["trim", "toEnumCase"]
130130
},
131+
"EventID": {
132+
"$ref": "./definitions.json#/definitions/EventID",
133+
"transform": ["trim"]
134+
},
131135
"ActivityType": {
132136
"$ref": "./definitions.json#/definitions/ActivityTypeLoose",
133137
"transform": ["trim", "toEnumCase"]

schemas/data/src/definitions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@
181181
"WellOpenIntervalBottomUnitLoose": {
182182
"$ref": "https://datastream.org/schema/data/values/WellOpenIntervalBottomUnit.legacy.json"
183183
},
184+
"EventID": {
185+
"title": "Event ID",
186+
"description": "A unique identifier supplied by the data contributor, usually corresponding to field sampling events",
187+
"$ref": "#/definitions/string",
188+
"maxLength": 255
189+
},
184190
"ActivityTypeStrict": {
185191
"$ref": "https://datastream.org/schema/data/values/ActivityType.primary.json"
186192
},

schemas/data/src/extract.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@
106106
"WellOpenIntervalBottomUnit": {
107107
"$ref": "./definitions.json#/definitions/WellOpenIntervalBottomUnitStrict"
108108
},
109+
"EventID": {
110+
"$ref": "./definitions.json#/definitions/EventID"
111+
},
109112
"ActivityType": {
110113
"$ref": "./definitions.json#/definitions/ActivityTypeStrict"
111114
},

schemas/data/src/frontend.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
"$ref": "./definitions.json#/definitions/WellOpenIntervalBottomUnitStrict",
125125
"transform": ["trim", "toEnumCase"]
126126
},
127+
"EventID": {
128+
"$ref": "./definitions.json#/definitions/EventID"
129+
},
127130
"ActivityType": {
128131
"$ref": "./definitions.json#/definitions/ActivityTypeStrict",
129132
"transform": ["trim", "toEnumCase"]

schemas/data/src/primary.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@
101101
"WellOpenIntervalBottomUnit": {
102102
"$ref": "./definitions.json#/definitions/WellOpenIntervalBottomUnitStrict"
103103
},
104+
"EventID": {
105+
"$ref": "./definitions.json#/definitions/EventID"
106+
},
104107
"ActivityType": {
105108
"$ref": "./definitions.json#/definitions/ActivityTypeStrict"
106109
},

schemas/data/src/quality-control.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"WellOpenIntervalTopUnit": true,
4343
"WellOpenIntervalBottomMeasure": true,
4444
"WellOpenIntervalBottomUnit": true,
45+
"EventID": true,
4546
"ActivityType": true,
4647
"ActivityMediaName": true,
4748
"ActivityStartDate": true,

schemas/data/test/format.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ test("Should reject strings with multiline", async (t) => {
8585
1234`,
8686
LaboratorySampleID: `qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM:/.,-'\"
8787
1234`,
88+
EventID: `qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM:/.,-'\"
89+
1234`,
8890
});
8991

9092
assert.equal(checkProperty(validate.errors, "pattern", "DatasetName"), true);
@@ -112,6 +114,7 @@ test("Should reject strings with multiline", async (t) => {
112114
checkProperty(validate.errors, "pattern", "LaboratorySampleID"),
113115
true,
114116
);
117+
assert.equal(checkProperty(validate.errors, "pattern", "EventID"), true);
115118
});
116119

117120
test("Should accept strings-multiline", async (t) => {
@@ -675,3 +678,12 @@ test("Should accept SampleCollectionMethodID <= 50 chars", async (t) => {
675678
validate({ SampleCollectionMethodID: "x".repeat(50) });
676679
assert.equal(checkProperty(validate.errors, "maxLength", "SampleCollectionMethodID"), false);
677680
});
681+
682+
test("Should reject EventID > 255 chars", async (t) => {
683+
validate({ EventID: "x".repeat(256) });
684+
assert.equal(checkProperty(validate.errors, "maxLength", "EventID"), true);
685+
});
686+
test("Should accept EventID <= 255 chars", async (t) => {
687+
validate({ EventID: "x".repeat(255) });
688+
assert.equal(checkProperty(validate.errors, "maxLength", "EventID"), false);
689+
});

schemas/data/test/primary.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ test("LaboratorySampleID has maxLength 60", () => {
139139
assert.equal(main.properties.LaboratorySampleID.maxLength, 60);
140140
});
141141

142+
test("EventID is text with maxLength 255", () => {
143+
const f = main.properties.EventID;
144+
assert.equal(f.type, "string");
145+
assert.equal(f.maxLength, 255);
146+
});
147+
142148
test("ResultComment has maxLength 4000", () => {
143149
assert.equal(main.properties.ResultComment.maxLength, 4000);
144150
});

schemas/data/test/required.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ test("Should reject additional headers", async (t) => {
159159
);
160160
});
161161

162+
test("Should treat EventID as an optional, unconditional field", async (t) => {
163+
validate({ EventID: "Spring 2018 survey" });
164+
// Recognized column — not rejected as an unknown/additional header.
165+
assert.equal(
166+
checkProperty(validate.errors, "unevaluatedProperties", "EventID"),
167+
false,
168+
);
169+
// Imposes no requirement of its own — never reported as required or as a dependency.
170+
assert.equal(checkProperty(validate.errors, "required", "EventID"), false);
171+
assert.equal(checkProperty(validate.errors, "dependencies", "EventID"), false);
172+
});
173+
162174
test("Should reject ActivityDepthHeightMeasure AND NOT ActivityDepthHeightUnit", async (t) => {
163175
const valid = validate({
164176
ActivityDepthHeightMeasure: true,

0 commit comments

Comments
 (0)