Skip to content

Commit

Permalink
First version from FIWARE Data Models
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Manuel Cantera committed Jun 6, 2019
1 parent 58a70d4 commit 3863ba6
Show file tree
Hide file tree
Showing 14 changed files with 643 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.idea/*
.DS_Store
.python_env
**/*.pyc
node_modules
**/*.log*
**bak
**/bin/**
**.Python
**.env**
.eslintcache

*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
*.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pids
*.pid
*.seed
*.pid.lock
jspm_packages/
.npm
*.tgz
.env
.next
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
dist: xenial
language: python
python:
- "3.7"

before_install:
- DATA_MODEL_NAME=`echo $TRAVIS_REPO_SLUG | awk -F'.' '{print $2}'`
- echo $DATA_MODEL_NAME


install:
- npm install -g ajv-cli
- cd .. && mkdir integration && cd integration
- git clone https://github.com/front-runner-smart-cities/tools
- cd tools/validator && pip3 install -r requirements.txt
- cd $TRAVIS_BUILD_DIR/../integration
- git clone --recurse-submodules https://github.com/front-runner-smart-cities/dataModels
- cd dataModels/specs/$DATA_MODEL_NAME
- rm -Rf *
- cd $TRAVIS_BUILD_DIR/ && cp -R * ../integration/dataModels/specs/$DATA_MODEL_NAME/
- docker run --name mongodb -d mongo:3.6
- docker run -d --name orion1 --link mongodb:mongodb -p 1026:1026 fiware/orion -dbhost mongodb


script:
- python3 ../integration/tools/validator/main.py ../integration/dataModels/ --noLD


notifications:
on_success: change
on_failure: always
Empty file added CONTRIBUTING.md
Empty file.
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The FIWARE Data Models Project Contributors: https://github.com/FIWARE/dataModels/graphs/contributors
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
All the data models documented here are offered under a Creative Commons by Attribution 4.0 License.
https://creativecommons.org/licenses/by/4.0/
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# dataModel.Alert
Alert Data Model
[![Status badge](https://img.shields.io/badge/status-draft-red.svg)](RELEASE_NOTES)
[![Build badge](https://img.shields.io/travis/front-runner-smart-cities/dataModel.Alert.svg "Travis build status")](https://travis-ci.org/front-runner-smart-cities/dataModel.Alert/)
[![License: CC BY 4.0](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)
# Alert data model

## Description

This entity models an alert and could be used to send alerts related to traffic
jam, accidents, weather conditions, high level of pollutants and so on. The
purpose of the model is to support the generation of notifications for a user or
trigger other actions, based on such alerts.

An alert is generated by a specific situation. The main features of an alert is
that it is not predictable and it is not a recurrent data. That means that an
alert could be an accident or a high level of pollutants measure, additionally
it could be the fall down of a patient or a car driving in the opposite
direction.

Some examples of context data are: type of alert (traffic, suspicious
activities, and pollution, etc.), severity, location and so on.

**Note**: JSON Schemas only capture the NGSI simplified representation, this
means that to test the JSON schema examples with a
[FIWARE NGSI version 2](http://fiware.github.io/specifications/ngsiv2/stable)
API implementation, you need to use the `keyValues` mode (`options=keyValues`).

## Examples of use

```json
{
"id": "Alert:1",
"type": "Alert",
"category": "traffic",
"subCategory": "trafficJam",
"severity": "high",
"location": {
"type": "Point",
"coordinates": [-3.712247222222222, 40.423852777777775]
},
"dateIssued": "2017-01-02T09:25:55.00Z",
"description": "The road is completely blocked for 3kms",
"alertSource": "https://account.lab.fiware.org/users/8"
}
```
1 change: 1 addition & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Draft Version. Call For Comments. 10/06/2019.
71 changes: 71 additions & 0 deletions alert-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://fiware.github.io/dataModels/specs/Alert/alert-schema.json",
"title": "Alert base schema",
"description": "Common definitions for Alert data model",
"definitions": {
"Common-Alert": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"dateIssued": {
"type": "string",
"format": "date-time"
},
"validFrom": {
"type": "string",
"format": "date-time"
},
"validTo": {
"type": "string",
"format": "date-time"
},
"severity": {
"type": "string",
"enum": [
"informational",
"low",
"medium",
"high",
"critical"
]
},
"category": {
"type": "string",
"enum": [
"traffic",
"naturalDisaster",
"weather",
"environment",
"health",
"security",
"agriculture"
]
},
"alertSource": {
"oneOf": [
{
"type": "string",
"format": "uri"
},
{
"$ref": "https://fiware.github.io/dataModels/common-schema.json#/definitions/EntityIdentifierType"
}
]
},
"data": {
"type": "object"
},
"type": {
"type": "string",
"enum": [
"Alert"
],
"description": "NGSI Entity type"
}
}
}
}
}
Loading

0 comments on commit 3863ba6

Please sign in to comment.