Skip to content
Gregor Leban edited this page Mar 15, 2017 · 5 revisions

Different things and topics are popular on different days. Today it can be refugees, tomorrow Malaysian Airlines. Event Registry can provide you with an up to date list of concepts and categories that are currently trending the most.

The trends in Event Registry are computed by comparing how much is a particular thing appearing in the articles in the last two days compared to the last two weeks.

Trending concepts

In order to get a list of concepts that are currently trending the most, you can simply use the GetTrendingConcepts() class. Here is an example use of this class:

from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)
q = GetTrendingConcepts(source = "news", count = 10,
    returnInfo = ReturnInfo(
        conceptInfo = ConceptInfoFlags(trendingHistory = True)))
ret = er.execQuery(q)

The resulting list in ret contains concept information of this form:

{
        "id": "270226",
        "uri": "http://en.wikipedia.org/wiki/Beau_Biden",
        "type": "person",
        "label": {
            "eng": "Beau Biden"
        },
        "trendingScore": {
            "news": {
                "nullPopFq": 31,
                "score": 209.213658995857,
                "testPopFq": 244
            }
        },
        "trendingHistory": {
            "latestArticleTimestamp": "2015-06-01 17:02:00",
            "news": [
                0, 1, 0, 0, 3, 21, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 9, 12, 1, 0, 4, 0, 2, 1, 1, 0, 0, 1, 220, 26
            ]
        }
    },

Beside the id, uri, type, label, the object also includes the trendingScore information as well as the trendingHistory with counts for the concept in the last 30 days.

The parameters that you can specify when constructing the GetTrendingConcepts() class are the following:

  • source: source information from which to compute top trends. Options: news, social
  • count: number of top trends to return
  • returnInfo: details about the concepts to return

Trending categories

As for trending concepts, we can also compute the currently top trending categories. The class to use in this case is GetTrendingCategories() and it can be used as follows:

from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)
q = GetTrendingCategories(source = "news", count = 10)
ret = er.execQuery(q)