Ejemplo n.º 1
0
def generate_graph_data_for_day(coll_name, day, next_day_start, writer):
    coll = topics_db[coll_name]
    lower = get_datetime_from_string(day, DAY_START)
    upper = lower + APPROXIMATION_RANGE
    while upper <= next_day_start:
        tweet_count = coll.find({TIMESTAMP: {GREATER_THAN_OR_EQUAL: lower, LESS_THAN: upper}}).count()
        make_entry(writer, lower, tweet_count * 100)
        lower += APPROXIMATION_RANGE
        upper += APPROXIMATION_RANGE
Ejemplo n.º 2
0
def generate_graph_data(tid):
    writer = init_writer(tid)
    day = START_DATE
    day = localize_datetime(day)
    coll_name = TOPIC_COLLECTION_NAME(tid)
    next_day = get_next_day(day)
    next_day_start = get_datetime_from_string(next_day, DAY_START)
    generate_graph_data_for_day(coll_name, day, next_day_start, writer)

    close_writer(writer)
Ejemplo n.º 3
0
def generate_graph_data(tid):
    writer = init_writer(tid)
    day = START_DATE
    day = localize_datetime(day)
    coll_name = TOPIC_COLLECTION_NAME(tid)
    next_day = get_next_day(day)
    next_day_start = get_datetime_from_string(next_day, DAY_START)
    generate_graph_data_for_day(coll_name, day, next_day_start, writer)

    close_writer(writer)
Ejemplo n.º 4
0
def generate_graph_data_for_day(coll_name, day, next_day_start, writer):
    coll = topics_db[coll_name]
    lower = get_datetime_from_string(day, DAY_START)
    upper = lower + APPROXIMATION_RANGE
    while upper <= next_day_start:
        tweet_count = coll.find({
            TIMESTAMP: {
                GREATER_THAN_OR_EQUAL: lower,
                LESS_THAN: upper
            }
        }).count()
        make_entry(writer, lower, tweet_count * 100)
        lower += APPROXIMATION_RANGE
        upper += APPROXIMATION_RANGE