Skip to content

Commit

Permalink
feat: add entities and context for alerts received when a threshold i…
Browse files Browse the repository at this point in the history
…s breached (#15)

* first samples of alert related entities + context

* reformatted files

* basic fixes

* upgrade core context to v1.8
  • Loading branch information
ranim-n authored Apr 30, 2024
1 parent 3b7f252 commit 8a5d928
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jsonld-contexts/cud-eco-gagnant.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://easy-global-market.github.io/cud-data-models/jsonld-contexts/user.jsonld",
"https://easy-global-market.github.io/cud-data-models/jsonld-contexts/fluid.jsonld",
"https://easy-global-market.github.io/cud-data-models/jsonld-contexts/consent.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
"https://easy-global-market.github.io/ngsild-api-data-models/alertEventRisk/jsonld-contexts/alertEventRisk.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld"
]
}
32 changes: 32 additions & 0 deletions ngsild-payloads/alert.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"id": "urn:ngsi-ld:Alert:7a08a58e-e613-4cc0-9160-8a2636970721",
"type": "Alert",
"hasSubject": {
"type": "Relationship",
"object": "urn:ngsi-ld:Event:7a08a58e-e613-4cc0-9160-8a2636970721"
},
"mailingList": {
"type": "Property",
"value": {
"email": [
"[email protected]"
]
}
},
"message": {
"type": "JsonProperty",
"json": {
"body": "[body of the mail]",
"subject": "[ALERT] Electricity consumption exceeded set value"
}
},
"occurrence": {
"type": "Property",
"value": true,
"observedAt": "2024-04-18T16:40:00Z"
},
"triggeredBy": {
"type": "Property",
"value": "urn:ngsi-ld:Subscription:7a08a58e-e613-4cc0-9160-8a2636970721"
}
}
41 changes: 41 additions & 0 deletions ngsild-payloads/event.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"id": "urn:ngsi-ld:Event:7a08a58e-e613-4cc0-9160-8a2636970721",
"type": [
"Event",
"AggregatedThresholdBreach"
],
"hasSubject": {
"type": "Relationship",
"watchedProperties": {
"type": "Property",
"value": "consumption"
},
"object": "urn:ngsi-ld:FluidMonitoring:Electricity:7a08a58e-e613-4cc0-9160-8a2636970721"
},
"occurrence": {
"type": "Property",
"value": "510",
"observedAt": "2024-04-18T16:39:00Z"
},
"status": {
"type": "Property",
"value": "true",
"observedAt": "2024-04-18T16:39:00Z"
},
"thresholdType": {
"type": "Property",
"value": "Upper"
},
"thresholdValue": {
"type": "Property",
"value": "500"
},
"thresholdAggrPeriod": {
"type": "Property",
"value": "P7D"
},
"hasAlert": {
"type": "Relationship",
"object": "urn:ngsi-ld:Alert:7a08a58e-e613-4cc0-9160-8a2636970721"
}
}
20 changes: 20 additions & 0 deletions ngsild-payloads/subscription.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "urn:ngsi-ld:Subscription:7a08a58e-e613-4cc0-9160-8a2636970721",
"type": "Subscription",
"entities": [
{
"id": "urn:ngsi-ld:Event:7a08a58e-e613-4cc0-9160-8a2636970721",
"type": "AggregatedThresholdBreach"
}
],
"watchedAttributes": [
"occurrence"
],
"notification": {
"format": "normalized",
"endpoint": {
"uri": "http://localhost:8080",
"accept": "application/json"
}
}
}

0 comments on commit 8a5d928

Please sign in to comment.