Skip to content

Commit

Permalink
feat: add missing fields to interface Event
Browse files Browse the repository at this point in the history
fixes #9
  • Loading branch information
Daniel J. Lauk committed Mar 27, 2020
1 parent 686d99c commit a097bb7
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 0 deletions.
229 changes: 229 additions & 0 deletions data-query.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
# This file contains data queries to check out the backend's responses.
#
# It's really just a helper for tinkering and getting the requests and
# responses right for when the documentation of the API leaves room for
# interpretation.

###

# non-aggregated query or a SCALAR

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-archiverappliance",
"name": "SINEG01-CMON-DIA0091:CURRENT-5"
}
],
"range": {
"startSeconds": 1585296203.363,
"endSeconds": 1585296205.363
},
"configFields": [
"shape"
],
"eventFields": [
"globalMillis",
"pulseId",
"shape",
"value",
"eventCount"
]
}

###

# non-aggregated query of an ARRAY (WAVEFORM)

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-databuffer",
"name": "SINEG01-RCIR-PUP10:SIG-AMPLT"
}
],
"range": {
"startSeconds": 1585296203.363,
"endSeconds": 1585296203.463
},
"configFields": [
"shape"
],
"eventFields": [
"eventCount",
"globalMillis",
"pulseId",
"shape",
"severity",
"status",
"type",
"value"
]
}

###

# aggregated query, without actual aggregation (eventCount === 1)

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-archiverappliance",
"name": "SINEG01-CMON-DIA0091:CURRENT-5"
}
],
"range": {
"startSeconds": 1585296203.363,
"endSeconds": 1585296205.363
},
"configFields": [
"shape"
],
"eventFields": [
"globalMillis",
"pulseId",
"value",
"shape",
"eventCount"
],
"aggregation": {
"aggregationType": "value",
"aggregations": [
"max",
"mean",
"min"
],
"nrOfBins": 512
}
}

###

# aggregated query, with aggregation (eventCount > 1)

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-archiverappliance",
"name": "SINEG01-CMON-DIA0091:CURRENT-5"
}
],
"range": {
"startSeconds": 1585290203.363,
"endSeconds": 1585296205.363
},
"configFields": [
"shape"
],
"eventFields": [
"eventCount",
"globalMillis",
"pulseId",
"shape",
"severity",
"status",
"type",
"value"
],
"aggregation": {
"aggregationType": "value",
"aggregations": [
"max",
"mean",
"min"
],
"nrOfBins": 512
}
}


###

# value aggregated query of an ARRAY (WAVEFORM)

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-databuffer",
"name": "SINEG01-RCIR-PUP10:SIG-AMPLT"
}
],
"range": {
"startSeconds": 1585296203.363,
"endSeconds": 1585296203.463
},
"configFields": [
"shape"
],
"eventFields": [
"globalMillis",
"pulseId",
"value",
"shape",
"eventCount"
],
"aggregation": {
"aggregationType": "value",
"aggregations": [
"max",
"mean",
"min"
],
"nrOfBins": 512
}
}

###

# index aggregated query of an ARRAY (WAVEFORM)
# without actual aggregation (eventCount === 1)

POST https://data-api.psi.ch/sf/query
Content-Type: application/json

{
"channels": [
{
"backend": "sf-databuffer",
"name": "SINEG01-RCIR-PUP10:SIG-AMPLT"
}
],
"range": {
"startSeconds": 1585296203.363,
"endSeconds": 1585296203.463
},
"configFields": [
"shape"
],
"eventFields": [
"globalMillis",
"pulseId",
"value",
"shape",
"eventCount"
],
"aggregation": {
"aggregationType": "index",
"aggregations": [
"max",
"mean",
"min"
],
"nrOfBins": 512
}
}
6 changes: 6 additions & 0 deletions src/query-data/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@ export interface QueryResponseItem {
* the original data query.
*/
export interface Event {
[EventField.BACKEND]?: string
[EventField.CHANNEL]?: string
[EventField.EVENT_COUNT]?: number
[EventField.GLOBAL_DATE]?: string
[EventField.GLOBAL_MILLIS]?: number
[EventField.GLOBAL_SECONDS]?: number
[EventField.IOC_DATE]?: string
[EventField.IOC_MILLIS]?: number
[EventField.IOC_SECONDS]?: number
[EventField.PULSE_ID]?: number
[EventField.SEVERITY]?: number
[EventField.SHAPE]?: number[]
[EventField.STATUS]?: number
[EventField.TRANSFORMED_VALUE]?: any // ### TODO: specify more correctly
[EventField.VALUE]?:
| number
| number[]
Expand Down

0 comments on commit a097bb7

Please sign in to comment.