{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A composite observation bundling multiple co-produced results from a single act of sensing. Each entry carries its own ObservedProperty, unit, and scale metadata. Use this instead of separate Observations when the results are genuinely co-produced (e.g. wave statistics from spectral processing) and have no independent existence.",
      "key": "any",
      "record": {
        "properties": {
          "derivedFrom": {
            "description": "AT-URIs of source observations or datastreams",
            "items": {
              "format": "at-uri",
              "type": "string"
            },
            "maxLength": 16,
            "type": "array"
          },
          "entries": {
            "description": "Array of co-produced result entries",
            "items": {
              "ref": "#multiObservationEntry",
              "type": "ref"
            },
            "maxLength": 32,
            "type": "array"
          },
          "phenomenonTime": {
            "description": "Time the phenomenon was observed. Start of interval if phenomenonTimeEnd is present.",
            "format": "datetime",
            "type": "string"
          },
          "phenomenonTimeEnd": {
            "description": "End of observation interval. For wave statistics, this is the end of the burst window.",
            "format": "datetime",
            "type": "string"
          },
          "resultQuality": {
            "description": "Quality flag applying to the composite observation as a whole",
            "knownValues": [
              "dev.sensorthings.quality#good",
              "dev.sensorthings.quality#suspect",
              "dev.sensorthings.quality#missing"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "resultTime": {
            "description": "Time the results became available",
            "format": "datetime",
            "type": "string"
          },
          "sensor": {
            "description": "AT-URI of the dev.sensorthings.sensor record (the instrument or process that co-produced these results)",
            "format": "at-uri",
            "type": "string"
          },
          "thing": {
            "description": "AT-URI of the dev.sensorthings.thing record",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "thing",
          "sensor",
          "phenomenonTime",
          "entries"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "multiObservationEntry": {
      "description": "A single result within a composite observation, fully self-describing.",
      "properties": {
        "observedProperty": {
          "description": "AT-URI of the dev.sensorthings.observedProperty record",
          "format": "at-uri",
          "type": "string"
        },
        "result": {
          "refs": [
            "dev.sensorthings.observation#numericResult",
            "dev.sensorthings.observation#categoryResult",
            "dev.sensorthings.observation#booleanResult",
            "dev.sensorthings.observation#arrayResult",
            "dev.sensorthings.observation#geoPointResult"
          ],
          "type": "union"
        },
        "resultQuality": {
          "description": "Quality flag for this specific entry, if different from the composite quality",
          "knownValues": [
            "dev.sensorthings.quality#good",
            "dev.sensorthings.quality#suspect",
            "dev.sensorthings.quality#missing"
          ],
          "maxLength": 64,
          "type": "string"
        },
        "resultScaleFactor": {
          "description": "Scale factor for this entry's numeric result. Default 0.",
          "type": "integer"
        },
        "unitOfMeasurement": {
          "ref": "dev.sensorthings.datastream#unitOfMeasurement",
          "type": "ref"
        }
      },
      "required": [
        "observedProperty",
        "unitOfMeasurement",
        "result"
      ],
      "type": "object"
    }
  },
  "id": "dev.sensorthings.multiObservation",
  "lexicon": 1,
  "revision": 1
}
