{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "required": [
    "location",
    "country",
    "city",
    "parameter",
    "unit",
    "value",
    "date",
    "sourceName",
    "sourceType",
    "mobile"
  ],
  "properties": {
    "location": {
      "type": "string",
      "minLength": 1
    },
    "parameter": {
      "type": "string",
      "enum": [
        "pm25",
        "pm10",
        "no2",
        "so2",
        "o3",
        "co",
        "bc"
      ]
    },
    "unit": {
      "type": "string",
      "enum": [
        "ug/m^3",
        "ppm"
      ]
    },
    "averagingPeriod": {
      "type": "object",
      "required": [
        "value",
        "unit"
      ],
      "additionalProperties": false,
      "properties": {
        "value": {
          "type": "number"
        },
        "unit": {
          "type": "string",
          "enum": [
            "hours"
          ]
        }
      }
    },
    "attribution": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "url": {
            "type": "string",
            "pattern": "^(https?://)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([/\\w \\.-]*)*/?"
          }
        }
      }
    },
    "coordinates": {
      "type": "object",
      "required": [
        "latitude",
        "longitude"
      ],
      "additionalProperties": false,
      "properties": {
        "latitude": {
          "type": "number",
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": "number",
          "minimum": -180,
          "maximum": 180
        }
      }
    },
    "value": {
      "type": "number"
    },
    "date": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "utc",
        "local"
      ],
      "properties": {
        "utc": {
          "type": "string"
        },
        "local": {
          "type": "string",
          "pattern": "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\+|-)\\d{2}:\\d{2}"
        }
      }
    },
    "sourceName": {
      "type": "string",
      "minLength": 1
    },
    "sourceType": {
      "type": "string",
      "enum": [
        "government",
        "research",
        "other"
      ]
    },
    "mobile": {
      "type": "boolean"
    },
    "city": {
      "type": "string",
      "minLength": 1
    },
    "country": {
      "type": "string",
      "maxLength": 2,
      "minLength": 2
    }
  }
}