@hestia-earth/data-validation 0.41.16 → 0.41.18

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.
@@ -8,169 +8,339 @@ var utils = require('@hestia-earth/utils');
8
8
  // validation.json
9
9
  var validations = [
10
10
  {
11
- function: "validate_date_lt_today",
11
+ function: "validate_id",
12
12
  level: "error",
13
- message: "must be before today"
13
+ message: "aggregation id must contain a product, region, start, end year, and a timestamp"
14
14
  },
15
15
  {
16
- function: "validate_node_dates",
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 greater than startDate"
23
+ message: "duration must be in specified interval"
19
24
  },
20
25
  {
21
- function: "validate_node_dates",
26
+ function: "validate_cycles_overlap",
22
27
  level: "error",
23
- message: "must be in the same format as endDate"
28
+ message: "management date must be before cycle start date"
24
29
  },
25
30
  {
26
- function: "validate_list_dates",
31
+ function: "validate_functionalUnit_not_1_ha",
27
32
  level: "error",
28
- message: "must be greater than startDate"
33
+ message: "must not be equal to 1 ha"
29
34
  },
30
35
  {
31
- function: "validate_list_dates_format",
36
+ function: "validate_sum_aboveGroundCropResidue",
32
37
  level: "error",
33
- message: "must have the same length as endDate"
38
+ message: "must be more than or equal to other crop residues"
34
39
  },
35
40
  {
36
- function: "validate_list_dates_length",
41
+ function: "validate_crop_residue_complete",
37
42
  level: "error",
38
- message: "must contain as many items as values"
43
+ message: "must specify the fate of cropResidue"
39
44
  },
40
45
  {
41
- function: "validate_list_value_between_min_max",
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 between min and max"
53
+ message: "must be one year prior to endDate"
44
54
  },
45
55
  {
46
- function: "validate_list_min_below_max",
56
+ function: "validate_cycleDuration",
47
57
  level: "error",
48
- message: "must be greater than min"
58
+ message: "must equal to endDate - startDate in days"
49
59
  },
50
60
  {
51
- function: "validate_list_min_max_lookup",
61
+ function: "validate_harvestedArea",
52
62
  level: "error",
53
- message: "must be above the minimum"
63
+ message: "must be lower or equal to siteArea"
54
64
  },
55
65
  {
56
- function: "validate_list_min_max_lookup",
66
+ function: "validate_maximum_cycleDuration",
57
67
  level: "error",
58
- message: "must be below the maximum"
68
+ message: "must be below maximum cycleDuration"
59
69
  },
60
70
  {
61
- function: "validate_region_list_value_diff_property_lookup",
71
+ function: "validate_riceGrainInHuskFlooded_minimum_cycleDuration",
62
72
  level: "warning",
63
- message: "should be within acceptable range of the lookup value"
73
+ message: "should be more than the cropping duration"
64
74
  },
65
75
  {
66
- function: "validate_list_term_percent",
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: "may be between 0 and 100"
103
+ message: "should add the fields for a relative cycle"
69
104
  },
70
105
  {
71
- function: "validate_list_term_percent",
106
+ function: "validate_possibleCoverCrop",
72
107
  level: "error",
73
- message: "should be between 0 and 100 (percentage)"
108
+ message: "cover crop cycle contains non cover crop product"
74
109
  },
75
110
  {
76
- function: "validate_list_percent_requires_value",
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: "should have required property 'value'"
128
+ message: "multiple ImpactAssessment are associated with this Product"
79
129
  },
80
130
  {
81
- function: "validate_list_valueType",
131
+ function: "validate_linked_impact_assessment",
82
132
  level: "error",
83
- message: "the node value type is incorrect"
133
+ message: "no ImpactAssessment are associated with this Product"
84
134
  },
85
135
  {
86
- function: "validate_list_has_properties",
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 add missing properties"
168
+ message: "should be linked to an emission in the Cycle"
89
169
  },
90
170
  {
91
- function: "validate_is_region",
171
+ function: "validate_excreta_inputs_products",
92
172
  level: "error",
93
- message: "must not be a country"
173
+ message: "must be included as an Input"
94
174
  },
95
175
  {
96
- function: "validate_region_in_country",
176
+ function: "validate_transformation_inputs_value",
97
177
  level: "error",
98
- message: "must be within the country"
178
+ message: "must be specified for multiple Inputs with the same term"
99
179
  },
100
180
  {
101
- function: "validate_country",
181
+ function: "validate_empty",
102
182
  level: "error",
103
- message: "must be a country"
183
+ message: "should not be empty"
104
184
  },
105
185
  {
106
- function: "validate_coordinates",
186
+ function: "validate_linked_cycle_product",
107
187
  level: "error",
108
- message: "does not contain latitude and longitude"
188
+ message: "should be included in the cycle products"
109
189
  },
110
190
  {
111
- function: "validate_area",
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 equal to boundary"
198
+ message: "should not be proportional to the site area"
114
199
  },
115
200
  {
116
- function: "validate_boundary_area",
201
+ function: "validate_fixed_nutrient_ratio",
117
202
  level: "warning",
118
- message: "boundaryArea should be lower than max size"
203
+ message: "should be the amount of nutrient, not of fertiliser"
119
204
  },
120
205
  {
121
- function: "validate_region_size",
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 be lower than max size"
213
+ message: "should specify functionalArea or site area"
124
214
  },
125
215
  {
126
- function: "validate_empty_fields",
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: "may not be empty"
223
+ message: "should be given at the same depths as the soil content"
129
224
  },
130
225
  {
131
- function: "validate_linked_source_privacy",
226
+ function: "validate_depths",
132
227
  level: "error",
133
- message: "should have the same privacy as the related source"
228
+ message: "must be greater than or equal to depthUpper"
134
229
  },
135
230
  {
136
- function: "validate_private_has_source",
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 add a source"
238
+ message: "should set both depthUpper and depthLower"
139
239
  },
140
240
  {
141
- function: "_validate_list_model",
241
+ function: "validate_term_unique",
142
242
  level: "error",
143
- message: "the value provided is not consistent with the model result"
243
+ message: "must be unique"
144
244
  },
145
245
  {
146
- function: "validate_duplicated_terms",
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: "should not use several terms describing the same product"
253
+ message: "the measurement provided might be in error"
149
254
  },
150
255
  {
151
- function: "validate_other_model",
256
+ function: "validate_value_length",
152
257
  level: "error",
153
- message: "is required when using other model"
258
+ message: "must not contain more than 1 value"
154
259
  },
155
260
  {
156
- function: "validate_nested_existing_node",
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 not link to an existing node"
278
+ message: "should add missing inputs"
159
279
  },
160
280
  {
161
- function: "validate_nested_existing_node",
281
+ function: "validate_compound_fertiliser_composition",
162
282
  level: "warning",
163
- message: "should not link to an existing node"
283
+ message: "should match the nutrient ratio of the compound fertiliser"
164
284
  },
165
285
  {
166
- function: "validate_lifespan",
286
+ function: "validate_related_impacts",
167
287
  level: "error",
168
- message: "must equal to endDate - startDate in decimal years"
288
+ message: "can not be linked to the same type"
169
289
  },
170
290
  {
171
- function: "validate_functionalArea",
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: "should specify functionalArea or site area"
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: "validate_soilTexture",
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: "must be unique"
558
+ message: "the property value type is incorrect"
359
559
  },
360
560
  {
361
- function: "validate_term_unique",
561
+ function: "validate_term_type",
362
562
  level: "error",
363
- message: "must provide value or min and max"
563
+ message: "can not be used on this termType"
364
564
  },
365
565
  {
366
- function: "validate_with_models",
566
+ function: "validate_default_value",
367
567
  level: "warning",
368
- message: "the measurement provided might be in error"
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: "_below_occupation",
571
+ function: "validate_date_lt_today",
397
572
  level: "error",
398
- message: "must be less than or equal to land occupation"
573
+ message: "must be before today"
399
574
  },
400
575
  {
401
- function: "validate_inonising_compounds_waste",
576
+ function: "validate_node_dates",
402
577
  level: "error",
403
- message: "must be linked to waste input"
578
+ message: "must be greater than startDate"
404
579
  },
405
580
  {
406
- function: "validate_resourceUse_landCover",
581
+ function: "validate_node_dates",
407
582
  level: "error",
408
- message: "this field is required"
583
+ message: "must be in the same format as endDate"
409
584
  },
410
585
  {
411
- function: "validate_resourceUse_landCover",
586
+ function: "validate_list_dates",
412
587
  level: "error",
413
- message: "this field is required"
588
+ message: "must be greater than startDate"
414
589
  },
415
590
  {
416
- function: "validate_empty",
591
+ function: "validate_list_dates_format",
417
592
  level: "error",
418
- message: "should not be empty"
593
+ message: "must have the same length as endDate"
419
594
  },
420
595
  {
421
- function: "validate_linked_cycle_product",
596
+ function: "validate_list_dates_length",
422
597
  level: "error",
423
- message: "should be included in the cycle products"
598
+ message: "must contain as many items as values"
424
599
  },
425
600
  {
426
- function: "validate_linked_cycle_endDate",
601
+ function: "validate_list_value_between_min_max",
427
602
  level: "error",
428
- message: "must be equal to the Cycle endDate"
603
+ message: "must be between min and max"
429
604
  },
430
605
  {
431
- function: "validate_functionalUnit_not_1_ha",
606
+ function: "validate_list_min_below_max",
432
607
  level: "error",
433
- message: "must not be equal to 1 ha"
608
+ message: "must be greater than min"
434
609
  },
435
610
  {
436
- function: "validate_sum_aboveGroundCropResidue",
611
+ function: "validate_list_min_max_lookup",
437
612
  level: "error",
438
- message: "must be more than or equal to other crop residues"
613
+ message: "must be above the minimum"
439
614
  },
440
615
  {
441
- function: "validate_crop_residue_complete",
616
+ function: "validate_list_min_max_lookup",
442
617
  level: "error",
443
- message: "must specify the fate of cropResidue"
618
+ message: "must be below the maximum"
444
619
  },
445
620
  {
446
- function: "validate_crop_residue_incomplete",
621
+ function: "validate_region_list_value_diff_property_lookup",
447
622
  level: "warning",
448
- message: "should specify the fate of cropResidue"
623
+ message: "should be within acceptable range of the lookup value"
449
624
  },
450
625
  {
451
- function: "validate_cycleDuration",
452
- level: "error",
453
- message: "must be one year prior to endDate"
626
+ function: "validate_list_term_percent",
627
+ level: "warning",
628
+ message: "may be between 0 and 100"
454
629
  },
455
630
  {
456
- function: "validate_cycleDuration",
631
+ function: "validate_list_term_percent",
457
632
  level: "error",
458
- message: "must equal to endDate - startDate in days"
633
+ message: "should be between 0 and 100 (percentage)"
459
634
  },
460
635
  {
461
- function: "validate_harvestedArea",
636
+ function: "validate_list_percent_requires_value",
462
637
  level: "error",
463
- message: "must be lower or equal to siteArea"
638
+ message: "should have required property 'value'"
464
639
  },
465
640
  {
466
- function: "validate_maximum_cycleDuration",
641
+ function: "validate_list_valueType",
467
642
  level: "error",
468
- message: "must be below maximum cycleDuration"
643
+ message: "the node value type is incorrect"
469
644
  },
470
645
  {
471
- function: "validate_riceGrainInHuskFlooded_minimum_cycleDuration",
646
+ function: "validate_list_has_properties",
472
647
  level: "warning",
473
- message: "should be more than the cropping duration"
648
+ message: "should add missing properties"
474
649
  },
475
650
  {
476
- function: "validate_crop_siteDuration",
651
+ function: "validate_is_region",
477
652
  level: "error",
478
- message: "should be equal to cycleDuration for crop"
653
+ message: "must not be a country"
479
654
  },
480
655
  {
481
- function: "validate_crop_siteDuration",
656
+ function: "validate_region_in_country",
482
657
  level: "error",
483
- message: "should be greater than cycleDuration for crop"
658
+ message: "must be within the country"
484
659
  },
485
660
  {
486
- function: "validate_animal_siteDuration",
661
+ function: "validate_country",
487
662
  level: "error",
488
- message: "should be equal to cycleDuration for animals"
663
+ message: "must be a country"
489
664
  },
490
665
  {
491
- function: "validate_animal_siteDuration",
666
+ function: "validate_coordinates",
492
667
  level: "error",
493
- message: "should be equal to cycleDuration - otherSitesDuration for animals"
668
+ message: "does not contain latitude and longitude"
494
669
  },
495
670
  {
496
- function: "validate_animal_siteDuration",
497
- level: "error",
498
- message: "should be less than cycleDuration for animals"
671
+ function: "validate_area",
672
+ level: "warning",
673
+ message: "should be equal to boundary"
499
674
  },
500
675
  {
501
- function: "validate_durations",
676
+ function: "validate_boundary_area",
502
677
  level: "warning",
503
- message: "should add the fields for a relative cycle"
678
+ message: "boundaryArea should be lower than max size"
504
679
  },
505
680
  {
506
- function: "validate_possibleCoverCrop",
507
- level: "error",
508
- message: "cover crop cycle contains non cover crop product"
681
+ function: "validate_region_size",
682
+ level: "warning",
683
+ message: "should be lower than max size"
509
684
  },
510
685
  {
511
- function: "validate_set_treatment",
686
+ function: "validate_empty_fields",
512
687
  level: "warning",
513
- message: "should specify a treatment when experimentDesign is specified"
688
+ message: "may not be empty"
514
689
  },
515
690
  {
516
- function: "validate_products_animals",
517
- level: "warning",
518
- message: "should not specify both liveAnimal and animalProduct"
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: "validate_stocking_density",
696
+ function: "validate_private_has_source",
522
697
  level: "warning",
523
- message: "should add the term stockingDensityPermanentPastureAverage"
698
+ message: "should add a source"
524
699
  },
525
700
  {
526
- function: "validate_linked_impact_assessment",
701
+ function: "_validate_list_model",
527
702
  level: "error",
528
- message: "multiple ImpactAssessment are associated with this Product"
703
+ message: "the value provided is not consistent with the model result"
529
704
  },
530
705
  {
531
- function: "validate_linked_impact_assessment",
532
- level: "error",
533
- message: "no ImpactAssessment are associated with this Product"
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: "validate_animal_product_mapping",
711
+ function: "validate_other_model",
537
712
  level: "error",
538
- message: "is not an allowed animalProduct"
713
+ message: "is required when using other model"
539
714
  },
540
715
  {
541
- function: "validate_requires_substrate",
542
- level: "error",
543
- message: "must add substrate inputs"
716
+ function: "validate_nested_existing_node",
717
+ level: "warning",
718
+ message: "should not link to an existing node"
544
719
  },
545
720
  {
546
- function: "validate_property_valueType",
547
- level: "error",
548
- message: "the property value type is incorrect"
721
+ function: "validate_nested_existing_node",
722
+ level: "warning",
723
+ message: "should not link to an existing node"
549
724
  },
550
725
  {
551
- function: "validate_term_type",
726
+ function: "validate_cycle_dates",
552
727
  level: "error",
553
- message: "can not be used on this termType"
728
+ message: "multiple cycles on the same site cannot overlap"
554
729
  },
555
730
  {
556
- function: "validate_default_value",
557
- level: "warning",
558
- message: "should be within percentage of default value"
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,91 +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_compound_fertiliser_composition",
637
- level: "warning",
638
- message: "should match the nutrient ratio of the compound fertiliser"
639
- },
640
- {
641
- function: "validate_related_impacts",
642
- level: "error",
643
- message: "can not be linked to the same type"
644
- },
645
- {
646
- function: "validate_related_impact_product",
647
- level: "error",
648
- message: "can not be linked to a different term"
649
- },
650
- {
651
- function: "_validate_input_value",
652
- level: "warning",
653
- message: "is outside confidence interval"
654
- },
655
- {
656
- function: "validate_animalFeed_requires_isAnimalFeed",
657
- level: "error",
658
- message: "must specify is it an animal feed"
659
- },
660
- {
661
- function: "validate_isAnimalFeed_animal_cycle",
662
- level: "error",
663
- message: "isAnimalFeed not allowed on a non-animal cycle"
664
- },
665
- {
666
- function: "validate_saplings",
667
- level: "error",
668
- message: "saplings cannot be used as an input here"
669
- },
670
- {
671
- function: "validate_seed",
672
- level: "error",
673
- message: "seed cannot be used as an input here"
674
- },
675
- {
676
- function: "validate_saplings_depreciated",
677
- level: "error",
678
- message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
679
- },
680
- {
681
- function: "validate_material_depreciated",
682
- level: "error",
683
- message: "must use the depreciated term"
684
- },
685
- {
686
- function: "validate_input_is_product",
687
- level: "error",
688
- message: "must be a product"
689
- },
690
- {
691
- function: "validate_input_unspecified_term",
692
- level: "warning",
693
- message: "should use a specific term"
694
- },
695
785
  {
696
786
  function: "_validate_all_values",
697
787
  level: "warning",
@@ -736,81 +826,6 @@ var validations = [
736
826
  function: "validate_coverage",
737
827
  level: "warning",
738
828
  message: "can not calculate all emissions"
739
- },
740
- {
741
- function: "validate_has_termType",
742
- level: "warning",
743
- message: "should contain at least one management node"
744
- },
745
- {
746
- function: "validate_fallow_dates",
747
- level: "error",
748
- message: "duration must be in specified interval"
749
- },
750
- {
751
- function: "validate_cycles_overlap",
752
- level: "error",
753
- message: "management date must be before cycle start date"
754
- },
755
- {
756
- function: "validate_cycle_dates",
757
- level: "error",
758
- message: "multiple cycles on the same site cannot overlap"
759
- },
760
- {
761
- function: "validate_cycles_linked_ia",
762
- level: "error",
763
- message: "cycles linked together cannot be added to the same site"
764
- },
765
- {
766
- function: "validate_linked_impactAssessment",
767
- level: "error",
768
- message: "must be linked to a verified country-level Impact Assessment"
769
- },
770
- {
771
- function: "validate_plantation_practices",
772
- level: "error",
773
- message: "must include practices for plantation weighting"
774
- },
775
- {
776
- function: "validate_id",
777
- level: "error",
778
- message: "aggregation id must contain a product, region, start, end year, and a timestamp"
779
- },
780
- {
781
- function: "_validate_previous_transformationId",
782
- level: "error",
783
- message: "must point to a previous transformation in the list"
784
- },
785
- {
786
- function: "_validate_previous_input",
787
- level: "error",
788
- message: "at least one Input must be a Product of the Cycle"
789
- },
790
- {
791
- function: "_validate_previous_input",
792
- level: "error",
793
- message: "at least one Input must be a Product of the previous Transformation"
794
- },
795
- {
796
- function: "_validate_previous_product_value",
797
- level: "error",
798
- message: "must be equal to previous product multiplied by the share"
799
- },
800
- {
801
- function: "validate_linked_emission",
802
- level: "warning",
803
- message: "should be linked to an emission in the Cycle"
804
- },
805
- {
806
- function: "validate_excreta_inputs_products",
807
- level: "error",
808
- message: "must be included as an Input"
809
- },
810
- {
811
- function: "validate_transformation_inputs_value",
812
- level: "error",
813
- message: "must be specified for multiple Inputs with the same term"
814
829
  }
815
830
  ];
816
831
 
@@ -2229,11 +2244,31 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
2229
2244
  name: "Cover crop"
2230
2245
  }
2231
2246
  )} Practice.`,
2232
- "saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
2233
- id: String(params.expected),
2234
- name: humanizeTermId(String(params.expected))
2235
- })} should be used instead of ${code(params.current)}.
2236
- If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`,
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
+ },
2237
2272
  "must use the depreciated term": ({ params }) => {
2238
2273
  var _a, _b;
2239
2274
  return `${code(
@@ -2316,6 +2351,31 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
2316
2351
  ${(_b = causes[params == null ? void 0 : params.cause]) != null ? _b : ""}
2317
2352
  Please check that both Inputs are the amounts of each nutrient applied with this fertiliser.`;
2318
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
+ },
2319
2379
  "the property value type is incorrect": ({ params: { expected } }) => `The value must be a ${expected}.`,
2320
2380
  "the node value type is incorrect": ({ params: { expected } }) => `The value must be a ${expected}.`,
2321
2381
  "can not be linked to the same type": ({ params: { current } }) => `Cannot be linked to the same ${current}.`,