@hestia-earth/data-validation 0.41.7 → 0.41.8
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 +81 -13
- package/file-errors/public-api.mjs +81 -13
- package/index.js +20 -0
- package/index.mjs +20 -0
- package/package.json +1 -1
- package/validation.json +20 -0
|
@@ -202,6 +202,11 @@ var validations = [
|
|
|
202
202
|
level: "error",
|
|
203
203
|
message: "longFallowDuration must be lower than 5 years"
|
|
204
204
|
},
|
|
205
|
+
{
|
|
206
|
+
function: "validate_plantationLifespan",
|
|
207
|
+
level: "error",
|
|
208
|
+
message: "must be greater than or equal to plantationProductiveLifespan"
|
|
209
|
+
},
|
|
205
210
|
{
|
|
206
211
|
function: "validate_waterRegime_rice_products",
|
|
207
212
|
level: "error",
|
|
@@ -627,6 +632,11 @@ var validations = [
|
|
|
627
632
|
level: "error",
|
|
628
633
|
message: "must specify is it an animal feed"
|
|
629
634
|
},
|
|
635
|
+
{
|
|
636
|
+
function: "validate_isAnimalFeed_animal_cycle",
|
|
637
|
+
level: "error",
|
|
638
|
+
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
639
|
+
},
|
|
630
640
|
{
|
|
631
641
|
function: "validate_saplings",
|
|
632
642
|
level: "error",
|
|
@@ -637,6 +647,11 @@ var validations = [
|
|
|
637
647
|
level: "error",
|
|
638
648
|
message: "seed cannot be used as an input here"
|
|
639
649
|
},
|
|
650
|
+
{
|
|
651
|
+
function: "validate_saplings_depreciated",
|
|
652
|
+
level: "error",
|
|
653
|
+
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
654
|
+
},
|
|
640
655
|
{
|
|
641
656
|
function: "validate_material_depreciated",
|
|
642
657
|
level: "error",
|
|
@@ -682,6 +697,11 @@ var validations = [
|
|
|
682
697
|
level: "error",
|
|
683
698
|
message: "must not be blank if complete"
|
|
684
699
|
},
|
|
700
|
+
{
|
|
701
|
+
function: "validate_completeness_transport",
|
|
702
|
+
level: "error",
|
|
703
|
+
message: "must have a value or a distance if complete"
|
|
704
|
+
},
|
|
685
705
|
{
|
|
686
706
|
function: "validate_has_termType",
|
|
687
707
|
level: "warning",
|
|
@@ -1130,6 +1150,20 @@ var guidePageId = (nodeType2, errorMessage) => {
|
|
|
1130
1150
|
var mapErrorMessage = "does not contain latitude and longitude";
|
|
1131
1151
|
var allowedDataPathsLabels = Object.values(schema.SchemaType);
|
|
1132
1152
|
var isInfrastructureInputTermType = (dataPath = "") => /infrastructure\[\d+\]\.inputs\[\d+\]\.term\.termType$/.test(dataPath);
|
|
1153
|
+
var termTypeRestrictingFields = {
|
|
1154
|
+
[schema.SchemaType.Practice]: {
|
|
1155
|
+
variety: [schema.TermTermType.landCover],
|
|
1156
|
+
ownershipStatus: [schema.TermTermType.operation]
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
var isNodeTermTypeRule = (schemaPath = "") => /^#\/allOf\/\d+\/then\/properties\/term\/properties\/termType\/enum$/.test(schemaPath);
|
|
1160
|
+
var sameValues = (values = [], others = []) => values.length === others.length && values.every((value) => others.includes(value));
|
|
1161
|
+
var termTypeRestrictingField = (nodeType2, schemaPath, allowedValues) => {
|
|
1162
|
+
var _a;
|
|
1163
|
+
return isNodeTermTypeRule(schemaPath) ? (_a = Object.entries(termTypeRestrictingFields[nodeType2] || {}).find(
|
|
1164
|
+
([, termTypes]) => sameValues(termTypes, allowedValues)
|
|
1165
|
+
)) == null ? void 0 : _a[0] : void 0;
|
|
1166
|
+
};
|
|
1133
1167
|
var idPatternError = (chars) => `You can only use the following characters for this field: ${chars.join(", ")}`;
|
|
1134
1168
|
var noTillage = { id: "noTillage", name: "No tillage" };
|
|
1135
1169
|
var pastureGrass = { id: "pastureGrass", name: "Pasture grass" };
|
|
@@ -1342,9 +1376,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1342
1376
|
${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."}`;
|
|
1343
1377
|
},
|
|
1344
1378
|
"should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
|
|
1345
|
-
var _a;
|
|
1379
|
+
var _a, _b;
|
|
1346
1380
|
const paths = parseDataPath(dataPath);
|
|
1347
|
-
const
|
|
1381
|
+
const nodeLabel = (_a = paths[paths.length - 3]) == null ? void 0 : _a.label;
|
|
1382
|
+
const restrictingField = dataPath.endsWith("term.termType") ? termTypeRestrictingField(nodeLabel, schemaPath, params == null ? void 0 : params.allowedValues) : null;
|
|
1383
|
+
const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_b = params == null ? void 0 : params.allowedValues) == null ? void 0 : _b.length) || 0) : "values";
|
|
1348
1384
|
const schemaPathMatch = schemaPath == null ? void 0 : schemaPath.split("/").slice(0, 3).join("/");
|
|
1349
1385
|
const ifError = schemaPathMatch ? errors.find(
|
|
1350
1386
|
(error) => {
|
|
@@ -1359,7 +1395,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1359
1395
|
return [
|
|
1360
1396
|
isInfrastructureInputTermType(dataPath) ? `Only terms in the ${listAsCodeWithAnd(params == null ? void 0 : params.allowedValues)} glossaries can be added as inputs to Site
|
|
1361
1397
|
infrastructure. Other inputs, e.g., ${code("fuel")}, should be specified on the Cycle.
|
|
1362
|
-
You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` :
|
|
1398
|
+
You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : restrictingField ? `The ${schemaLink(`${nodeLabel}#${restrictingField}`, restrictingField)} field can only be added to ${pluralize(
|
|
1399
|
+
nodeLabel,
|
|
1400
|
+
0
|
|
1401
|
+
)} using a term from the following glossaries: ${listAsCode(params == null ? void 0 : params.allowedValues)}.
|
|
1402
|
+
Please either remove ${code(restrictingField)} from this ${nodeLabel}, or change the Term to one from the glossaries listed above.` : dataPath.endsWith("term.termType") ? [
|
|
1363
1403
|
`For ${pluralize(
|
|
1364
1404
|
paths[paths.length - 3].label,
|
|
1365
1405
|
0
|
|
@@ -1391,6 +1431,10 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1391
1431
|
"longFallowDuration must be lower than 5 years": () => `Your long fallow duration is greater than five years.
|
|
1392
1432
|
Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,
|
|
1393
1433
|
and this definition is used for HESTIA also.`,
|
|
1434
|
+
"must be greater than or equal to plantationProductiveLifespan": ({ params }) => `The ${termLink({ id: "plantationLifespan", name: "Plantation lifespan" })} (${code(params == null ? void 0 : params.current)} days)
|
|
1435
|
+
is shorter than the ${termLink({ id: "plantationProductiveLifespan", name: "Plantation productive lifespan" })}
|
|
1436
|
+
(${code(params == null ? void 0 : params.min)} days).
|
|
1437
|
+
The productive lifespan is part of the plantation lifespan, so it cannot be longer. Please check both values.`,
|
|
1394
1438
|
"should be more than the cropping duration": ({ params }) => `The ${schemaLink(
|
|
1395
1439
|
"Cycle#cycleDuration",
|
|
1396
1440
|
"cycleDuration"
|
|
@@ -1694,6 +1738,12 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1694
1738
|
"must specify is it an animal feed": () => `This Cycle is an animal production Cycle and this Input could be an animal feed or could be for another use.
|
|
1695
1739
|
Please specify the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field on this Input.
|
|
1696
1740
|
Knowing the fate is essential to distinguish Inputs between those which are fed to animals and those which are used for other purposes.`,
|
|
1741
|
+
"isAnimalFeed not allowed on a non-animal cycle": ({ params }) => `This Cycle does not produce animals: it has no ${schemaLink("Cycle#animals", "animals")} and no ${glossaryTypeLink(
|
|
1742
|
+
schema.TermTermType.liveAnimal
|
|
1743
|
+
)}, ${glossaryTypeLink(schema.TermTermType.animalProduct)} or ${glossaryTypeLink(
|
|
1744
|
+
schema.TermTermType.liveAquaticSpecies
|
|
1745
|
+
)} Product, so ${(params == null ? void 0 : params.term) ? code(params.term.name || params.term["@id"]) : "this Input"} cannot be fed to animals.
|
|
1746
|
+
Please remove the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field${(params == null ? void 0 : params.current) === void 0 ? "" : ` (currently ${code(`${params.current}`)})`} from this Input.`,
|
|
1697
1747
|
"should specify a treatment when experimentDesign is specified": () => `You have specified that this Source uses an experimental design, but have not specified the treatment for this Cycle.
|
|
1698
1748
|
Adding the treatment provides important meta-data and will enable greater re-use of these data.
|
|
1699
1749
|
Add the ${schemaLink("Cycle#treatment", "treatment")} field to the Cycle.
|
|
@@ -1837,7 +1887,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1837
1887
|
${((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.termType) === schema.TermTermType.measurement ? `This Measurement has additional restrictions and needs either a ${code("value")} or both a ${code("min")} and ${code("max")} specified.
|
|
1838
1888
|
Please consider adding both the ${code("min")} and the ${code("max")}, or delete the Measurement.` : ""}`;
|
|
1839
1889
|
},
|
|
1840
|
-
"must specify water type for ponds": ({ params }) => `
|
|
1890
|
+
"must specify water type for ponds": ({ params }) => `You must specify the ${externalNodeLink(
|
|
1841
1891
|
{
|
|
1842
1892
|
"@type": schema.NodeType.Term,
|
|
1843
1893
|
"@id": "waterSalinity",
|
|
@@ -1854,7 +1904,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1854
1904
|
name: "Brackish water"
|
|
1855
1905
|
}
|
|
1856
1906
|
)}).
|
|
1857
|
-
This will allow us to calculate methane emissions from
|
|
1907
|
+
This will allow us to calculate methane emissions from the waterbody.
|
|
1858
1908
|
${(params == null ? void 0 : params.products) ? `Note: our gap-filling model can only work when the lookup ${code("defaultSalinity")} is set for all products,
|
|
1859
1909
|
but we are currently missing a value for: ${joinValues(params.products)}.` : ""}`,
|
|
1860
1910
|
"invalid water salinity": ({ params }) => `The water type ${params == null ? void 0 : params.current} is not consistent with the Water salinity you specified.
|
|
@@ -1967,6 +2017,19 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1967
2017
|
`Completeness#${params.expected}`,
|
|
1968
2018
|
params.expected
|
|
1969
2019
|
)}, none of the data in the completeness area can have missing or blank values.`,
|
|
2020
|
+
"must have a value or a distance if complete": ({ params }) => {
|
|
2021
|
+
var _a, _b;
|
|
2022
|
+
return `If completeness is set to true for ${schemaLink(
|
|
2023
|
+
`Completeness#${params.expected}`,
|
|
2024
|
+
params.expected
|
|
2025
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm) or a ${schemaLink(
|
|
2026
|
+
"Transport#distance",
|
|
2027
|
+
"distance"
|
|
2028
|
+
)} (in km). This ${termLink({
|
|
2029
|
+
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2030
|
+
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2031
|
+
})} has neither.`;
|
|
2032
|
+
},
|
|
1970
2033
|
"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.
|
|
1971
2034
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
1972
2035
|
Use Transformations if needed to represent additional processing steps rather than new Cycles.` : "The primary Product must not also be an Input into the cycle.",
|
|
@@ -2002,19 +2065,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2002
2065
|
"Saplings"
|
|
2003
2066
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2004
2067
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2005
|
-
"seed cannot be used as an input here": ({ params }) => `
|
|
2068
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from saplings rather than sown, so ${externalNodeLink(
|
|
2006
2069
|
{
|
|
2007
2070
|
"@type": schema.NodeType.Term,
|
|
2008
2071
|
"@id": String(params.expected),
|
|
2009
2072
|
name: "Saplings, depreciated amount per Cycle"
|
|
2010
2073
|
}
|
|
2011
|
-
)}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2074
|
+
)} should be used instead of ${code(params.current)}.
|
|
2075
|
+
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(
|
|
2076
|
+
{
|
|
2077
|
+
id: "coverCrop",
|
|
2078
|
+
name: "Cover crop"
|
|
2079
|
+
}
|
|
2080
|
+
)} Practice.`,
|
|
2081
|
+
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2082
|
+
id: String(params.expected),
|
|
2083
|
+
name: "Seed"
|
|
2084
|
+
})} should be used instead of ${code(params.current)}.
|
|
2085
|
+
If this is a case of intercropping, add the relevant ${code(schema.TermTermType.landCover)} Practices to the Cycle.`,
|
|
2018
2086
|
"must use the depreciated term": ({ params }) => {
|
|
2019
2087
|
var _a, _b;
|
|
2020
2088
|
return `${code(
|
|
@@ -200,6 +200,11 @@ var validations = [
|
|
|
200
200
|
level: "error",
|
|
201
201
|
message: "longFallowDuration must be lower than 5 years"
|
|
202
202
|
},
|
|
203
|
+
{
|
|
204
|
+
function: "validate_plantationLifespan",
|
|
205
|
+
level: "error",
|
|
206
|
+
message: "must be greater than or equal to plantationProductiveLifespan"
|
|
207
|
+
},
|
|
203
208
|
{
|
|
204
209
|
function: "validate_waterRegime_rice_products",
|
|
205
210
|
level: "error",
|
|
@@ -625,6 +630,11 @@ var validations = [
|
|
|
625
630
|
level: "error",
|
|
626
631
|
message: "must specify is it an animal feed"
|
|
627
632
|
},
|
|
633
|
+
{
|
|
634
|
+
function: "validate_isAnimalFeed_animal_cycle",
|
|
635
|
+
level: "error",
|
|
636
|
+
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
637
|
+
},
|
|
628
638
|
{
|
|
629
639
|
function: "validate_saplings",
|
|
630
640
|
level: "error",
|
|
@@ -635,6 +645,11 @@ var validations = [
|
|
|
635
645
|
level: "error",
|
|
636
646
|
message: "seed cannot be used as an input here"
|
|
637
647
|
},
|
|
648
|
+
{
|
|
649
|
+
function: "validate_saplings_depreciated",
|
|
650
|
+
level: "error",
|
|
651
|
+
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
652
|
+
},
|
|
638
653
|
{
|
|
639
654
|
function: "validate_material_depreciated",
|
|
640
655
|
level: "error",
|
|
@@ -680,6 +695,11 @@ var validations = [
|
|
|
680
695
|
level: "error",
|
|
681
696
|
message: "must not be blank if complete"
|
|
682
697
|
},
|
|
698
|
+
{
|
|
699
|
+
function: "validate_completeness_transport",
|
|
700
|
+
level: "error",
|
|
701
|
+
message: "must have a value or a distance if complete"
|
|
702
|
+
},
|
|
683
703
|
{
|
|
684
704
|
function: "validate_has_termType",
|
|
685
705
|
level: "warning",
|
|
@@ -1128,6 +1148,20 @@ var guidePageId = (nodeType2, errorMessage) => {
|
|
|
1128
1148
|
var mapErrorMessage = "does not contain latitude and longitude";
|
|
1129
1149
|
var allowedDataPathsLabels = Object.values(SchemaType);
|
|
1130
1150
|
var isInfrastructureInputTermType = (dataPath = "") => /infrastructure\[\d+\]\.inputs\[\d+\]\.term\.termType$/.test(dataPath);
|
|
1151
|
+
var termTypeRestrictingFields = {
|
|
1152
|
+
[SchemaType.Practice]: {
|
|
1153
|
+
variety: [TermTermType.landCover],
|
|
1154
|
+
ownershipStatus: [TermTermType.operation]
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
var isNodeTermTypeRule = (schemaPath = "") => /^#\/allOf\/\d+\/then\/properties\/term\/properties\/termType\/enum$/.test(schemaPath);
|
|
1158
|
+
var sameValues = (values = [], others = []) => values.length === others.length && values.every((value) => others.includes(value));
|
|
1159
|
+
var termTypeRestrictingField = (nodeType2, schemaPath, allowedValues) => {
|
|
1160
|
+
var _a;
|
|
1161
|
+
return isNodeTermTypeRule(schemaPath) ? (_a = Object.entries(termTypeRestrictingFields[nodeType2] || {}).find(
|
|
1162
|
+
([, termTypes]) => sameValues(termTypes, allowedValues)
|
|
1163
|
+
)) == null ? void 0 : _a[0] : void 0;
|
|
1164
|
+
};
|
|
1131
1165
|
var idPatternError = (chars) => `You can only use the following characters for this field: ${chars.join(", ")}`;
|
|
1132
1166
|
var noTillage = { id: "noTillage", name: "No tillage" };
|
|
1133
1167
|
var pastureGrass = { id: "pastureGrass", name: "Pasture grass" };
|
|
@@ -1340,9 +1374,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1340
1374
|
${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."}`;
|
|
1341
1375
|
},
|
|
1342
1376
|
"should be equal to one of the allowed values": ({ params, dataPath, schemaPath }, count, errors) => {
|
|
1343
|
-
var _a;
|
|
1377
|
+
var _a, _b;
|
|
1344
1378
|
const paths = parseDataPath(dataPath);
|
|
1345
|
-
const
|
|
1379
|
+
const nodeLabel = (_a = paths[paths.length - 3]) == null ? void 0 : _a.label;
|
|
1380
|
+
const restrictingField = dataPath.endsWith("term.termType") ? termTypeRestrictingField(nodeLabel, schemaPath, params == null ? void 0 : params.allowedValues) : null;
|
|
1381
|
+
const values = paths.length >= 2 ? pluralize(paths[paths.length - 1].path, ((_b = params == null ? void 0 : params.allowedValues) == null ? void 0 : _b.length) || 0) : "values";
|
|
1346
1382
|
const schemaPathMatch = schemaPath == null ? void 0 : schemaPath.split("/").slice(0, 3).join("/");
|
|
1347
1383
|
const ifError = schemaPathMatch ? errors.find(
|
|
1348
1384
|
(error) => {
|
|
@@ -1357,7 +1393,11 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1357
1393
|
return [
|
|
1358
1394
|
isInfrastructureInputTermType(dataPath) ? `Only terms in the ${listAsCodeWithAnd(params == null ? void 0 : params.allowedValues)} glossaries can be added as inputs to Site
|
|
1359
1395
|
infrastructure. Other inputs, e.g., ${code("fuel")}, should be specified on the Cycle.
|
|
1360
|
-
You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` :
|
|
1396
|
+
You can use the ${schemaLink("Input#operation", "operation")} field on inputs to specify what the input is for.` : restrictingField ? `The ${schemaLink(`${nodeLabel}#${restrictingField}`, restrictingField)} field can only be added to ${pluralize(
|
|
1397
|
+
nodeLabel,
|
|
1398
|
+
0
|
|
1399
|
+
)} using a term from the following glossaries: ${listAsCode(params == null ? void 0 : params.allowedValues)}.
|
|
1400
|
+
Please either remove ${code(restrictingField)} from this ${nodeLabel}, or change the Term to one from the glossaries listed above.` : dataPath.endsWith("term.termType") ? [
|
|
1361
1401
|
`For ${pluralize(
|
|
1362
1402
|
paths[paths.length - 3].label,
|
|
1363
1403
|
0
|
|
@@ -1389,6 +1429,10 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1389
1429
|
"longFallowDuration must be lower than 5 years": () => `Your long fallow duration is greater than five years.
|
|
1390
1430
|
Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,
|
|
1391
1431
|
and this definition is used for HESTIA also.`,
|
|
1432
|
+
"must be greater than or equal to plantationProductiveLifespan": ({ params }) => `The ${termLink({ id: "plantationLifespan", name: "Plantation lifespan" })} (${code(params == null ? void 0 : params.current)} days)
|
|
1433
|
+
is shorter than the ${termLink({ id: "plantationProductiveLifespan", name: "Plantation productive lifespan" })}
|
|
1434
|
+
(${code(params == null ? void 0 : params.min)} days).
|
|
1435
|
+
The productive lifespan is part of the plantation lifespan, so it cannot be longer. Please check both values.`,
|
|
1392
1436
|
"should be more than the cropping duration": ({ params }) => `The ${schemaLink(
|
|
1393
1437
|
"Cycle#cycleDuration",
|
|
1394
1438
|
"cycleDuration"
|
|
@@ -1692,6 +1736,12 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1692
1736
|
"must specify is it an animal feed": () => `This Cycle is an animal production Cycle and this Input could be an animal feed or could be for another use.
|
|
1693
1737
|
Please specify the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field on this Input.
|
|
1694
1738
|
Knowing the fate is essential to distinguish Inputs between those which are fed to animals and those which are used for other purposes.`,
|
|
1739
|
+
"isAnimalFeed not allowed on a non-animal cycle": ({ params }) => `This Cycle does not produce animals: it has no ${schemaLink("Cycle#animals", "animals")} and no ${glossaryTypeLink(
|
|
1740
|
+
TermTermType.liveAnimal
|
|
1741
|
+
)}, ${glossaryTypeLink(TermTermType.animalProduct)} or ${glossaryTypeLink(
|
|
1742
|
+
TermTermType.liveAquaticSpecies
|
|
1743
|
+
)} Product, so ${(params == null ? void 0 : params.term) ? code(params.term.name || params.term["@id"]) : "this Input"} cannot be fed to animals.
|
|
1744
|
+
Please remove the ${schemaLink("Input#isAnimalFeed", "isAnimalFeed")} field${(params == null ? void 0 : params.current) === void 0 ? "" : ` (currently ${code(`${params.current}`)})`} from this Input.`,
|
|
1695
1745
|
"should specify a treatment when experimentDesign is specified": () => `You have specified that this Source uses an experimental design, but have not specified the treatment for this Cycle.
|
|
1696
1746
|
Adding the treatment provides important meta-data and will enable greater re-use of these data.
|
|
1697
1747
|
Add the ${schemaLink("Cycle#treatment", "treatment")} field to the Cycle.
|
|
@@ -1835,7 +1885,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1835
1885
|
${((_a = params == null ? void 0 : params.term) == null ? void 0 : _a.termType) === TermTermType.measurement ? `This Measurement has additional restrictions and needs either a ${code("value")} or both a ${code("min")} and ${code("max")} specified.
|
|
1836
1886
|
Please consider adding both the ${code("min")} and the ${code("max")}, or delete the Measurement.` : ""}`;
|
|
1837
1887
|
},
|
|
1838
|
-
"must specify water type for ponds": ({ params }) => `
|
|
1888
|
+
"must specify water type for ponds": ({ params }) => `You must specify the ${externalNodeLink(
|
|
1839
1889
|
{
|
|
1840
1890
|
"@type": NodeType.Term,
|
|
1841
1891
|
"@id": "waterSalinity",
|
|
@@ -1852,7 +1902,7 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1852
1902
|
name: "Brackish water"
|
|
1853
1903
|
}
|
|
1854
1904
|
)}).
|
|
1855
|
-
This will allow us to calculate methane emissions from
|
|
1905
|
+
This will allow us to calculate methane emissions from the waterbody.
|
|
1856
1906
|
${(params == null ? void 0 : params.products) ? `Note: our gap-filling model can only work when the lookup ${code("defaultSalinity")} is set for all products,
|
|
1857
1907
|
but we are currently missing a value for: ${joinValues(params.products)}.` : ""}`,
|
|
1858
1908
|
"invalid water salinity": ({ params }) => `The water type ${params == null ? void 0 : params.current} is not consistent with the Water salinity you specified.
|
|
@@ -1965,6 +2015,19 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
1965
2015
|
`Completeness#${params.expected}`,
|
|
1966
2016
|
params.expected
|
|
1967
2017
|
)}, none of the data in the completeness area can have missing or blank values.`,
|
|
2018
|
+
"must have a value or a distance if complete": ({ params }) => {
|
|
2019
|
+
var _a, _b;
|
|
2020
|
+
return `If completeness is set to true for ${schemaLink(
|
|
2021
|
+
`Completeness#${params.expected}`,
|
|
2022
|
+
params.expected
|
|
2023
|
+
)}, every Transport must have a ${schemaLink("Transport#value", "value")} (in tkm) or a ${schemaLink(
|
|
2024
|
+
"Transport#distance",
|
|
2025
|
+
"distance"
|
|
2026
|
+
)} (in km). This ${termLink({
|
|
2027
|
+
id: (_a = params.term) == null ? void 0 : _a["@id"],
|
|
2028
|
+
name: (_b = params.term) == null ? void 0 : _b.name
|
|
2029
|
+
})} has neither.`;
|
|
2030
|
+
},
|
|
1968
2031
|
"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.
|
|
1969
2032
|
This ensures we reflect the full process rather than just single sub-processes.
|
|
1970
2033
|
Use Transformations if needed to represent additional processing steps rather than new Cycles.` : "The primary Product must not also be an Input into the cycle.",
|
|
@@ -2000,19 +2063,24 @@ var createErrorFormatter = ({ renderer: r, urls }) => {
|
|
|
2000
2063
|
"Saplings"
|
|
2001
2064
|
)} used divided by the number of possible Cycles in the plantation's lifespan.
|
|
2002
2065
|
See the ${guideLink("guide-file-upload-special-cases", "special upload case")} for more details.`,
|
|
2003
|
-
"seed cannot be used as an input here": ({ params }) => `
|
|
2066
|
+
"seed cannot be used as an input here": ({ params }) => `The Cycle only represents plantation crops, which are established from saplings rather than sown, so ${externalNodeLink(
|
|
2004
2067
|
{
|
|
2005
2068
|
"@type": NodeType.Term,
|
|
2006
2069
|
"@id": String(params.expected),
|
|
2007
2070
|
name: "Saplings, depreciated amount per Cycle"
|
|
2008
2071
|
}
|
|
2009
|
-
)}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2072
|
+
)} should be used instead of ${code(params.current)}.
|
|
2073
|
+
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(
|
|
2074
|
+
{
|
|
2075
|
+
id: "coverCrop",
|
|
2076
|
+
name: "Cover crop"
|
|
2077
|
+
}
|
|
2078
|
+
)} Practice.`,
|
|
2079
|
+
"saplingsDepreciatedAmountPerCycle cannot be used as an input here": ({ params }) => `The Cycle only represents non-plantation crops, so ${termLink({
|
|
2080
|
+
id: String(params.expected),
|
|
2081
|
+
name: "Seed"
|
|
2082
|
+
})} should be used instead of ${code(params.current)}.
|
|
2083
|
+
If this is a case of intercropping, add the relevant ${code(TermTermType.landCover)} Practices to the Cycle.`,
|
|
2016
2084
|
"must use the depreciated term": ({ params }) => {
|
|
2017
2085
|
var _a, _b;
|
|
2018
2086
|
return `${code(
|
package/index.js
CHANGED
|
@@ -208,6 +208,11 @@ var validations = [
|
|
|
208
208
|
level: "error",
|
|
209
209
|
message: "longFallowDuration must be lower than 5 years"
|
|
210
210
|
},
|
|
211
|
+
{
|
|
212
|
+
function: "validate_plantationLifespan",
|
|
213
|
+
level: "error",
|
|
214
|
+
message: "must be greater than or equal to plantationProductiveLifespan"
|
|
215
|
+
},
|
|
211
216
|
{
|
|
212
217
|
function: "validate_waterRegime_rice_products",
|
|
213
218
|
level: "error",
|
|
@@ -633,6 +638,11 @@ var validations = [
|
|
|
633
638
|
level: "error",
|
|
634
639
|
message: "must specify is it an animal feed"
|
|
635
640
|
},
|
|
641
|
+
{
|
|
642
|
+
function: "validate_isAnimalFeed_animal_cycle",
|
|
643
|
+
level: "error",
|
|
644
|
+
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
645
|
+
},
|
|
636
646
|
{
|
|
637
647
|
function: "validate_saplings",
|
|
638
648
|
level: "error",
|
|
@@ -643,6 +653,11 @@ var validations = [
|
|
|
643
653
|
level: "error",
|
|
644
654
|
message: "seed cannot be used as an input here"
|
|
645
655
|
},
|
|
656
|
+
{
|
|
657
|
+
function: "validate_saplings_depreciated",
|
|
658
|
+
level: "error",
|
|
659
|
+
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
660
|
+
},
|
|
646
661
|
{
|
|
647
662
|
function: "validate_material_depreciated",
|
|
648
663
|
level: "error",
|
|
@@ -688,6 +703,11 @@ var validations = [
|
|
|
688
703
|
level: "error",
|
|
689
704
|
message: "must not be blank if complete"
|
|
690
705
|
},
|
|
706
|
+
{
|
|
707
|
+
function: "validate_completeness_transport",
|
|
708
|
+
level: "error",
|
|
709
|
+
message: "must have a value or a distance if complete"
|
|
710
|
+
},
|
|
691
711
|
{
|
|
692
712
|
function: "validate_has_termType",
|
|
693
713
|
level: "warning",
|
package/index.mjs
CHANGED
|
@@ -206,6 +206,11 @@ var validations = [
|
|
|
206
206
|
level: "error",
|
|
207
207
|
message: "longFallowDuration must be lower than 5 years"
|
|
208
208
|
},
|
|
209
|
+
{
|
|
210
|
+
function: "validate_plantationLifespan",
|
|
211
|
+
level: "error",
|
|
212
|
+
message: "must be greater than or equal to plantationProductiveLifespan"
|
|
213
|
+
},
|
|
209
214
|
{
|
|
210
215
|
function: "validate_waterRegime_rice_products",
|
|
211
216
|
level: "error",
|
|
@@ -631,6 +636,11 @@ var validations = [
|
|
|
631
636
|
level: "error",
|
|
632
637
|
message: "must specify is it an animal feed"
|
|
633
638
|
},
|
|
639
|
+
{
|
|
640
|
+
function: "validate_isAnimalFeed_animal_cycle",
|
|
641
|
+
level: "error",
|
|
642
|
+
message: "isAnimalFeed not allowed on a non-animal cycle"
|
|
643
|
+
},
|
|
634
644
|
{
|
|
635
645
|
function: "validate_saplings",
|
|
636
646
|
level: "error",
|
|
@@ -641,6 +651,11 @@ var validations = [
|
|
|
641
651
|
level: "error",
|
|
642
652
|
message: "seed cannot be used as an input here"
|
|
643
653
|
},
|
|
654
|
+
{
|
|
655
|
+
function: "validate_saplings_depreciated",
|
|
656
|
+
level: "error",
|
|
657
|
+
message: "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
658
|
+
},
|
|
644
659
|
{
|
|
645
660
|
function: "validate_material_depreciated",
|
|
646
661
|
level: "error",
|
|
@@ -686,6 +701,11 @@ var validations = [
|
|
|
686
701
|
level: "error",
|
|
687
702
|
message: "must not be blank if complete"
|
|
688
703
|
},
|
|
704
|
+
{
|
|
705
|
+
function: "validate_completeness_transport",
|
|
706
|
+
level: "error",
|
|
707
|
+
message: "must have a value or a distance if complete"
|
|
708
|
+
},
|
|
689
709
|
{
|
|
690
710
|
function: "validate_has_termType",
|
|
691
711
|
level: "warning",
|
package/package.json
CHANGED
package/validation.json
CHANGED
|
@@ -195,6 +195,11 @@
|
|
|
195
195
|
"level": "error",
|
|
196
196
|
"message": "longFallowDuration must be lower than 5 years"
|
|
197
197
|
},
|
|
198
|
+
{
|
|
199
|
+
"function": "validate_plantationLifespan",
|
|
200
|
+
"level": "error",
|
|
201
|
+
"message": "must be greater than or equal to plantationProductiveLifespan"
|
|
202
|
+
},
|
|
198
203
|
{
|
|
199
204
|
"function": "validate_waterRegime_rice_products",
|
|
200
205
|
"level": "error",
|
|
@@ -620,6 +625,11 @@
|
|
|
620
625
|
"level": "error",
|
|
621
626
|
"message": "must specify is it an animal feed"
|
|
622
627
|
},
|
|
628
|
+
{
|
|
629
|
+
"function": "validate_isAnimalFeed_animal_cycle",
|
|
630
|
+
"level": "error",
|
|
631
|
+
"message": "isAnimalFeed not allowed on a non-animal cycle"
|
|
632
|
+
},
|
|
623
633
|
{
|
|
624
634
|
"function": "validate_saplings",
|
|
625
635
|
"level": "error",
|
|
@@ -630,6 +640,11 @@
|
|
|
630
640
|
"level": "error",
|
|
631
641
|
"message": "seed cannot be used as an input here"
|
|
632
642
|
},
|
|
643
|
+
{
|
|
644
|
+
"function": "validate_saplings_depreciated",
|
|
645
|
+
"level": "error",
|
|
646
|
+
"message": "saplingsDepreciatedAmountPerCycle cannot be used as an input here"
|
|
647
|
+
},
|
|
633
648
|
{
|
|
634
649
|
"function": "validate_material_depreciated",
|
|
635
650
|
"level": "error",
|
|
@@ -675,6 +690,11 @@
|
|
|
675
690
|
"level": "error",
|
|
676
691
|
"message": "must not be blank if complete"
|
|
677
692
|
},
|
|
693
|
+
{
|
|
694
|
+
"function": "validate_completeness_transport",
|
|
695
|
+
"level": "error",
|
|
696
|
+
"message": "must have a value or a distance if complete"
|
|
697
|
+
},
|
|
678
698
|
{
|
|
679
699
|
"function": "validate_has_termType",
|
|
680
700
|
"level": "warning",
|