binaychandra commited on
Commit
f22bc91
·
1 Parent(s): e8d6aa5
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -208,8 +208,8 @@ def get_bot_valresponse():
208
  output_gendata = json.dumps(llm_response_dict)
209
  return output_gendata
210
 
211
- @app.route("/data.html", methods=['GET', 'POST'])
212
- @app.route("/data", methods=['GET', 'POST'])
213
  def data():
214
  tbl_htmls = {}
215
  firsttable = ""
@@ -243,7 +243,26 @@ def hometest():
243
  session['end_date'] = request.form.get('calendar_value').split(":")[1]
244
  session['sl_subsl'] = request.form.get('sl_subsl')
245
  session['tbl_selected'] = request.form.get('tbl_selected')
246
- return redirect(url_for('data'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  # if __name__ == '__main__':
249
  # app.run(debug=True)
 
208
  output_gendata = json.dumps(llm_response_dict)
209
  return output_gendata
210
 
211
+ @app.route("/data.html", methods=['POST'])
212
+ @app.route("/data", methods=['POST'])
213
  def data():
214
  tbl_htmls = {}
215
  firsttable = ""
 
243
  session['end_date'] = request.form.get('calendar_value').split(":")[1]
244
  session['sl_subsl'] = request.form.get('sl_subsl')
245
  session['tbl_selected'] = request.form.get('tbl_selected')
246
+ # return redirect(url_for('data'))
247
+ tbl_htmls = {}
248
+ slsslinfo = request.form.get('sl_subsl')
249
+ tbl_selected = request.form.get('tbl_selected')
250
+ print("-------------------------Hello world------------------------")
251
+ print(tbl_selected)
252
+ for tblname in tbl_selected:
253
+ # Read sqlite query results into a pandas DataFrame
254
+ # con = sqlite3.connect("database.db")
255
+ # df = pd.read_sql_query(f"SELECT * from {tblname}", con)
256
+ filepath = f".referencefiles/{tblname}.csv"
257
+ df = pd.read_csv(filepath)
258
+ top_records = df.copy()
259
+ # con.close()
260
+ html_top_records = top_records.to_html(index=False, table_id= f'dtable_{tblname}', classes='display nowrap table table-bordered table-striped table-condensed small p-1', justify='left')
261
+ html_top_records = html_top_records.replace('<thead>', '<thead class="thead-light" style="top: 0;position: sticky;">')
262
+ tbl_htmls[tblname] = html_top_records
263
+
264
+ return render_template('data.html', table_htmls = tbl_htmls, tempdisplay = slsslinfo, req_tables = json.dumps(tbl_selected[0]))
265
+
266
 
267
  # if __name__ == '__main__':
268
  # app.run(debug=True)