Merge in dev to Master #1
@ -7,3 +7,4 @@ Flask-WTF
|
|||||||
bootstrap-flask
|
bootstrap-flask
|
||||||
waitress
|
waitress
|
||||||
bokeh
|
bokeh
|
||||||
|
pandas
|
||||||
|
@ -62,7 +62,7 @@ def index():
|
|||||||
def updater():
|
def updater():
|
||||||
if 'logged_in' not in session:
|
if 'logged_in' not in session:
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
create_graphs()
|
#create_graphs()
|
||||||
query_db = beer_database_query.pool_query()
|
query_db = beer_database_query.pool_query()
|
||||||
query = query_db.get_top(10, "sg")
|
query = query_db.get_top(10, "sg")
|
||||||
form = dataForm()
|
form = dataForm()
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Bokeh Plot</title>
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flow-root;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-3.5.0.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
Bokeh.set_log_level("info");
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="bb5c0e1d-dc95-4d96-9cbc-a29ed2eade5c" data-root-id="p1001" style="display: contents;"></div>
|
|
||||||
|
|
||||||
<script type="application/json" id="af8187ed-c6d3-40c3-84a3-bbe58799b466">
|
|
||||||
{"00bec54e-f52e-4b7f-b2b6-8e6e4eb73c82":{"version":"3.5.0","title":"Bokeh Application","roots":[{"type":"object","name":"Figure","id":"p1001","attributes":{"height":250,"x_range":{"type":"object","name":"FactorRange","id":"p1011","attributes":{"factors":["2024-03-27","2024-03-25","2024-03-15","2024-03-13"]}},"y_range":{"type":"object","name":"DataRange1d","id":"p1003","attributes":{"start":6}},"x_scale":{"type":"object","name":"CategoricalScale","id":"p1012"},"y_scale":{"type":"object","name":"LinearScale","id":"p1013"},"title":{"type":"object","name":"Title","id":"p1004","attributes":{"text":"Pool data"}},"renderers":[{"type":"object","name":"GlyphRenderer","id":"p1030","attributes":{"data_source":{"type":"object","name":"ColumnDataSource","id":"p1024","attributes":{"selected":{"type":"object","name":"Selection","id":"p1025","attributes":{"indices":[],"line_indices":[]}},"selection_policy":{"type":"object","name":"UnionRenderers","id":"p1026"},"data":{"type":"map","entries":[["x",["2024-03-27","2024-03-25","2024-03-15","2024-03-13"]],["y",[7.25,7.5,7.6,7.0]]]}}},"view":{"type":"object","name":"CDSView","id":"p1031","attributes":{"filter":{"type":"object","name":"AllIndices","id":"p1032"}}},"glyph":{"type":"object","name":"Line","id":"p1027","attributes":{"x":{"type":"field","field":"x"},"y":{"type":"field","field":"y"},"line_color":"#1f77b4"}},"nonselection_glyph":{"type":"object","name":"Line","id":"p1028","attributes":{"x":{"type":"field","field":"x"},"y":{"type":"field","field":"y"},"line_color":"#1f77b4","line_alpha":0.1}},"muted_glyph":{"type":"object","name":"Line","id":"p1029","attributes":{"x":{"type":"field","field":"x"},"y":{"type":"field","field":"y"},"line_color":"#1f77b4","line_alpha":0.2}}}}],"toolbar":{"type":"object","name":"Toolbar","id":"p1010"},"toolbar_location":null,"left":[{"type":"object","name":"LinearAxis","id":"p1019","attributes":{"ticker":{"type":"object","name":"BasicTicker","id":"p1020","attributes":{"mantissas":[1,2,5]}},"formatter":{"type":"object","name":"BasicTickFormatter","id":"p1021"},"major_label_policy":{"type":"object","name":"AllLabels","id":"p1022"}}}],"below":[{"type":"object","name":"CategoricalAxis","id":"p1014","attributes":{"ticker":{"type":"object","name":"CategoricalTicker","id":"p1015"},"formatter":{"type":"object","name":"CategoricalTickFormatter","id":"p1016"},"major_label_policy":{"type":"object","name":"AllLabels","id":"p1017"}}}],"center":[{"type":"object","name":"Grid","id":"p1018","attributes":{"axis":{"id":"p1014"},"grid_line_color":null}},{"type":"object","name":"Grid","id":"p1023","attributes":{"dimension":1,"axis":{"id":"p1019"}}}]}}]}}
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function() {
|
|
||||||
const fn = function() {
|
|
||||||
Bokeh.safely(function() {
|
|
||||||
(function(root) {
|
|
||||||
function embed_document(root) {
|
|
||||||
const docs_json = document.getElementById('af8187ed-c6d3-40c3-84a3-bbe58799b466').textContent;
|
|
||||||
const render_items = [{"docid":"00bec54e-f52e-4b7f-b2b6-8e6e4eb73c82","roots":{"p1001":"bb5c0e1d-dc95-4d96-9cbc-a29ed2eade5c"},"root_ids":["p1001"]}];
|
|
||||||
root.Bokeh.embed.embed_items(docs_json, render_items);
|
|
||||||
}
|
|
||||||
if (root.Bokeh !== undefined) {
|
|
||||||
embed_document(root);
|
|
||||||
} else {
|
|
||||||
let attempts = 0;
|
|
||||||
const timer = setInterval(function(root) {
|
|
||||||
if (root.Bokeh !== undefined) {
|
|
||||||
clearInterval(timer);
|
|
||||||
embed_document(root);
|
|
||||||
} else {
|
|
||||||
attempts++;
|
|
||||||
if (attempts > 100) {
|
|
||||||
clearInterval(timer);
|
|
||||||
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 10, root)
|
|
||||||
}
|
|
||||||
})(window);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
if (document.readyState != "loading") fn();
|
|
||||||
else document.addEventListener("DOMContentLoaded", fn);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||||||
from bokeh.models.layouts import HBox
|
|
||||||
from bokeh.plotting import column
|
|
||||||
from charts import PoolCharts
|
|
||||||
from bokeh.io import output_file, show
|
|
||||||
from bokeh.layouts import row
|
|
||||||
|
|
||||||
output_file("static/data_plot.html")
|
|
||||||
|
|
||||||
chart = PoolCharts.PoolCharts()
|
|
||||||
|
|
||||||
ph = chart.line_chart("Pool PH", "ph", 50)
|
|
||||||
|
|
||||||
total_chlorine = chart.line_chart("Pool Total Chlorine", "total_chlorine", 50)
|
|
||||||
|
|
||||||
free_chlorine = chart.line_chart("Pool Free Chlorine", "free_chlorine", 50)
|
|
||||||
|
|
||||||
show(column(ph, total_chlorine, free_chlorine))
|
|
0
src/flask/table/__init__.py
Normal file
0
src/flask/table/__init__.py
Normal file
29
src/flask/table/table_builder.py
Normal file
29
src/flask/table/table_builder.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
from mongo.get_conn import db_conn
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
class TableBuilder():
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.db = db_conn()
|
||||||
|
|
||||||
|
def table_build(self, field, read_count=3, runs=5) -> pd.DataFrame:
|
||||||
|
data = self.db.beer_db
|
||||||
|
data = data.find({}).sort("date", -1)
|
||||||
|
df_dict = {}
|
||||||
|
df_dict["beer_run_id"]=[]
|
||||||
|
df_dict["sg"] = []
|
||||||
|
df_dict["date"] = []
|
||||||
|
df_dict["final_reading"] = []
|
||||||
|
|
||||||
|
for record in data:
|
||||||
|
df_dict["beer_run_id"].append(record["beer_run_id"])
|
||||||
|
df_dict["sg"].append(record["sg"])
|
||||||
|
df_dict["date"].append(record["date"])
|
||||||
|
df_dict["final_reading"].append(record["final_reading"])
|
||||||
|
|
||||||
|
df = pd.DataFrame(data=df_dict)
|
||||||
|
df_sum = df.groupby('beer_run_id').agg({'sg': ['max', 'min']})
|
||||||
|
return df_sum
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class= "col-xs-12 col-sm-12 col-md-12">
|
<div class= "col-xs-12 col-sm-12 col-md-12">
|
||||||
<iframe style="width: 100vw; height: 40vh;" src="static/data_plot.html" frameborder="0" allowfullscreen>
|
<!--<iframe style="width: 100vw; height: 40vh;" src="static/data_plot.html" frameborder="0" allowfullscreen>
|
||||||
<!--<iframe style="width: 100vw;height: 80vh;position: relative;" src="static/data_plot.html" frameborder="0" allowfullscreen>-->
|
<!--<iframe style="width: 100vw;height: 80vh;position: relative;" src="static/data_plot.html" frameborder="0" allowfullscreen>-->
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
|
5
src/flask/test.py
Normal file
5
src/flask/test.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import table.table_builder as table_builder
|
||||||
|
|
||||||
|
test = table_builder.TableBuilder()
|
||||||
|
|
||||||
|
print(test.table_build("sg"))
|
Loading…
x
Reference in New Issue
Block a user