Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Built out the AVRO example a bit more

...


    "signal"  :  "vehicle.body.cabin.temperature"
"count" : "132" # Might be redundant information, optional.
    "values" : {
        { 
   "ts" : "2020-01-10T02:59:43.491751"
   "value" : "42.5"
     },
        { 
   "ts" : "2020-01-10T02:59:43.491751"
   "value" : "43.0"
     },
... 130 more records
}
}

AVRO-schema example (not complete, and of course the "#comments" are not allowed to be there)
# First attempt at AVRO schema for TimeSeries

{ "type": "record", "name": "TimeSeries", "fields" : [ # This is the AVRO meaning of record (i.e. kind {"name": "signal", "type": "string"}, {of struct), not the Record type in our type hierarchy. "name": "countTimeSeries", "type": "int" },
{"name": "values", "type": "array" "items" :
{ "name" : "ts # We are defining the TimeSeries value format "fields" : [ {"name": "signal", "type" : "string"}, # ISOFull formattedpath timestampVSS with }dot-notation,
like in example above { "name" : "valuecount", "type": "unionint" {}, TODO: union of int/long/string/ # VSS types }
}
} as above
{"name": "values", "type": "array",
"items" : {
"type" : "record", # ***
"name" : "TimeStampedRecord",
"fields" : [
{ "name" : "ts", "type" : "string" # ISO formatted timestamp, maybe use int later for efficiency },
# "value" can be any VSS data type, so here we must define a "union" of types. Also arrays are possible in that union.
{ "name" : "value", "type" : [ "int", "long", "float", "double", "string", "boolean",
{ "type" : "array", "items" :
# This gets a bit complex because the array primitive type could also be any type (i.e. another union, except we don't do arrays in arrays)
[ "int", "long", "float", "double", "string", "boolean"
] # End of union definition for the items in an array
} # End of the VSS Array type definition
] # End of union definition for the field "value" in the TimeStampedRecord
] # End of list of fields
} # End of "items"
} # end of "values"
] # end of "fields"
} # end of TimeSeries record

*** Note that we should define the TimeStampedRecord schema separately, and refer to it instead of having it inline like this...



Snapshot:


"timeperiod" {
"start" : "2020-01-10T02:00:00Z",
"end" : "2020-01-11T01:59:59Z"
},
"values" : {
{
    "signal" : "vehicle.body.cabin.temperature",
     "value" : "22.0",
     "ts" : "2020-01-10T02:59:43.491751"
},
{
    "signal" : "vehicle.drivetrain.engine.rpm.average",
      "value" : "3200",
     "ts" : "2020-01-10T02:59:44.100403"
}
}

...