Skip to content

Commit 357ac17

Browse files
committed
v0.1.2
1 parent f350558 commit 357ac17

File tree

3 files changed

+89
-60
lines changed

3 files changed

+89
-60
lines changed

questions/app.py

+75-49
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from pydoc import classname
12
import dash.html as html
23
import dash_bootstrap_components as dbc
34

@@ -15,7 +16,9 @@
1516
navbar = dbc.NavbarSimple(
1617
children=[
1718
dbc.NavItem(dbc.NavLink("Info", id="open-offcanvas", n_clicks=0)),
18-
dbc.NavItem(dbc.NavLink("Github", href="https://github.com/mikulatomas/questions")),
19+
dbc.NavItem(
20+
dbc.NavLink("Github", href="https://github.com/mikulatomas/questions")
21+
),
1922
],
2023
brand="Kaggle Questions Dataset",
2124
brand_href="/",
@@ -55,10 +58,9 @@
5558
),
5659
dbc.Row(
5760
html.Ul(
58-
id="concepts",
59-
),
61+
id="concepts",
62+
),
6063
className="flex-grow-1 overflow-auto full-height-fix pt-2",
61-
6264
),
6365
],
6466
className="h-100 d-flex flex-column",
@@ -100,63 +102,87 @@
100102

101103
navigation = dbc.Col(
102104
html.Div(
103-
[
104-
dbc.Row(
105-
[
106-
html.Div(
107-
[
108-
html.H2("Navigation"),
109-
]
110-
),
111-
], className="pt-3 pb-2"
112-
),
113-
dbc.Row(
114-
[
115-
html.Div(
116-
[
117-
dbc.Label("More general"),
118-
html.Div(id="upper-concepts"),
119-
dbc.Label("More specific"),
120-
html.Div(id="lower-concepts"),
121-
]
122-
),
123-
],
124-
className="flex-grow-1 overflow-auto full-height-fix",
125-
),
126-
],
127-
className="h-100 d-flex flex-column",
128-
),
129-
id="navigation", width=2, className="border-right background-gray")
130-
105+
[
106+
dbc.Row(
107+
[
108+
html.Div(
109+
[
110+
html.H2("Navigation"),
111+
]
112+
),
113+
],
114+
className="pt-3 pb-2",
115+
),
116+
dbc.Row(
117+
[
118+
html.Div(
119+
[
120+
dbc.Label("More general"),
121+
html.Div(id="upper-concepts"),
122+
dbc.Label("More specific"),
123+
html.Div(id="lower-concepts"),
124+
]
125+
),
126+
],
127+
className="flex-grow-1 overflow-auto full-height-fix",
128+
),
129+
],
130+
className="h-100 d-flex flex-column",
131+
),
132+
id="navigation",
133+
width=2,
134+
className="border-right background-gray",
135+
)
131136

132-
questions = dbc.Col(html.Div(
137+
tabs = dbc.Tabs(
138+
[
139+
dbc.Tab(
133140
[
134-
dbc.Row(
135-
id="mca",
136-
className="pt-3 pb-2",
137-
),
138141
dbc.Row(
139142
[
140-
html.Ul(
141-
id="question-list"
142-
),
143+
html.Ul(id="question-list"),
143144
],
144-
className="flex-grow-1 overflow-auto full-height-fix",
145+
className="pt-3",
145146
),
146147
],
147-
className="h-100 d-flex flex-column",
148+
label="Questions",
148149
),
149-
id="questions", className="border-right")
150+
dbc.Tab(
151+
dbc.Row(
152+
id="mca",
153+
className="pt-3 pb-2",
154+
),
155+
label="MCA Plot",
156+
),
157+
],
158+
className="mt-2 mb-2",
159+
)
160+
161+
questions = dbc.Col(
162+
html.Div(
163+
tabs,
164+
className="h-100 d-flex flex-column",
165+
),
166+
id="questions",
167+
className="border-right",
168+
)
150169

151170

152171
info = dbc.Offcanvas(
153-
html.P(
154-
["Original dataset is avaliable ", html.A("here", href="https://www.kaggle.com/umairnasir14/all-kaggle-questions-on-qoura-dataset"), "."]
172+
html.P(
173+
[
174+
"Original dataset is avaliable ",
175+
html.A(
176+
"here",
177+
href="https://www.kaggle.com/umairnasir14/all-kaggle-questions-on-qoura-dataset",
155178
),
156-
id="info",
157-
title="Kaggle Question Dataset",
158-
is_open=False,
159-
)
179+
".",
180+
]
181+
),
182+
id="info",
183+
title="Kaggle Question Dataset",
184+
is_open=False,
185+
)
160186

161187
app.layout = html.Div(
162188
[

questions/assets/style.css

+9
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,13 @@ h2 {
9595
font-size: 0.9em;
9696
line-height: 1.3em;
9797
border-radius: 3px;
98+
}
99+
100+
#question-list {
101+
height: 80vh;
102+
overflow: auto;
103+
}
104+
105+
#mca {
106+
height: 80vh;
98107
}

questions/callbacks.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def update_detail(pathname):
147147
]
148148

149149
return metadata, centrality
150-
150+
151151
return ["N/A"], ["N/A"]
152152

153153

@@ -169,7 +169,7 @@ def update_navigation(pathname):
169169
lower = navigation_links(concept.lower_neighbors, "up", concept.intent)
170170

171171
return upper, lower
172-
172+
173173
return ["N/A"], ["N/A"]
174174

175175

@@ -211,15 +211,9 @@ def update_questions(pathname):
211211

212212
fig = mca.to_plotly()
213213
fig.update_traces(marker={"size": 7})
214-
graph = dcc.Graph(id="mca_3d", figure=fig)
215-
mca_plot = [
216-
html.H2("MCA plot"),
217-
dbc.Label("Multiple correspondence analysis (MCA) plot"),
218-
graph,
219-
html.H2("Questions"),
220-
]
214+
mca_plot = [dcc.Graph(id="mca_3d", figure=fig)]
221215
else:
222-
mca_plot = [html.H2("Questions")]
216+
mca_plot = []
223217

224218
questions = [
225219
li_question(
@@ -233,7 +227,7 @@ def update_questions(pathname):
233227
]
234228

235229
return mca_plot, questions
236-
230+
237231
return None, []
238232

239233

0 commit comments

Comments
 (0)