diff options
| author | Priyansh <[email protected]> | 2021-12-09 01:40:53 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2021-12-09 01:40:53 -0500 |
| commit | 02fb6066c2b9e5e28224b8f3fc224982403e7f44 (patch) | |
| tree | cdb07cd6f6be91d1f3ff3be037938174d7be5fcf | |
| parent | 69b81f679d05d3dcffe99fb27612400d4d0b9d7f (diff) | |
| download | temp_pred_arima-02fb6066c2b9e5e28224b8f3fc224982403e7f44.tar.xz temp_pred_arima-02fb6066c2b9e5e28224b8f3fc224982403e7f44.zip | |
Code changes due to new project structure
| -rw-r--r-- | app.py | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -1,22 +1,16 @@ from flask import Flask, render_template from flask import request import pandas as pd -from sql_functions import run_sql_pandas, get_list_of_dict -from time_series_model import plot_data +import json app = Flask(__name__) -def get_cities_list(): - sql_statement = 'SELECT DISTINCT(City_Name) as City_Name, Lat, Long FROM City_table join Loc_Table on City_Table.City_Id = Loc_table.City_Id' - return run_sql_pandas(sql_statement) - @app.route("/") @app.route("/index") def index(): - cities_list = get_cities_list() - keys = ("city", "latitude", "longitude") - cities_list = get_list_of_dict(keys, cities_list) - return render_template("index.html", cities_list=cities_list) + with open("cities.json", "r") as cities_list: + data = json.load(cities_list) + return render_template("index.html", cities_list=data) @app.route("/receiveDates", methods=["POST"]) @@ -27,7 +21,6 @@ def receive_dates(): dates = [] for i in dates_unmf: dates.append(i.strftime('%Y-%m-%d')) - plot_data(dates) return 'OK' if __name__ == '__main__': |
