Example #1
0
def index():
	#get bike counts
	current_time, df_sc = ap.get_bikes()

	time_dict = {'hour': current_time.hour, 'minute': current_time.strftime('%M'), 'second': current_time.strftime('%S')}
	# get data to pass to view

	df_t = df.merge(df_sc, on = 'terminal', how= 'inner' )
	df_t['fill'] = df_t['bikes_avail']/df_t['dockcount']

	terminals =  df_t.to_dict('records')

	return render_template('index.html', terminals = terminals, time = time_dict)
Example #2
0
	df_t = df.merge(df_sc, on = 'terminal', how= 'inner' )
	df_t['fill'] = df_t['bikes_avail']/df_t['dockcount']

	terminals =  df_t.to_dict('records')

	return render_template('index.html', terminals = terminals, time = time_dict)


@app.route('/simulation/', methods=['POST'])
def simulation():
	data = json.loads(request.form.get("data"))
	
	hour=  int(data['hour'])

	return jsonify(response = (sim_data[:hour]))



if __name__ == '__main__':

	df = pd.read_csv('static/map/reduced_station_data.csv')
	rf_d = joblib.load('static/pickles/demand pickle/d.pkl') 
	rf_s = joblib.load('static/pickles/supply pickle/s.pkl') 

	current_time, df_sc = ap.get_bikes()
	df_t = df.merge(df_sc, on = 'terminal', how= 'inner' )
	
	job_function()

	app.run(host='0.0.0.0',debug=True)