{
  "$id": "https://www.hestia.earth/schema-data/json-schema/Emission.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$comment": "Schema version 39.0.1",
  "title": "Emission",
  "description": "A chemical flow into water, soil, or air occurring during a [Cycle](/schema/Cycle) or [Transformation](/schema/Transformation). Each Emission must be unique and the fields which determine uniqueness are defined in the <code>[emissions](/schema/Cycle#emissions)</code> field of the Cycle or [Transformation](/schema/Transformation#emissions).\n",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Emission",
      "enum": [
        "Emission"
      ]
    },
    "@type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Emission",
      "enum": [
        "Emission"
      ],
      "extend": true
    },
    "term": {
      "$ref": "./Term-deep.json#",
      "description": "A reference to the Term describing the Emission.",
      "examples": [
        {
          "@id": "no3ToGroundwaterSoilFlux",
          "@type": "Term",
          "name": "NO3, to groundwater, soil flux",
          "units": "kg NO3",
          "termType": "emission"
        },
        {
          "@id": "so2ToAirInputsProduction",
          "@type": "Term",
          "name": "SO2, to air, inputs production",
          "units": "kg SO2",
          "termType": "emission"
        },
        {
          "@id": "co2ToAirUreaHydrolysis",
          "@type": "Term",
          "name": "CO2, to air, urea hydrolysis",
          "units": "kg CO2",
          "termType": "emission"
        },
        {
          "@id": "pesticideToWaterInputsProduction",
          "@type": "Term",
          "name": "Pesticide, to water, inputs productions",
          "units": "kg active ingredient",
          "termType": "emission"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "description": {
      "type": "string",
      "description": "A description of the Emission.",
      "examples": [],
      "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": [
        {
          "@id": "CAS-1071-83-6",
          "@type": "Term",
          "name": "Glyphosate",
          "units": "kg active ingredient",
          "termType": "pesticideAI"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "value": {
      "type": "array",
      "items": {
        "type": [
          "number",
          "null"
        ]
      },
      "description": "The quantity of the Emission. If an average, it should always be the mean. Can be a single number (array of length one) or an array of numbers with associated dates (e.g., representing multiple measurements over time).",
      "examples": [
        [
          60.75,
          70.5
        ],
        [
          2.11
        ],
        [
          32
        ],
        [
          0.00622
        ]
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "distribution": {
      "type": "array",
      "items": {
        "type": [
          "number",
          "array"
        ]
      },
      "description": "An array of up to 1000 random samples from the posterior distribution of valuedates field.",
      "examples": [],
      "exportDefaultCSV": true,
      "maxItems": 1000
    },
    "sd": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "number",
            "minimum": 0
          },
          {
            "type": "null"
          }
        ]
      },
      "description": "The standard deviation of value.",
      "examples": [],
      "minimum": 0,
      "arraySameSize": [
        "value"
      ],
      "exportDefaultCSV": true
    },
    "min": {
      "type": "array",
      "items": {
        "type": [
          "number",
          "null"
        ]
      },
      "description": "The minimum of value.",
      "examples": [],
      "arraySameSize": [
        "value"
      ],
      "exportDefaultCSV": true
    },
    "max": {
      "type": "array",
      "items": {
        "type": [
          "number",
          "null"
        ]
      },
      "description": "The maximum of value.",
      "examples": [],
      "arraySameSize": [
        "value"
      ],
      "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",
        "replications",
        "animals",
        "other observations",
        "time",
        "spatial",
        "regions",
        "simulated",
        "modelled"
      ],
      "exportDefaultCSV": true
    },
    "observations": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "number",
            "minimum": 1
          },
          {
            "type": "null"
          }
        ]
      },
      "description": "The number of observations the descriptive statistics are calculated over.",
      "examples": [],
      "searchable": true,
      "minimum": 1,
      "arraySameSize": [
        "value"
      ],
      "exportDefaultCSV": true
    },
    "dates": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "A corresponding array to value, representing the dates of the Emissions in ISO 8601 format (YYYY-MM-DD, YYYY-MM, YYYY, --MM-DD, --MM, or YYYY-MM-DDTHH:mm:ssZ).",
      "examples": [
        [
          "1989-06-16",
          "1989-08-01"
        ]
      ],
      "dateTimePattern": true,
      "arraySameSize": [
        "value"
      ],
      "exportDefaultCSV": true
    },
    "startDate": {
      "type": "string",
      "description": "For Emissions over periods, the start date of the Emission if different from the start date of the Cycle in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [],
      "datePattern": true,
      "exportDefaultCSV": true
    },
    "endDate": {
      "type": "string",
      "description": "For Emissions over periods, the end date of the Emission if different from the end date of the Cycle in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [],
      "datePattern": true,
      "exportDefaultCSV": true
    },
    "emissionDuration": {
      "type": "number",
      "description": "The duration of the Emissions in days, particularly used for measured Emissions.",
      "examples": [],
      "exclusiveMinimum": 0,
      "exportDefaultCSV": true
    },
    "depthUpper": {
      "type": "number",
      "minimum": 0,
      "maximum": 9999,
      "description": "For soil Emissions, the upper (shallower) depth at which the Emission was recorded in centimeters, using positive numbers.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "depthLower": {
      "type": "number",
      "minimum": 0,
      "maximum": 9999,
      "description": "For soil Emissions, the lower (deeper) depth at which the Emission was recorded in centimeters, using positive numbers.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "methodTier": {
      "type": "string",
      "description": "    background data refer to emissions which do not occur in the\n    current Cycle. They are either drawn from external, secondary, and often\n    aggregated datasets such as ecoinvent or are\n    drawn from a linked Impact Assessment.\n\n    measured refers to emissions which are quantified using physical\n    measurement. Terms to describe the measurement technique are contained in the\n    measurement glossary.\n\n    tier 1 models quantify emissions from activity data (i.e., data on\n    Inputs, Practices, etc.) using a simple equation with\n    parameters which are not country or region specific.\n\n    tier 2 models quantify emissions from activity data using a\n    simple equation, often of the same form as the tier 1 model, but with\n    geographically specific parameters.\n\n    tier 3 models quantify emissions from activity data but use\n    equations or algorithms that differ from tier 1 and\n    tier 2 approaches. These approaches include process based models\n    and statistical models with various forms.\n\n    not relevant means this emission is not relevant and in this case\n    value = 0.\n",
      "examples": [
        "measured",
        "background",
        "tier 1",
        "background"
      ],
      "enum": [
        "background",
        "measured",
        "tier 1",
        "tier 2",
        "tier 3",
        "not relevant"
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "methodModel": {
      "$ref": "./Term-deep.json#",
      "description": "A reference to the Term describing the method for measuring the Emission or the model used to calculate it.",
      "examples": [
        {
          "@id": "percolationLysimeter",
          "@type": "Term",
          "name": "Percolation lysimeter",
          "termType": "methodEmissionResourceUse"
        },
        {
          "@id": "ecoinventV3",
          "@type": "Term",
          "name": "ecoinvent v3",
          "termType": "model"
        },
        {
          "@id": "ipcc2006",
          "@type": "Term",
          "name": "IPCC (2006)",
          "termType": "model"
        },
        {
          "@id": "usetoxV2-1",
          "@type": "Term",
          "name": "USEtox v2.1",
          "termType": "model"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "methodModelDescription": {
      "type": "string",
      "description": "A free text field, describing the method for measuring the Emission or the model used to calculate it.",
      "examples": [
        "version 3.1.2"
      ],
      "exportDefaultCSV": true
    },
    "properties": {
      "type": "array",
      "items": {
        "$ref": "./Property.json#"
      },
      "description": "A list of Properties of the Emission, which would override any default properties specified in the term.",
      "examples": [],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "term.@id",
        "key.@id",
        "date",
        "startDate",
        "endDate"
      ]
    },
    "inputs": {
      "type": "array",
      "items": {
        "$ref": "./Term-deep.json#"
      },
      "description": "For background Emissions, the Term(s) describing the Inputs they are associated with. This is a required field for background Emissions.",
      "examples": [
        [
          {
            "@id": "electricityGridMarketMix",
            "@type": "Term",
            "name": "Electricity, grid, market mix",
            "termType": "electricity"
          }
        ],
        [
          {
            "@id": "rapeseedSeedWhole",
            "@type": "Term",
            "name": "Rapeseed, seed (whole)",
            "termType": "crop"
          }
        ]
      ],
      "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"
      ]
    },
    "transport": {
      "type": "array",
      "items": {
        "$ref": "./Term-deep.json#"
      },
      "description": "For Emissions created by transport, the Term(s) describing the transport.",
      "examples": [],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "@id"
      ]
    },
    "operation": {
      "$ref": "./Term-deep.json#",
      "description": "For Emissions created by an operation, the Term describing the operation.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "transformation": {
      "$ref": "./Term-deep.json#",
      "description": "For Emissions created during a Transformation, the Term describing the Transformation.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "site": {
      "$ref": "./Site-deep.json#",
      "description": "If the Cycle occurred on multiple Sites, the Site where this Emission occurred.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "country": {
      "$ref": "./Term-deep.json#",
      "description": "The country from the Glossary, following GADM naming conventions. This is for background emissions (emissions from inputs production) only.",
      "examples": [
        {
          "@id": "GADM-FRA",
          "@type": "Term",
          "name": "France"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "source": {
      "$ref": "./Source-deep.json#",
      "description": "A reference to the Source of these data, if different from the defaultSource of the Cycle.",
      "examples": [
        {
          "@id": "yyu8v5",
          "@type": "Source",
          "name": "Murwira (1993)"
        },
        {
          "@id": "yyu8v5",
          "@type": "Source",
          "name": "Wernet et al (2016)"
        }
      ],
      "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 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
    },
    "deleted": {
      "type": "boolean",
      "description": "Indicates if this emission has been marked as deleted from the original dataset.",
      "examples": [],
      "internal": true
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "term"
        ]
      },
      "then": {
        "properties": {
          "term": {
            "properties": {
              "termType": {
                "enum": [
                  "emission"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "methodTier"
        ],
        "properties": {
          "methodTier": {
            "const": "background"
          }
        }
      },
      "then": {
        "required": [
          "inputs"
        ]
      }
    },
    {
      "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"
                  ]
                }
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "methodModel"
        ]
      },
      "then": {
        "properties": {
          "methodModel": {
            "properties": {
              "termType": {
                "enum": [
                  "model",
                  "methodEmissionResourceUse"
                ]
              }
            }
          }
        }
      }
    },
    {
      "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": [
          "country"
        ]
      },
      "then": {
        "properties": {
          "country": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "country"
        ]
      },
      "then": {
        "required": [
          "methodTier"
        ],
        "properties": {
          "methodTier": {
            "const": "background"
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "key"
        ]
      },
      "then": {
        "properties": {
          "key": {
            "properties": {
              "termType": {
                "enum": [
                  "fuel",
                  "material",
                  "waste",
                  "inorganicFertiliser",
                  "otherInorganicChemical",
                  "otherOrganicChemical",
                  "pesticideAI",
                  "soilAmendment",
                  "veterinaryDrug"
                ]
              }
            }
          }
        }
      }
    }
  ],
  "oneOf": [
    {
      "required": [
        "@type"
      ]
    },
    {
      "required": [
        "type"
      ]
    }
  ],
  "required": [
    "term",
    "value",
    "methodTier",
    "methodModel"
  ]
}