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 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)