-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
132 lines (124 loc) · 3.8 KB
/
utils.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
126
127
128
129
130
131
132
from dash import dcc, html
import pandas as pd
import numpy as np
import scipy as sp
import scipy.integrate
import plotly.express as px
def Header(app):
return html.Div([get_header(app), get_menu(), get_model_kind()])
def get_header(app):
header = html.Div(
[
html.Div(
[
html.Div(
[
html.A(
html.Img(
src = app.get_asset_url('yonsei_logo.png'),
className = 'logo',
),
href='http://sevcpt.yuhs.ac/',
style = {'float':'left'}
),
html.A(
html.H1(
children = 'SEVCPT',
style = {
'font-size':'30px',
'margin-top': '20px'
}
),
href='http://sevcpt.yuhs.ac/',
style = {
'float':'left',
}
),
],
className="twelve columns",
style={"padding-left": "0"},
),
],
className="row",
),
html.Div(
[
html.Div(
[
html.Div(
[html.H5("Bacteriophage Cocktail Simulator")],
className="seven columns main-title",
)
],
className="twelve columns",
style={"padding-left": "0"},
),
],
className="row",
)
]
)
return header
def get_menu():
menu = html.Div(
[
dcc.Link(
'Model Description',
href = '/bacteriophage/model-description',
className='tab',
),
dcc.Link(
'Model Simulation',
href = '/bacteriophage/simulate-model',
className = 'tab'
),
],
className = 'row all-tabs'
)
return menu
def get_model_kind():
return html.Div(
[
html.Div(
[
dcc.Dropdown(
['model1', 'model2'],
'model1',
id = 'model-kind-input'
)
],
className = 'twelve columns'
)
],
className = 'row',
style = {
'margin-bottom': '30px',
'margin-top': '30px',
'margin-left': '30px',
'margin-right': '30px'
}
)
def make_dash_table(df):
'''
This function was taken from https://github.com/plotly/dash-sample-apps/blob/main/apps/dash-financial-report/utils.py
'''
table = []
for index, row in df.iterrows():
html_row = []
for i in range(len(row)):
html_row.append(html.Td([row[i]]))
table.append(html.Tr(html_row))
return table
def NamedInput(name, **kwargs):
return html.Div(
style={
"margin": "0px 0px",
'float': 'left'
},
children=[
html.P(children=f"{name}:", style={"margin-left": "3px"}),
dcc.Input(**kwargs,
style = {'width': '150px'}
),
],
)