-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.py
109 lines (99 loc) · 5.34 KB
/
layout.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
'''the layout of the dashboard'''
from dash import dcc, html
from style import TABS_STYLE, TAB_SELECTED_STYLE, TAB_STYLE
def get_basic_visualization_tab() -> dcc.Tab:
'''get the basic visualization tab, has no personality score'''
return dcc.Tab(label='Basic', children=[], style=TAB_STYLE,
selected_style=TAB_SELECTED_STYLE)
def get_personality_score_visualization_tab() -> dcc.Tab:
'''get the personality score visualization tab'''
return dcc.Tab(label='Personality', children=[
get_personality_score_founding_part(),
get_personality_city_status_category_part()
], style=TAB_STYLE, selected_style=TAB_SELECTED_STYLE)
def get_personality_score_founding_part() -> html.Div:
'''get the founding part of the personality score visualization tab'''
category = {'openness': ['artistic', 'adventurous', 'intellectual',
'liberal', 'imaginative', 'emotionally_aware'],
'extraversion': ['sociable', 'friendly', 'assertive',
'active', 'energetic', 'cheerful'],
'agreeableness': ['generous', 'trusting', 'cooperative',
'empathetic', 'genuine', 'humble'],
'conscientiousness': ['self_assured', 'organized', 'dutiful',
'disciplined', 'cautious', 'ambitious'],
'neuroticism': ['anxiety_prone', 'stress_prone', 'melancholy',
'self_conscious', 'aggressive', 'impulsive']}
items = []
for cate in category.keys():
items.extend(category[cate])
# items = list(category.keys())
return html.Div([
html.H3('Personality score and founding relevance', style={
'text-align': 'center', 'margin-bottom': '20px',
'font-size': '18px'}),
html.Div([
dcc.Dropdown(id='personality-score-category-dropdown',
placeholder='Personality category',
options=items,
clearable=False,
value=items[0],
style={'width': '50%', 'display': 'inline-block'}),
dcc.Dropdown(id='founding-item-dropdown',
placeholder='Founding category',
options=['num_funding_rounds', 'total_funding_usd'],
clearable=False,
value='num_funding_rounds',
style={'width': '50%', 'display': 'inline-block'})],
style={'width': '100%', 'display': 'inline-block'}),
dcc.Graph(id='personality-score-founding-graph')],
style={'width': '80%', 'padding': '0 20',
'margin': '0 auto', 'text-align': 'center',
'margin-top': '20px', 'margin-bottom': '40px'})
def get_personality_city_status_category_part() -> html.Div:
'''get the city status category part'''
category = {'openness': ['artistic', 'adventurous', 'intellectual',
'liberal', 'imaginative', 'emotionally_aware'],
'extraversion': ['sociable', 'friendly', 'assertive',
'active', 'energetic', 'cheerful'],
'agreeableness': ['generous', 'trusting', 'cooperative',
'empathetic', 'genuine', 'humble'],
'conscientiousness': ['self_assured', 'organized', 'dutiful',
'disciplined', 'cautious', 'ambitious'],
'neuroticism': ['anxiety_prone', 'stress_prone', 'melancholy',
'self_conscious', 'aggressive', 'impulsive']}
items = []
# for cate in category.keys():
# items.extend(category[cate])
items = list(category.keys())
return html.Div([
html.H3('Personality score and city/status/category/employee', style={
'text-align': 'center', 'margin-bottom': '20px',
'font-size': '18px'}),
html.Div([
dcc.Dropdown(id='personality-score-category-dropdown-2',
placeholder='Personality category',
options=items,
clearable=False,
value=items[0],
style={'width': '50%', 'display': 'inline-block'}),
dcc.Dropdown(id='city-status-category-dropdown',
placeholder='Founding category',
options=['city', 'status', 'category_groups_list',
'employee_count'],
clearable=False,
value='status',
style={'width': '50%', 'display': 'inline-block'})],
style={'width': '100%', 'display': 'inline-block'}),
dcc.Graph(id='personality-score-city-status-category-graph',
style={'height': '500px'})],
style={'width': '80%', 'padding': '0 20',
'margin': '0 auto', 'text-align': 'center',
'margin-top': '20px', 'margin-bottom': '40px'})
def get_layout() -> html.Div:
'''Get the layout of the dashboard.'''
return html.Div([
dcc.Tabs([
get_basic_visualization_tab(),
get_personality_score_visualization_tab(),
], style=TABS_STYLE)
], style={'font-family': 'Libertinus Sans, sans-serif'})