Ejemplo n.º 1
0
def get_heatmap(keyword):
    hour = int(flask.request.args.get('hour'))
    past_day = datetime.datetime.now() - datetime.timedelta(hours=24 - hour * 4)
    end = past_day + datetime.timedelta(hours=4)
    # grab all the articles in the past 24 hours that have entities
    match = {'$match': {
    'timestamp': {'$gt': past_day, '$lt': end},
    'keywords': keyword}}
    return json.dumps(database.get_latest_entities(match))
Ejemplo n.º 2
0
def get_heatmap(keyword):
    hour = int(flask.request.args.get('hour'))
    past_day = datetime.datetime.now() - datetime.timedelta(hours=24 -
                                                            hour * 4)
    end = past_day + datetime.timedelta(hours=4)
    # grab all the articles in the past 24 hours that have entities
    match = {
        '$match': {
            'timestamp': {
                '$gt': past_day,
                '$lt': end
            },
            'keywords': keyword
        }
    }
    return json.dumps(database.get_latest_entities(match))
Ejemplo n.º 3
0
def get_entities():
    return json.dumps(database.get_latest_entities())
Ejemplo n.º 4
0
def get_entities():
    return json.dumps(database.get_latest_entities())