Config query fields.

This commit is contained in:
Fabian Märki
2018-01-16 17:01:14 +01:00
parent 593228ead5
commit 0ff19f14a9
19 changed files with 1000 additions and 394 deletions

View File

@ -282,7 +282,11 @@ A request is performed by sending a valid JSON object in the HTTP request body.
"endPulseId":3
},
"ordering":"asc",
"fields":[
"configFields":[
"globalDate",
"type"
],
"eventFields":[
"pulseId",
"globalDate",
"value"
@ -328,7 +332,8 @@ A request is performed by sending a valid JSON object in the HTTP request body.
- **range**: The range of the query (see [here](Readme.md#query_range)).
- **limit**: An optional limit for the number of elements to retrieve. Limit together with aggregation does not make sense and thus is not supported.
- **ordering**: The ordering of the data (see [here](Readme.md#data_ordering)).
- **fields**: Array of requested fields (see [here](Readme.md#requested_fields)).
- **configFields**: Array of requested config fields (see [here](Readme.md#requested_fields)). Omitting this field disables the config query.
- **eventFields**: Array of requested event fields (see [here](Readme.md#requested_fields)). Omitting this field results in a default set of event fields.
- **aggregation**: Setting this attribute activates data aggregation (see [here](Readme.md#data_aggregation) for its specification).
- **response**: Specifies the format of the response of the requested data (see [here](Readme.md#response_format)). If this value is not set it defaults to JSON.
- **mapping**: Activates a table like alignment of the response which allows a mapping of values belonging to the same pulse-id/global time (see [here](Readme.md#value_mapping) - usually left undefined).
@ -437,14 +442,20 @@ Queries are applied to a range. The following types of ranges are supported.
### Requested Fields
```json
"fields":[
"configFields":[
"pulseId",
"globalDate",
"type"
],
"eventFields":[
"pulseId",
"globalDate",
"value"
]
```
- **fields**: Array of requested fields (see [here](https://github.psi.ch/sf_daq/ch.psi.daq.domain/blob/master/src/main/java/ch/psi/daq/domain/query/operation/EventField.java) for possible values of data queries and [here](https://github.psi.ch/sf_daq/ch.psi.daq.domain/blob/master/src/main/java/ch/psi/daq/domain/query/operation/ConfigField.java) for possible values of config queries).
- **configFields**: Array of requested config fields (see [here](https://github.psi.ch/sf_daq/ch.psi.daq.domain/blob/master/src/main/java/ch/psi/daq/domain/query/operation/ConfigField.java)) for possible values of config queries.
- **eventFields**: Array of requested event fields (see [here](https://github.psi.ch/sf_daq/ch.psi.daq.domain/blob/master/src/main/java/ch/psi/daq/domain/query/operation/EventField.java) for possible values of data queries.
It is possible to request the time in seconds (since midnight, January 1, 1970 UTC (the UNIX epoch) as a decimal value including fractional seconds - using fields *globalSeconds* and *iocSeconds*), in milliseconds (since midnight, January 1, 1970 UTC (the JAVA epoch) - using fields *globalMillis* and *iocMillis*) or as a ISO8601 formatted String - using fields *globalDate* and *iocDate* (such as 1997-07-16T19:20:30.123456789+02:00).
@ -885,7 +896,7 @@ Allows for server side optimizations since not all data needs to be retrieved.
```json
{
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -899,7 +910,7 @@ Allows for server side optimizations since not all data needs to be retrieved.
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -948,7 +959,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"fields":["pulseId","valu
"channel1",
"channel2"
],
"fields":[
"eventFields":[
"channel",
"pulseId",
"iocSeconds",
@ -963,7 +974,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"fields":["pulseId","valu
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"response":{"format":"csv"},"range":{"startPulseId":0,"endPulseId":4},"channels":["channel1","channel2"],"fields":["channel","pulseId","iocSeconds","globalSeconds","shape","eventCount","value"]}' https://data-api.psi.ch/sf/query
curl -H "Content-Type: application/json" -X POST -d '{"response":{"format":"csv"},"range":{"startPulseId":0,"endPulseId":4},"channels":["channel1","channel2"],"eventFields":["channel","pulseId","iocSeconds","globalSeconds","shape","eventCount","value"]}' https://data-api.psi.ch/sf/query
```
##### Response
@ -989,7 +1000,7 @@ testChannel2;4;0.040000000;0.040000000;[1];1;4
```json
{
"ordering":"desc",
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -1006,7 +1017,7 @@ Use **none** in case ordering does not matter (allows for server side optimizati
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"ordering":"desc","fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"ordering":"desc","eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1050,7 +1061,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"ordering":"desc","fields
"aggregationType":"value",
"aggregations":["min","mean","max"]
},
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -1064,7 +1075,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"ordering":"desc","fields
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"aggregationType":"value","aggregations":["min","mean","max"]},"fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"aggregationType":"value","aggregations":["min","mean","max"]},"eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1129,7 +1140,7 @@ Illustration of array value aggregation:
"aggregationType":"value",
"aggregations":["min","mean","max"]
},
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -1143,7 +1154,7 @@ Illustration of array value aggregation:
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"nrOfBins":2,"aggregationType":"value","aggregations":["min","mean","max"]},"fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"nrOfBins":2,"aggregationType":"value","aggregations":["min","mean","max"]},"eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1195,7 +1206,7 @@ Illustration of array value aggregation with additional binning:
"aggregationType":"value",
"aggregations":["min","mean","max"]
},
"fields":["globalMillis","value"],
"eventFields":["globalMillis","value"],
"range":{
"startSeconds":"0.0",
"endSeconds":"0.030000000"
@ -1209,7 +1220,7 @@ Illustration of array value aggregation with additional binning:
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"pulsesPerBin":2,"aggregationType":"value","aggregations":["min","mean","max"]},"fields":["globalMillis","value"],"range":{"startSeconds":"0.0","endSeconds":"0.030000000"},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"pulsesPerBin":2,"aggregationType":"value","aggregations":["min","mean","max"]},"eventFields":["globalMillis","value"],"range":{"startSeconds":"0.0","endSeconds":"0.030000000"},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1257,7 +1268,7 @@ Illustration of array value aggregation with additional binning:
"aggregationType":"index",
"aggregations":["min","mean","max","sum"]
},
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -1271,7 +1282,7 @@ Illustration of array value aggregation with additional binning:
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"nrOfBins":1,"aggregationType":"index","aggregations":["min","max","mean","sum"]},"fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"aggregation":{"nrOfBins":1,"aggregationType":"index","aggregations":["min","max","mean","sum"]},"eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01"]}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1329,7 +1340,7 @@ Maps values based on their pulse-id/global time. Please note that the response f
```json
{
"fields":["pulseId","value"],
"eventFields":["pulseId","value"],
"range":{
"startPulseId":0,
"endPulseId":3
@ -1347,7 +1358,7 @@ Maps values based on their pulse-id/global time. Please note that the response f
##### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"fields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01","Channel_02"],"mapping":{"incomplete":"provide-as-is"}}' https://data-api.psi.ch/sf/query | python -m json.tool
curl -H "Content-Type: application/json" -X POST -d '{"eventFields":["pulseId","value"],"range":{"startPulseId":0,"endPulseId":3},"channels":["Channel_01","Channel_02"],"mapping":{"incomplete":"provide-as-is"}}' https://data-api.psi.ch/sf/query | python -m json.tool
```
##### Response
@ -1432,7 +1443,7 @@ A request is performed by sending a valid JSON object in the HTTP request body.
"endPulseId":3
},
"ordering":"asc",
"fields":[
"configFields":[
"pulseId",
"globalDate",
"type"