Added all providers for plot_tool in moduleStats + fixed date range bug

This commit is contained in:
Mokaddem 2016-08-16 11:07:36 +02:00
parent 8fa3c2b147
commit cdd08d7df0
3 changed files with 7 additions and 5 deletions

View file

@ -72,6 +72,7 @@ def compute_most_posted(server, message):
def compute_provider_info(server, path):
redis_all_provider = 'all_provider_set'
redis_avg_size_name_set = 'top_size_set'
redis_providers_name_set = 'providers_set'
@ -83,6 +84,7 @@ def compute_provider_info(server, path):
new_avg = paste_size
# Add/Update in Redis
server.sadd(redis_all_provider, paste_provider)
prev_num_paste = server.hget(paste_provider+'_num', paste_date)
if prev_num_paste is not None:
ok = server.hset(paste_provider+'_num', paste_date, int(prev_num_paste)+1)

View file

@ -480,7 +480,7 @@ def sentiment_analysis_plot_tool_getdata():
if getProviders == 'True':
providers = []
for cur_provider in r_serv_charts.smembers('providers_set'):
for cur_provider in r_serv_charts.smembers('all_provider_set'):
providers.append(cur_provider)
return jsonify(providers)
@ -488,8 +488,6 @@ def sentiment_analysis_plot_tool_getdata():
query = request.args.get('query')
query = query.split(',')
Qdate = request.args.get('Qdate')
print query
print Qdate
date1 = (Qdate.split('-')[0]).split('.')
date1 = datetime.date(int(date1[2]), int(date1[1]), int(date1[0]))
@ -499,14 +497,15 @@ def sentiment_analysis_plot_tool_getdata():
timestamp1 = calendar.timegm(date1.timetuple())
timestamp2 = calendar.timegm(date2.timetuple())
print timestamp2
oneHour = 60*60
print timestamp1, timestamp2
oneDay = oneHour*24
to_return = {}
for cur_provider in query:
list_date = {}
cur_provider_name = cur_provider + '_'
for cur_timestamp in range(int(timestamp1), int(timestamp2), oneHour):
for cur_timestamp in range(int(timestamp1), int(timestamp2)+oneDay, oneHour):
cur_set_name = cur_provider_name + str(cur_timestamp)
list_value = []

View file

@ -65,6 +65,7 @@ function plotData(){
// retreive the data from the server
$.getJSON('/sentiment_analysis_plot_tool_getdata/?getProviders=False&query='+query+'&Qdate='+Qdate, function(data){
console.log(data);
var to_plot = [];
for (provider in data){
var nltk_data = Object.keys(data[provider]).map(function (key) { return data[provider][key]; });