forked from ParameswaranSajeenthiran/ECGAnalysisDashbaord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
125 lines (111 loc) · 3.14 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#
# import numpy as np
# import pandas as pd
# import streamlit as st
# import wfdb
#
# # from loguru import logger
#
# from page.PreProccessing import Preprocess
# from page.Descriptive_Analysis import DescriptiveAnalysis
# from page.Predictive_Analysis import PredictiveAnalysis
# from utils.sidebar import sidebar_caption
#
# #
# # # Config the whole app
# # st.set_page_config(
# # page_title="A Dashboard Template",
# # page_icon="🧊",
# # layout="wide",
# # initial_sidebar_state="expanded",
# # )
# #
#
# # @st.cache()
# def fake_data():
# """some fakest.chch data"""
#
# dt = pd.date_range("2021-01-01", "2021-03-01")
# df = pd.DataFrame(
# {"datetime": dt, "values": np.random.randint(0, 10, size=len(dt))}
# )
#
# return df
#
#
# def main():
# """A streamlit app template"""
#
# # st.sidebar.title("Tools")
# st.set_page_config(layout="wide")
# PAGES = {
# "Descriptive Analysis": DescriptiveAnalysis,
# "PreProcessing": Preprocess,
# "Predictive Analysis": PredictiveAnalysis
# }
#
# # Select page
# # Use dropdown if you prefer
# selection = st.sidebar.radio("Tools", list(PAGES.keys()))
# sidebar_caption()
# option = st.sidebar.selectbox(
# "Select A patient Record",
# ("100", "101", "102", "103", "104", "105", "106"))
#
# data = f"mit-bih-arrhythmia-database-1.0.0/{option}"
#
# record = wfdb.rdrecord(data, smooth_frames=True)
#
# page = PAGES[selection]
#
# DATA = {"record": record, }
#
# with st.spinner(f"Loading Page {selection} ..."):
#
#
#
# page = page(DATA)
# page()
#
#
# if __name__ == "__main__":
# main()
import streamlit as st
from page.PreProccessing import Preprocess
import wfdb
from page.Descriptive_Analysis import DescriptiveAnalysis
from page.Predictive_Analysis import PredictiveAnalysis
from page.arrythmia_detection import ArrhythmiaAnalysis
st.set_page_config(layout="wide")
# tab1, tab2 = st.tabs(["📈 Chart", "🗃 Data"])
tab1, tab2, tab3,tab4 = st.tabs(["📈 Preprocessing", "🗃 Descriptive Analysis", "📊 Predictive Analysis","Arrhythia Detection"])
data = f"mit-bih-arrhythmia-database-1.0.0/100"
record = wfdb.rdrecord(data, smooth_frames=True)
signal=[]
# page = PAGES[selection]
DATA = {"record": record, }
with tab1:
option = st.selectbox(
"Select A patient Record",
("100", "101", "102", "103", "104", "105", "106"))
data = f"mit-bih-arrhythmia-database-1.0.0/{option}"
record = wfdb.rdrecord(data, smooth_frames=True)
DATA = {"record": record }
page=Preprocess(DATA)
signal=page.content()
print(signal)
# st.header("A cat")
# st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
with tab2:
DATA = {"record": record, "signal":signal}
page = DescriptiveAnalysis(DATA)
page.content()
st.header("A dog")
st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
with tab3:
st.header("An owl")
st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
with tab4:
DATA = {"record": record, "signal":signal}
page = ArrhythmiaAnalysis(DATA)
page.content()