How to use data models

Simple user:
  • Use the csv (comma separated values) like this table, a csv is available in every data model and its specification and explanation in the /doc/spec.md that explains the meaning of the fields
id type address__addressLocality address__addressCountry atmosphericPressure dataProvider dateObserved location__coordinates precipitation pressureTendency relativeHumidity source stationCode stationName temperature windDirection windSpeed illuminance refDevice streamGauge snowHeight
Spain-WeatherObserved-Valladolid-2016-11-30T07:00:00.00Z WeatherObserved Valladolid ES 938.9 TEF 2016-11-30T07:00:00.00Z [-4.754444444, 41.640833333] 0 0.5 1 http://www.aemet.es 2422 Valladolid 3.3 -45 2 1000 device-0A3478 50 20

Source

  • The specification described in the READ.me
Bit more expert user (use json):

{
"id": "Spain-WeatherObserved-Valladolid-2016-11-30T07:00:00.00Z",
"type": "WeatherObserved",
"address": {
"addressLocality": "Valladolid",
"addressCountry": "ES"
},
"atmosphericPressure": 938.9,
"dataProvider": "TEF",
"dateObserved": "2016-11-30T07:00:00.00Z",
"location": {
"type": "Point",
"coordinates": [-4.754444444, 41.640833333] },
"precipitation": 0,
"pressureTendency": 0.5,
"relativeHumidity": 1,
"source": "http://www.aemet.es",
"stationCode": "2422",
"stationName": "Valladolid",
"temperature": 3.3,
"windDirection": -45,
"windSpeed": 2,
"illuminance": 1000,
"refDevice": "device-0A3478",
"streamGauge": 50,
"snowHeight": 20,
"uvIndexMax": 1.0
}

You can insert a normalized version of these payloads through this command

curl -iX POST ‘http://localhost:1026/v2/entities’ -H ‘Content-Type: application/json’ -d ‘ payload

where payload take these values

for NGSI-Ld https://github.com/smart-data-models/dataModel.Weather/blob/master/WeatherObserved/examples/example-normalized.jsonld

for NGSI v2 https://github.com/smart-data-models/dataModel.Weather/blob/master/WeatherObserved/examples/example-normalized.json

Quite expert, you can validate your json payloads against the json schemas:


{
"$schema": "http://json-schema.org/schema#",
"$id": "https://smart-data-models.github.io/dataModel.Weather/WeatherObserved/schema.json",
"title": " - Weather Observed schema",
"description": "An observation of weather conditions at a certain place and time. This data model has been developed in cooperation with mobile operators and the GSMA.",
"type": "object",
"allOf": [
{
"$ref": "https://smart-data-models.github.io/data-models/common-schema.json#/definitions/GSMA-Commons"
},
{
"$ref": "https://smart-data-models.github.io/data-models/common-schema.json#/definitions/Location-Commons"
},
{
"$ref": "https://smart-data-models.github.io/dataModel.Weather/weather-schema.json#/definitions/Weather-Commons"
},
{
"properties": {
"type": {
"type": "string",
"enum": ["WeatherObserved"],
"description": "NGSI Entity type"
},
"dateObserved": {
"type": "string",
"format": "date-time"
},
"precipitation": {
"type": "number",
"minimum": 0
},
"atmosphericPressure": {
"type": "number",
"minimum": 0
},
"solarRadiation": {
"type": "number",
"minimum": 0
},
"illuminance": {
"type": "number",
"minimum": 0
},
"pressureTendency": {
"oneOf": [
{
"type": "string",
"enum": ["raising", "falling", "steady"] },
{
"type": "number"
}
] },
"dewPoint": {
"type": "number"
},
"refDevice": {
"$ref": "https://smart-data-models.github.io/data-models/common-schema.json#/definitions/EntityIdentifierType"
},
"streamGauge": {
"type": "number"
},
"snowHeight": {
"type": "number"
},
"uVIndexMax": {
"type": "number",
"minimum": 1
}
}
}
],
"required": ["id", "type", "dateObserved", "location"] }

source

Comments are closed.