def page_requests(): dygraph_fn='rc_page_requests' startindex=9 endindex=-1 n_items=8 data = p.parse_PageViews(metric="Page view totals non-mobile + mobile",next_metric="=== Page view totals non-mobile ===",startindex=startindex,endindex=endindex) # hack hack, all projects is in different section hackdata = p.parse_PageViews(metric='=== Page view totals per project - non-mobile + mobile ===',next_metric='Whatever....',startindex=startindex,endindex=endindex) # construct a copy and rearrange the needed data copy_data = OrderedDict() copy_data['project'] = data['project'] # add 'All projects' or 'Total' depending on what the input file wants if 'All projects' in hackdata: copy_data['Total'] = hackdata['All projects'] else: copy_data['Total'] = hackdata['Total'] copy_data['All projects'] = copy_data['Total'] n_collected = 1 for k,v in data.items()[1:]: if k != 'All projects': copy_data[k] = v n_collected += 1 if n_collected==n_items: break p.write_dygraph_file(copy_data,dygraph_fn)
def very_active_editors_absolute_per_project(): dygraph_fn = 'rc_very_active_editors_count_project' metric = 'Very active editors - Absolute - Per Project' next_metric = 'Very active editors - Indexed - Per Wiki' n_lines = 12 # wikivoyage is 10 data = p.parse_StatisticsMonthly(metric,next_metric,n_lines) p.write_dygraph_file(data,dygraph_fn)
def mobile_page_requests(): dygraph_fn='rc_page_requests_mobile' metric="=== Page view totals mobile ===" next_metric="=== Page view totals per project - non-mobile + mobile ===" startindex=47 endindex=-1 key_index=23 n_lines=8 data = p.parse_PageViews(metric,next_metric,startindex=startindex,endindex=endindex,key_index=key_index,n_lines=n_lines) # Gett the mobile total metric="=== Page view totals per project - mobile ===" next_metric="end of file" startindex=32 endindex=-1 key_index=8 n_lines=3 totaldata = p.parse_PageViews(metric,next_metric,startindex=startindex,endindex=endindex,key_index=key_index,n_lines=n_lines) copydata = OrderedDict() copydata['project'] = data['project'] #copydata['All projects'] = totaldata['All projects'] copydata['Total'] = totaldata['Total'] for k in data.keys()[1:]: copydata[k] = data[k] p.write_dygraph_file(copydata,dygraph_fn)
def new_editors_count(): dygraph_fn='rc_new_editors_count' metric="New editors - Absolute - Per Wiki" next_metric="New editors - Absolute - Per Project" n_lines = 10 data = p.parse_StatisticsMonthly(metric,next_metric,n_lines=n_lines) # write dygraph file p.write_dygraph_file(data,dygraph_fn)
def edit_counts(): dygraph_fn='rc_edits_count' metric="Edits per month - Absolute - Per Wiki" next_metric="Edits per month - Absolute - Per Project" n_lines = 25 data = p.parse_StatisticsMonthly(metric,next_metric,n_lines=n_lines) # write dygraph file p.write_dygraph_file(data,dygraph_fn)
def new_article_count(): dygraph_fn='rc_new_article_count' metric="New articles per day - Absolute - Per Wiki" next_metric="New articles per day - Absolute - Per Project" n_lines = 25 data = p.parse_StatisticsMonthly(metric,next_metric,n_lines=n_lines) # write dygraph file p.write_dygraph_file(data,dygraph_fn)
def article_count(): dygraph_fn='rc_article_count' metric="Article count (official) - Absolute - Per Wiki" next_metric="Article count (official) - Absolute - Per Project" n_lines = 9 data = p.parse_StatisticsMonthly(metric,next_metric,n_lines=n_lines) # write dygraph file p.write_dygraph_file(data,dygraph_fn)
def binary_files(): dygraph_fn='rc_binary_files' metric="Binaries per month - Absolute" next_metric="Binaries per month - Indexed" n_lines = 20 data = p.parse_StatisticsMonthly(metric,next_metric) # write dygraph file p.write_dygraph_file(data,dygraph_fn)
def very_active_editors(): dygraph_fn='rc_very_active_editors_count' metric="Very active editors - Absolute - Per Wiki" next_metric="Very active editors - Absolute - Per Project" # n_lines = 10 # only old report card entries n_lines = 25 # all countries so graph can be edited using the dataset-ui data = p.parse_StatisticsMonthly(metric,next_metric,n_lines=n_lines) # Update 05/01/12: not necessary anymore # hack hack, the total editors in that section is incorrect as of now as it should inlcude 'commons'. # hackdata = p.parse_StatisticsMonthly(metric='Very active editors - Absolute - Per Project',next_metric='Whatever....we only want 3 lines',n_lines=3) # replace 'All projects' # data['Total'] = hackdata['All projects'] # write dygraph file p.write_dygraph_file(data,dygraph_fn)