Get Demand Surges
Identify dates with surges in demand caused by multiple events happening at the same time and location.
The Demand Surge API can be used to quickly scan a period of 90 days for abnormal increases in attendance for a given area. The API calculates the mean attendance for your requested location across 90 days, then returns all the dates where attendance is a certain number of standard deviations over the mean. This is represented by the
min_surge_intensity
parameter, which corresponds to the number of standard deviations the API will look for.GET https://api.predicthq.com/v1/demand-surge/
Parameter | Description |
---|---|
date_from
date | The start date of the demand surge search window.
The accepted format for this parameter is YYYY-MM-DD
E.g. ?date_from=2021-05-12 |
date_to
date | The end date of the demand surge search window.
The accepted format for this parameter is YYYY-MM-DD
E.g. ?date_to=2021-08-10 |
min_surge_intensity
string | Filters out demand surges smaller than the minimum surge intensity provided.
Possible values:
E.g. ?min_surge_intensity=m |
location.*
string | Filters out demand surges not included in the location specified. Supports place_id , origin and radius suffixes.
|
Field | Description |
---|---|
count
number | The number of identified demand surges given the search criteria. |
surge_dates
array | An array of identified demand surges. |
date
date | The date of the identified demand surge. |
phq_attendance_sum
number | The sum of all attendance based features in the identified demand surge. |
curl
python
curl -X GET https://api.predicthq.com/v1/demand-surge/?date_from=2021-05-12&date_to=2021-08-10&min_surge_intensity=m&location.place_id=2643743 \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
import requests
response = requests.get(
url="https://api.predicthq.com/v1/demand-surge/",
headers={
"Authorization": "Bearer $ACCESS_TOKEN",
"Accept": "application/json"
},
params={
"date_from": "2021-05-12",
"date_to": "2021-08-10",
"min_surge_intensity": "m",
"location.place_id": "2643743"
}
)
print(response.json())
Last modified 2mo ago