{
  "$id": "https://www.hestia.earth/schema-data/json-schema/Indicator.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$comment": "Schema version 39.0.1",
  "title": "Indicator",
  "description": "An emission, resource use, or characterised environmental impact indicator. Each Indicator must be unique, and the fields which determine uniqueness are defined in the <code>[emissionsResourceUse](/schema/ImpactAssessment#emissionsResourceUse)</code>, <code>[impacts](/schema/ImpactAssessment#impacts)</code>, and <code>[endpoints](/schema/ImpactAssessment#endpoints)</code> fields of the Impact Assessment.\n",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Indicator",
      "enum": [
        "Indicator"
      ]
    },
    "@type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Indicator",
      "enum": [
        "Indicator"
      ],
      "extend": true
    },
    "term": {
      "$ref": "./Term-deep.json#",
      "description": "A reference to the Term describing the emission e.g., CH4, to air, crop residue burning; the resource use e.g., Freshwater withdrawals, during Cycle; or the characterised environmental impact indicator e.g., Terrestrial ecotoxicity potential (1,4-DCBeq).",
      "examples": [
        {
          "@id": "gwp100",
          "@type": "Term",
          "name": "GWP100",
          "units": "kg CO2eq",
          "termType": "characterisedIndicator"
        },
        {
          "@id": "landOccupationDuringCycle",
          "@type": "Term",
          "name": "Land occupation, during Cycle",
          "units": "m2*year",
          "termType": "resourceUse"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "key": {
      "$ref": "./Term-deep.json#",
      "description": "For certain emissions (Pesticide, to ..., Ionising compounds, to, and Heavy metals, to...) the element or compound that was emitted.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "value": {
      "type": "number",
      "description": "The quantity. If an average, it should always be the mean.",
      "examples": [
        0.1947728,
        2.8
      ],
      "exportDefaultCSV": true
    },
    "distribution": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "description": "An array of up to 1000 random samples from the posterior distribution of value</code. This should describe the entire distribution of the dataset and not the distribution of the mean.",
      "examples": [],
      "exportDefaultCSV": true,
      "maxItems": 1000
    },
    "sd": {
      "type": "number",
      "minimum": 0,
      "description": "The standard deviation of value.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "min": {
      "type": "number",
      "description": "The minimum of value.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "max": {
      "type": "number",
      "description": "The maximum of value.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "percentile10th": {
      "type": "number",
      "description": "The 10th percentile of value.",
      "examples": [],
      "exportDefaultCSV": false,
      "internal": true
    },
    "percentile90th": {
      "type": "number",
      "description": "The 90th percentile of value.",
      "examples": [],
      "exportDefaultCSV": false,
      "internal": true
    },
    "statsDefinition": {
      "type": "string",
      "description": "What the descriptive statistics (sd, min, max, and value) are calculated across, or whether they are simulated or the output of a model. spatial refers to descriptive statistics calculated across spatial units (e.g., pixels) within a region or country. time refers to descriptive statistics calculated across units of time (e.g., hours).",
      "examples": [],
      "enum": [
        "sites",
        "cycles",
        "impactAssessments",
        "replications",
        "animals",
        "other observations",
        "time",
        "spatial",
        "regions",
        "simulated",
        "modelled"
      ],
      "exportDefaultCSV": true
    },
    "observations": {
      "type": "integer",
      "description": "The number of observations the descriptive statistics are calculated over.",
      "examples": [],
      "minimum": 1,
      "searchable": true,
      "exportDefaultCSV": true
    },
    "methodTier": {
      "type": "string",
      "description": "For emissions only, a field which matches the methodTier in each Cycle Emission.",
      "examples": [],
      "enum": [
        "background",
        "measured",
        "tier 1",
        "tier 2",
        "tier 3",
        "not relevant"
      ]
    },
    "methodModel": {
      "$ref": "./Term-deep.json#",
      "description": "A reference to the Term describing the method or model for calculating these data.",
      "examples": [
        {
          "@id": "ipcc2007",
          "@type": "Term",
          "name": "IPCC (2007)",
          "termType": "model"
        },
        {
          "@id": "landOccupationCalculationIncludingUsedAndUnusedDuration",
          "@type": "Term",
          "name": "Land occupation calculation, including used and unused duration",
          "termType": "model"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "methodModelDescription": {
      "type": "string",
      "description": "A free text field, describing the method or model used for calculating these data. For example, it can be used to specify the version of the method or model, and/or the software used to carry out the assessment.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "inputs": {
      "type": "array",
      "items": {
        "$ref": "./Term-deep.json#"
      },
      "description": "For emissions or resource uses from Inputs production, the Term describing the Input. For characterised indicators or endpoint indicators, if this Indicator represents the quantity of that indicator caused by producing one or more Inputs used by this Cycle, the Term describing the Inputs.",
      "examples": [],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "@id"
      ]
    },
    "animals": {
      "type": "array",
      "items": {
        "$ref": "./Term-deep.json#"
      },
      "description": "For background Emissions, the Term(s) describing the Animal(s) they are associated with.",
      "examples": [],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "@id"
      ]
    },
    "country": {
      "$ref": "./Term-deep.json#",
      "description": "For indicators describing an emission or resource use related to inputs production, the country where the impacts occurred.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "operation": {
      "$ref": "./Term-deep.json#",
      "description": "For emissions or resource uses created by an operation, the Term describing the operation.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "landCover": {
      "$ref": "./Term-deep.json#",
      "description": "For land occupation and transformation, the term from the land cover glossary that describes the current land cover of the occupied land (e.g., Cropland or Almond tree). This is a required field for land occupation and land transformation resource uses.",
      "examples": [
        {
          "@id": "artichokePlant",
          "@type": "Term",
          "name": "Artichoke plant",
          "units": "% area",
          "termType": "landCover"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "previousLandCover": {
      "$ref": "./Term-deep.json#",
      "description": "For land transformation only, the land cover term that describes the previous land cover of the transformed land. The transformation period is defined by the term (e.g., 20 years, 100 years). If the land was transformed from multiple different land covers (e.g., 50% from forest to cropland and 50% from cropland to cropland), create one Indicator for each transformation. This is a required field for land transformation resource uses.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "transformation": {
      "$ref": "./Term-deep.json#",
      "description": "For emissions or resource uses created during a Transformation, the Term describing the Transformation.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "source": {
      "$ref": "./Source-deep.json#",
      "description": "A reference to the Source of these data.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "otherSources": {
      "type": "array",
      "items": {
        "$ref": "./Source-deep.json#"
      },
      "description": "A list of references to any other sources of these data.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "schemaVersion": {
      "type": "string",
      "description": "The version of the schema when these data were created.",
      "examples": [],
      "internal": true
    },
    "added": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of fields that have been added to the original dataset.",
      "examples": [],
      "internal": true
    },
    "addedVersion": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of versions of the model used to add these fields.",
      "examples": [],
      "internal": true
    },
    "updated": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of fields that have been updated on the original dataset.",
      "examples": [],
      "internal": true
    },
    "updatedVersion": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of versions of the model used to update these fields.",
      "examples": [],
      "internal": true
    },
    "aggregated": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of fields that have been 'aggregated' using data from multiple Sites and Cycles.",
      "examples": [],
      "internal": true
    },
    "aggregatedVersion": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A list of versions of the aggregation engine corresponding to each aggregated field.",
      "examples": [],
      "internal": true
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "term"
        ]
      },
      "then": {
        "properties": {
          "term": {
            "properties": {
              "termType": {
                "enum": [
                  "emission",
                  "endpointIndicator",
                  "characterisedIndicator",
                  "resourceUse"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "methodModel"
        ]
      },
      "then": {
        "properties": {
          "methodModel": {
            "properties": {
              "termType": {
                "enum": [
                  "model",
                  "methodEmissionResourceUse"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "operation"
        ]
      },
      "then": {
        "properties": {
          "operation": {
            "properties": {
              "termType": {
                "enum": [
                  "operation"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "anyOf": [
          {
            "required": [
              "min"
            ]
          },
          {
            "required": [
              "max"
            ]
          },
          {
            "required": [
              "sd"
            ]
          }
        ]
      },
      "then": {
        "required": [
          "statsDefinition"
        ]
      }
    },
    {
      "if": {
        "required": [
          "statsDefinition"
        ]
      },
      "then": {
        "anyOf": [
          {
            "required": [
              "value"
            ]
          },
          {
            "required": [
              "min"
            ]
          },
          {
            "required": [
              "max"
            ]
          },
          {
            "required": [
              "sd"
            ]
          }
        ]
      }
    },
    {
      "if": {
        "required": [
          "landCover"
        ]
      },
      "then": {
        "properties": {
          "landCover": {
            "properties": {
              "termType": {
                "enum": [
                  "landCover"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "previousLandCover"
        ]
      },
      "then": {
        "properties": {
          "previousLandCover": {
            "properties": {
              "termType": {
                "enum": [
                  "landCover"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "term"
        ],
        "properties": {
          "term": {
            "required": [
              "termType"
            ],
            "properties": {
              "termType": {
                "enum": [
                  "emission"
                ]
              }
            }
          }
        }
      },
      "then": {
        "required": [
          "methodTier"
        ]
      }
    },
    {
      "if": {
        "required": [
          "term"
        ],
        "properties": {
          "term": {
            "required": [
              "termType"
            ],
            "properties": {
              "termType": {
                "enum": [
                  "endpointIndicator",
                  "characterisedIndicator",
                  "resourceUse"
                ]
              }
            }
          }
        }
      },
      "then": {
        "not": {
          "required": [
            "methodTier"
          ]
        }
      }
    },
    {
      "if": {
        "required": [
          "country"
        ]
      },
      "then": {
        "properties": {
          "country": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "key"
        ]
      },
      "then": {
        "properties": {
          "key": {
            "properties": {
              "termType": {
                "enum": [
                  "fuel",
                  "material",
                  "waste",
                  "inorganicFertiliser",
                  "otherInorganicChemical",
                  "otherOrganicChemical",
                  "pesticideAI",
                  "soilAmendment",
                  "veterinaryDrug"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "inputs"
        ]
      },
      "then": {
        "properties": {
          "inputs": {
            "items": {
              "properties": {
                "termType": {
                  "enum": [
                    "biologicalControlAgent",
                    "electricity",
                    "feedFoodAdditive",
                    "fuel",
                    "material",
                    "inorganicFertiliser",
                    "organicFertiliser",
                    "biochar",
                    "fertiliserBrandName",
                    "pesticideAI",
                    "pesticideBrandName",
                    "seed",
                    "soilAmendment",
                    "substrate",
                    "veterinaryDrug",
                    "water",
                    "transport",
                    "animalProduct",
                    "crop",
                    "aquaticCrop",
                    "forage",
                    "cropResidue",
                    "liveAnimal",
                    "liveAquaticSpecies",
                    "processedFood",
                    "excretaManagement",
                    "wasteManagement",
                    "operation",
                    "otherOrganicChemical",
                    "otherInorganicChemical"
                  ]
                }
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "animals"
        ]
      },
      "then": {
        "properties": {
          "animals": {
            "items": {
              "properties": {
                "termType": {
                  "enum": [
                    "liveAnimal",
                    "liveAquaticSpecies"
                  ]
                }
              }
            }
          }
        }
      }
    }
  ],
  "oneOf": [
    {
      "required": [
        "@type"
      ]
    },
    {
      "required": [
        "type"
      ]
    }
  ],
  "required": [
    "term",
    "value",
    "methodModel"
  ]
}