This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openpyxl as xl | |
from openpyxl.chart import LineChart, Reference | |
import win32com.client | |
import PIL | |
from PIL import ImageGrab, Image | |
import os | |
import sys | |
from docx.shared import Cm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
engine = create_engine("postgresql://<username>:<password>@localhost:5432/records_db") | |
engine_dataset = create_engine("postgresql://<username>:<password>@localhost:5432/datasets_db") | |
engine.execute("CREATE TABLE IF NOT EXISTS records (name text PRIMARY KEY, details text[])") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
import psycopg2 | |
import pandas as pd | |
import streamlit as st |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st.title('Dashboard') | |
column_1, column_2 = st.beta_columns(2) | |
with column_1: | |
st.header('Save records') | |
name = st.text_input('Please enter name') | |
details = st.text_input('Please enter details (separated by comma)') | |
details = ('{%s}' % (details)) | |
if st.button('Save record to database'): | |
write_record(name,details,engine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_record(name,details,engine): | |
engine.execute("INSERT INTO records (name,details) VALUES ('%s','%s')" % (name,details)) | |
def read_record(field,name,engine): | |
result = engine.execute("SELECT %s FROM records WHERE name = '%s'" % (field,name)) | |
return result.first()[0] | |
def update_record(field,name,new_value,engine): | |
engine.execute("UPDATE records SET %s = '%s' WHERE name = '%s'" % (field,new_value,name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
import streamlit as st | |
import plotly.graph_objects as go | |
import plotly.express as px | |
from datetime import datetime | |
import pandas as pd | |
arduino = serial.Serial(port='COM5', baudrate=9600, parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS) #Change the COM port to whichever port your arduino is in | |
gauge_placeholder = st.empty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def donut_chart(value): | |
if value >= 80: | |
color = [0.4392,0.6784,0.2784] | |
if (value < 80) and (value >= 60): | |
color = [0.9569,0.6941,0.5137] | |
if value < 60: | |
color = [1.0000,0.4118,0.4118] | |
my_circle=plt.Circle( (0,0), 0.8, color=[0.4902,0.8000,1.0000]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bar_chart(credit, debit, balance): | |
x = [x[0:6] for (x,y) in balance] | |
y1 = [y for (x,y) in credit] | |
y2 = [y for (x,y) in debit] | |
y3 = [y for (x,y) in balance] | |
n = len(x) | |
index = np.arange(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def download(df,filename): # Downloading DataFrame | |
csv = df.to_csv(index=False) | |
b64 = base64.b64encode(csv.encode()).decode() | |
href = (f'<a href="data:file/csv;base64,{b64}" download="%s.csv">Download csv file</a>' % (filename)) | |
return href | |
st.sidebar.subheader('Test Dataset') | |
status_test, df_test = file_upload('Please upload a test dataset') | |
if status_test == True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st.sidebar.subheader('Training Dataset') | |
status, df = file_upload('Please upload a training dataset') | |
if status == True: | |
col_names = list(df) | |
st.title('Training') | |
st.subheader('Parameters') | |
col1, col2, col3 = st.columns((3,3,2)) |
NewerOlder