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

QualityFlag

Source schemas/json/quality-flag.schema.json

On this page
  1. Properties
  2. Positive fixtures
  3. Negative fixtures
  4. Mappings to open standards
  5. Schema

One quality flag from the controlled vocabulary (OBSP 0.1 section 5.6) with the test and test version that set it. NOT_CHECKED means no test ran and carries no test; every other flag names its test.

FieldValue
Identifierurn:obsp:schema:v3.1:qualityflag
Dialecthttps://json-schema.org/draft/2020-12/schema
Used by functionsQualify

Properties

PropertyRequiredTypeDescription
schemaVersionyesreference
apiVersionyesconstant
kindyesconstant
protocolVersionyesconstant
flagUniyesreference
flagyesreference
testCodenoreference
testVersionnostring
setAtyesreference
setByyesobject
observationRefnoreference
notenoreference
recordedAtyesreference
extensionsnoreference

Positive fixtures

  • quality-flag.not-checked.valid.json
  • quality-flag.valid.json

Negative fixtures

  • quality-flag.free-text-test-code.json: test codes are controlled
  • quality-flag.missing-test-code.json: a checked flag names its test
  • quality-flag.missing-test-version.json: a checked flag names its test version
  • quality-flag.not-checked-with-test.json: NOT_CHECKED carries no test
  • quality-flag.unknown-flag.json: flag from GOOD|SUSPECT|BAD|MISSING|ESTIMATED|NOT_CHECKED

Mappings to open standards

A mapping to a standard, never a conformance statement.

  • maps to NS-5 Figures, maps and visualization (relation REL-NS-5)

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:obsp:schema:v3.1:qualityflag",
  "title": "QualityFlag",
  "description": "One quality flag from the controlled vocabulary (OBSP 0.1 section 5.6) with the test and test version that set it. NOT_CHECKED means no test ran and carries no test; every other flag names its test.",
  "type": "object",
  "required": [
    "schemaVersion",
    "apiVersion",
    "kind",
    "protocolVersion",
    "flagUni",
    "flag",
    "setAt",
    "setBy",
    "recordedAt"
  ],
  "properties": {
    "schemaVersion": {
      "$ref": "#/$defs/SchemaVersion"
    },
    "apiVersion": {
      "const": "obsp/quality-flag/v3.1"
    },
    "kind": {
      "const": "QualityFlag"
    },
    "protocolVersion": {
      "const": "obsp/0.1"
    },
    "flagUni": {
      "$ref": "#/$defs/Uni"
    },
    "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/Timestamp"
    },
    "setBy": {
      "type": "object",
      "required": [
        "role",
        "agentUni"
      ],
      "properties": {
        "role": {
          "$ref": "#/$defs/ProtocolRole"
        },
        "agentUni": {
          "$ref": "#/$defs/Uni"
        }
      },
      "additionalProperties": false
    },
    "observationRef": {
      "$ref": "#/$defs/RecordRef"
    },
    "note": {
      "$ref": "#/$defs/NonEmptyString"
    },
    "recordedAt": {
      "$ref": "#/$defs/Timestamp"
    },
    "extensions": {
      "$ref": "#/$defs/Extensions"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "flag": {
            "const": "NOT_CHECKED"
          }
        },
        "required": [
          "flag"
        ]
      },
      "then": {
        "not": {
          "anyOf": [
            {
              "required": [
                "testCode"
              ]
            },
            {
              "required": [
                "testVersion"
              ]
            }
          ]
        }
      },
      "else": {
        "required": [
          "testCode",
          "testVersion"
        ]
      }
    }
  ],
  "$defs": {
    "SchemaVersion": {
      "type": "string",
      "const": "3.1.0"
    },
    "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-z0-9._-]{1,31}:[A-Fa-f0-9]{32,128}$",
      "description": "Algorithm-prefixed hexadecimal digest"
    },
    "NonEmptyString": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
    },
    "Timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "RecordVersion": {
      "type": "string",
      "pattern": "^[0-9]+(\\.[0-9]+){0,2}$"
    },
    "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
    },
    "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/Timestamp"
        }
      },
      "additionalProperties": false
    },
    "ProtocolRole": {
      "enum": [
        "NODE",
        "SITE_CELL",
        "CLUSTER",
        "FED_PEER",
        "GRID_OPERATOR",
        "PROVIDER",
        "VERIFIER",
        "CONSUMER",
        "STEWARD"
      ],
      "description": "OBSP 0.1 participant role (specification section 3). Roles, never company names."
    },
    "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
    },
    "CorrectionState": {
      "enum": [
        "CURRENT",
        "DISPUTED",
        "SUPERSEDED",
        "WITHDRAWN",
        "RECALLED"
      ]
    },
    "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"
    }
  },
  "additionalProperties": false
}