Skip to content

Commit f1154c2

Browse files
Fix weather alarm (FIWARE#243)
1 parent 2d31895 commit f1154c2

18 files changed

+505
-309
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ matrix:
3737
before_script:
3838
- eslint --ext .json .
3939
- jshint .
40-
- validate -p . -c true
40+
- validate -i common-schema.json -i geometry-schema.json -i Weather/weather-schema.json -i Alert/alert-schema.json -p . -c true
4141
script:
4242
- true
4343

Alert/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mode (`options=keyValues`).
2929
40.423852777777775
3030
]
3131
},
32-
"dateObserved": "2017-01-02T09:25:55.00Z",
32+
"dateIssued": "2017-01-02T09:25:55.00Z",
3333
"description": "The road is completely blocked for 3kms",
3434
"alertSource": "https://account.lab.fiware.org/users/8"
3535
}

Alert/alert-schema.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"$schema": "http://json-schema.org/schema#",
3+
"id": "https://fiware.github.io/dataModels/Alert/alert-schema.json",
4+
"title": "Alert base schema",
5+
"description": "Common definitions for Alert data model",
6+
"definitions": {
7+
"Common-Alert": {
8+
"type": "object",
9+
"properties": {
10+
"description": {
11+
"type": "string"
12+
},
13+
"dateIssued": {
14+
"type": "string",
15+
"format": "date-time"
16+
},
17+
"validFrom": {
18+
"type": "string",
19+
"format": "date-time"
20+
},
21+
"validTo": {
22+
"type": "string",
23+
"format": "date-time"
24+
},
25+
"severity": {
26+
"type": "string",
27+
"enum": [
28+
"informational",
29+
"low",
30+
"medium",
31+
"high",
32+
"critical"
33+
]
34+
},
35+
"category": {
36+
"type": "string",
37+
"enum": [
38+
"traffic",
39+
"weather",
40+
"environment",
41+
"health",
42+
"security"
43+
]
44+
},
45+
"alertSource": {
46+
"oneOf": [
47+
{
48+
"type": "string",
49+
"format": "uri"
50+
},
51+
{
52+
"$ref": "https://fiware.github.io/dataModels/common-schema.json#/definitions/EntityIdentifierType"
53+
}
54+
]
55+
},
56+
"data": {
57+
"type": "object"
58+
},
59+
"type": {
60+
"type": "string",
61+
"enum": [
62+
"Alert"
63+
],
64+
"description": "NGSI Entity type"
65+
}
66+
}
67+
}
68+
}
69+
}

Alert/doc/spec.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ found [here](../schema.json).
3737
+ Allowed values:
3838
+ (`trafficJam`, `carAccident`, `carWrongDirection`, `carStopped`,
3939
`pothole`, `roadClosed`, `roadWorks`, `hazardOnRoad`, `injuredBiker`)
40-
(for `traffic` category)
41-
+ (`rainfall`, `highTemperature`, `lowTemperature`, `heatWave`, `ice`,
40+
(for `traffic` category)
41+
+ (`rainfall`, `highTemperature`, `lowTemperature`, `heatWave`, `coldWave`, `ice`,
4242
`snow`, `wind`, `fog`, `flood`, `tsunami`, `tornado`, `tropicalCyclone`,
43-
`hurricane` ) (for `weather` category)
43+
`hurricane`, `snow/ice`, `thunderstorms`, `coastalEvent`, `forestFire`,
44+
`avalanches`, `rain/flood`) (for `weather` category)
4445
+ (`airPollution`, `waterPollution`, `pollenConcentration`)
4546
(for `environment` category)
4647
+ (`asthmaAttack`, `bumpedPatient`, `fallenPatient`, `heartAttack` )
@@ -57,7 +58,7 @@ found [here](../schema.json).
5758
+ Attribute type: [Address](https://schema.org/address)
5859
+ Mandatory if `location` is not present.
5960

60-
+ `dateObserved` : The date and time the observation of the alert
61+
+ `dateIssued` : The date and time the alert was issued by the alert generator
6162
in ISO8601 UTC format.
6263
+ Attribute type: [DateTime](https://schema.org/DateTime).
6364
+ Normative References: [ISO8601](https://www.iso.org/standard/40874.html)
@@ -115,7 +116,7 @@ mode (`options=keyValues`).
115116
40.423852777777775
116117
]
117118
},
118-
"dateObserved": "2017-01-02T09:25:55.00Z",
119+
"dateIssued": "2017-01-02T09:25:55.00Z",
119120
"description": "The road is completely blocked for 3kms",
120121
"alertSource": "https://account.lab.fiware.org/users/8"
121122
}
@@ -136,7 +137,7 @@ mode (`options=keyValues`).
136137
40.423852777777775
137138
]
138139
},
139-
"dateObserved": "2017-04-25T09:25:55.00Z",
140+
"dateIssued": "2017-04-25T09:25:55.00Z",
140141
"description": "Potential robbery in main building",
141142
"alertSource": "Camera1234",
142143
"data": {

Alert/example-1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
40.423852777777775
1212
]
1313
},
14-
"dateObserved": "2017-01-02T09:25:55.00Z",
14+
"dateIssued": "2017-01-02T09:25:55.00Z",
1515
"validFrom": "2017-01-02T09:25:55.00Z",
1616
"validTo": "2017-01-02T10:25:55.00Z",
1717
"description": "The road is completely blocked for 3kms",

Alert/example-2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "Point",
88
"coordinates": [-3.712247222222222, 40.423852777777775]
99
},
10-
"dateObserved": "2017-04-25T09:25:55.00Z",
10+
"dateIssued": "2017-04-25T09:25:55.00Z",
1111
"description": "Potential robbery in main building",
1212
"alertSource": "Camera1234",
1313
"data": {

Alert/schema.json

+33-92
Original file line numberDiff line numberDiff line change
@@ -2,108 +2,49 @@
22
"$schema": "http://json-schema.org/schema#",
33
"id": "https://fiware.github.io/dataModels/Alert/schema.json",
44
"title": "Alert data model JSON Schema",
5-
"description": "An alert generated by a user or device in a givel location",
6-
"type": "object",
7-
"allOf": [
5+
"description": "An alert generated by a user or device in a given location",
6+
"allOf": [
87
{
98
"$ref": "https://fiware.github.io/dataModels/common-schema.json#/definitions/GSMA-Commons"
109
},
1110
{
1211
"$ref": "https://fiware.github.io/dataModels/common-schema.json#/definitions/Location-Commons"
1312
},
1413
{
14+
"$ref": "https://fiware.github.io/dataModels/Alert/alert-schema.json#/definitions/Common-Alert"
15+
},
16+
{
17+
"type": "object",
1518
"properties": {
16-
"description": {
17-
"type": "string"
18-
},
19-
"dateObserved": {
20-
"type": "string",
21-
"format": "date-time"
22-
},
23-
"validFrom": {
24-
"type": "string",
25-
"format": "date-time"
26-
},
27-
"validTo": {
28-
"type": "string",
29-
"format": "date-time"
30-
},
31-
"severity": {
32-
"type": "string",
33-
"enum": [
34-
"informational",
35-
"low",
36-
"medium",
37-
"high",
38-
"critical"
39-
]
40-
},
41-
"category": {
42-
"type": "string",
43-
"enum": [
44-
"traffic",
45-
"weather",
46-
"environment",
47-
"health",
48-
"security"
49-
]
50-
},
5119
"subCategory": {
5220
"type": "string",
53-
"enum": [
54-
"trafficJam",
55-
"carAccident",
56-
"carWrongDirection",
57-
"carStopped",
58-
"pothole",
59-
"roadClosed",
60-
"roadWorks",
61-
"hazardOnRoad",
62-
"injuredBiker",
63-
"rainfall",
64-
"highTemperature",
65-
"lowTemperature",
66-
"heatWave",
67-
"ice",
68-
"snow",
69-
"wind",
70-
"fog",
71-
"flood",
72-
"tsunami",
73-
"tornado",
74-
"tropicalCyclone",
75-
"hurricane",
76-
"asthmaAttack",
77-
"bumpedPatient",
78-
"fallenPatient",
79-
"heartAttack",
80-
"suspiciousAction",
81-
"robbery",
82-
"assault"
21+
"anyOf": [
22+
{
23+
"enum": [
24+
"trafficJam",
25+
"carAccident",
26+
"carWrongDirection",
27+
"carStopped",
28+
"pothole",
29+
"roadClosed",
30+
"roadWorks",
31+
"hazardOnRoad",
32+
"injuredBiker",
33+
"asthmaAttack",
34+
"bumpedPatient",
35+
"fallenPatient",
36+
"heartAttack",
37+
"suspiciousAction",
38+
"robbery",
39+
"assault"
40+
]
41+
},
42+
{
43+
"$ref": "https://fiware.github.io/dataModels/Weather/weather-schema.json#/definitions/WeatherAlertCategories"
44+
}
8345
]
84-
},
85-
"alertSource": {
86-
"oneOf": [
87-
{
88-
"type": "string",
89-
"format": "uri"
90-
},
91-
{
92-
"$ref": "https://fiware.github.io/dataModels/common-schema.json#/definitions/EntityIdentifierType"
93-
}
94-
]
95-
},
96-
"data": {
97-
"type": "object"
98-
},
99-
"type": {
100-
"type": "string",
101-
"enum": [
102-
"Alert"
103-
],
104-
"description": "NGSI Entity type"
10546
}
106-
}
47+
}
10748
}
10849
],
10950
"oneOf": [
@@ -114,7 +55,7 @@
11455
"location",
11556
"alertSource",
11657
"category",
117-
"dateObserved"
58+
"dateIssued"
11859
]
11960
},
12061
{
@@ -124,7 +65,7 @@
12465
"address",
12566
"alertSource",
12667
"category",
127-
"dateObserved"
68+
"dateIssued"
12869
]
12970
}
13071
]

Weather/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Weather data models
22

3-
This folder contains all the code that supports NGSIv2 end points for providing weather information.
3+
This folder contains all the code that defines domain-specific datamodels for providing weather information.
44
The following entity types are supported:
55

66
* `WeatherObserved` .- Weather observations provided by [AEMET Weather Stations](../PointOfInterest/WeatherStation/README.md)
77
* `WeatherForecast` .- Weather forecasts provided by [AEMET](http://aemet.es) and [IPMA](http://ipma.pt)
8-
* `WeatherAlarm` .- Weather alarms provided by [MeteoAlarm](http://meteoalarm.eu) and [IPMA](http://ipma.pt)
8+
* `Alert` .- Alerts with `weather` `category` provided by [MeteoAlarm](http://meteoalarm.eu) and [IPMA](http://ipma.pt)
99

10-
The main script in this folder is `aemet.py` which serves as the main entry point for NGSIv2 weather data.

Weather/WeatherAlarm/doc/spec.md

-26
This file was deleted.

0 commit comments

Comments
 (0)