{
  "$id": "https://www.hestia.earth/schema-data/json-schema/Site-deep.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$comment": "Schema version 39.0.1",
  "title": "Site",
  "description": "The area on which a Cycle occurred. Typically a field for growing crops or grazing animals, an aquaculture pond, a building, or semi-natural vegetation. Sites can also be whole farms, regions, or countries.\n",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "description": "My local unique ID",
      "examples": [
        "my-unique-id-1"
      ],
      "exportDefaultCSV": true,
      "pattern": "^[\\w\\u00C0-\\u017F\\-\\.\\s\\(\\),+]+$"
    },
    "@id": {
      "type": "string",
      "description": "Unique id assigned by HESTIA",
      "examples": [
        "@hestia-unique-id-1"
      ],
      "extend": true,
      "exportDefaultCSV": true
    },
    "type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Site",
      "enum": [
        "Site"
      ]
    },
    "@type": {
      "type": "string",
      "description": "Type of the Node",
      "default": "Site",
      "enum": [
        "Site"
      ],
      "extend": true
    },
    "name": {
      "type": "string",
      "description": "An automatically generated name for the Site composed of: siteType, \"-\", organisation.name, \"-\", region \",\" country, \"-\", description.",
      "examples": [
        "Field 1",
        "Land use change example"
      ],
      "extend": true,
      "internal": true,
      "searchable": true
    },
    "description": {
      "type": "string",
      "description": "A description of the Site, including information that cannot be captured with other fields.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "organisation": {
      "$ref": "./Organisation-deep.json#",
      "description": "A reference to the Organisation this Site is managed by.",
      "examples": [
        {
          "@id": "org",
          "@type": "Organisation",
          "name": "La Ferme du Grand Roc"
        }
      ],
      "exportDefaultCSV": true
    },
    "siteType": {
      "type": "string",
      "description": "The type of the Site. Definitions for agricultural land follow FAOSTAT, where cropland here means arable land and permanent crops. The additional term \"glass or high accessible cover\" is defined by EUROSTAT.",
      "examples": [
        "cropland",
        "cropland"
      ],
      "enum": [
        "forest",
        "other natural vegetation",
        "cropland",
        "glass or high accessible cover",
        "permanent pasture",
        "animal housing",
        "pond",
        "tank",
        "river or stream",
        "lake",
        "sea or ocean",
        "agri-food processor",
        "food retailer"
      ],
      "extend": true,
      "searchable": true,
      "exportDefaultCSV": true
    },
    "tenure": {
      "type": "string",
      "description": "The ownership status of the Site following EUROSTAT terminology.",
      "examples": [],
      "enum": [
        "farming on owned land",
        "farming on rented land",
        "farming on common land",
        "share farming",
        "other tenure model"
      ],
      "exportDefaultCSV": true
    },
    "numberOfSites": {
      "type": "number",
      "minimum": 1,
      "description": "If data on multiple Sites are aggregated and represented as a single Site, the number of Sites.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "boundary": {
      "type": "object",
      "description": "A nested GeoJSON object for the Site boundary of type 'FeatureCollection', 'Feature' or 'GeometryCollection' in the WGS84 datum. For cropland the boundary should represent area under cultivation (also called sown area).",
      "examples": [
        {
          "type": "FeatureCollection",
          "features": [
            {
              "type": "Feature",
              "properties": {},
              "geometry": {
                "type": "Polygon",
                "coordinates": [
                  [
                    [
                      6.9052934646606445,
                      49.16690366996946
                    ],
                    [
                      6.903340816497803,
                      49.16568302182135
                    ],
                    [
                      6.900680065155029,
                      49.16423784775604
                    ],
                    [
                      6.9001007080078125,
                      49.16369063491694
                    ],
                    [
                      6.8998003005981445,
                      49.163255666551734
                    ],
                    [
                      6.900315284729004,
                      49.16308729067498
                    ],
                    [
                      6.901495456695557,
                      49.16392916433382
                    ],
                    [
                      6.903705596923828,
                      49.165023578693386
                    ],
                    [
                      6.903920173645019,
                      49.1649534246523
                    ],
                    [
                      6.906323432922362,
                      49.16608990788086
                    ],
                    [
                      6.9052934646606445,
                      49.16690366996946
                    ]
                  ]
                ]
              }
            }
          ]
        }
      ],
      "geojson": true,
      "exportDefaultCSV": true
    },
    "area": {
      "type": "number",
      "description": "The area of the Site in hectares. For cropland, this must be area under cultivation, also called sown area. Harvested area, which can be less than sown area, can be defined for each Cycle using the field harvestedArea. If data from more than one Site has been averaged (numberOfSites is greater than one) the area must also be the mean area across Sites and not the sum of areas. If the Site is a country or region, the area must be the area represented by the Cycle data (e.g., the area of the sampled farms or the area of maize production in a country).",
      "examples": [
        4.465786
      ],
      "exclusiveMinimum": 0,
      "exportDefaultCSV": true
    },
    "areaSd": {
      "type": "number",
      "minimum": 0,
      "description": "The standard deviation of area, if there are multiple Sites.",
      "examples": [],
      "exportDefaultCSV": true
    },
    "areaMin": {
      "type": "number",
      "description": "The minimum of area, if there are multiple Sites.",
      "examples": [],
      "exclusiveMinimum": 0,
      "exportDefaultCSV": true
    },
    "areaMax": {
      "type": "number",
      "description": "The maximum of area, if there are multiple Sites.",
      "examples": [],
      "exclusiveMinimum": 0,
      "exportDefaultCSV": true
    },
    "latitude": {
      "type": "number",
      "minimum": -90,
      "maximum": 90,
      "description": "The latitude of the centroid of the Site (-90 to 90, WGS84 datum). Latitude should be provided with at least five decimal place precision (which roughly corresponds to 1 meter precision at the equator).",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "longitude": {
      "type": "number",
      "minimum": -180,
      "maximum": 180,
      "description": "The longitude of the centroid of the Site (-180 to 180, WGS84 datum). Longitude should be provided with at least five decimal place precision.",
      "examples": [],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "country": {
      "$ref": "./Term-deep.json#",
      "description": "The country from the Glossary.",
      "examples": [
        {
          "@id": "GADM-FRA",
          "@type": "Term",
          "name": "France",
          "termType": "region"
        },
        {
          "@id": "GADM-BRA",
          "@type": "Term",
          "name": "Brazil",
          "termType": "region"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "region": {
      "$ref": "./Term-deep.json#",
      "description": "The most specific geographical region from the Glossary.",
      "examples": [
        {
          "@id": "GADM-FRA.6.9.3_1",
          "@type": "Term",
          "name": "Forbach (Districts), Moselle (Department), Grand Est (Region), France",
          "termType": "region"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "glnNumber": {
      "type": "string",
      "pattern": "^\\d{13}$",
      "description": "The Global Location Number.",
      "examples": []
    },
    "startDate": {
      "type": "string",
      "description": "The date in which the Site in its current form was established in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [],
      "datePattern": true
    },
    "endDate": {
      "type": "string",
      "description": "The date in which the Site in its current form ceased to exist in ISO 8601 format (YYYY-MM-DD, YYYY-MM, or YYYY).",
      "examples": [],
      "datePattern": true
    },
    "defaultMethodClassification": {
      "type": "string",
      "description": "The default classification of the method used to acquire or estimate all Infrastructure and Management data in the Cycle. Only required if the Site contains data on Infrastructure and Management. It can be overridden by specifying a methodClassification for each Infrastructure item or Management data item.    physical measurement means the amount is quantified using weighing,\n    volume measurement, metering, chemical methods, or other physical approaches.\n\n    verified survey data means the data are initially collected through\n    surveys; all or a subset of the data are verified using physical methods; and\n    erroneous survey data are discarded or corrected.\n\n    non-verified survey data means the data are collected through\n    surveys that have not been subjected to verification.\n\n    modelled means a previously calibrated model is used to estimate\n    this data point from other data points describing this Cycle.\n\n    estimated with assumptions means a documented assumption is used\n    to estimate this data point from other data points describing this Cycle.\n\n    consistent external sources means the data are taken from external\n    datasets referring to different producers/enterprises:\n\n        Using the same technology (defined as the same\n        System or the same key Practices\n        as those specified in the Cycle);\n\n        At the same date (defined as occurring within the\n        startDate and endDate of the Cycle);\n        and\n\n        In the same region or country.\n\n    Modelling or assumptions may have also been used to transform these data.\n\n    inconsistent external sources means the data are taken from external\n    datasets referring to different producers/enterprises:\n\n        Using a different technology (defined as a different\n        System or using different key\n        Practices to those specified in the Cycle);\n\n        At a different date (defined as occurring within the\n        startDate and endDate of the Cycle);\n        or\n\n        In a different region or country.\n\n    Modelling or assumptions may have also been used to transform these data.\n\n    expert opinion means the data have been estimated by experts in\n    the field.\n\n    unsourced assumption means the data do not have a clear source\n    and/or are based on assumptions only.\n",
      "examples": [
        "physical measurement",
        "verified survey data"
      ],
      "enum": [
        "physical measurement",
        "verified survey data",
        "non-verified survey data",
        "modelled",
        "estimated with assumptions",
        "consistent external sources",
        "inconsistent external sources",
        "expert opinion",
        "unsourced assumption"
      ],
      "searchable": true,
      "exportDefaultCSV": true
    },
    "defaultMethodClassificationDescription": {
      "type": "string",
      "description": "A justification of the defaultMethodClassification used. If the data were estimated with assumptions this field should also describe the assumptions.",
      "examples": [
        "Specifications regarding site infrastructure were provided by the manufacturer.",
        "Data from site visits and historical maps"
      ],
      "exportDefaultCSV": true
    },
    "defaultSource": {
      "$ref": "./Source-deep.json#",
      "description": "The default Source for all data in the Site which can be overridden by specifying a source for each Measurement or item of Infrastructure. Not required (but recommended) for public uploads (i.e., where dataPrivate is false).",
      "examples": [
        {
          "@id": "source",
          "@type": "Source",
          "name": "Gigou (1990)"
        },
        {
          "@id": "source",
          "@type": "Source",
          "name": "Cordoba (2024)"
        }
      ],
      "searchable": true,
      "exportDefaultCSV": true,
      "recommended": true
    },
    "measurements": {
      "type": "array",
      "items": {
        "$ref": "./Measurement.json#"
      },
      "description": "The Measurements taken on the Site.",
      "examples": [
        [
          {
            "@type": "Measurement",
            "term": {
              "@id": "soilPh",
              "@type": "Term",
              "name": "Soil pH",
              "termType": "measurement"
            },
            "method": {
              "@id": "cacl2MethodSoilPh",
              "@type": "Term",
              "name": "CaCl2 method, soil pH",
              "termType": "methodMeasurement"
            },
            "methodClassification": "on-site physical measurement",
            "dates": [
              "1989-01-01"
            ],
            "value": [
              7.6
            ]
          },
          {
            "@type": "Measurement",
            "term": {
              "@id": "organicCarbonPerKgSoil",
              "@type": "Term",
              "name": "Organic carbon (per kg soil)",
              "units": "g C / kg soil",
              "termType": "measurement"
            },
            "method": {
              "@id": "chromicAcidWetOxidation",
              "@type": "Term",
              "name": "Chromic acid wet oxidation",
              "termType": "methodMeasurement"
            },
            "methodClassification": "on-site physical measurement",
            "dates": [
              "1989-01",
              "1989-01-01",
              "1989-01-01T20:20:39"
            ],
            "value": [
              0.1,
              0.36,
              0.4
            ],
            "depthUpper": 0,
            "depthLower": 30
          }
        ]
      ],
      "searchable": true,
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "term.@id",
        "dates",
        "startDate",
        "endDate",
        "measurementDuration",
        "depthUpper",
        "depthLower",
        "method.@id",
        "methodDescription",
        "methodClassification"
      ]
    },
    "management": {
      "type": "array",
      "items": {
        "$ref": "./Management.json#"
      },
      "description": "The Management of the Site.",
      "examples": [
        [
          {
            "@type": "Management",
            "term": {
              "@id": "forest",
              "@type": "Term",
              "name": "Forest",
              "termType": "landCover"
            },
            "value": 5.9,
            "startDate": "1990-01-01",
            "endDate": "1990-12-31"
          },
          {
            "@type": "Management",
            "term": {
              "@id": "annualCropland",
              "@type": "Term",
              "name": "Annual cropland",
              "termType": "landCover"
            },
            "value": 94.15,
            "startDate": "1990-01-01",
            "endDate": "1990-12-31"
          },
          {
            "@type": "Management",
            "term": {
              "@id": "permanentCropland",
              "@type": "Term",
              "name": "Permanent cropland",
              "termType": "landCover"
            },
            "value": 0,
            "startDate": "1990-01-01",
            "endDate": "1990-12-31"
          },
          {
            "@type": "Management",
            "term": {
              "@id": "permanentPasture",
              "@type": "Term",
              "name": "Permanent pasture",
              "termType": "landCover"
            },
            "value": 0,
            "startDate": "1990-01-01",
            "endDate": "1990-12-31"
          },
          {
            "@type": "Management",
            "term": {
              "@id": "maizePlant",
              "@type": "Term",
              "name": "Maize plant",
              "termType": "landCover"
            },
            "value": 100,
            "startDate": "2010-01-01",
            "endDate": "2010-12-31"
          }
        ]
      ],
      "searchable": true,
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "term.@id",
        "startDate",
        "endDate"
      ]
    },
    "infrastructure": {
      "type": "array",
      "items": {
        "$ref": "./Infrastructure.json#"
      },
      "description": "The Infrastructure on the Site.",
      "examples": [
        [
          {
            "@type": "Infrastructure",
            "infrastructureId": "dripIrrigationEquipment",
            "term": {
              "@id": "dripIrrigationEquipment",
              "@type": "Term",
              "name": "Drip irrigation equipment",
              "termType": "irrigation"
            },
            "startDate": "1988-01-01",
            "defaultLifespan": 25,
            "source": {
              "@id": "s66765d",
              "@type": "Source",
              "name": "Gigou (1990)"
            },
            "inputs": [
              {
                "@type": "Input",
                "term": {
                  "@id": "polyvinylChloride",
                  "@type": "Term",
                  "name": "Polyvinyl Chloride",
                  "units": "kg",
                  "termType": "material"
                },
                "value": [
                  1100
                ]
              }
            ],
            "inputsCompleteness": true
          }
        ]
      ],
      "exportDefaultCSV": true,
      "uniqueArrayItem": [
        "infrastructureId"
      ]
    },
    "dataPrivate": {
      "type": "boolean",
      "description": "If these data are private. Private means that HESTIA administrators can access these data and you can grant access to other platform users, but these data will not be made available to any other users of the platform or distributed to third parties.",
      "examples": [],
      "default": false
    },
    "boundaryArea": {
      "type": "number",
      "minimum": 0,
      "description": "The area in km2 of the boundary, used for validation and gap filling. This field is automatically calculated when boundary is provided.",
      "examples": [],
      "internal": true
    },
    "ecoregion": {
      "type": "string",
      "description": "The WWF Terrestrial Ecoregion name.",
      "examples": [
        "Western European broadleaf forests"
      ],
      "internal": true,
      "exportDefaultCSV": true
    },
    "awareWaterBasinId": {
      "type": "string",
      "description": "The AWARE water basin identifier.",
      "examples": [],
      "internal": true,
      "exportDefaultCSV": true
    },
    "originalId": {
      "type": "string",
      "description": "The identifier for these data in the source database.",
      "examples": [],
      "internal": true
    },
    "schemaVersion": {
      "type": "string",
      "description": "The version of the schema when these data were created.",
      "examples": [],
      "internal": true,
      "searchable": 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": "boolean",
      "description": "If this Site has been 'aggregated' using data from multiple Sites.",
      "examples": [],
      "internal": true,
      "searchable": true
    },
    "aggregatedDataValidated": {
      "type": "boolean",
      "description": "If this aggregated Site has been validated by the HESTIA team.",
      "examples": [],
      "internal": true,
      "searchable": true
    },
    "aggregatedVersion": {
      "type": "string",
      "description": "A version of the aggregation engine corresponding to this Site.",
      "examples": [],
      "internal": true
    },
    "aggregatedSites": {
      "type": "array",
      "items": {
        "$ref": "./Site-deep.json#"
      },
      "description": "Sites used to aggregated this Site.",
      "examples": [],
      "internal": true
    },
    "aggregatedSources": {
      "type": "array",
      "items": {
        "$ref": "./Source-deep.json#"
      },
      "description": "Sources used to aggregated this Site.",
      "examples": [],
      "internal": true
    },
    "createdAt": {
      "type": "string",
      "description": "Date created on HESTIA in ISO 8601 format (YYYY-MM-DD).",
      "examples": [],
      "format": "date",
      "internal": true,
      "searchable": true
    },
    "updatedAt": {
      "type": "string",
      "description": "Last update date on HESTIA in ISO 8601 format (YYYY-MM-DD).",
      "examples": [],
      "format": "date",
      "internal": true,
      "searchable": true
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "dataPrivate"
        ],
        "properties": {
          "dataPrivate": {
            "const": false
          }
        }
      },
      "then": {
        "required": [
          "defaultSource"
        ]
      }
    },
    {
      "if": {
        "required": [
          "country"
        ]
      },
      "then": {
        "properties": {
          "country": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "region"
        ]
      },
      "then": {
        "properties": {
          "region": {
            "properties": {
              "termType": {
                "enum": [
                  "region"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "anyOf": [
          {
            "required": [
              "management"
            ]
          },
          {
            "required": [
              "infrastructure"
            ]
          }
        ]
      },
      "then": {
        "required": [
          "defaultMethodClassification"
        ]
      }
    },
    {
      "if": {
        "required": [
          "defaultMethodClassification"
        ]
      },
      "then": {
        "required": [
          "defaultMethodClassificationDescription"
        ]
      }
    },
    {
      "if": {
        "required": [
          "area"
        ]
      },
      "then": {
        "properties": {
          "infrastructure": {
            "items": {
              "not": {
                "required": [
                  "functionalArea"
                ]
              }
            }
          }
        }
      }
    }
  ],
  "oneOf": [
    {
      "required": [
        "@type",
        "@id"
      ]
    },
    {
      "required": [
        "type",
        "id"
      ]
    }
  ]
}