forked from gargium/ATT-Big-Data-Challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
45 lines (37 loc) · 1.28 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from flask import Flask, render_template, json
from bigData import bayArea
from algorithm import algorithm
app = Flask(__name__)
bayArea = bayArea()
algorithm = algorithm()
SFBSIs = algorithm.BSI("SF")
SCBSIs = algorithm.BSI("SC")
SRBSIs = algorithm.BSI("SR")
@app.route("/")
def index():
return render_template('index.html')
@app.route("/chart")
def chart():
countyToTractMap = {}
countyToTractMap["SR"] = bayArea.get_tracts("SR")
countyToTractMap["SF"] = bayArea.get_tracts("SF")
countyToTractMap["SC"] = bayArea.get_tracts("SC")
return render_template('chart.html', bayArea=json.dumps(bayArea.get_bay_area()),
countyTractMap=json.dumps(countyToTractMap),
sfBSIs = json.dumps(SFBSIs),
scBSIs = json.dumps(SCBSIs),
srBSIs = json.dumps(SRBSIs))
@app.route("/map")
def map():
return render_template('map.html',
urlSF='static/Data/sanFrancisco/sanFrancisco2010.geojson',
urlSR='static/Data/sanRamon/sanRamon2010.geojson',
urlSC='static/Data/santaClara/santaClara2010.geojson',
sfBSIs = json.dumps(SFBSIs),
scBSIs = json.dumps(SCBSIs),
srBSIs = json.dumps(SRBSIs))
@app.route("/about/")
def about():
return render_template('about.html')
if __name__ == "__main__":
app.run(debug=True)