Trend Detections
Trend Detection is configured on projects to look for anomalies in time series data. For an introduction and tutorial on this feature, read the Trend Detection chapter.
Methods
List Trend Detection Entities
GET https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/trenddetections
Returns an array of all trend detection entities in a project.
Parameters: |
|
---|---|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | List of configured trend detection entities. { "trend_detection_entities": [ { "aggregation_time_field": "$item_created_at", "aggregation_field": "Price", "name": "EU Egg Price Trend", "created_at": "2016-06-07T10:52:05", "modified_at": "2016-06-07T10:52:07", "trends_healthy": True, "aggregation_interval": "1w", "aggregation_method": "avg", "query": "Type:\"Egg Price\" \"Country\":EU", "project_id": "j0mN4DgQTGWDSBP3QcqDwg", "id": "em_I-hJMRzi-OjvObOqU6A" } ] }
|
Create Trend Detection Entity
POST
https://squirro-endpoint/api/topic
/v0/(string: tenant)/projects/(id: project_id)/trenddetections
Parameters: |
|
---|---|
JSON Data: | Data is passed in as a JSON object. Valid object keys:
|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | Created trend detection. { "trend_detection_entity": { "aggregation_time_field": "$item_created_at", "aggregation_field": "Price", "name": "EU Egg Price Trend", "created_at": "2016-06-15T11:15:46", "modified_at": "2016-06-15T11:15:46", "trends_healthy": True, "aggregation_interval": "1d", "aggregation_method": "avg", "query": "Type:\"Egg Price\" \"Country\":EU", "project_id": "V73xio3rR6-8lPwBOG_EVA", "id": "hI9E58PvT_mTPtpC6_rQkQ" } }
|
Get Trend Detection Entity
GET
v0/(string: tenant)/projects/(id: project_id)/trenddetections/(id: tde_id)https://squirro-endpoint/api/topic
/
Parameters: |
|
---|---|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | Requested Trend Detection Entity. { "trend_detection_entity": { "aggregation_time_field": "$item_created_at", "aggregation_field": "Price", "name": "EU Egg Price Trend", "created_at": "2016-06-15T11:15:46", "modified_at": "2016-06-15T11:15:46", "trends_healthy": True, "aggregation_interval": "1d", "aggregation_method": "avg", "query": "Type:\"Egg Price\" \"Country\":EU", "project_id": "V73xio3rR6-8lPwBOG_EVA", "id": "hI9E58PvT_mTPtpC6_rQkQ" } }
|
Delete Trend Detection Entity
DELETE https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/
trenddetections
/(id: tde_id)
Parameters: |
|
---|---|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Method deprecations
Methods below will be deprecated soon. Please use the boolean flags with `Get Trend Detection Entity` end point to get the thresholds, labels and predictions.
Get Thresholds
GET https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/trenddetections/{id: tde_id}/thresholds
Returns a list of the calculated thresholds for dates in the trend detection time range. Based on these thresholds the anomalies are flagged - every time the data surpasses the threshold, it's an anomaly.
In the trend detection widget on the dashboard, the thresholds are visualized with the grey background area.
Parameters: |
|
---|---|
Query Parameters: | Parameters are optional.
|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | List of Thresholds. { "thresholds": [ { "count": 127.8694520548, "timestamp": "2015-01-05T00:00:00" }, { "count": 126.9704256148, "timestamp": "2015-01-12T00:00:00" }, { "count": 126.2358246885, "timestamp": "2015-01-19T00:00:00" }, { "count": 125.6758949924, "timestamp": "2015-01-26T00:00:00" } ] } |
Get Labels
GET https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/trenddetections/{id: tde_id}/labels
Returns the detected labels (anomalies) in the data.
Parameters: |
|
---|---|
Query Parameters: | Parameters are optional.
|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | List of Labels. { "labels": [ "2015-04-06T00:00:00" ] } This output signifies that the data contains one anomaly in the data, namely in the aggregation interval that starts on 2015-04-06 midnight. |
Get Predictions
GET https://squirro-endpoint/api/topic/v0/(string: tenant)/projects/(id: project_id)/trenddetections/{id: tde_id}/predictions
Returns the future predicted thresholds for the given Trend Detection Entity. This returns predictions for the same time range on which data has been processed already.
Parameters: |
|
---|---|
Headers: | See Common Headers. |
Status Codes: |
See also Common Status Codes. |
Returns: | List of Predictions. The example output below has been cut. { "predictions": [ { "timestamp": "2016-02-22T00:00:00", "prediction_value": 8.3393183124, "prediction_threshold": 11.1056841591 }, { "timestamp": "2016-02-29T00:00:00", "prediction_value": 11.9445990546, "prediction_threshold": 12.7986151892 } ] } This output shows two time buckets (weekly interval) with a predicted value and the anomaly threshold for each of those buckets. |