-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.py
125 lines (108 loc) · 3.3 KB
/
index.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
from dash import Dash
from dash.dependencies import Input, Output, State
from app.layout.index_string import INDEX_STRING
from app.layout.layout import LAYOUT
from app.callbacks import callbacks
app = Dash(
__name__,
title='Lever for Change Landscape',
update_title=None,
prevent_initial_callbacks=True
)
app.index_string = INDEX_STRING
app.layout = LAYOUT
server = app.server
""" Callback definitions """
@app.callback(
Output('camera-data', 'data'),
Input('landscape-graph', 'relayoutData'),
)
def update_camera_data(*args):
return callbacks.update_camera_data(*args)
@app.callback(
Output('select-proposal', 'style'),
Input('search-control', 'value')
)
def toggle_select_competition(value):
return callbacks.toggle_select_proposal(value)
@app.callback(
Output('select-competition', 'style'),
Input('search-control', 'value')
)
def toggle_select_competition(value):
return callbacks.toggle_search_controls(value, 'select-competition')
@app.callback(
Output('select-topic', 'style'),
Input('search-control', 'value')
)
def toggle_select_competition(value):
return callbacks.toggle_search_controls(value, 'select-topic')
@app.callback(
Output('document-search', 'style'),
Input('search-control', 'value')
)
def toggle_document_search(value):
return callbacks.toggle_search_controls(value, 'document-search')
@app.callback(
Output('location-search', 'style'),
Input('search-control', 'value')
)
def toggle_document_search(value):
return callbacks.toggle_search_controls(value, 'location-search')
@app.callback(
Output('outlier-threshold', 'className'),
Input('graph-view-select', 'value')
)
def toggle_outlier_threshold(value):
return callbacks.toggle_outlier_threshold(value)
@app.callback(
Output('select-proposal', 'options'),
Output('select-proposal', 'disabled'),
Input('select-competition', 'value'),
Input('select-topic', 'value'),
Input('document-search', 'value'),
Input('location-search', 'value')
)
def update_select_proposal_dropdown(*args):
return callbacks.update_select_proposal_dropdown(*args)
@app.callback(
Output('landscape-graph', 'figure'),
Input('select-proposal', 'value'),
Input('landscape-graph', 'clickData'),
Input('graph-view-select', 'value'),
Input('outlier-threshold', 'value'),
State('graph-view-select', 'value'),
State('camera-data', 'data'),
)
def update_graph(*args):
return callbacks.update_graph(*args)
@app.callback(
Output('click-data', 'children'),
Output('selected-proposal', 'data'),
Input('landscape-graph', 'clickData'),
Input('select-proposal', 'value'),
)
def update_selected_proposal(*args):
return callbacks.update_selected_proposal(*args)
@app.callback(
Output('download-dataframe', 'data'),
Input('download-btn', 'n_clicks'),
State('selected-proposal', 'data')
)
def download_dataframe(clicks, index):
return callbacks.download_dataframe(clicks, index)
@app.callback(
Output('download-btn', 'className'),
Input('selected-proposal', 'data')
)
def show_download_button(index):
return callbacks.show_download_button(index)
@app.callback(
Output('welcome-modal', 'style'),
Input('close-welcome-modal', 'n_clicks'),
Input('open-welcome-modal', 'n_clicks')
)
def toggle_welcome_modal(*args):
return callbacks.toggle_welcome_modal(*args)
if __name__ == '__main__':
app.run_server(debug=True)