@hestia-earth/data-validation 0.41.13 → 0.41.15
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.js +84 -22
- package/file-errors/public-api.mjs +84 -22
- package/index.js +15 -0
- package/index.mjs +15 -0
- package/package.json +1 -1
- package/validation.json +15 -0
|
@@ -187,6 +187,11 @@ var validations = [
|
|
|
187
187
|
level: "error",
|
|
188
188
|
message: "must not have background methodTier"
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
function: "validate_methodTier_background",
|
|
192
|
+
level: "error",
|
|
193
|
+
message: "must be an existing term"
|
|
194
|
+
},
|
|
190
195
|
{
|
|
191
196
|
function: "validate_depth",
|
|
192
197
|
level: "warning",
|
|
@@ -292,6 +297,11 @@ var validations = [
|
|
|
292
297
|
level: "error",
|
|
293
298
|
message: "at least one landCover practice must match an equivalent product"
|
|
294
299
|
},
|
|
300
|
+
{
|
|
301
|
+
function: "validate_coverCrop_landCover_primary_product",
|
|
302
|
+
level: "error",
|
|
303
|
+
message: "a cover crop can not be the land cover of the primary product"
|
|
304
|
+
},
|
|
295
305
|
{
|
|
296
306
|
function: "validate_practices_management",
|
|
297
307
|
level: "error",
|
|
@@ -322,6 +332,11 @@ var validations = [
|
|
|
322
332
|
level: "error",
|
|
323
333
|
message: "is outside the allowed range"
|
|
324
334
|
},
|
|
335
|
+
{
|
|
336
|
+
function: "validate_soilTexture_depths",
|
|
337
|
+
level: "warning",
|
|
338
|
+
message: "should be given at the same depths as the soil content"
|
|
339
|
+
},
|
|
325
340
|
{
|
|
326
341
|
function: "validate_depths",
|
|
327
342
|
level: "error",
|
|
@@ -1428,6 +1443,25 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1428
1443
|
At least one measurement of sand, silt, or clay content does not match the possible range for the specified soil texture.`}
|
|
1429
1444
|
${errorCount === 1 ? "Please check the measurement, its depth intervals, and the dates of the measurement or update the soil texture if needed." : "Please check your measurements, their depth intervals, and the dates of the measurements or update the soil textures if needed."}`;
|
|
1430
1445
|
},
|
|
1446
|
+
"should be given at the same depths as the soil content": ({ params }) => {
|
|
1447
|
+
var _a, _b, _c;
|
|
1448
|
+
const formatDepths = (depths) => {
|
|
1449
|
+
var _a2, _b2;
|
|
1450
|
+
return `${(_a2 = depths == null ? void 0 : depths.depthUpper) != null ? _a2 : "-"}-${(_b2 = depths == null ? void 0 : depths.depthLower) != null ? _b2 : "-"} cm`;
|
|
1451
|
+
};
|
|
1452
|
+
return `The soil texture ${termLink({
|
|
1453
|
+
id: (_a = params == null ? void 0 : params.term) == null ? void 0 : _a["@id"],
|
|
1454
|
+
name: (_b = params == null ? void 0 : params.term) == null ? void 0 : _b.name
|
|
1455
|
+
})} is given at ${code(
|
|
1456
|
+
formatDepths(params == null ? void 0 : params.current)
|
|
1457
|
+
)}, but the sand, silt and clay content are only given at ${joinValues(
|
|
1458
|
+
((_c = params == null ? void 0 : params.expected) != null ? _c : []).map(formatDepths)
|
|
1459
|
+
)}.
|
|
1460
|
+
The soil texture is only checked against the sand, silt and clay content measured at the same ${code(
|
|
1461
|
+
"depthUpper"
|
|
1462
|
+
)} and ${code("depthLower")}, so at this depth the two are never compared.
|
|
1463
|
+
Please add the sand, silt and clay content at the same depths as the soil texture.`;
|
|
1464
|
+
},
|
|
1431
1465
|
"should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
|
|
1432
1466
|
var _a, _b;
|
|
1433
1467
|
const paths = parseDataPath(dataPath);
|
|
@@ -1660,6 +1694,13 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1660
1694
|
100
|
|
1661
1695
|
)} if the Number of tillages has been set to ${code(0)}. Please resolve this conflict.`,
|
|
1662
1696
|
"can not be linked to the same Cycle": () => "You can not link an Input to the Impact Assessment of the same Cycle.",
|
|
1697
|
+
"can not be linked to a different term": ({ params }) => {
|
|
1698
|
+
var _a;
|
|
1699
|
+
return `The Impact Assessment linked to this Input is for the Product ${termLink({
|
|
1700
|
+
id: params == null ? void 0 : params.current
|
|
1701
|
+
})}, which does not match the Input.
|
|
1702
|
+
Link an Impact Assessment whose Product is ${joinWithOr(((_a = params == null ? void 0 : params.expected) != null ? _a : []).map((id) => termLink({ id })))} instead.`;
|
|
1703
|
+
},
|
|
1663
1704
|
// deprecated, remove when message is not being used anymore
|
|
1664
1705
|
"must be 0 for product value 0": ({ dataPath, params }, errorCount) => `If the amount produced is zero, the ${code(dataPath == null ? void 0 : dataPath.split(".").pop())} of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
1665
1706
|
"economicValueShare must be 0 for product value 0": ({ params }, errorCount) => `If the amount produced is zero, the economicValueShare of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
@@ -1928,26 +1969,29 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1928
1969
|
schema.TermTermType.liveAnimal
|
|
1929
1970
|
)} to the ${schemaLink("Cycle#animals", "Animal")} blank nodes.
|
|
1930
1971
|
The allowed product ids are: ${listAsCode(params == null ? void 0 : params.expected)}`,
|
|
1931
|
-
"duration must be in specified interval": ({ params: { term } = {} }) =>
|
|
1932
|
-
|
|
1933
|
-
"
|
|
1934
|
-
"
|
|
1935
|
-
|
|
1972
|
+
"duration must be in specified interval": ({ dataPath, params: { term } = {} }) => {
|
|
1973
|
+
const node = /\.practices\[\d+\]$/.test(dataPath != null ? dataPath : "") ? "Practice" : "Management";
|
|
1974
|
+
return ["shortFallow", "shortBareFallow"].includes(term["@id"]) ? `${code("Short fallow")} is defined as land left fallow for less than 365 days.
|
|
1975
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1976
|
+
`${node}#endDate`,
|
|
1977
|
+
"endDate"
|
|
1978
|
+
)} on this term and ensure the difference between the two dates is less than 365 days.
|
|
1936
1979
|
If it is more than 365 days, consider using the terms ${code("Long fallow")} or ${code("Set aside")} instead.` : ["longFallow", "longBareFallow"].includes(term["@id"]) ? `${code("Long fallow")} is defined as land left fallow for more than a year but less than five years.
|
|
1937
|
-
Please check the ${schemaLink(
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1980
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1981
|
+
`${node}#endDate`,
|
|
1982
|
+
"endDate"
|
|
1983
|
+
)} on this term and ensure the difference between the two dates falls between 365 and 1826 days.
|
|
1941
1984
|
If it is less than 365 days, consider using the term ${code("Short fallow")} instead.
|
|
1942
1985
|
If it is more than 1826 days, consider using the term ${code("Set aside")} instead.` : `${code(
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
Please check the ${schemaLink(
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1986
|
+
"Set aside"
|
|
1987
|
+
)} is defined as the temporary set aside of land for more than five years but less than twenty years.
|
|
1988
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1989
|
+
`${node}#endDate`,
|
|
1990
|
+
"endDate"
|
|
1991
|
+
)} on this term and ensure the difference between the two dates falls between 1826 and 7305 days.
|
|
1949
1992
|
If it is less than 1826 days, consider using the terms ${code("Short fallow")}or ${code("Long fallow")} instead.
|
|
1950
|
-
If it is more than 7305 days, consider using the term ${code("Other natural vegetation")} instead
|
|
1993
|
+
If it is more than 7305 days, consider using the term ${code("Other natural vegetation")} instead.`;
|
|
1994
|
+
},
|
|
1951
1995
|
"must not add the feed input to the Cycle as well": ({ params: { term } = {} }) => `You have added the animal feed Input ${code(term["@id"])} to the Cycle inputs as well, which might lead to double counting.
|
|
1952
1996
|
If you do not know the amount of ${code(term["@id"])} given to each Animal, please add the Input to the Cycle only.`,
|
|
1953
1997
|
"must provide value or min and max": ({ params }) => {
|
|
@@ -2117,13 +2161,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2117
2161
|
return `If completeness is set to true for ${schemaLink(
|
|
2118
2162
|
`Completeness#${params.expected}`,
|
|
2119
2163
|
params.expected
|
|
2120
|
-
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm)
|
|
2164
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm), a ${schemaLink(
|
|
2121
2165
|
"Transport#distance",
|
|
2122
2166
|
"distance"
|
|
2123
|
-
)} (in km).
|
|
2167
|
+
)} (in km), or ${schemaLink("Transport#inputs", "inputs")} (e.g. the fuel used) which all have a ${code(
|
|
2168
|
+
"value"
|
|
2169
|
+
)}. This ${termLink({
|
|
2124
2170
|
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2125
2171
|
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2126
|
-
})} has
|
|
2172
|
+
})} has none of these.`;
|
|
2127
2173
|
},
|
|
2128
2174
|
"primary product cannot be an input": ({ params }) => params.siteType === schema.SiteSiteType["agri-food processor"] ? `For a processing cycle, the primary Product must not also be an Input into the cycle.
|
|
2129
2175
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
@@ -2146,6 +2192,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2146
2192
|
`If specifying fallow periods, you must also include the Product's equivalent Practice with a ${code("startDate")} and ${code("endDate")}.`,
|
|
2147
2193
|
`Alternatively, do not set these ${code(schema.TermTermType.landCover)} practices, and they will be gap filled automatically from products.`
|
|
2148
2194
|
])}`,
|
|
2195
|
+
"a cover crop can not be the land cover of the primary product": ({ params }) => {
|
|
2196
|
+
var _a, _b, _c, _d;
|
|
2197
|
+
return `The ${termLink({ 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 })} Practice is set as a cover crop, but it is the land cover of ${termLink({ id: (_c = params == null ? void 0 : params.product) == null ? void 0 : _c["@id"], name: (_d = params == null ? void 0 : params.product) == null ? void 0 : _d.name })}, the primary Product of this Cycle. HESTIA counts the land cover of a cover crop separately from the main crop, so this land cover would be counted twice.
|
|
2198
|
+
Remove the cover crop property from this Practice, and add the cover crop as its own ${code(schema.TermTermType.landCover)} Practice if it is known.`;
|
|
2199
|
+
},
|
|
2149
2200
|
"should match the site management node value": ({ params }) => `The data you have uploaded in the Management node are not consistent with the data provided in the Cycles.
|
|
2150
2201
|
${typeof (params == null ? void 0 : params.current) === "boolean" ? `A ${code("Management")} node must have the same ${code("value")} as every Practice using the same ${code("term")} between the same ${code("startDate")} and ${code("endDate")} \u2014 your Cycles say ${code(params == null ? void 0 : params.current)}, but the ${code("Management")} node has ${code(params == null ? void 0 : params.expected)}.` : `The ${code("value")} of a ${code("Management")} node must be the total of every Practice using the same ${code("term")} between the same ${code("startDate")} and ${code("endDate")} \u2014 your Cycles add up to ${code(params == null ? void 0 : params.current)}, but the ${code("Management")} node has ${code(params == null ? void 0 : params.expected)}.`}
|
|
2151
2202
|
Please check your upload and ensure that the data is consistent throughout.`,
|
|
@@ -2160,11 +2211,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2160
2211
|
"Saplings"
|
|
2161
2212
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2162
2213
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2163
|
-
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from
|
|
2214
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from planting material rather than sown, so ${externalNodeLink(
|
|
2164
2215
|
{
|
|
2165
2216
|
"@type": schema.NodeType.Term,
|
|
2166
2217
|
"@id": String(params.expected),
|
|
2167
|
-
name:
|
|
2218
|
+
name: humanizeTermId(String(params.expected))
|
|
2168
2219
|
}
|
|
2169
2220
|
)} should be used instead of ${code(params.current)}.
|
|
2170
2221
|
If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle, or, if it was sown as a cover crop under the plantation, add the ${termLink(
|
|
@@ -2175,7 +2226,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2175
2226
|
)} Practice.`,
|
|
2176
2227
|
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2177
2228
|
id: String(params.expected),
|
|
2178
|
-
name:
|
|
2229
|
+
name: humanizeTermId(String(params.expected))
|
|
2179
2230
|
})} should be used instead of ${code(params.current)}.
|
|
2180
2231
|
If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`,
|
|
2181
2232
|
"must use the depreciated term": ({ params }) => {
|
|
@@ -2253,11 +2304,22 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2253
2304
|
Please amend the value of ${code("harvestedArea")} accordingly.`,
|
|
2254
2305
|
"must be above the minimum": ({ params: { min } }) => `Must be above ${min}.`,
|
|
2255
2306
|
"must be below the maximum": ({ params: { max } }) => `Must be below ${max}.`,
|
|
2307
|
+
"must be greater than min": ({ params }) => `The ${code("max")} (${joinValues([].concat(params == null ? void 0 : params.max).map(String))}) must be greater than the ${code(
|
|
2308
|
+
"min"
|
|
2309
|
+
)} (${joinValues([].concat(params == null ? void 0 : params.min).map(String))}).
|
|
2310
|
+
Please check they have not been swapped: the ${code("value")} can be gap-filled from them.`,
|
|
2256
2311
|
"must be linked to waste input": () => `The term ${code(
|
|
2257
2312
|
"ionisingCompoundsToAirInputsProduction"
|
|
2258
2313
|
)} can only have 1 entry of ${code("termType")}: ${glossaryTypeLink(
|
|
2259
2314
|
schema.TermTermType.waste
|
|
2260
2315
|
)}, so that the ${code("value")} field can represent the amount of units of that waste term.`,
|
|
2316
|
+
"must be an existing term": ({ params }) => {
|
|
2317
|
+
var _a, _b;
|
|
2318
|
+
return `${code(((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.name) || ((_b = params == null ? void 0 : params.term) == null ? void 0 : _b["@id"]))} is not in the ${glossaryLink(
|
|
2319
|
+
"Glossary"
|
|
2320
|
+
)}: it has been removed or renamed.
|
|
2321
|
+
Please replace it with the current term.`;
|
|
2322
|
+
},
|
|
2261
2323
|
"must not have background methodTier": ({ params: { allowedValues } }) => `Only background emissions (e.g., "Inputs Production") can have ${code("methodTier")}=${schema.EmissionMethodTier.background}.
|
|
2262
2324
|
You must instead choose one of the following values: ${listAsCode(allowedValues)}`,
|
|
2263
2325
|
"should be within acceptable range of the lookup value": ({ params }) => `The ${code(params.term["@id"])} value is ${code(params.delta)}% higher than our default value for this Term (${code(params.expected)}).
|
|
@@ -185,6 +185,11 @@ var validations = [
|
|
|
185
185
|
level: "error",
|
|
186
186
|
message: "must not have background methodTier"
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
function: "validate_methodTier_background",
|
|
190
|
+
level: "error",
|
|
191
|
+
message: "must be an existing term"
|
|
192
|
+
},
|
|
188
193
|
{
|
|
189
194
|
function: "validate_depth",
|
|
190
195
|
level: "warning",
|
|
@@ -290,6 +295,11 @@ var validations = [
|
|
|
290
295
|
level: "error",
|
|
291
296
|
message: "at least one landCover practice must match an equivalent product"
|
|
292
297
|
},
|
|
298
|
+
{
|
|
299
|
+
function: "validate_coverCrop_landCover_primary_product",
|
|
300
|
+
level: "error",
|
|
301
|
+
message: "a cover crop can not be the land cover of the primary product"
|
|
302
|
+
},
|
|
293
303
|
{
|
|
294
304
|
function: "validate_practices_management",
|
|
295
305
|
level: "error",
|
|
@@ -320,6 +330,11 @@ var validations = [
|
|
|
320
330
|
level: "error",
|
|
321
331
|
message: "is outside the allowed range"
|
|
322
332
|
},
|
|
333
|
+
{
|
|
334
|
+
function: "validate_soilTexture_depths",
|
|
335
|
+
level: "warning",
|
|
336
|
+
message: "should be given at the same depths as the soil content"
|
|
337
|
+
},
|
|
323
338
|
{
|
|
324
339
|
function: "validate_depths",
|
|
325
340
|
level: "error",
|
|
@@ -1426,6 +1441,25 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1426
1441
|
At least one measurement of sand, silt, or clay content does not match the possible range for the specified soil texture.`}
|
|
1427
1442
|
${errorCount === 1 ? "Please check the measurement, its depth intervals, and the dates of the measurement or update the soil texture if needed." : "Please check your measurements, their depth intervals, and the dates of the measurements or update the soil textures if needed."}`;
|
|
1428
1443
|
},
|
|
1444
|
+
"should be given at the same depths as the soil content": ({ params }) => {
|
|
1445
|
+
var _a, _b, _c;
|
|
1446
|
+
const formatDepths = (depths) => {
|
|
1447
|
+
var _a2, _b2;
|
|
1448
|
+
return `${(_a2 = depths == null ? void 0 : depths.depthUpper) != null ? _a2 : "-"}-${(_b2 = depths == null ? void 0 : depths.depthLower) != null ? _b2 : "-"} cm`;
|
|
1449
|
+
};
|
|
1450
|
+
return `The soil texture ${termLink({
|
|
1451
|
+
id: (_a = params == null ? void 0 : params.term) == null ? void 0 : _a["@id"],
|
|
1452
|
+
name: (_b = params == null ? void 0 : params.term) == null ? void 0 : _b.name
|
|
1453
|
+
})} is given at ${code(
|
|
1454
|
+
formatDepths(params == null ? void 0 : params.current)
|
|
1455
|
+
)}, but the sand, silt and clay content are only given at ${joinValues(
|
|
1456
|
+
((_c = params == null ? void 0 : params.expected) != null ? _c : []).map(formatDepths)
|
|
1457
|
+
)}.
|
|
1458
|
+
The soil texture is only checked against the sand, silt and clay content measured at the same ${code(
|
|
1459
|
+
"depthUpper"
|
|
1460
|
+
)} and ${code("depthLower")}, so at this depth the two are never compared.
|
|
1461
|
+
Please add the sand, silt and clay content at the same depths as the soil texture.`;
|
|
1462
|
+
},
|
|
1429
1463
|
"should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
|
|
1430
1464
|
var _a, _b;
|
|
1431
1465
|
const paths = parseDataPath(dataPath);
|
|
@@ -1658,6 +1692,13 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1658
1692
|
100
|
|
1659
1693
|
)} if the Number of tillages has been set to ${code(0)}. Please resolve this conflict.`,
|
|
1660
1694
|
"can not be linked to the same Cycle": () => "You can not link an Input to the Impact Assessment of the same Cycle.",
|
|
1695
|
+
"can not be linked to a different term": ({ params }) => {
|
|
1696
|
+
var _a;
|
|
1697
|
+
return `The Impact Assessment linked to this Input is for the Product ${termLink({
|
|
1698
|
+
id: params == null ? void 0 : params.current
|
|
1699
|
+
})}, which does not match the Input.
|
|
1700
|
+
Link an Impact Assessment whose Product is ${joinWithOr(((_a = params == null ? void 0 : params.expected) != null ? _a : []).map((id) => termLink({ id })))} instead.`;
|
|
1701
|
+
},
|
|
1661
1702
|
// deprecated, remove when message is not being used anymore
|
|
1662
1703
|
"must be 0 for product value 0": ({ dataPath, params }, errorCount) => `If the amount produced is zero, the ${code(dataPath == null ? void 0 : dataPath.split(".").pop())} of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
1663
1704
|
"economicValueShare must be 0 for product value 0": ({ params }, errorCount) => `If the amount produced is zero, the economicValueShare of ${errorCount === 1 ? code(params == null ? void 0 : params.term.name) : "that product"} must also be zero.`,
|
|
@@ -1926,26 +1967,29 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1926
1967
|
TermTermType.liveAnimal
|
|
1927
1968
|
)} to the ${schemaLink("Cycle#animals", "Animal")} blank nodes.
|
|
1928
1969
|
The allowed product ids are: ${listAsCode(params == null ? void 0 : params.expected)}`,
|
|
1929
|
-
"duration must be in specified interval": ({ params: { term } = {} }) =>
|
|
1930
|
-
|
|
1931
|
-
"
|
|
1932
|
-
"
|
|
1933
|
-
|
|
1970
|
+
"duration must be in specified interval": ({ dataPath, params: { term } = {} }) => {
|
|
1971
|
+
const node = /\.practices\[\d+\]$/.test(dataPath != null ? dataPath : "") ? "Practice" : "Management";
|
|
1972
|
+
return ["shortFallow", "shortBareFallow"].includes(term["@id"]) ? `${code("Short fallow")} is defined as land left fallow for less than 365 days.
|
|
1973
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1974
|
+
`${node}#endDate`,
|
|
1975
|
+
"endDate"
|
|
1976
|
+
)} on this term and ensure the difference between the two dates is less than 365 days.
|
|
1934
1977
|
If it is more than 365 days, consider using the terms ${code("Long fallow")} or ${code("Set aside")} instead.` : ["longFallow", "longBareFallow"].includes(term["@id"]) ? `${code("Long fallow")} is defined as land left fallow for more than a year but less than five years.
|
|
1935
|
-
Please check the ${schemaLink(
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1978
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1979
|
+
`${node}#endDate`,
|
|
1980
|
+
"endDate"
|
|
1981
|
+
)} on this term and ensure the difference between the two dates falls between 365 and 1826 days.
|
|
1939
1982
|
If it is less than 365 days, consider using the term ${code("Short fallow")} instead.
|
|
1940
1983
|
If it is more than 1826 days, consider using the term ${code("Set aside")} instead.` : `${code(
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
Please check the ${schemaLink(
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1984
|
+
"Set aside"
|
|
1985
|
+
)} is defined as the temporary set aside of land for more than five years but less than twenty years.
|
|
1986
|
+
Please check the ${schemaLink(`${node}#startDate`, "startDate")} and ${schemaLink(
|
|
1987
|
+
`${node}#endDate`,
|
|
1988
|
+
"endDate"
|
|
1989
|
+
)} on this term and ensure the difference between the two dates falls between 1826 and 7305 days.
|
|
1947
1990
|
If it is less than 1826 days, consider using the terms ${code("Short fallow")}or ${code("Long fallow")} instead.
|
|
1948
|
-
If it is more than 7305 days, consider using the term ${code("Other natural vegetation")} instead
|
|
1991
|
+
If it is more than 7305 days, consider using the term ${code("Other natural vegetation")} instead.`;
|
|
1992
|
+
},
|
|
1949
1993
|
"must not add the feed input to the Cycle as well": ({ params: { term } = {} }) => `You have added the animal feed Input ${code(term["@id"])} to the Cycle inputs as well, which might lead to double counting.
|
|
1950
1994
|
If you do not know the amount of ${code(term["@id"])} given to each Animal, please add the Input to the Cycle only.`,
|
|
1951
1995
|
"must provide value or min and max": ({ params }) => {
|
|
@@ -2115,13 +2159,15 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2115
2159
|
return `If completeness is set to true for ${schemaLink(
|
|
2116
2160
|
`Completeness#${params.expected}`,
|
|
2117
2161
|
params.expected
|
|
2118
|
-
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm)
|
|
2162
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm), a ${schemaLink(
|
|
2119
2163
|
"Transport#distance",
|
|
2120
2164
|
"distance"
|
|
2121
|
-
)} (in km).
|
|
2165
|
+
)} (in km), or ${schemaLink("Transport#inputs", "inputs")} (e.g. the fuel used) which all have a ${code(
|
|
2166
|
+
"value"
|
|
2167
|
+
)}. This ${termLink({
|
|
2122
2168
|
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2123
2169
|
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2124
|
-
})} has
|
|
2170
|
+
})} has none of these.`;
|
|
2125
2171
|
},
|
|
2126
2172
|
"primary product cannot be an input": ({ params }) => params.siteType === SiteSiteType["agri-food processor"] ? `For a processing cycle, the primary Product must not also be an Input into the cycle.
|
|
2127
2173
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
@@ -2144,6 +2190,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2144
2190
|
`If specifying fallow periods, you must also include the Product's equivalent Practice with a ${code("startDate")} and ${code("endDate")}.`,
|
|
2145
2191
|
`Alternatively, do not set these ${code(TermTermType.landCover)} practices, and they will be gap filled automatically from products.`
|
|
2146
2192
|
])}`,
|
|
2193
|
+
"a cover crop can not be the land cover of the primary product": ({ params }) => {
|
|
2194
|
+
var _a, _b, _c, _d;
|
|
2195
|
+
return `The ${termLink({ 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 })} Practice is set as a cover crop, but it is the land cover of ${termLink({ id: (_c = params == null ? void 0 : params.product) == null ? void 0 : _c["@id"], name: (_d = params == null ? void 0 : params.product) == null ? void 0 : _d.name })}, the primary Product of this Cycle. HESTIA counts the land cover of a cover crop separately from the main crop, so this land cover would be counted twice.
|
|
2196
|
+
Remove the cover crop property from this Practice, and add the cover crop as its own ${code(TermTermType.landCover)} Practice if it is known.`;
|
|
2197
|
+
},
|
|
2147
2198
|
"should match the site management node value": ({ params }) => `The data you have uploaded in the Management node are not consistent with the data provided in the Cycles.
|
|
2148
2199
|
${typeof (params == null ? void 0 : params.current) === "boolean" ? `A ${code("Management")} node must have the same ${code("value")} as every Practice using the same ${code("term")} between the same ${code("startDate")} and ${code("endDate")} \u2014 your Cycles say ${code(params == null ? void 0 : params.current)}, but the ${code("Management")} node has ${code(params == null ? void 0 : params.expected)}.` : `The ${code("value")} of a ${code("Management")} node must be the total of every Practice using the same ${code("term")} between the same ${code("startDate")} and ${code("endDate")} \u2014 your Cycles add up to ${code(params == null ? void 0 : params.current)}, but the ${code("Management")} node has ${code(params == null ? void 0 : params.expected)}.`}
|
|
2149
2200
|
Please check your upload and ensure that the data is consistent throughout.`,
|
|
@@ -2158,11 +2209,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2158
2209
|
"Saplings"
|
|
2159
2210
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2160
2211
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2161
|
-
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from
|
|
2212
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from planting material rather than sown, so ${externalNodeLink(
|
|
2162
2213
|
{
|
|
2163
2214
|
"@type": NodeType.Term,
|
|
2164
2215
|
"@id": String(params.expected),
|
|
2165
|
-
name:
|
|
2216
|
+
name: humanizeTermId(String(params.expected))
|
|
2166
2217
|
}
|
|
2167
2218
|
)} should be used instead of ${code(params.current)}.
|
|
2168
2219
|
If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle, or, if it was sown as a cover crop under the plantation, add the ${termLink(
|
|
@@ -2173,7 +2224,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2173
2224
|
)} Practice.`,
|
|
2174
2225
|
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2175
2226
|
id: String(params.expected),
|
|
2176
|
-
name:
|
|
2227
|
+
name: humanizeTermId(String(params.expected))
|
|
2177
2228
|
})} should be used instead of ${code(params.current)}.
|
|
2178
2229
|
If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle.`,
|
|
2179
2230
|
"must use the depreciated term": ({ params }) => {
|
|
@@ -2251,11 +2302,22 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2251
2302
|
Please amend the value of ${code("harvestedArea")} accordingly.`,
|
|
2252
2303
|
"must be above the minimum": ({ params: { min } }) => `Must be above ${min}.`,
|
|
2253
2304
|
"must be below the maximum": ({ params: { max } }) => `Must be below ${max}.`,
|
|
2305
|
+
"must be greater than min": ({ params }) => `The ${code("max")} (${joinValues([].concat(params == null ? void 0 : params.max).map(String))}) must be greater than the ${code(
|
|
2306
|
+
"min"
|
|
2307
|
+
)} (${joinValues([].concat(params == null ? void 0 : params.min).map(String))}).
|
|
2308
|
+
Please check they have not been swapped: the ${code("value")} can be gap-filled from them.`,
|
|
2254
2309
|
"must be linked to waste input": () => `The term ${code(
|
|
2255
2310
|
"ionisingCompoundsToAirInputsProduction"
|
|
2256
2311
|
)} can only have 1 entry of ${code("termType")}: ${glossaryTypeLink(
|
|
2257
2312
|
TermTermType.waste
|
|
2258
2313
|
)}, so that the ${code("value")} field can represent the amount of units of that waste term.`,
|
|
2314
|
+
"must be an existing term": ({ params }) => {
|
|
2315
|
+
var _a, _b;
|
|
2316
|
+
return `${code(((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.name) || ((_b = params == null ? void 0 : params.term) == null ? void 0 : _b["@id"]))} is not in the ${glossaryLink(
|
|
2317
|
+
"Glossary"
|
|
2318
|
+
)}: it has been removed or renamed.
|
|
2319
|
+
Please replace it with the current term.`;
|
|
2320
|
+
},
|
|
2259
2321
|
"must not have background methodTier": ({ params: { allowedValues } }) => `Only background emissions (e.g., "Inputs Production") can have ${code("methodTier")}=${EmissionMethodTier.background}.
|
|
2260
2322
|
You must instead choose one of the following values: ${listAsCode(allowedValues)}`,
|
|
2261
2323
|
"should be within acceptable range of the lookup value": ({ params }) => `The ${code(params.term["@id"])} value is ${code(params.delta)}% higher than our default value for this Term (${code(params.expected)}).
|
package/index.js
CHANGED
|
@@ -193,6 +193,11 @@ var validations = [
|
|
|
193
193
|
level: "error",
|
|
194
194
|
message: "must not have background methodTier"
|
|
195
195
|
},
|
|
196
|
+
{
|
|
197
|
+
function: "validate_methodTier_background",
|
|
198
|
+
level: "error",
|
|
199
|
+
message: "must be an existing term"
|
|
200
|
+
},
|
|
196
201
|
{
|
|
197
202
|
function: "validate_depth",
|
|
198
203
|
level: "warning",
|
|
@@ -298,6 +303,11 @@ var validations = [
|
|
|
298
303
|
level: "error",
|
|
299
304
|
message: "at least one landCover practice must match an equivalent product"
|
|
300
305
|
},
|
|
306
|
+
{
|
|
307
|
+
function: "validate_coverCrop_landCover_primary_product",
|
|
308
|
+
level: "error",
|
|
309
|
+
message: "a cover crop can not be the land cover of the primary product"
|
|
310
|
+
},
|
|
301
311
|
{
|
|
302
312
|
function: "validate_practices_management",
|
|
303
313
|
level: "error",
|
|
@@ -328,6 +338,11 @@ var validations = [
|
|
|
328
338
|
level: "error",
|
|
329
339
|
message: "is outside the allowed range"
|
|
330
340
|
},
|
|
341
|
+
{
|
|
342
|
+
function: "validate_soilTexture_depths",
|
|
343
|
+
level: "warning",
|
|
344
|
+
message: "should be given at the same depths as the soil content"
|
|
345
|
+
},
|
|
331
346
|
{
|
|
332
347
|
function: "validate_depths",
|
|
333
348
|
level: "error",
|
package/index.mjs
CHANGED
|
@@ -191,6 +191,11 @@ var validations = [
|
|
|
191
191
|
level: "error",
|
|
192
192
|
message: "must not have background methodTier"
|
|
193
193
|
},
|
|
194
|
+
{
|
|
195
|
+
function: "validate_methodTier_background",
|
|
196
|
+
level: "error",
|
|
197
|
+
message: "must be an existing term"
|
|
198
|
+
},
|
|
194
199
|
{
|
|
195
200
|
function: "validate_depth",
|
|
196
201
|
level: "warning",
|
|
@@ -296,6 +301,11 @@ var validations = [
|
|
|
296
301
|
level: "error",
|
|
297
302
|
message: "at least one landCover practice must match an equivalent product"
|
|
298
303
|
},
|
|
304
|
+
{
|
|
305
|
+
function: "validate_coverCrop_landCover_primary_product",
|
|
306
|
+
level: "error",
|
|
307
|
+
message: "a cover crop can not be the land cover of the primary product"
|
|
308
|
+
},
|
|
299
309
|
{
|
|
300
310
|
function: "validate_practices_management",
|
|
301
311
|
level: "error",
|
|
@@ -326,6 +336,11 @@ var validations = [
|
|
|
326
336
|
level: "error",
|
|
327
337
|
message: "is outside the allowed range"
|
|
328
338
|
},
|
|
339
|
+
{
|
|
340
|
+
function: "validate_soilTexture_depths",
|
|
341
|
+
level: "warning",
|
|
342
|
+
message: "should be given at the same depths as the soil content"
|
|
343
|
+
},
|
|
329
344
|
{
|
|
330
345
|
function: "validate_depths",
|
|
331
346
|
level: "error",
|
package/package.json
CHANGED
package/validation.json
CHANGED
|
@@ -180,6 +180,11 @@
|
|
|
180
180
|
"level": "error",
|
|
181
181
|
"message": "must not have background methodTier"
|
|
182
182
|
},
|
|
183
|
+
{
|
|
184
|
+
"function": "validate_methodTier_background",
|
|
185
|
+
"level": "error",
|
|
186
|
+
"message": "must be an existing term"
|
|
187
|
+
},
|
|
183
188
|
{
|
|
184
189
|
"function": "validate_depth",
|
|
185
190
|
"level": "warning",
|
|
@@ -285,6 +290,11 @@
|
|
|
285
290
|
"level": "error",
|
|
286
291
|
"message": "at least one landCover practice must match an equivalent product"
|
|
287
292
|
},
|
|
293
|
+
{
|
|
294
|
+
"function": "validate_coverCrop_landCover_primary_product",
|
|
295
|
+
"level": "error",
|
|
296
|
+
"message": "a cover crop can not be the land cover of the primary product"
|
|
297
|
+
},
|
|
288
298
|
{
|
|
289
299
|
"function": "validate_practices_management",
|
|
290
300
|
"level": "error",
|
|
@@ -315,6 +325,11 @@
|
|
|
315
325
|
"level": "error",
|
|
316
326
|
"message": "is outside the allowed range"
|
|
317
327
|
},
|
|
328
|
+
{
|
|
329
|
+
"function": "validate_soilTexture_depths",
|
|
330
|
+
"level": "warning",
|
|
331
|
+
"message": "should be given at the same depths as the soil content"
|
|
332
|
+
},
|
|
318
333
|
{
|
|
319
334
|
"function": "validate_depths",
|
|
320
335
|
"level": "error",
|