Skip to content

Commit

Permalink
Merge pull request #1288 from hackforla/combDashboards2
Browse files Browse the repository at this point in the history
Update plotly dash overview dashboards (combined old dashboards)
  • Loading branch information
joshuayhwu authored Aug 4, 2022
2 parents 3df408a + 965cad2 commit ecf4ce4
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 895 deletions.
41 changes: 3 additions & 38 deletions server/dash/app.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
import json
import urllib

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd

from dash import Dash, dcc, html

external_stylesheets = ['/static/reports.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
# Suppress Callback Exceptions due to multi-page Dashboard layout, some callback id may not exist initially.
app = Dash(__name__, external_stylesheets=external_stylesheets, suppress_callback_exceptions=True)

# set up default layout
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='page-content')
])

server = app.server
app.config.suppress_callback_exceptions = True

BATCH_SIZE = 10000


def batch_get_data(url):
# set up your query
if '?' in url:
batch_url = f"{url}&limit={BATCH_SIZE}"
else:
batch_url = f"{url}?limit={BATCH_SIZE}"

response_size = BATCH_SIZE
result_list = []
skip = 0

# loop through query results and add to a list (better performance!)
while (response_size == BATCH_SIZE):
batch = json.loads(urllib.request.urlopen(f"{batch_url}&skip={skip}").read())
result_list.extend(batch)
response_size = len(batch)
skip = skip + BATCH_SIZE

# convert JSON object list to dataframe
df = pd.DataFrame.from_records(result_list)

return df
131 changes: 0 additions & 131 deletions server/dash/dashboards/neighborhood.py

This file was deleted.

Loading

0 comments on commit ecf4ce4

Please sign in to comment.