Skip to content

Commit 631f304

Browse files
authored
First version (#2)
1 parent 7e62ec1 commit 631f304

16 files changed

+3047
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,7 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
*.ipynb
132+
133+
private/

questions/__init__.py

Whitespace-only changes.

questions/app.py

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
import dash.html as html
2+
import dash_bootstrap_components as dbc
3+
4+
from dash import dcc
5+
6+
from .server import app, server
7+
from .data import (
8+
attribute_counts,
9+
min_extent_size,
10+
max_extent_size,
11+
)
12+
from . import callbacks
13+
14+
15+
navbar = dbc.NavbarSimple(
16+
children=[
17+
dbc.NavItem(dbc.NavLink("Info", id="open-offcanvas", n_clicks=0)),
18+
dbc.NavItem(dbc.NavLink("Github", href="https://github.com/mikulatomas/questions")),
19+
],
20+
brand="Kaggle Questions Dataset",
21+
brand_href="/",
22+
color="dark",
23+
dark=True,
24+
fluid=True,
25+
)
26+
27+
concepts = dbc.Col(
28+
html.Div(
29+
[
30+
dbc.Row(
31+
[
32+
html.H2("Concepts"),
33+
dbc.Label("Keywords"),
34+
dcc.Dropdown(
35+
id="intent-dropdown",
36+
options=[
37+
{"label": f"{label} ({count})", "value": label}
38+
for label, count in attribute_counts.iteritems()
39+
],
40+
multi=True,
41+
className="mb-2",
42+
),
43+
dbc.Label("Minimal number of questions"),
44+
dcc.Slider(
45+
id="concept-size-slider",
46+
min=min_extent_size,
47+
max=max_extent_size // 5,
48+
step=1,
49+
value=10,
50+
tooltip={"placement": "bottom", "always_visible": False},
51+
className="ps-4 pe-4",
52+
),
53+
],
54+
className="pt-3",
55+
),
56+
dbc.Row(
57+
html.Ul(
58+
id="concepts",
59+
),
60+
className="flex-grow-1 overflow-auto full-height-fix pt-2",
61+
62+
),
63+
],
64+
className="h-100 d-flex flex-column",
65+
),
66+
width=2,
67+
id="keywords-col",
68+
className="border-right background-gray",
69+
)
70+
71+
72+
detail = dbc.Col(
73+
html.Div(
74+
[
75+
dbc.Row(
76+
[
77+
html.Div(
78+
[
79+
html.H2("Concept detail"),
80+
dbc.Label("Metadata"),
81+
html.Ul(id="metadata"),
82+
dbc.Label("Related keywords"),
83+
]
84+
),
85+
],
86+
className="pt-3 pb-2",
87+
),
88+
dbc.Row(
89+
html.Ul(
90+
id="centrality",
91+
),
92+
className="flex-grow-1 overflow-auto full-height-fix",
93+
),
94+
],
95+
className="h-100 d-flex flex-column",
96+
),
97+
width=2,
98+
className="border-right background-gray",
99+
)
100+
101+
navigation = dbc.Col(
102+
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+
131+
132+
questions = dbc.Col(html.Div(
133+
[
134+
dbc.Row(
135+
id="mca",
136+
className="pt-3 pb-2",
137+
),
138+
dbc.Row(
139+
[
140+
html.Ul(
141+
id="question-list"
142+
),
143+
],
144+
className="flex-grow-1 overflow-auto full-height-fix",
145+
),
146+
],
147+
className="h-100 d-flex flex-column",
148+
),
149+
id="questions", className="border-right")
150+
151+
152+
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"), "."]
155+
),
156+
id="info",
157+
title="Kaggle Question Dataset",
158+
is_open=False,
159+
)
160+
161+
app.layout = html.Div(
162+
[
163+
dcc.Location(id="url", refresh=False),
164+
info,
165+
dbc.Container(
166+
[
167+
dbc.Row(navbar),
168+
dbc.Row(
169+
[concepts, questions, detail, navigation], className="flex-grow-1"
170+
),
171+
],
172+
fluid=True,
173+
className="min-vh-100 d-flex flex-column",
174+
),
175+
],
176+
)

questions/assets/style.css

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
html, body, .wrapper, container-fluid{
2+
height: 100vh;
3+
}
4+
5+
ul {
6+
list-style-type: none;
7+
padding-left: 0;
8+
}
9+
10+
li {
11+
position: relative;
12+
}
13+
14+
a {
15+
text-decoration: none;
16+
}
17+
18+
h2 {
19+
font-size: 1.5em;
20+
}
21+
22+
.full-height-fix {
23+
height: 0px;
24+
}
25+
26+
.navbar .container-fluid {
27+
padding-left: 0;
28+
}
29+
30+
.status-bar {
31+
text-align: right;
32+
background-color: white;
33+
border-radius: 0 0 3px 3px;
34+
}
35+
36+
.border-right {
37+
border-right: 1px solid #EEEEEE;
38+
}
39+
40+
.background-gray {
41+
background-color: #F7F7F7;
42+
}
43+
44+
#concepts li, .navigation li {
45+
display: block;
46+
position: relative;
47+
background-color: white;
48+
padding: 0.5em;
49+
padding-right: 7em;
50+
margin-bottom: 0.4em;
51+
font-size: 0.9em;
52+
line-height: 1.3em;
53+
border-radius: 3px;
54+
}
55+
56+
.navigation .sign {
57+
padding-left: 2em;
58+
}
59+
60+
61+
#centrality {
62+
list-style-type: none;
63+
padding-top: 0;
64+
margin-left: 0;
65+
}
66+
67+
#centrality li {
68+
display: block;
69+
position: relative;
70+
background-color: white;
71+
padding: 0.4em;
72+
padding-right: 7em;
73+
margin-bottom: 0.4em;
74+
font-size: 0.9em;
75+
line-height: 1.3em;
76+
border-radius: 3px;
77+
font-weight: bold;
78+
}
79+
80+
#question-list {
81+
list-style-type: none;
82+
padding: 1em;
83+
padding-top: 0;
84+
margin-left: 0;
85+
}
86+
87+
#question-list li {
88+
display: block;
89+
position: relative;
90+
background-color: #F7F7F7;
91+
border: 1px solid #F7F7F7;
92+
padding: 0.8em;
93+
padding-bottom: 2.3em;
94+
margin-bottom: 1em;
95+
font-size: 0.9em;
96+
line-height: 1.3em;
97+
border-radius: 3px;
98+
}

0 commit comments

Comments
 (0)