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