in progress.

This commit is contained in:
Fabian Märki
2015-08-21 12:01:56 +02:00
parent eb1bdee425
commit ea18618596
6 changed files with 2261 additions and 12 deletions

353
Readme.md
View File

@ -36,7 +36,7 @@ POST http://<host>:<port>/channels
#### Data
```
```json
{"regex": "TRFCA|TRFCB", "dbMode": "databuffer"}
```
@ -92,7 +92,7 @@ curl -H "Content-Type: application/json" -X POST -d '{"channels":["channel1","ch
The response is in JSON.
```
```json
[
{
"channel":"channel1",
@ -151,9 +151,9 @@ The response is in JSON.
Following examples build on a waveform data (see below). They also work for scalars (consider it as a waveform of length = 1) and images (waveform of length = dimX * dimY).
![Visualized data](doc/images/Data_Visualization.png)
![Data Visualization](doc/images/Data_Visualization.png)
```
```json
[
{
"channel":"Channel_01",
@ -231,7 +231,7 @@ Following examples build on a waveform data (see below). They also work for scal
##### Query by Pulse-Id Range
```
```json
{
"startPulseId":0,
"endPulseId":3,
@ -255,7 +255,7 @@ See JSON representation of the data above.
##### Query by Time Range
```
```json
{
"startMillis":0,
"startNanos":0,
@ -281,7 +281,7 @@ See JSON representation of the data above.
##### Query by Date Range
```
```json
{
"startDate":"1970/01/01 01:00:00.000",
"startNanos":0,
@ -309,7 +309,7 @@ See JSON representation of the data above.
##### Querying Archiver Appliance
```
```json
{
"dbmode":"archiverappliance",
"startMillis":0,
@ -341,7 +341,7 @@ See JSON representation of the data above.
Allows for server side optimizations since not all data needs to be retrieved.
```
```json
{
"fields":["pulseId","value"]
"startPulseId":0,
@ -352,9 +352,6 @@ Allows for server side optimizations since not all data needs to be retrieved.
}
```
Archiver Appliance supports queries by *time range* and *date range* only (as it has no notion about pulse-id).
###### Command
```bash
@ -407,4 +404,336 @@ curl -H "Content-Type: application/json" -X POST -d '{"fields":["pulseId","value
]
}
]
```
##### Data Ordering
```json
{
"ordering":"desc",
"fields":["pulseId","value"]
"startPulseId":0,
"endPulseId":3,
"channels":[
"Channel_01"
]
}
```
Use **none** in case ordering does not matter (allows for server side optimizations).
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"ordering":"desc","fields":["pulseId","value"],"startPulseId":0,"endPulseId":3,"channels":["Channel_01"]}' http://sf-nube-14.psi.ch:8080/query
```
###### Response
```json
[
{
"channel":"Channel_01",
"data":[
{
"pulseId":3,
"value":[
4,
5,
6,
7
]
},
{
"pulseId":2,
"value":[
3,
4,
5,
6
]
},
{
"pulseId":1,
"value":[
2,
3,
4,
5
]
},
{
"pulseId":0,
"value":[
1,
2,
3,
4
]
}
]
}
]
```
##### Value Aggregation
```json
{
"aggregationType":"value",
"aggregations":["min","max","mean"],
"fields":["pulseId","value"]
"startPulseId":0,
"endPulseId":3,
"channels":[
"Channel_01"
]
}
```
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregationType":"value","aggregations":["min","max","mean"],"fields":["pulseId","value"],"startPulseId":0,"endPulseId":3,"channels":["Channel_01"]}' http://sf-nube-14.psi.ch:8080/query
```
###### Response
```json
[
{
"channel":"Channel_01",
"data":[
{
"pulseId":0,
"value":{
"min":1.0,
"max":4.0,
"mean":2.5
}
},
{
"pulseId":1,
"value":{
"min":2.0,
"max":5.0,
"mean":3.5
}
},
{
"pulseId":2,
"value":{
"min":3.0,
"max":6.0,
"mean":4.5
}
},
{
"pulseId":3,
"value":{
"min":4.0,
"max":7.0,
"mean":5.5
}
}
]
}
]
```
Array value [aggregations](https://github.psi.ch/projects/ST/repos/ch.psi.daq.query/browse/src/main/java/ch/psi/daq/query/model/Aggregation.java).
![Value Aggregation](doc/images/Value_Aggregation.png)
##### Value Aggregation with Binning
```json
{
"nrOfBins":2,
"aggregationType":"value",
"aggregations":["min","max","mean"],
"fields":["pulseId","value"]
"startPulseId":0,
"endPulseId":3,
"channels":[
"Channel_01"
]
}
```
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"nrOfBins":2,"aggregationType":"value","aggregations":["min","max","mean"],"fields":["pulseId","value"],"startPulseId":0,"endPulseId":3,"channels":["Channel_01"]}' http://sf-nube-14.psi.ch:8080/query
```
###### Response
```json
[
{
"channel":"Channel_01",
"data":[
{
"pulseId":0,
"value":{
"min":1.0,
"max":5.0,
"mean":3.0
}
},
{
"pulseId":2,
"value":{
"min":3.0,
"max":7.0,
"mean":5.0
}
}
]
}
]
```
Array value [aggregation](https://github.psi.ch/projects/ST/repos/ch.psi.daq.query/browse/src/main/java/ch/psi/daq/query/model/Aggregation.java) with additional binning.
![Value Aggregation with Binning](doc/images/Value_Binning.png)
##### Index Aggregation
```json
{
"nrOfBins":1,
"aggregationType":"index",
"aggregations":["min","max","mean","sum"],
"fields":["pulseId","value"]
"startPulseId":0,
"endPulseId":3,
"channels":[
"Channel_01"
]
}
```
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"nrOfBins":1,"aggregationType":"index","aggregations":["min","max","mean","sum"],"fields":["pulseId","value"],"startPulseId":0,"endPulseId":3,"channels":["Channel_01"]}' http://sf-nube-14.psi.ch:8080/query
```
###### Response
```json
[
{
"channel":"Channel_01",
"data":[
{
"pulseId":0,
"value":[
{
"min":1.0,
"max":4.0,
"mean":2.5,
"sum":10.0
},
{
"min":2.0,
"max":5.0,
"mean":3.5,
"sum":14.0
},
{
"min":3.0,
"max":6.0,
"mean":4.5,
"sum":18.0
},
{
"min":4.0,
"max":7.0,
"mean":5.5,
"sum":22.0
}
]
}
]
}
]
```
[Aggregation](https://github.psi.ch/projects/ST/repos/ch.psi.daq.query/browse/src/main/java/ch/psi/daq/query/model/Aggregation.java) of array indices with binning (several nrOfBins are also possible).
![Index Aggregation with Binning](doc/images/Index_Binning.png)
##### Extrema Search
```json
{
"aggregationType":"extrema",
"aggregations":["min","max","sum"],
"fields":["pulseId","value"]
"startPulseId":0,
"endPulseId":3,
"channels":[
"Channel_01"
]
}
```
###### Command
```bash
curl -H "Content-Type: application/json" -X POST -d '{"aggregationType":"extrema","aggregations":["min","max","sum"],"fields":["pulseId","value"],"startPulseId":0,"endPulseId":3,"channels":["Channel_01"]}' http://sf-nube-14.psi.ch:8080/query
```
###### Response
```json
[
{
"channel":"Channel_01",
"data":{
"minima":{
"min":{
"value":1.0,
"event":{
"pulseId":0,
"value":[1,2,3,4]
}
},
"sum":{
"value":10.0,
"event":{
"pulseId":0,
"value":[1,2,3,4]
}
}
},
"maxima":{
"max":{
"value":7.0,
"event":{
"pulseId":3,
"value":[4,5,6,7]
}
},
"sum":{
"value":22.0,
"event":{
"pulseId":3,
"value":[4,5,6,7]
}
}
}
}
}
]
```