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

HeaderValue

Content-Type

application/json

Request Body

FieldDescription

name string required

Name of an analysis. E.g. My Location Analysis 1

location.* object required

Contains geopoint, radius and unit to represent the location of your data to create the analysis.

  • geopoint contains lat and lon which are coordinates for your analysis, e.g. if you are creating an analysis for a store in Seattle you'd specify the latitude and longitude of your store.

  • radius must be an integer or a float number up to 2 decimal places. It represents the radius of the event search around your geopoint to use for time series modelling and correlation. We strongly recommend using the Suggested Radius API to find a suitable radius for your location/industry.

  • unit is the unit for radius and must be one of:

    • m - meters

    • km - kilometers

    • ft - feet

    • mi - miles

E.g.

{
  "geopoint": {
    "lat": "-36.849761",
    "lon": "174.7628903"
  },
  "radius": 1.22,
  "unit": "km"
}

rank.* object required

Specifies which rank type to use when calculating event impacts and anomaly detection. Currently, only PHQ rank is supported (also known as "Rank") so this value should be set to "phq" as shown below.

{
  "type": "phq"
}

Possible rank type values: phq - PHQ 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

Note: this field is being used in the Control Center Beam UI for the purpose of fetching a list of relevant events in the correct time zone. It no longer has bearing on the outcome of a Beam analysis.

Response

Example response

Below is an example response:

{
  "analysis_id": "2iJcUzm3-ZE"
}

Examples

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"
        }
    }
    EOF
    )

Guides

Below are some guides relevant to this API:

Last updated

© 2024 PredictHQ Ltd