Increase Accuracy with Aggregate Event Impact

Once you’ve familiarized yourself with our data, you’ll likely find that focusing on individual spikes often leads to a data set too small to accurately correlate. By doing it at an aggregate level, a data science team will be looking at enough volume of spike days to prove correlations between demand and events.

Making Requests

Examples of these requests are included in raw HTTP, cURL, and the Python Requests library - use the links on the menu bar at the top right to switch between these options.

Aggregate Event Impact API Endpoint

Find events that cause high demand

In this example we will use PHQ Rank to find high demand days in the city of Chicago in February 2020.

To find high demand days for the city of Chicago, place.scope=4887398, during the month of February 2020, active.gte=2020-02-01&active.lte=2020-02-29, using PHQ Rank rank=rank.

  • GET /v1/events/impact/?place.scope=4887398&active.gte=2020-02-01&active.lte=2020-02-29&active.tz=America/Chicago&impact_rank=rank HTTP/1.1
    Authorization: Bearer $ACCESS_TOKEN
    
  • curl -X GET "https://api.predicthq.com/v1/events/impact/?place.scope=4887398&active.gte=2020-02-01&active.lte=2020-02-29&active.tz=America/Chicago&impact_rank=rank" \
         -H "Authorization: Bearer $ACCESS_TOKEN"
    
  • import requests
    
    response = requests.get(
        url="https://api.predicthq.com/v1/events/impact/",
        headers={
          "Authorization": "Bearer $ACCESS_TOKEN",
          "Accept": "application/json"
        },
        params={
            "place.scope": "4887398",
            "active.gte": "2020-02-01",
            "active.lte": "2020-02-29",
            "active.tz": "America/Chicago",
            "impact_rank": "rank"
        }
    )
    
    
    print(response.json())
    

A snippet of the full results are shown below:

"results": [
        {
            "date": "2020-02-01",
            "count": 128,
            "impact": 77531,
            "rank_levels": {
                "1": 51,
                "2": 34,
                "3": 37,
                "4": 6,
                "5": 0
            },
            "rank_levels_impact": {
                "1": 836,
                "2": 5853,
                "3": 37256,
                "4": 33586,
                "5": 0
            },
            "categories": {
                "community": 25,
                "concerts": 37,
                "conferences": 3,
            ...

To find the aggregated impact on airline demand, we can use the same search but specify Aviation Rank rank=aviation_rank.

  • GET /v1/events/impact/?place.scope=4887398&active.gte=2020-02-01&active.lte=2020-02-29&active.tz=America/Chicago&impact_rank=aviation_rank HTTP/1.1
    Authorization: Bearer $ACCESS_TOKEN
    
  • curl -X GET "https://api.predicthq.com/v1/events/impact/?place.scope=4887398&active.gte=2020-02-01&active.lte=2020-02-29&active.tz=America/Chicago&impact_rank=aviation_rank" \
         -H "Authorization: Bearer $ACCESS_TOKEN"
    
  • import requests
    
    response = requests.get(
        url="https://api.predicthq.com/v1/events/impact/",
        headers={
          "Authorization": "Bearer $ACCESS_TOKEN",
          "Accept": "application/json"
        },
        params={
            "place.scope": "4887398",
            "active.gte": "2020-02-01",
            "active.lte": "2020-02-29",
            "active.tz": "America/Chicago",
            "impact_rank": "aviation_rank"
        }
    )
    
    
    print(response.json())