Links

Create an Analysis

Creating an Analysis is the first step in understand which types of events impact your demand.

Request

HTTP Request

POST https://api.predicthq.com/v1/beam/analyses

Request Headers

Header
Value
Content-Type
application/json

Request Body

Field
Description
name string required
Name of an analysis. E.g. My Location Analysis 1
location.* object required
This should be the location of your data. We will use this location for our time series modelling and to correlate with events in the specified area.
{
"geopoint": {
"lat": "-36.849761",
"lon": "174.7628903"
},
"radius": 1.2,
"unit": "km"
}
We recommend using the Suggested Radius API to find a suitable radius for your location/industry. Possible radius units: mi - Miles m - Meters km - Kilometers
rank.* object required
Specifies which rank type to use when calculating event impacts and anomaly detection. If you're unsure which to use we recommend using phq.
{
"type": "phq"
}
Possible rank type values: phq - PHQ Rank aviation - Aviation Rank Optionally, specify the minimum rank level to use when calculating event impacts.
E.g.
{
"type": "phq",
"levels": {
"phq": {
"min": 51
}
}
}
tz string optional
Time zone of the location in TZ Database format. E.g. Pacific/Auckland

Response

Example response
Below is an example response:
{
"analysis_id": "2iJcUzm3-ZE"
}

Examples

curl
python
curl -X POST https://api.predicthq.com/v1/beam/analyses \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @<(cat <<EOF
{
"name": "Analysis 1",
"location": {
"geopoint": {
"lat": "-36.849761",
"lon": "174.7628903"
},
"radius": 1.2,
"unit": "km"
},
"rank": {
"type": "phq"
},
"tz": "UTC"
}
EOF
)
import requests
response = requests.post(
url="https://api.predicthq.com/v1/beam/analyses",
headers={
"Authorization": "Bearer $ACCESS_TOKEN",
"Accept": "application/json"
},
json={
"name": "Analysis 1",
"location": {
"geopoint": {
"lat": "-36.849761",
"lon": "174.7628903"
},
"radius": 1.2,
"unit": "km"
},
"rank": {
"type": "phq"
},
"tz": "UTC"
}
)
print(response.json())

Guides

Below are some guides relevant to this API: