2020-06-12 20:03:25 +02:00
|
|
|
from flask import render_template
|
|
|
|
|
|
|
|
from app import app
|
2020-06-12 22:49:49 +02:00
|
|
|
from app.forms import DatasetForm
|
2020-06-13 20:57:21 +02:00
|
|
|
from app.processing import process_data
|
2020-06-14 21:47:31 +02:00
|
|
|
from app.data_request import scrape_flickr
|
2020-06-12 20:03:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
@app.route("/")
|
|
|
|
@app.route("/index")
|
|
|
|
def index():
|
|
|
|
return render_template("index.html", title="Home Page")
|
|
|
|
|
|
|
|
|
2020-06-14 00:58:52 +02:00
|
|
|
@app.route("/data", methods=["GET", "POST"])
|
2020-06-12 20:03:25 +02:00
|
|
|
def data():
|
2020-06-12 22:49:49 +02:00
|
|
|
form = DatasetForm()
|
|
|
|
if form.validate_on_submit():
|
2020-06-14 00:58:52 +02:00
|
|
|
table = process_data(form.dataset.data)
|
|
|
|
return render_template("visualization.html", title="Visualization", table=table)
|
2020-06-12 22:49:49 +02:00
|
|
|
return render_template("data.html", title="Data", form=form)
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/visualization")
|
2020-06-14 00:58:52 +02:00
|
|
|
def visualization():
|
|
|
|
return render_template("visualization.html", title="Visualization", table=table)
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/map")
|
|
|
|
def map():
|
|
|
|
return render_template("map.html", title="Map")
|
2020-06-14 21:47:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
@app.route("/photos")
|
|
|
|
def photos():
|
2020-06-15 01:19:13 +02:00
|
|
|
images = scrape_flickr("paris coronavirus")
|
2020-06-14 21:47:31 +02:00
|
|
|
return render_template("photos.html", title="Photos", images=images)
|