Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Specification
Specification
Functions
Schemas
Registers

ObservationRecord

Source schemas/json/observation-record.schema.json

On this page
  1. Properties
  2. Positive fixtures
  3. Negative fixtures
  4. Mappings to open standards
  5. Schema
FieldValue
Identifierurn:obsp:schema:v3.1:observationrecord
Dialecthttps://json-schema.org/draft/2020-12/schema
Used by functionsDescribe, Observe, Qualify

Properties

PropertyRequiredTypeDescription
schemaVersionyesreference
observationUniyesreference
systemUniyesreference
observedPropertyyesstring
phenomenonTimenostring
resultTimeyesreference
validTimenostring
geometrynoobject
unitnostring
resultyesobject | array | string | number | boolean | nullObservation result value
uncertaintynoobject
qualityFlagsnoarray
evidenceRefsyesarray
resultStatenoenumerationOptional typed result state. Any state other than PRESENT carries a null result, never a zero.
sensorPassportRefnoreferenceSensorPassport version in force for this observation (OBSP 0.1 section 5.3)
timeQualityRefnoreferenceTimeQuality reported with this observation (OBSP 0.1 section 5.4)
qualitynoarrayControlled quality flags with the test that set them (OBSP 0.1 section 5.6). qualityFlags (free strings) stays for backward compatibility.
provenanceRefnoreferencePROV-O provenance bundle (provenance.schema.json)
extensionsnoreference

Positive fixtures

  • observation-record.missing-typed.valid.json
  • observation-record.obsp-fields.valid.json
  • observation-record.valid.json

Negative fixtures

  • observation-record.missing-as-zero.json: a MISSING result is null, never zero
  • observation-record.missing-schemaversion.json: required at /: 'schemaVersion' is a required property
  • observation-record.quality-flag-without-test.json: a checked quality flag names its test
  • observation-record.sensor-passport-without-version.json: the sensor passport is referenced by version

Mappings to open standards

A mapping to a standard, never a conformance statement.

  • maps to NS-3 Risk index record UNIs (relation REL-NS-3)
  • maps to NRS-S11 System profile: instruments, sensors and calibration (OPS) (relation REL-NRS-S11)
  • maps to NHS-1 Nexus Hazard Standard (relation REL-NHS-1)
  • maps to NIS-1 Nexus Indicator Standard (relation REL-NIS-1)
  • maps to RFC 3339 (date and time) (relation EXT-RFC3339)
  • maps to W3C/OGC SOSA and SSN ontologies (relation EXT-SOSA)
  • maps to OGC API - Features, proposed (OIP-0001)
  • maps to OGC API - Environmental Data Retrieval (EDR), proposed (OIP-0001)

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:obsp:schema:v3.1:observationrecord",
  "title": "ObservationRecord",
  "type": "object",
  "required": [
    "observationUni",
    "systemUni",
    "observedProperty",
    "resultTime",
    "result",
    "evidenceRefs",
    "schemaVersion"
  ],
  "properties": {
    "schemaVersion": {
      "$ref": "#/$defs/SchemaVersion"
    },
    "observationUni": {
      "$ref": "#/$defs/Uni"
    },
    "systemUni": {
      "$ref": "#/$defs/Uni"
    },
    "observedProperty": {
      "type": "string",
      "minLength": 1
    },
    "phenomenonTime": {
      "type": "string",
      "minLength": 1
    },
    "resultTime": {
      "$ref": "#/$defs/IsoDateTime"
    },
    "validTime": {
      "type": "string",
      "minLength": 1
    },
    "geometry": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "minLength": 1
        },
        "coordinates": true
      },
      "additionalProperties": true
    },
    "unit": {
      "type": "string",
      "minLength": 1
    },
    "result": {
      "description": "Observation result value",
      "type": [
        "object",
        "array",
        "string",
        "number",
        "boolean",
        "null"
      ]
    },
    "uncertainty": {
      "type": "object",
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean",
          "integer"
        ]
      }
    },
    "qualityFlags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "evidenceRefs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/EvidenceRef"
      }
    },
    "resultState": {
      "enum": [
        "PRESENT",
        "MISSING",
        "NOT_OBSERVED",
        "WITHHELD"
      ],
      "description": "Optional typed result state. Any state other than PRESENT carries a null result, never a zero."
    },
    "sensorPassportRef": {
      "$ref": "#/$defs/VersionedRecordRef",
      "description": "SensorPassport version in force for this observation (OBSP 0.1 section 5.3)"
    },
    "timeQualityRef": {
      "$ref": "#/$defs/RecordRef",
      "description": "TimeQuality reported with this observation (OBSP 0.1 section 5.4)"
    },
    "quality": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/QualityFlagEntry"
      },
      "description": "Controlled quality flags with the test that set them (OBSP 0.1 section 5.6). qualityFlags (free strings) stays for backward compatibility."
    },
    "provenanceRef": {
      "$ref": "#/$defs/RecordRef",
      "description": "PROV-O provenance bundle (provenance.schema.json)"
    },
    "extensions": {
      "$ref": "#/$defs/Extensions"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "resultState": {
            "enum": [
              "MISSING",
              "NOT_OBSERVED",
              "WITHHELD"
            ]
          }
        },
        "required": [
          "resultState"
        ]
      },
      "then": {
        "properties": {
          "result": {
            "type": "null"
          }
        }
      }
    }
  ],
  "$defs": {
    "Uni": {
      "type": "string",
      "minLength": 8,
      "maxLength": 256,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9:._/@-]{7,255}$",
      "description": "Durable UNI or typed unresolved identifier according to authority rules"
    },
    "Digest": {
      "type": "string",
      "pattern": "^[a-z0-9]+:[A-Fa-f0-9]{32,128}$",
      "description": "alg:hex digest"
    },
    "IsoDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "NonEmptyString": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    },
    "EvidenceRef": {
      "type": "object",
      "required": [
        "uri",
        "digest"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "digest": {
          "$ref": "#/$defs/Digest"
        },
        "kind": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "recordedAt": {
          "$ref": "#/$defs/IsoDateTime"
        }
      },
      "additionalProperties": false
    },
    "StateVector": {
      "type": "object",
      "required": [
        "implementationState",
        "verificationState",
        "operationalState",
        "claimState",
        "correctionState"
      ],
      "properties": {
        "implementationState": {
          "enum": [
            "NOT_STARTED",
            "DECLARED",
            "SCAFFOLDED",
            "IMPLEMENTED",
            "INTEGRATED"
          ]
        },
        "serviceState": {
          "enum": [
            "NOT_DEPLOYED",
            "STARTING",
            "AVAILABLE",
            "DEGRADED",
            "UNAVAILABLE"
          ]
        },
        "verificationState": {
          "enum": [
            "NOT_TESTED",
            "TESTED",
            "INTEGRATION_VERIFIED",
            "INDEPENDENTLY_ASSESSED"
          ]
        },
        "operationalState": {
          "enum": [
            "NOT_OBSERVED",
            "LAB_OBSERVED",
            "PILOT_OBSERVED",
            "PRODUCTION_OBSERVED"
          ]
        },
        "releaseState": {
          "enum": [
            "INTERNAL",
            "LAB",
            "PILOT",
            "CONTROLLED_RELEASE",
            "CONTROLLED_GA",
            "RETIRED"
          ]
        },
        "claimState": {
          "enum": [
            "NOT_PERMITTED",
            "QUALIFIED",
            "PERMITTED_FOR_SCOPE"
          ]
        },
        "correctionState": {
          "enum": [
            "CURRENT",
            "DISPUTED",
            "SUPERSEDED",
            "WITHDRAWN",
            "RECALLED"
          ]
        }
      },
      "additionalProperties": false
    },
    "Extensions": {
      "type": "object",
      "description": "Namespaced extension bag; unknown top-level fields remain forbidden.",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9]*(\\.[a-z][a-z0-9]*)+$"
      },
      "additionalProperties": true
    },
    "SchemaVersion": {
      "type": "string",
      "const": "3.1.0"
    },
    "RecordVersion": {
      "type": "string",
      "pattern": "^[0-9]+(\\.[0-9]+){0,2}$"
    },
    "RecordRef": {
      "type": "object",
      "required": [
        "uni",
        "digest"
      ],
      "properties": {
        "uni": {
          "$ref": "#/$defs/Uni"
        },
        "version": {
          "$ref": "#/$defs/RecordVersion"
        },
        "digest": {
          "$ref": "#/$defs/Digest"
        }
      },
      "additionalProperties": false
    },
    "VersionedRecordRef": {
      "type": "object",
      "required": [
        "uni",
        "version",
        "digest"
      ],
      "properties": {
        "uni": {
          "$ref": "#/$defs/Uni"
        },
        "version": {
          "$ref": "#/$defs/RecordVersion"
        },
        "digest": {
          "$ref": "#/$defs/Digest"
        }
      },
      "additionalProperties": false
    },
    "QualityFlagValue": {
      "enum": [
        "GOOD",
        "SUSPECT",
        "BAD",
        "MISSING",
        "ESTIMATED",
        "NOT_CHECKED"
      ],
      "description": "Controlled quality-flag vocabulary (OBSP 0.1 section 5.6, WMO-style)"
    },
    "TestCode": {
      "type": "string",
      "pattern": "^(RANGE|STEP|PERSISTENCE|SPIKE|CLIMATOLOGY|INTERNAL_CONSISTENCY|SPATIAL_CONSISTENCY|COMPLETENESS|TIME_INTEGRITY|CALIBRATION_VALIDITY|MANUAL_REVIEW|GAP_FILL_MODEL)$|^LOCAL\\.[a-z0-9-]+\\.[A-Z][A-Z0-9_]{1,63}$",
      "description": "Quality-control test that set the flag: a controlled WMO-style code, or LOCAL.<namespace>.<CODE> for a registered local test"
    },
    "QualityFlagEntry": {
      "type": "object",
      "required": [
        "flag"
      ],
      "properties": {
        "flag": {
          "$ref": "#/$defs/QualityFlagValue"
        },
        "testCode": {
          "$ref": "#/$defs/TestCode"
        },
        "testVersion": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+([-+][0-9A-Za-z.-]+)?$"
        },
        "setAt": {
          "$ref": "#/$defs/IsoDateTime"
        }
      },
      "additionalProperties": false,
      "if": {
        "properties": {
          "flag": {
            "const": "NOT_CHECKED"
          }
        },
        "required": [
          "flag"
        ]
      },
      "then": {
        "not": {
          "anyOf": [
            {
              "required": [
                "testCode"
              ]
            },
            {
              "required": [
                "testVersion"
              ]
            }
          ]
        }
      },
      "else": {
        "required": [
          "testCode",
          "testVersion"
        ]
      },
      "description": "Inline form of quality-flag.schema.json: NOT_CHECKED carries no test; every other flag names its test and test version"
    }
  },
  "additionalProperties": false
}