# dev.sensorthings.observation

> Published by [sensorthings.dev](https://lexicon.garden/identity/did:plc:gqcmwsromoknyigx2afqcvqk)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:gqcmwsromoknyigx2afqcvqk/dev.sensorthings.observation)
- [Documentation](https://lexicon.garden/lexicon/did:plc:gqcmwsromoknyigx2afqcvqk/dev.sensorthings.observation/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:gqcmwsromoknyigx2afqcvqk/dev.sensorthings.observation/examples)

## Definitions

### `dev.sensorthings.observation`

**Type**: `record`

A single act of observation. The result type is determined by the $type discriminator on the result object.

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `result` | `union` | Yes | The observation result. Type determined by $type discriminator. |
| `datastream` | `string` (at-uri) | Yes | AT-URI of the parent Datastream |
| `parameters` | `unknown` | No | Additional name-value pairs (e.g. depth, height above ground) |
| `resultTime` | `string` (datetime) | No | Time the result became available (if different from phenomenonTime) |
| `derivedFrom` | `array` | No | AT-URIs of source observations or datastreams from which this observation was derived (e.g. tidal residual derived from observed and predicted level datastreams) |
| `resultQuality` | `string` | No | Quality flag as a token reference |
| `phenomenonTime` | `string` (datetime) | Yes | Time the phenomenon was observed (ISO 8601). Start of interval if phenomenonTimeEnd is present. |
| `featureOfInterest` | `string` (at-uri) | No | AT-URI of the feature being observed, if different from the Thing's location |
| `phenomenonTimeEnd` | `string` (datetime) | No | End of observation interval (ISO 8601). If absent, the observation is an instant. Used for aggregates (daily means), processing windows (wave burst statistics), and accumulations (hourly rainfall). |

### `dev.sensorthings.observation#arrayResult`

**Type**: `object`

Array of scaled integer values sharing the parent Datastream's resultScaleFactor. Used for wave spectra (energy at frequency bins), current profiles (speed at depth bins), and similar array-valued observations.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `labels` | `array` | No | Optional labels identifying each element (e.g. frequency bin edges in Hz, depth bin centres in m). Must be same length as values if present. |
| `values` | `array` | Yes | Ordered array of scaled integer values |

### `dev.sensorthings.observation#booleanResult`

**Type**: `object`

True/false observation. Used for threshold exceedances, detection flags, binary sensor states.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `boolean` | Yes |  |

### `dev.sensorthings.observation#numericResult`

**Type**: `object`

Scaled integer result. Real value = value × 10^(−resultScaleFactor). The common case for continuous measurements.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `integer` | Yes |  |

### `dev.sensorthings.observation#categoryResult`

**Type**: `object`

Categorical observation from a controlled vocabulary. Used for weather codes, flood alert levels, land cover classes, sea state.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `string` | Yes | Code or label from the vocabulary |
| `vocabulary` | `string` (uri) | No | URI of the code list or vocabulary (e.g. https://codes.wmo.int/306/4677 for WMO present weather codes) |

### `dev.sensorthings.observation#geoPointResult`

**Type**: `object`

Geographic position result for position-as-observation (e.g. GPS fix from a drifting buoy). Uses the same encoding as Thing.location.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `altMm` | `integer` | No | Altitude in mm above WGS84 ellipsoid |
| `latE7` | `integer` | Yes |  |
| `lonE7` | `integer` | Yes |  |

## Raw Schema

```json
{
  "id": "dev.sensorthings.observation",
  "defs": {
    "main": {
      "key": "any",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "datastream",
          "result",
          "phenomenonTime"
        ],
        "properties": {
          "result": {
            "refs": [
              "#numericResult",
              "#categoryResult",
              "#booleanResult",
              "#arrayResult",
              "#geoPointResult"
            ],
            "type": "union",
            "description": "The observation result. Type determined by $type discriminator."
          },
          "datastream": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the parent Datastream"
          },
          "parameters": {
            "type": "unknown",
            "description": "Additional name-value pairs (e.g. depth, height above ground)"
          },
          "resultTime": {
            "type": "string",
            "format": "datetime",
            "description": "Time the result became available (if different from phenomenonTime)"
          },
          "derivedFrom": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "at-uri"
            },
            "maxLength": 16,
            "description": "AT-URIs of source observations or datastreams from which this observation was derived (e.g. tidal residual derived from observed and predicted level datastreams)"
          },
          "resultQuality": {
            "type": "string",
            "maxLength": 64,
            "description": "Quality flag as a token reference",
            "knownValues": [
              "dev.sensorthings.quality#good",
              "dev.sensorthings.quality#suspect",
              "dev.sensorthings.quality#missing"
            ]
          },
          "phenomenonTime": {
            "type": "string",
            "format": "datetime",
            "description": "Time the phenomenon was observed (ISO 8601). Start of interval if phenomenonTimeEnd is present."
          },
          "featureOfInterest": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the feature being observed, if different from the Thing's location"
          },
          "phenomenonTimeEnd": {
            "type": "string",
            "format": "datetime",
            "description": "End of observation interval (ISO 8601). If absent, the observation is an instant. Used for aggregates (daily means), processing windows (wave burst statistics), and accumulations (hourly rainfall)."
          }
        }
      },
      "description": "A single act of observation. The result type is determined by the $type discriminator on the result object."
    },
    "arrayResult": {
      "type": "object",
      "required": [
        "values"
      ],
      "properties": {
        "labels": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 32
          },
          "maxLength": 1024,
          "description": "Optional labels identifying each element (e.g. frequency bin edges in Hz, depth bin centres in m). Must be same length as values if present."
        },
        "values": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "maxLength": 1024,
          "description": "Ordered array of scaled integer values"
        }
      },
      "description": "Array of scaled integer values sharing the parent Datastream's resultScaleFactor. Used for wave spectra (energy at frequency bins), current profiles (speed at depth bins), and similar array-valued observations."
    },
    "booleanResult": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "boolean"
        }
      },
      "description": "True/false observation. Used for threshold exceedances, detection flags, binary sensor states."
    },
    "numericResult": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "integer"
        }
      },
      "description": "Scaled integer result. Real value = value × 10^(−resultScaleFactor). The common case for continuous measurements."
    },
    "categoryResult": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "string",
          "maxLength": 256,
          "description": "Code or label from the vocabulary"
        },
        "vocabulary": {
          "type": "string",
          "format": "uri",
          "description": "URI of the code list or vocabulary (e.g. https://codes.wmo.int/306/4677 for WMO present weather codes)"
        }
      },
      "description": "Categorical observation from a controlled vocabulary. Used for weather codes, flood alert levels, land cover classes, sea state."
    },
    "geoPointResult": {
      "type": "object",
      "required": [
        "latE7",
        "lonE7"
      ],
      "properties": {
        "altMm": {
          "type": "integer",
          "description": "Altitude in mm above WGS84 ellipsoid"
        },
        "latE7": {
          "type": "integer",
          "maximum": 900000000,
          "minimum": -900000000
        },
        "lonE7": {
          "type": "integer",
          "maximum": 1800000000,
          "minimum": -1800000000
        }
      },
      "description": "Geographic position result for position-as-observation (e.g. GPS fix from a drifting buoy). Uses the same encoding as Thing.location."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
