├── .gitignore ├── app.py ├── homepage.py ├── index.py ├── navbar.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | __pycache__/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | # Data 2 | import pandas as pd 3 | import pickle 4 | # Graphing 5 | import plotly.graph_objects as go 6 | # Dash 7 | import dash 8 | import dash_core_components as dcc 9 | import dash_html_components as html 10 | import dash_bootstrap_components as dbc 11 | from dash.dependencies import Output, Input 12 | # Navbar 13 | from navbar import Navbar 14 | df = pd.read_csv('https://gist.githubusercontent.com/joelsewhere/f75da35d9e0c7ed71e5a93c10c52358d/raw/d8534e2f25495cc1de3cd604f952e8cbc0cc3d96/population_il_cities.csv') 15 | df.set_index(df.iloc[:, 0], drop=True, inplace=True) 16 | df = df.iloc[:, 1:] 17 | 18 | nav = Navbar() 19 | 20 | header = html.H3( 21 | 'Select the name of an Illinois city to see its population!' 22 | ) 23 | 24 | options = [{'label': x.replace(', Illinois', ''), 'value': x} 25 | for x in df.columns] 26 | 27 | dropdown = html.Div(dcc.Dropdown( 28 | id='pop_dropdown', 29 | options=options, 30 | value='Abingdon city, Illinois' 31 | )) 32 | 33 | output = html.Div(id='output', 34 | children=[], 35 | ) 36 | 37 | 38 | def App(): 39 | layout = html.Div([ 40 | nav, 41 | header, 42 | dropdown, 43 | output 44 | ]) 45 | return layout 46 | 47 | 48 | def build_graph(city): 49 | data = [go.Scatter(x=df.index, 50 | y=df[city], 51 | marker={'color': 'orange'})] 52 | graph = dcc.Graph( 53 | figure={ 54 | 'data': data, 55 | 'layout': go.Layout( 56 | title='{} Population Change'.format(city), 57 | yaxis={'title': 'Population'}, 58 | hovermode='closest' 59 | ) 60 | } 61 | ) 62 | return graph 63 | -------------------------------------------------------------------------------- /homepage.py: -------------------------------------------------------------------------------- 1 | import dash 2 | import dash_bootstrap_components as dbc 3 | import dash_core_components as dcc 4 | import dash_html_components as html 5 | 6 | from navbar import Navbar 7 | nav = Navbar() 8 | 9 | body = dbc.Container( 10 | [ 11 | dbc.Row( 12 | [ 13 | dbc.Col( 14 | [ 15 | html.H2("Heading"), 16 | html.P( 17 | """\ 18 | Donec id elit non mi porta gravida at eget metus.Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentumnibh, ut fermentum massa justo sit amet risus. Etiam porta semmalesuada magna mollis euismod. Donec sed odio dui. Donec id elit nonmi porta gravida at eget metus. Fusce dapibus, tellus ac cursuscommodo, tortor mauris condimentum nibh, ut fermentum massa justo sitamet risus. Etiam porta sem malesuada magna mollis euismod. Donec sedodio dui.""" 19 | ), 20 | dbc.Button("View details", color="secondary"), 21 | ], 22 | md=4, 23 | ), 24 | dbc.Col( 25 | [ 26 | html.H2("Graph"), 27 | dcc.Graph( 28 | figure={"data": [{"x": [1, 2, 3], "y": [1, 4, 9]}]} 29 | ), 30 | ] 31 | ), 32 | ] 33 | ) 34 | ], 35 | className="mt-4", 36 | ) 37 | 38 | def Homepage(): 39 | layout = html.Div([ 40 | nav, 41 | body 42 | ]) 43 | return layout 44 | 45 | app = dash.Dash(__name__, external_stylesheets = [dbc.themes.UNITED]) 46 | app.layout = Homepage() 47 | if __name__ == "__main__": 48 | app.run_server() 49 | 50 | 51 | -------------------------------------------------------------------------------- /index.py: -------------------------------------------------------------------------------- 1 | import dash 2 | import dash_core_components as dcc 3 | import dash_html_components as html 4 | from dash.dependencies import Input, Output 5 | import dash_bootstrap_components as dbc 6 | from app import App, build_graph 7 | from homepage import Homepage 8 | 9 | app = dash.Dash(__name__, external_stylesheets=[dbc.themes.UNITED]) 10 | 11 | app.config.suppress_callback_exceptions = True 12 | 13 | app.layout = html.Div([ 14 | dcc.Location(id = 'url', refresh = False), 15 | html.Div(id = 'page-content') 16 | ]) 17 | 18 | @app.callback(Output('page-content', 'children'), 19 | [Input('url', 'pathname')]) 20 | def display_page(pathname): 21 | if pathname == '/time-series': 22 | return App() 23 | else: 24 | return Homepage() 25 | 26 | @app.callback( 27 | Output('output', 'children'), 28 | [Input('pop_dropdown', 'value')] 29 | ) 30 | def update_graph(city): 31 | graph = build_graph(city) 32 | return graph 33 | 34 | if __name__ == '__main__': 35 | app.run_server(debug=True) 36 | 37 | 38 | -------------------------------------------------------------------------------- /navbar.py: -------------------------------------------------------------------------------- 1 | import dash_bootstrap_components as dbc 2 | 3 | 4 | def Navbar(): 5 | navbar = dbc.NavbarSimple( 6 | children=[ 7 | dbc.NavItem(dbc.NavLink("Time-Series", href="/time-series")), 8 | dbc.DropdownMenu( 9 | nav=True, 10 | in_navbar=True, 11 | label="Menu", 12 | children=[ 13 | dbc.DropdownMenuItem("Entry 1"), 14 | dbc.DropdownMenuItem("Entry 2"), 15 | dbc.DropdownMenuItem(divider=True), 16 | dbc.DropdownMenuItem("Entry 3"), 17 | ], 18 | ), 19 | ], 20 | brand="Home", 21 | brand_href="/home", 22 | sticky="top", 23 | ) 24 | return navbar 25 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | absl-py==0.7.1 2 | aiohttp==3.6.2 3 | alabaster==0.7.12 4 | alembic==1.2.1 5 | altair==4.0.1 6 | anaconda-client==1.7.2 7 | anaconda-navigator==1.9.7 8 | anaconda-project==0.8.3 9 | appnope==0.1.0 10 | appscript==1.0.1 11 | argcomplete==1.10.0 12 | arrow==0.15.5 13 | asn1crypto==0.24.0 14 | astor==0.8.0 15 | astroid==2.2.5 16 | astropy==3.2.1 17 | astunparse==1.6.2 18 | async-timeout==3.0.1 19 | atomicwrites==1.3.0 20 | attrs==19.1.0 21 | Automat==0.8.0 22 | awscli==1.16.157 23 | Babel==2.7.0 24 | backcall==0.1.0 25 | backports.functools-lru-cache==1.5 26 | backports.os==0.1.1 27 | backports.shutil-get-terminal-size==1.0.0 28 | backports.tempfile==1.0 29 | backports.weakref==1.0.post1 30 | bcrypt==3.1.7 31 | beautifulsoup4==4.9.0 32 | binaryornot==0.4.4 33 | bitarray==0.9.3 34 | bkcharts==0.2 35 | bleach==3.1.0 36 | blessed==1.16.1 37 | blinker==1.4 38 | blis==0.2.4 39 | bokeh==1.2.0 40 | boto==2.49.0 41 | boto3==1.9.210 42 | botocore==1.12.210 43 | Bottleneck==1.2.1 44 | branca==0.3.1 45 | cachetools==3.1.1 46 | certifi==2020.4.5.1 47 | cffi==1.12.3 48 | chardet==3.0.4 49 | chart-studio==1.0.0 50 | Click==7.0 51 | click-plugins==1.1.1 52 | cligj==0.5.0 53 | cloudpickle==1.2.1 54 | clyent==1.2.2 55 | colorama==0.3.9 56 | colorcet==2.0.2 57 | colour==0.1.5 58 | conda==4.8.3 59 | conda-build==3.18.8 60 | conda-package-handling==1.3.11 61 | conda-verify==3.4.2 62 | constantly==15.1.0 63 | contextlib2==0.5.5 64 | cookiecutter==1.7.0 65 | cryptography==2.7 66 | cssselect==1.1.0 67 | cycler==0.10.0 68 | cymem==2.0.2 69 | Cython==0.29.12 70 | cytoolz==0.10.0 71 | dash==1.2.0 72 | dash-bootstrap-components==0.7.0 73 | dash-core-components==1.1.2 74 | dash-html-components==1.0.1 75 | dash-renderer==1.0.1 76 | dash-table==4.2.0 77 | dask==2.1.0 78 | decorator==4.4.0 79 | defusedxml==0.6.0 80 | descartes==1.1.0 81 | distributed==2.1.0 82 | Django==2.2.6 83 | django-bootstrap4==1.1.1 84 | django-plotly-dash==1.1.5 85 | docopt==0.6.2 86 | docutils==0.14 87 | docx2txt==0.8 88 | dominate==2.4.0 89 | dpd-components==0.1.0 90 | dpd-static-support==0.0.5 91 | EbookLib==0.17.1 92 | emojis==0.5.1 93 | en-core-web-sm==2.1.0 94 | enlighten==1.4.0 95 | entrypoints==0.3 96 | et-xmlfile==1.0.1 97 | extract-msg==0.23.1 98 | fastcache==1.1.0 99 | filelock==3.0.12 100 | Fiona==1.8.6 101 | firebase==3.0.1 102 | flake8==3.7.9 103 | Flask==1.1.1 104 | Flask-Babel==0.12.2 105 | Flask-Bootstrap==3.3.7.1 106 | Flask-Compress==1.4.0 107 | Flask-Login==0.4.1 108 | Flask-Mail==0.9.1 109 | Flask-Migrate==2.5.2 110 | Flask-Moment==0.9.0 111 | Flask-SQLAlchemy==2.4.1 112 | Flask-WTF==0.14.2 113 | folium==0.10.0 114 | fsspec==0.6.3 115 | funcy==1.13 116 | future==0.17.1 117 | fuzzywuzzy==0.17.0 118 | gast==0.2.2 119 | gcloud==0.18.3 120 | GDAL==2.3.3 121 | gensim==3.8.0 122 | geographiclib==1.49 123 | geojson==2.5.0 124 | geopandas==0.5.1 125 | geopy==1.20.0 126 | gevent==1.4.0 127 | gitdb==4.0.4 128 | GitPython==3.1.1 129 | glob2==0.7 130 | gmpy2==2.0.8 131 | google-api-python-client==1.7.11 132 | google-auth==1.6.3 133 | google-auth-httplib2==0.0.3 134 | google-auth-oauthlib==0.4.1 135 | google-pasta==0.1.7 136 | googleapis-common-protos==1.51.0 137 | gpt-2-simple==0.6 138 | graphviz==0.14 139 | greenlet==0.4.15 140 | grpcio==1.23.0 141 | gspread==3.1.0 142 | gunicorn==19.9.0 143 | h5py==2.9.0 144 | heapdict==1.0.0 145 | holoviews==1.12.7 146 | html5lib==1.0.1 147 | httpie==1.0.3 148 | httplib2==0.14.0 149 | hyperlink==17.3.1 150 | idna==2.8 151 | imageio==2.5.0 152 | imagesize==1.1.0 153 | IMAPClient==2.1.0 154 | imbalanced-learn==0.6.2 155 | imblearn==0.0 156 | IMDbPY==6.9.dev20191126 157 | importlib-metadata==0.17 158 | incremental==17.5.0 159 | ipykernel==5.1.1 160 | ipython==7.6.1 161 | ipython-genutils==0.2.0 162 | ipywidgets==7.5.0 163 | isort==4.3.21 164 | itsdangerous==1.1.0 165 | jdcal==1.4.1 166 | jedi==0.13.3 167 | jellyfish==0.5.6 168 | Jinja2==2.10.1 169 | jinja2-time==0.2.0 170 | jmespath==0.9.4 171 | joblib==0.13.2 172 | json-lines==0.5.0 173 | json5==0.8.4 174 | jsonschema==3.0.1 175 | jupyter==1.0.0 176 | jupyter-client==5.3.1 177 | jupyter-console==6.0.0 178 | jupyter-contrib-core==0.3.3 179 | jupyter-contrib-nbextensions==0.5.1 180 | jupyter-core==4.5.0 181 | jupyter-highlight-selected-word==0.2.0 182 | jupyter-latex-envs==1.4.6 183 | jupyter-nbextensions-configurator==0.4.1 184 | jupyter-plotly-dash==0.4.2 185 | jupyterlab==1.0.2 186 | jupyterlab-server==1.0.0 187 | jwcrypto==0.7 188 | Keras==2.2.4 189 | Keras-Applications==1.0.8 190 | Keras-Preprocessing==1.1.0 191 | keyring==18.0.0 192 | kiwisolver==1.1.0 193 | lazy-object-proxy==1.4.1 194 | libarchive-c==2.8 195 | lief==0.9.0 196 | llvmlite==0.29.0 197 | locket==0.2.0 198 | lxml==4.3.4 199 | Mako==1.1.0 200 | mapclassify==2.0.1 201 | Markdown==3.1.1 202 | MarkupSafe==1.1.1 203 | marshmallow==3.3.0 204 | matplotlib==3.1.0 205 | mccabe==0.6.1 206 | mistune==0.8.4 207 | mkl-fft==1.0.12 208 | mkl-random==1.0.2 209 | mkl-service==2.0.2 210 | mock==3.0.5 211 | more-itertools==7.0.0 212 | mpld3==0.3 213 | mpmath==1.1.0 214 | msgpack==0.6.1 215 | multidict==4.7.5 216 | multipledispatch==0.6.0 217 | munch==2.3.2 218 | murmurhash==1.0.0 219 | navigator-updater==0.2.1 220 | nbconvert==5.5.0 221 | nbformat==4.4.0 222 | nbserverproxy==0.8.8 223 | networkx==2.3 224 | nltk==3.4.4 225 | nose==1.3.7 226 | notebook==6.0.0 227 | num2words==0.5.10 228 | numba==0.44.1 229 | numexpr==2.6.9 230 | numpy==1.16.4 231 | numpydoc==0.9.1 232 | oauth2client==4.1.3 233 | oauthlib==3.1.0 234 | olefile==0.46 235 | openpyxl==2.6.2 236 | packaging==19.0 237 | pandas==0.24.2 238 | pandocfilters==1.4.2 239 | param==1.9.2 240 | parsel==1.5.2 241 | parso==0.5.0 242 | partd==1.0.0 243 | path.py==12.0.1 244 | pathlib2==2.3.4 245 | patsy==0.5.1 246 | pdfminer.six==20181108 247 | pep8==1.7.1 248 | pexpect==4.7.0 249 | pickleshare==0.7.5 250 | pigar==0.9.2 251 | Pillow==6.1.0 252 | pixiedust==1.1.17 253 | pkginfo==1.5.0.1 254 | plac==0.9.6 255 | plotly==4.1.0 256 | plotly-geo==1.0.0 257 | pluggy==0.12.0 258 | ply==3.11 259 | poyo==0.5.0 260 | praatio==3.8.0 261 | preshed==2.0.1 262 | progressbar==2.5 263 | prometheus-client==0.7.1 264 | prompt-toolkit==2.0.9 265 | Protego==0.1.15 266 | protobuf==3.9.1 267 | psutil==5.6.3 268 | psycopg2==2.7.6.1 269 | ptyprocess==0.6.0 270 | py==1.8.0 271 | pyasn1==0.4.5 272 | pyasn1-modules==0.2.7 273 | pycodestyle==2.5.0 274 | pycosat==0.6.3 275 | pycparser==2.19 276 | pycrypto==2.6.1 277 | pycryptodome==3.9.0 278 | pyct==0.4.6 279 | pycurl==7.43.0.3 280 | PyDispatcher==2.0.5 281 | pyflakes==2.1.1 282 | Pygments==2.4.2 283 | PyHamcrest==1.9.0 284 | PyJWT==1.7.1 285 | pyLDAvis==2.1.2 286 | pylint==2.3.1 287 | pymongo==3.9.0 288 | pyodbc==4.0.26 289 | pyOpenSSL==19.0.0 290 | pyparsing==2.4.0 291 | PyPDF2==1.26.0 292 | pyproj==2.2.2 293 | pyrsistent==0.14.11 294 | pyshp==2.1.0 295 | PySocks==1.7.0 296 | pytest==5.0.1 297 | pytest-arraydiff==0.3 298 | pytest-astropy==0.5.0 299 | pytest-doctestplus==0.3.0 300 | pytest-openfiles==0.3.2 301 | pytest-remotedata==0.3.1 302 | pytest-runner==5.2 303 | python-dateutil==2.8.0 304 | python-dotenv==0.10.3 305 | python-editor==1.0.4 306 | python-jwt==3.2.6 307 | python-Levenshtein==0.12.0 308 | python-pptx==0.6.18 309 | pytz==2019.1 310 | pyviz-comms==0.7.2 311 | PyWavelets==1.0.3 312 | PyYAML==5.1.1 313 | pyzmq==18.0.0 314 | QtAwesome==0.5.7 315 | qtconsole==4.5.1 316 | QtPy==1.8.0 317 | queuelib==1.5.0 318 | regex==2019.8.19 319 | requests==2.22.0 320 | requests-oauthlib==1.2.0 321 | requests-toolbelt==0.9.1 322 | retrying==1.3.3 323 | rope==0.14.0 324 | rsa==3.4.2 325 | Rtree==0.8.3 326 | ruamel-yaml==0.15.46 327 | s3fs==0.4.0 328 | s3transfer==0.2.0 329 | scikit-image==0.15.0 330 | scikit-learn==0.22.2.post1 331 | scipy==1.3.0 332 | Scrapy==1.8.0 333 | seaborn==0.9.0 334 | selenium==3.141.0 335 | Send2Trash==1.5.0 336 | service-identity==18.1.0 337 | Shapely==1.6.4.post2 338 | simplegeneric==0.8.1 339 | singledispatch==3.4.0.3 340 | six==1.12.0 341 | slack==0.0.2 342 | slackclient==1.0.7 343 | smart-open==1.8.4 344 | smmap==3.0.2 345 | snowballstemmer==1.9.0 346 | sortedcollections==1.1.2 347 | sortedcontainers==2.1.0 348 | soupsieve==1.8 349 | spacy==2.1.8 350 | SpeechRecognition==3.8.1 351 | Sphinx==2.1.2 352 | sphinxcontrib-applehelp==1.0.1 353 | sphinxcontrib-devhelp==1.0.1 354 | sphinxcontrib-htmlhelp==1.0.2 355 | sphinxcontrib-jsmath==1.0.1 356 | sphinxcontrib-qthelp==1.0.2 357 | sphinxcontrib-serializinghtml==1.1.3 358 | sphinxcontrib-websupport==1.1.2 359 | spyder==3.3.6 360 | spyder-kernels==0.5.1 361 | SQLAlchemy==1.3.5 362 | sqlparse==0.3.0 363 | srsly==0.1.0 364 | sseclient==0.0.25 365 | statistics==1.0.3.5 366 | statsmodels==0.10.0 367 | sympy==1.4 368 | tables==3.5.2 369 | tblib==1.4.0 370 | tensorboard==1.14.0 371 | tensorflow==1.14.0 372 | tensorflow-estimator==1.14.0 373 | termcolor==1.1.0 374 | terminado==0.8.2 375 | testpath==0.4.2 376 | textract==1.6.3 377 | tgt==1.4.4 378 | thinc==7.0.8 379 | toolz==0.10.0 380 | toposort==1.5 381 | tornado==6.0.3 382 | tqdm==4.32.1 383 | traitlets==4.3.2 384 | tweepy==3.8.0 385 | Twisted==19.7.0 386 | tzlocal==1.5.1 387 | unicodecsv==0.14.1 388 | uritemplate==3.0.0 389 | urllib3==1.24.2 390 | us==1.0.0 391 | virtualenv==16.7.3 392 | visitor==0.1.3 393 | w3lib==1.21.0 394 | wasabi==0.2.2 395 | wcwidth==0.1.7 396 | webencodings==0.5.1 397 | websocket-client==0.57.0 398 | Werkzeug==0.15.4 399 | whichcraft==0.6.1 400 | widgetsnbextension==3.5.0 401 | wordcloud==1.5.0.post41+g32f5d2a 402 | wrapt==1.11.2 403 | WTForm==1.0 404 | WTForms==2.2.1 405 | wurlitzer==1.0.2 406 | xlrd==1.2.0 407 | XlsxWriter==1.1.8 408 | xlwings==0.15.8 409 | xlwt==1.3.0 410 | yarl==1.4.2 411 | zict==1.0.0 412 | zipp==0.5.1 413 | zope.interface==4.6.0 414 | --------------------------------------------------------------------------------