@hestia-earth/data-validation 0.41.15 → 0.41.17
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/file-errors/public-api.d.mts +1 -1
- package/file-errors/public-api.d.ts +1 -1
- package/file-errors/public-api.js +438 -356
- package/file-errors/public-api.mjs +438 -356
- package/index.js +379 -359
- package/index.mjs +379 -359
- package/package.json +1 -1
- package/validation.json +379 -359
|
@@ -8,169 +8,339 @@ var utils = require('@hestia-earth/utils');
|
|
|
8
8
|
// validation.json
|
|
9
9
|
var validations = [
|
|
10
10
|
{
|
|
11
|
-
function: "
|
|
11
|
+
function: "validate_id",
|
|
12
12
|
level: "error",
|
|
13
|
-
message: "must
|
|
13
|
+
message: "aggregation id must contain a product, region, start, end year, and a timestamp"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
function: "
|
|
16
|
+
function: "validate_has_termType",
|
|
17
|
+
level: "warning",
|
|
18
|
+
message: "should contain at least one management node"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
function: "validate_fallow_dates",
|
|
17
22
|
level: "error",
|
|
18
|
-
message: "must be
|
|
23
|
+
message: "duration must be in specified interval"
|
|
19
24
|
},
|
|
20
25
|
{
|
|
21
|
-
function: "
|
|
26
|
+
function: "validate_cycles_overlap",
|
|
22
27
|
level: "error",
|
|
23
|
-
message: "must be
|
|
28
|
+
message: "management date must be before cycle start date"
|
|
24
29
|
},
|
|
25
30
|
{
|
|
26
|
-
function: "
|
|
31
|
+
function: "validate_functionalUnit_not_1_ha",
|
|
27
32
|
level: "error",
|
|
28
|
-
message: "must be
|
|
33
|
+
message: "must not be equal to 1 ha"
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
|
-
function: "
|
|
36
|
+
function: "validate_sum_aboveGroundCropResidue",
|
|
32
37
|
level: "error",
|
|
33
|
-
message: "must
|
|
38
|
+
message: "must be more than or equal to other crop residues"
|
|
34
39
|
},
|
|
35
40
|
{
|
|
36
|
-
function: "
|
|
41
|
+
function: "validate_crop_residue_complete",
|
|
37
42
|
level: "error",
|
|
38
|
-
message: "must
|
|
43
|
+
message: "must specify the fate of cropResidue"
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
|
-
function: "
|
|
46
|
+
function: "validate_crop_residue_incomplete",
|
|
47
|
+
level: "warning",
|
|
48
|
+
message: "should specify the fate of cropResidue"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
function: "validate_cycleDuration",
|
|
42
52
|
level: "error",
|
|
43
|
-
message: "must be
|
|
53
|
+
message: "must be one year prior to endDate"
|
|
44
54
|
},
|
|
45
55
|
{
|
|
46
|
-
function: "
|
|
56
|
+
function: "validate_cycleDuration",
|
|
47
57
|
level: "error",
|
|
48
|
-
message: "must
|
|
58
|
+
message: "must equal to endDate - startDate in days"
|
|
49
59
|
},
|
|
50
60
|
{
|
|
51
|
-
function: "
|
|
61
|
+
function: "validate_harvestedArea",
|
|
52
62
|
level: "error",
|
|
53
|
-
message: "must be
|
|
63
|
+
message: "must be lower or equal to siteArea"
|
|
54
64
|
},
|
|
55
65
|
{
|
|
56
|
-
function: "
|
|
66
|
+
function: "validate_maximum_cycleDuration",
|
|
57
67
|
level: "error",
|
|
58
|
-
message: "must be below
|
|
68
|
+
message: "must be below maximum cycleDuration"
|
|
59
69
|
},
|
|
60
70
|
{
|
|
61
|
-
function: "
|
|
71
|
+
function: "validate_riceGrainInHuskFlooded_minimum_cycleDuration",
|
|
62
72
|
level: "warning",
|
|
63
|
-
message: "should be
|
|
73
|
+
message: "should be more than the cropping duration"
|
|
64
74
|
},
|
|
65
75
|
{
|
|
66
|
-
function: "
|
|
76
|
+
function: "validate_crop_siteDuration",
|
|
77
|
+
level: "error",
|
|
78
|
+
message: "should be equal to cycleDuration for crop"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
function: "validate_crop_siteDuration",
|
|
82
|
+
level: "error",
|
|
83
|
+
message: "should be greater than cycleDuration for crop"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
function: "validate_animal_siteDuration",
|
|
87
|
+
level: "error",
|
|
88
|
+
message: "should be equal to cycleDuration for animals"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
function: "validate_animal_siteDuration",
|
|
92
|
+
level: "error",
|
|
93
|
+
message: "should be equal to cycleDuration - otherSitesDuration for animals"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
function: "validate_animal_siteDuration",
|
|
97
|
+
level: "error",
|
|
98
|
+
message: "should be less than cycleDuration for animals"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
function: "validate_durations",
|
|
67
102
|
level: "warning",
|
|
68
|
-
message: "
|
|
103
|
+
message: "should add the fields for a relative cycle"
|
|
69
104
|
},
|
|
70
105
|
{
|
|
71
|
-
function: "
|
|
106
|
+
function: "validate_possibleCoverCrop",
|
|
72
107
|
level: "error",
|
|
73
|
-
message: "
|
|
108
|
+
message: "cover crop cycle contains non cover crop product"
|
|
74
109
|
},
|
|
75
110
|
{
|
|
76
|
-
function: "
|
|
111
|
+
function: "validate_set_treatment",
|
|
112
|
+
level: "warning",
|
|
113
|
+
message: "should specify a treatment when experimentDesign is specified"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
function: "validate_products_animals",
|
|
117
|
+
level: "warning",
|
|
118
|
+
message: "should not specify both liveAnimal and animalProduct"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
function: "validate_stocking_density",
|
|
122
|
+
level: "warning",
|
|
123
|
+
message: "should add the term stockingDensityPermanentPastureAverage"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
function: "validate_linked_impact_assessment",
|
|
77
127
|
level: "error",
|
|
78
|
-
message: "
|
|
128
|
+
message: "multiple ImpactAssessment are associated with this Product"
|
|
79
129
|
},
|
|
80
130
|
{
|
|
81
|
-
function: "
|
|
131
|
+
function: "validate_linked_impact_assessment",
|
|
82
132
|
level: "error",
|
|
83
|
-
message: "
|
|
133
|
+
message: "no ImpactAssessment are associated with this Product"
|
|
84
134
|
},
|
|
85
135
|
{
|
|
86
|
-
function: "
|
|
136
|
+
function: "validate_animal_product_mapping",
|
|
137
|
+
level: "error",
|
|
138
|
+
message: "is not an allowed animalProduct"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
function: "validate_requires_substrate",
|
|
142
|
+
level: "error",
|
|
143
|
+
message: "must add substrate inputs"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
function: "_validate_previous_transformationId",
|
|
147
|
+
level: "error",
|
|
148
|
+
message: "must point to a previous transformation in the list"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
function: "_validate_previous_input",
|
|
152
|
+
level: "error",
|
|
153
|
+
message: "at least one Input must be a Product of the Cycle"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
function: "_validate_previous_input",
|
|
157
|
+
level: "error",
|
|
158
|
+
message: "at least one Input must be a Product of the previous Transformation"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
function: "_validate_previous_product_value",
|
|
162
|
+
level: "error",
|
|
163
|
+
message: "must be equal to previous product multiplied by the share"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
function: "validate_linked_emission",
|
|
87
167
|
level: "warning",
|
|
88
|
-
message: "should
|
|
168
|
+
message: "should be linked to an emission in the Cycle"
|
|
89
169
|
},
|
|
90
170
|
{
|
|
91
|
-
function: "
|
|
171
|
+
function: "validate_excreta_inputs_products",
|
|
92
172
|
level: "error",
|
|
93
|
-
message: "must
|
|
173
|
+
message: "must be included as an Input"
|
|
94
174
|
},
|
|
95
175
|
{
|
|
96
|
-
function: "
|
|
176
|
+
function: "validate_transformation_inputs_value",
|
|
97
177
|
level: "error",
|
|
98
|
-
message: "must be
|
|
178
|
+
message: "must be specified for multiple Inputs with the same term"
|
|
99
179
|
},
|
|
100
180
|
{
|
|
101
|
-
function: "
|
|
181
|
+
function: "validate_empty",
|
|
102
182
|
level: "error",
|
|
103
|
-
message: "
|
|
183
|
+
message: "should not be empty"
|
|
104
184
|
},
|
|
105
185
|
{
|
|
106
|
-
function: "
|
|
186
|
+
function: "validate_linked_cycle_product",
|
|
107
187
|
level: "error",
|
|
108
|
-
message: "
|
|
188
|
+
message: "should be included in the cycle products"
|
|
109
189
|
},
|
|
110
190
|
{
|
|
111
|
-
function: "
|
|
191
|
+
function: "validate_linked_cycle_endDate",
|
|
192
|
+
level: "error",
|
|
193
|
+
message: "must be equal to the Cycle endDate"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
function: "validate_value_follows_area",
|
|
112
197
|
level: "warning",
|
|
113
|
-
message: "should be
|
|
198
|
+
message: "should not be proportional to the site area"
|
|
114
199
|
},
|
|
115
200
|
{
|
|
116
|
-
function: "
|
|
201
|
+
function: "validate_fixed_nutrient_ratio",
|
|
117
202
|
level: "warning",
|
|
118
|
-
message: "
|
|
203
|
+
message: "should be the amount of nutrient, not of fertiliser"
|
|
119
204
|
},
|
|
120
205
|
{
|
|
121
|
-
function: "
|
|
206
|
+
function: "validate_lifespan",
|
|
207
|
+
level: "error",
|
|
208
|
+
message: "must equal to endDate - startDate in decimal years"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
function: "validate_functionalArea",
|
|
122
212
|
level: "warning",
|
|
123
|
-
message: "should
|
|
213
|
+
message: "should specify functionalArea or site area"
|
|
124
214
|
},
|
|
125
215
|
{
|
|
126
|
-
function: "
|
|
216
|
+
function: "validate_soilTexture",
|
|
217
|
+
level: "error",
|
|
218
|
+
message: "is outside the allowed range"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
function: "validate_soilTexture_depths",
|
|
127
222
|
level: "warning",
|
|
128
|
-
message: "
|
|
223
|
+
message: "should be given at the same depths as the soil content"
|
|
129
224
|
},
|
|
130
225
|
{
|
|
131
|
-
function: "
|
|
226
|
+
function: "validate_depths",
|
|
132
227
|
level: "error",
|
|
133
|
-
message: "
|
|
228
|
+
message: "must be greater than or equal to depthUpper"
|
|
134
229
|
},
|
|
135
230
|
{
|
|
136
|
-
function: "
|
|
231
|
+
function: "validate_required_depths",
|
|
232
|
+
level: "error",
|
|
233
|
+
message: "must set both depthUpper and depthLower"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
function: "validate_required_depths",
|
|
137
237
|
level: "warning",
|
|
138
|
-
message: "should
|
|
238
|
+
message: "should set both depthUpper and depthLower"
|
|
139
239
|
},
|
|
140
240
|
{
|
|
141
|
-
function: "
|
|
241
|
+
function: "validate_term_unique",
|
|
142
242
|
level: "error",
|
|
143
|
-
message: "
|
|
243
|
+
message: "must be unique"
|
|
144
244
|
},
|
|
145
245
|
{
|
|
146
|
-
function: "
|
|
246
|
+
function: "validate_term_unique",
|
|
247
|
+
level: "error",
|
|
248
|
+
message: "must provide value or min and max"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
function: "validate_with_models",
|
|
147
252
|
level: "warning",
|
|
148
|
-
message: "
|
|
253
|
+
message: "the measurement provided might be in error"
|
|
149
254
|
},
|
|
150
255
|
{
|
|
151
|
-
function: "
|
|
256
|
+
function: "validate_value_length",
|
|
152
257
|
level: "error",
|
|
153
|
-
message: "
|
|
258
|
+
message: "must not contain more than 1 value"
|
|
154
259
|
},
|
|
155
260
|
{
|
|
156
|
-
function: "
|
|
261
|
+
function: "validate_water_measurements",
|
|
262
|
+
level: "error",
|
|
263
|
+
message: "must specify water type for ponds"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
function: "validate_water_salinity",
|
|
267
|
+
level: "error",
|
|
268
|
+
message: "invalid water salinity"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
function: "validate_soil_type_consistency",
|
|
272
|
+
level: "error",
|
|
273
|
+
message: "measurements for the same termType must be consistent"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
function: "validate_must_include_id",
|
|
157
277
|
level: "warning",
|
|
158
|
-
message: "should
|
|
278
|
+
message: "should add missing inputs"
|
|
159
279
|
},
|
|
160
280
|
{
|
|
161
|
-
function: "
|
|
281
|
+
function: "validate_compound_fertiliser_composition",
|
|
162
282
|
level: "warning",
|
|
163
|
-
message: "should
|
|
283
|
+
message: "should match the nutrient ratio of the compound fertiliser"
|
|
164
284
|
},
|
|
165
285
|
{
|
|
166
|
-
function: "
|
|
286
|
+
function: "validate_related_impacts",
|
|
167
287
|
level: "error",
|
|
168
|
-
message: "
|
|
288
|
+
message: "can not be linked to the same type"
|
|
169
289
|
},
|
|
170
290
|
{
|
|
171
|
-
function: "
|
|
291
|
+
function: "validate_related_impact_product",
|
|
292
|
+
level: "error",
|
|
293
|
+
message: "can not be linked to a different term"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
function: "_validate_input_value",
|
|
172
297
|
level: "warning",
|
|
173
|
-
message: "
|
|
298
|
+
message: "is outside confidence interval"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
function: "validate_animalFeed_requires_isAnimalFeed",
|
|
302
|
+
level: "error",
|
|
303
|
+
message: "must specify is it an animal feed"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
function: "validate_isAnimalFeed_animal_cycle",
|
|
307
|
+
level: "error",
|
|
308
|
+
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
function: "validate_saplings",
|
|
312
|
+
level: "error",
|
|
313
|
+
message: "saplings cannot be used as an input here"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
function: "validate_seed",
|
|
317
|
+
level: "error",
|
|
318
|
+
message: "seed cannot be used as an input here"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
function: "validate_saplings_depreciated",
|
|
322
|
+
level: "error",
|
|
323
|
+
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
function: "validate_seed_correspondingSpecies",
|
|
327
|
+
level: "error",
|
|
328
|
+
message: "must specify correspondingSpecies in intercropping"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
function: "validate_material_depreciated",
|
|
332
|
+
level: "error",
|
|
333
|
+
message: "must use the depreciated term"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
function: "validate_input_is_product",
|
|
337
|
+
level: "error",
|
|
338
|
+
message: "must be a product"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
function: "validate_input_unspecified_term",
|
|
342
|
+
level: "warning",
|
|
343
|
+
message: "should use a specific term"
|
|
174
344
|
},
|
|
175
345
|
{
|
|
176
346
|
function: "validate_method_not_relevant",
|
|
@@ -197,6 +367,61 @@ var validations = [
|
|
|
197
367
|
level: "warning",
|
|
198
368
|
message: "should set the depth"
|
|
199
369
|
},
|
|
370
|
+
{
|
|
371
|
+
function: "validate_linked_impactAssessment",
|
|
372
|
+
level: "error",
|
|
373
|
+
message: "must be linked to a verified country-level Impact Assessment"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
function: "validate_plantation_practices",
|
|
377
|
+
level: "error",
|
|
378
|
+
message: "must include practices for plantation weighting"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
function: "validate_characterisedIndicator_model",
|
|
382
|
+
level: "error",
|
|
383
|
+
message: "is not allowed for this characterisedIndicator"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
function: "_below_occupation",
|
|
387
|
+
level: "error",
|
|
388
|
+
message: "must be less than or equal to land occupation"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
function: "validate_inonising_compounds_waste",
|
|
392
|
+
level: "error",
|
|
393
|
+
message: "must be linked to waste input"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
function: "validate_resourceUse_landCover",
|
|
397
|
+
level: "error",
|
|
398
|
+
message: "this field is required"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
function: "validate_resourceUse_landCover",
|
|
402
|
+
level: "error",
|
|
403
|
+
message: "this field is required"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
function: "validate_has_animals",
|
|
407
|
+
level: "warning",
|
|
408
|
+
message: "should specify the herd composition"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
function: "validate_duplicated_feed_inputs",
|
|
412
|
+
level: "error",
|
|
413
|
+
message: "must not add the feed input to the Cycle as well"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
function: "validate_has_milkYieldPractice",
|
|
417
|
+
level: "warning",
|
|
418
|
+
message: "should specify the a milkYield practice"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
function: "validate_animal_has_recommended_products",
|
|
422
|
+
level: "warning",
|
|
423
|
+
message: "should specify a recommended product"
|
|
424
|
+
},
|
|
200
425
|
{
|
|
201
426
|
function: "validate_defaultValue",
|
|
202
427
|
level: "warning",
|
|
@@ -328,234 +553,184 @@ var validations = [
|
|
|
328
553
|
message: "cropResidue product is not accounted for by the cropResidueManagement practices"
|
|
329
554
|
},
|
|
330
555
|
{
|
|
331
|
-
function: "
|
|
332
|
-
level: "error",
|
|
333
|
-
message: "is outside the allowed range"
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
function: "validate_soilTexture_depths",
|
|
337
|
-
level: "warning",
|
|
338
|
-
message: "should be given at the same depths as the soil content"
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
function: "validate_depths",
|
|
342
|
-
level: "error",
|
|
343
|
-
message: "must be greater than or equal to depthUpper"
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
function: "validate_required_depths",
|
|
347
|
-
level: "error",
|
|
348
|
-
message: "must set both depthUpper and depthLower"
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
function: "validate_required_depths",
|
|
352
|
-
level: "warning",
|
|
353
|
-
message: "should set both depthUpper and depthLower"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
function: "validate_term_unique",
|
|
556
|
+
function: "validate_property_valueType",
|
|
357
557
|
level: "error",
|
|
358
|
-
message: "
|
|
558
|
+
message: "the property value type is incorrect"
|
|
359
559
|
},
|
|
360
560
|
{
|
|
361
|
-
function: "
|
|
561
|
+
function: "validate_term_type",
|
|
362
562
|
level: "error",
|
|
363
|
-
message: "
|
|
563
|
+
message: "can not be used on this termType"
|
|
364
564
|
},
|
|
365
565
|
{
|
|
366
|
-
function: "
|
|
566
|
+
function: "validate_default_value",
|
|
367
567
|
level: "warning",
|
|
368
|
-
message: "
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
function: "validate_value_length",
|
|
372
|
-
level: "error",
|
|
373
|
-
message: "must not contain more than 1 value"
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
function: "validate_water_measurements",
|
|
377
|
-
level: "error",
|
|
378
|
-
message: "must specify water type for ponds"
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
function: "validate_water_salinity",
|
|
382
|
-
level: "error",
|
|
383
|
-
message: "invalid water salinity"
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
function: "validate_soil_type_consistency",
|
|
387
|
-
level: "error",
|
|
388
|
-
message: "measurements for the same termType must be consistent"
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
function: "validate_characterisedIndicator_model",
|
|
392
|
-
level: "error",
|
|
393
|
-
message: "is not allowed for this characterisedIndicator"
|
|
568
|
+
message: "should be within percentage of default value"
|
|
394
569
|
},
|
|
395
570
|
{
|
|
396
|
-
function: "
|
|
571
|
+
function: "validate_date_lt_today",
|
|
397
572
|
level: "error",
|
|
398
|
-
message: "must be
|
|
573
|
+
message: "must be before today"
|
|
399
574
|
},
|
|
400
575
|
{
|
|
401
|
-
function: "
|
|
576
|
+
function: "validate_node_dates",
|
|
402
577
|
level: "error",
|
|
403
|
-
message: "must be
|
|
578
|
+
message: "must be greater than startDate"
|
|
404
579
|
},
|
|
405
580
|
{
|
|
406
|
-
function: "
|
|
581
|
+
function: "validate_node_dates",
|
|
407
582
|
level: "error",
|
|
408
|
-
message: "
|
|
583
|
+
message: "must be in the same format as endDate"
|
|
409
584
|
},
|
|
410
585
|
{
|
|
411
|
-
function: "
|
|
586
|
+
function: "validate_list_dates",
|
|
412
587
|
level: "error",
|
|
413
|
-
message: "
|
|
588
|
+
message: "must be greater than startDate"
|
|
414
589
|
},
|
|
415
590
|
{
|
|
416
|
-
function: "
|
|
591
|
+
function: "validate_list_dates_format",
|
|
417
592
|
level: "error",
|
|
418
|
-
message: "
|
|
593
|
+
message: "must have the same length as endDate"
|
|
419
594
|
},
|
|
420
595
|
{
|
|
421
|
-
function: "
|
|
596
|
+
function: "validate_list_dates_length",
|
|
422
597
|
level: "error",
|
|
423
|
-
message: "
|
|
598
|
+
message: "must contain as many items as values"
|
|
424
599
|
},
|
|
425
600
|
{
|
|
426
|
-
function: "
|
|
601
|
+
function: "validate_list_value_between_min_max",
|
|
427
602
|
level: "error",
|
|
428
|
-
message: "must be
|
|
603
|
+
message: "must be between min and max"
|
|
429
604
|
},
|
|
430
605
|
{
|
|
431
|
-
function: "
|
|
606
|
+
function: "validate_list_min_below_max",
|
|
432
607
|
level: "error",
|
|
433
|
-
message: "must
|
|
608
|
+
message: "must be greater than min"
|
|
434
609
|
},
|
|
435
610
|
{
|
|
436
|
-
function: "
|
|
611
|
+
function: "validate_list_min_max_lookup",
|
|
437
612
|
level: "error",
|
|
438
|
-
message: "must be
|
|
613
|
+
message: "must be above the minimum"
|
|
439
614
|
},
|
|
440
615
|
{
|
|
441
|
-
function: "
|
|
616
|
+
function: "validate_list_min_max_lookup",
|
|
442
617
|
level: "error",
|
|
443
|
-
message: "must
|
|
618
|
+
message: "must be below the maximum"
|
|
444
619
|
},
|
|
445
620
|
{
|
|
446
|
-
function: "
|
|
621
|
+
function: "validate_region_list_value_diff_property_lookup",
|
|
447
622
|
level: "warning",
|
|
448
|
-
message: "should
|
|
623
|
+
message: "should be within acceptable range of the lookup value"
|
|
449
624
|
},
|
|
450
625
|
{
|
|
451
|
-
function: "
|
|
452
|
-
level: "
|
|
453
|
-
message: "
|
|
626
|
+
function: "validate_list_term_percent",
|
|
627
|
+
level: "warning",
|
|
628
|
+
message: "may be between 0 and 100"
|
|
454
629
|
},
|
|
455
630
|
{
|
|
456
|
-
function: "
|
|
631
|
+
function: "validate_list_term_percent",
|
|
457
632
|
level: "error",
|
|
458
|
-
message: "
|
|
633
|
+
message: "should be between 0 and 100 (percentage)"
|
|
459
634
|
},
|
|
460
635
|
{
|
|
461
|
-
function: "
|
|
636
|
+
function: "validate_list_percent_requires_value",
|
|
462
637
|
level: "error",
|
|
463
|
-
message: "
|
|
638
|
+
message: "should have required property 'value'"
|
|
464
639
|
},
|
|
465
640
|
{
|
|
466
|
-
function: "
|
|
641
|
+
function: "validate_list_valueType",
|
|
467
642
|
level: "error",
|
|
468
|
-
message: "
|
|
643
|
+
message: "the node value type is incorrect"
|
|
469
644
|
},
|
|
470
645
|
{
|
|
471
|
-
function: "
|
|
646
|
+
function: "validate_list_has_properties",
|
|
472
647
|
level: "warning",
|
|
473
|
-
message: "should
|
|
648
|
+
message: "should add missing properties"
|
|
474
649
|
},
|
|
475
650
|
{
|
|
476
|
-
function: "
|
|
651
|
+
function: "validate_is_region",
|
|
477
652
|
level: "error",
|
|
478
|
-
message: "
|
|
653
|
+
message: "must not be a country"
|
|
479
654
|
},
|
|
480
655
|
{
|
|
481
|
-
function: "
|
|
656
|
+
function: "validate_region_in_country",
|
|
482
657
|
level: "error",
|
|
483
|
-
message: "
|
|
658
|
+
message: "must be within the country"
|
|
484
659
|
},
|
|
485
660
|
{
|
|
486
|
-
function: "
|
|
661
|
+
function: "validate_country",
|
|
487
662
|
level: "error",
|
|
488
|
-
message: "
|
|
663
|
+
message: "must be a country"
|
|
489
664
|
},
|
|
490
665
|
{
|
|
491
|
-
function: "
|
|
666
|
+
function: "validate_coordinates",
|
|
492
667
|
level: "error",
|
|
493
|
-
message: "
|
|
668
|
+
message: "does not contain latitude and longitude"
|
|
494
669
|
},
|
|
495
670
|
{
|
|
496
|
-
function: "
|
|
497
|
-
level: "
|
|
498
|
-
message: "should be
|
|
671
|
+
function: "validate_area",
|
|
672
|
+
level: "warning",
|
|
673
|
+
message: "should be equal to boundary"
|
|
499
674
|
},
|
|
500
675
|
{
|
|
501
|
-
function: "
|
|
676
|
+
function: "validate_boundary_area",
|
|
502
677
|
level: "warning",
|
|
503
|
-
message: "should
|
|
678
|
+
message: "boundaryArea should be lower than max size"
|
|
504
679
|
},
|
|
505
680
|
{
|
|
506
|
-
function: "
|
|
507
|
-
level: "
|
|
508
|
-
message: "
|
|
681
|
+
function: "validate_region_size",
|
|
682
|
+
level: "warning",
|
|
683
|
+
message: "should be lower than max size"
|
|
509
684
|
},
|
|
510
685
|
{
|
|
511
|
-
function: "
|
|
686
|
+
function: "validate_empty_fields",
|
|
512
687
|
level: "warning",
|
|
513
|
-
message: "
|
|
688
|
+
message: "may not be empty"
|
|
514
689
|
},
|
|
515
690
|
{
|
|
516
|
-
function: "
|
|
517
|
-
level: "
|
|
518
|
-
message: "should
|
|
691
|
+
function: "validate_linked_source_privacy",
|
|
692
|
+
level: "error",
|
|
693
|
+
message: "should have the same privacy as the related source"
|
|
519
694
|
},
|
|
520
695
|
{
|
|
521
|
-
function: "
|
|
696
|
+
function: "validate_private_has_source",
|
|
522
697
|
level: "warning",
|
|
523
|
-
message: "should add
|
|
698
|
+
message: "should add a source"
|
|
524
699
|
},
|
|
525
700
|
{
|
|
526
|
-
function: "
|
|
701
|
+
function: "_validate_list_model",
|
|
527
702
|
level: "error",
|
|
528
|
-
message: "
|
|
703
|
+
message: "the value provided is not consistent with the model result"
|
|
529
704
|
},
|
|
530
705
|
{
|
|
531
|
-
function: "
|
|
532
|
-
level: "
|
|
533
|
-
message: "
|
|
706
|
+
function: "validate_duplicated_terms",
|
|
707
|
+
level: "warning",
|
|
708
|
+
message: "should not use several terms describing the same product"
|
|
534
709
|
},
|
|
535
710
|
{
|
|
536
|
-
function: "
|
|
711
|
+
function: "validate_other_model",
|
|
537
712
|
level: "error",
|
|
538
|
-
message: "is
|
|
713
|
+
message: "is required when using other model"
|
|
539
714
|
},
|
|
540
715
|
{
|
|
541
|
-
function: "
|
|
542
|
-
level: "
|
|
543
|
-
message: "
|
|
716
|
+
function: "validate_nested_existing_node",
|
|
717
|
+
level: "warning",
|
|
718
|
+
message: "should not link to an existing node"
|
|
544
719
|
},
|
|
545
720
|
{
|
|
546
|
-
function: "
|
|
547
|
-
level: "
|
|
548
|
-
message: "
|
|
721
|
+
function: "validate_nested_existing_node",
|
|
722
|
+
level: "warning",
|
|
723
|
+
message: "should not link to an existing node"
|
|
549
724
|
},
|
|
550
725
|
{
|
|
551
|
-
function: "
|
|
726
|
+
function: "validate_cycle_dates",
|
|
552
727
|
level: "error",
|
|
553
|
-
message: "
|
|
728
|
+
message: "multiple cycles on the same site cannot overlap"
|
|
554
729
|
},
|
|
555
730
|
{
|
|
556
|
-
function: "
|
|
557
|
-
level: "
|
|
558
|
-
message: "
|
|
731
|
+
function: "validate_cycles_linked_ia",
|
|
732
|
+
level: "error",
|
|
733
|
+
message: "cycles linked together cannot be added to the same site"
|
|
559
734
|
},
|
|
560
735
|
{
|
|
561
736
|
function: "validate_economicValueShare",
|
|
@@ -607,86 +782,6 @@ var validations = [
|
|
|
607
782
|
level: "error",
|
|
608
783
|
message: "requires a water salinity measurement"
|
|
609
784
|
},
|
|
610
|
-
{
|
|
611
|
-
function: "validate_has_animals",
|
|
612
|
-
level: "warning",
|
|
613
|
-
message: "should specify the herd composition"
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
function: "validate_duplicated_feed_inputs",
|
|
617
|
-
level: "error",
|
|
618
|
-
message: "must not add the feed input to the Cycle as well"
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
function: "validate_has_milkYieldPractice",
|
|
622
|
-
level: "warning",
|
|
623
|
-
message: "should specify the a milkYield practice"
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
function: "validate_animal_has_recommended_products",
|
|
627
|
-
level: "warning",
|
|
628
|
-
message: "should specify a recommended product"
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
function: "validate_must_include_id",
|
|
632
|
-
level: "warning",
|
|
633
|
-
message: "should add missing inputs"
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
function: "validate_related_impacts",
|
|
637
|
-
level: "error",
|
|
638
|
-
message: "can not be linked to the same type"
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
function: "validate_related_impact_product",
|
|
642
|
-
level: "error",
|
|
643
|
-
message: "can not be linked to a different term"
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
function: "_validate_input_value",
|
|
647
|
-
level: "warning",
|
|
648
|
-
message: "is outside confidence interval"
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
function: "validate_animalFeed_requires_isAnimalFeed",
|
|
652
|
-
level: "error",
|
|
653
|
-
message: "must specify is it an animal feed"
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
function: "validate_isAnimalFeed_animal_cycle",
|
|
657
|
-
level: "error",
|
|
658
|
-
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
function: "validate_saplings",
|
|
662
|
-
level: "error",
|
|
663
|
-
message: "saplings cannot be used as an input here"
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
function: "validate_seed",
|
|
667
|
-
level: "error",
|
|
668
|
-
message: "seed cannot be used as an input here"
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
function: "validate_saplings_depreciated",
|
|
672
|
-
level: "error",
|
|
673
|
-
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
674
|
-
},
|
|
675
|
-
{
|
|
676
|
-
function: "validate_material_depreciated",
|
|
677
|
-
level: "error",
|
|
678
|
-
message: "must use the depreciated term"
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
function: "validate_input_is_product",
|
|
682
|
-
level: "error",
|
|
683
|
-
message: "must be a product"
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
function: "validate_input_unspecified_term",
|
|
687
|
-
level: "warning",
|
|
688
|
-
message: "should use a specific term"
|
|
689
|
-
},
|
|
690
785
|
{
|
|
691
786
|
function: "_validate_all_values",
|
|
692
787
|
level: "warning",
|
|
@@ -731,81 +826,6 @@ var validations = [
|
|
|
731
826
|
function: "validate_coverage",
|
|
732
827
|
level: "warning",
|
|
733
828
|
message: "can not calculate all emissions"
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
function: "validate_has_termType",
|
|
737
|
-
level: "warning",
|
|
738
|
-
message: "should contain at least one management node"
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
function: "validate_fallow_dates",
|
|
742
|
-
level: "error",
|
|
743
|
-
message: "duration must be in specified interval"
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
function: "validate_cycles_overlap",
|
|
747
|
-
level: "error",
|
|
748
|
-
message: "management date must be before cycle start date"
|
|
749
|
-
},
|
|
750
|
-
{
|
|
751
|
-
function: "validate_cycle_dates",
|
|
752
|
-
level: "error",
|
|
753
|
-
message: "multiple cycles on the same site cannot overlap"
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
function: "validate_cycles_linked_ia",
|
|
757
|
-
level: "error",
|
|
758
|
-
message: "cycles linked together cannot be added to the same site"
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
function: "validate_linked_impactAssessment",
|
|
762
|
-
level: "error",
|
|
763
|
-
message: "must be linked to a verified country-level Impact Assessment"
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
function: "validate_plantation_practices",
|
|
767
|
-
level: "error",
|
|
768
|
-
message: "must include practices for plantation weighting"
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
function: "validate_id",
|
|
772
|
-
level: "error",
|
|
773
|
-
message: "aggregation id must contain a product, region, start, end year, and a timestamp"
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
function: "_validate_previous_transformationId",
|
|
777
|
-
level: "error",
|
|
778
|
-
message: "must point to a previous transformation in the list"
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
function: "_validate_previous_input",
|
|
782
|
-
level: "error",
|
|
783
|
-
message: "at least one Input must be a Product of the Cycle"
|
|
784
|
-
},
|
|
785
|
-
{
|
|
786
|
-
function: "_validate_previous_input",
|
|
787
|
-
level: "error",
|
|
788
|
-
message: "at least one Input must be a Product of the previous Transformation"
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
function: "_validate_previous_product_value",
|
|
792
|
-
level: "error",
|
|
793
|
-
message: "must be equal to previous product multiplied by the share"
|
|
794
|
-
},
|
|
795
|
-
{
|
|
796
|
-
function: "validate_linked_emission",
|
|
797
|
-
level: "warning",
|
|
798
|
-
message: "should be linked to an emission in the Cycle"
|
|
799
|
-
},
|
|
800
|
-
{
|
|
801
|
-
function: "validate_excreta_inputs_products",
|
|
802
|
-
level: "error",
|
|
803
|
-
message: "must be included as an Input"
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
function: "validate_transformation_inputs_value",
|
|
807
|
-
level: "error",
|
|
808
|
-
message: "must be specified for multiple Inputs with the same term"
|
|
809
829
|
}
|
|
810
830
|
];
|
|
811
831
|
|
|
@@ -2224,11 +2244,31 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2224
2244
|
name: "Cover crop"
|
|
2225
2245
|
}
|
|
2226
2246
|
)} Practice.`,
|
|
2227
|
-
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) =>
|
|
2228
|
-
id:
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2247
|
+
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params, dataPath }) => {
|
|
2248
|
+
const otherTerms = `a more suitable term, e.g. ${termLink({ id: "seed", name: "Seed" })} (in kg) or ${termLink({
|
|
2249
|
+
id: "seedlings",
|
|
2250
|
+
name: "Seedlings"
|
|
2251
|
+
})} (in number)`;
|
|
2252
|
+
return (dataPath == null ? void 0 : dataPath.endsWith(".correspondingSpecies")) ? `Only plantation crops can be grown from saplings, and the ${code("correspondingSpecies")} of this Input, ${termLink({
|
|
2253
|
+
id: String(params.current),
|
|
2254
|
+
name: humanizeTermId(String(params.current))
|
|
2255
|
+
})}, is not a plantation.
|
|
2256
|
+
Link the saplings to the plantation they were planted for, or record the planting material of ${code(
|
|
2257
|
+
params.current
|
|
2258
|
+
)} with ${otherTerms}.` : `Only plantation crops can be grown from saplings. If your Cycle has no plantation crops, replace ${code(
|
|
2259
|
+
params.current
|
|
2260
|
+
)} with ${otherTerms}.
|
|
2261
|
+
If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`;
|
|
2262
|
+
},
|
|
2263
|
+
"must specify correspondingSpecies in intercropping": ({ params }) => {
|
|
2264
|
+
var _a, _b;
|
|
2265
|
+
return `${code(schema.TermTermType.seed)} completeness is set to ${code(false)}, but this ${code(
|
|
2266
|
+
((_a = params.term) == null ? void 0 : _a.name) || ((_b = params.term) == null ? void 0 : _b["@id"])
|
|
2267
|
+
)} Input has a value and no ${code("correspondingSpecies")}, so it is counted as the seed of every intercropped species.
|
|
2268
|
+
If the value only refers to one species, set its ${code("correspondingSpecies")} to one of ${joinValues(
|
|
2269
|
+
params.expected
|
|
2270
|
+
)}. If it refers to the total seed planted, set ${code(schema.TermTermType.seed)} completeness to ${code(true)}.`;
|
|
2271
|
+
},
|
|
2232
2272
|
"must use the depreciated term": ({ params }) => {
|
|
2233
2273
|
var _a, _b;
|
|
2234
2274
|
return `${code(
|
|
@@ -2294,6 +2334,48 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2294
2334
|
"must equal to endDate - startDate in decimal years": ({ params: { expected } }) => `Must be equal to ${code("endDate")} - ${code("startDate")} in years (~${expected})`,
|
|
2295
2335
|
"must be more than or equal to other crop residues": ({ params: { expected } }) => `Must be more than or equal to sum(${expected.join(" + ")})`,
|
|
2296
2336
|
"should add missing inputs": ({ params: { expected } }) => `Should add missing inputs: ${listAsCode(expected)}`,
|
|
2337
|
+
"should match the nutrient ratio of the compound fertiliser": ({ params }) => {
|
|
2338
|
+
var _a, _b;
|
|
2339
|
+
const [denominator, numerator] = ((_a = params == null ? void 0 : params.termIds) != null ? _a : []).map((id) => termLink({ id }));
|
|
2340
|
+
const expected = (params == null ? void 0 : params.min) === (params == null ? void 0 : params.max) ? code(params == null ? void 0 : params.min) : `${code(params == null ? void 0 : params.min)} to ${code(params == null ? void 0 : params.max)}`;
|
|
2341
|
+
const causes = {
|
|
2342
|
+
swapped: "This is close to the inverse of the expected ratio: the values of the two Inputs may have been swapped.",
|
|
2343
|
+
elemental: `This is close to the expected ratio converted to elements: the value may have been given as kg of elemental P or K rather than kg of ${code(
|
|
2344
|
+
"P2O5"
|
|
2345
|
+
)} or ${code("K2O")}.`,
|
|
2346
|
+
otherCompound: `This is close to the ratio of ${termLink({
|
|
2347
|
+
id: params == null ? void 0 : params.compound
|
|
2348
|
+
})}: the values may have been calculated from the composition of another fertiliser.`
|
|
2349
|
+
};
|
|
2350
|
+
return `The value of ${numerator} divided by the value of ${denominator} is ${code(params == null ? void 0 : params.current)}, but the composition of this fertiliser gives a ratio of ${expected}.
|
|
2351
|
+
${(_b = causes[params == null ? void 0 : params.cause]) != null ? _b : ""}
|
|
2352
|
+
Please check that both Inputs are the amounts of each nutrient applied with this fertiliser.`;
|
|
2353
|
+
},
|
|
2354
|
+
"should not be proportional to the site area": ({ params }) => {
|
|
2355
|
+
var _a, _b;
|
|
2356
|
+
return `Across the ${code(params == null ? void 0 : params.count)} Cycles of this upload with the same source, country and primary Product (this one and the others after it), the value of ${termLink(
|
|
2357
|
+
{ id: (_a = params == null ? void 0 : params.term) == null ? void 0 : _a["@id"], name: (_b = params == null ? void 0 : params.term) == null ? void 0 : _b.name }
|
|
2358
|
+
)} rises with the ${schemaLink("Site#area", "area")} of the Site (a rank correlation of ${code(
|
|
2359
|
+
params == null ? void 0 : params.correlation
|
|
2360
|
+
)}), and dividing it by the area makes the values more consistent, with a median of ${code(
|
|
2361
|
+
params == null ? void 0 : params.expected
|
|
2362
|
+
)} per hectare.
|
|
2363
|
+
A value per hectare does not depend on the size of the field, so these values may be totals for each field.
|
|
2364
|
+
Please check they are given per hectare in every one of these Cycles, dividing them by the ${code(
|
|
2365
|
+
"area"
|
|
2366
|
+
)} of the Site if needed.`;
|
|
2367
|
+
},
|
|
2368
|
+
"should be the amount of nutrient, not of fertiliser": ({ params }) => {
|
|
2369
|
+
const nutrients = ["kg N", "kg P2O5", "kg K2O"];
|
|
2370
|
+
const amounts = (values) => (values != null ? values : []).map((value, index) => `${code(value)} ${nutrients[index]}`).join(r.inlineSeparator);
|
|
2371
|
+
return `This Cycle and ${code(
|
|
2372
|
+
(params == null ? void 0 : params.count) - 1
|
|
2373
|
+
)} others of this upload with the same source, country and primary Product give round amounts of nutrients in one fixed ratio, here ${amounts(
|
|
2374
|
+
params == null ? void 0 : params.current
|
|
2375
|
+
)} per hectare, far above the usual rates for this crop in this country (${amounts(params == null ? void 0 : params.expected)}).
|
|
2376
|
+
These may be the amounts of compound fertiliser recorded as amounts of each nutrient.
|
|
2377
|
+
Please convert the amount of fertiliser into the amount of each nutrient it contains, using its composition, in every one of these Cycles.`;
|
|
2378
|
+
},
|
|
2297
2379
|
"the property value type is incorrect": ({ params: { expected } }) => `The value must be a ${expected}.`,
|
|
2298
2380
|
"the node value type is incorrect": ({ params: { expected } }) => `The value must be a ${expected}.`,
|
|
2299
2381
|
"can not be linked to the same type": ({ params: { current } }) => `Cannot be linked to the same ${current}.`,
|