예제 #1
0
if 'DEBUG' in os.environ:
    debug = os.environ['DEBUG'] == 'True'
    print(f"DEBUG environment variable present, DEBUG set to {debug}")
else:
    print("No DEBUG environment variable: defaulting to debug mode")
    debug = True

# -------- Data --------------------------
df, df_prediction = get_all_data()
df_tidy = tidy_most_recent(
    df)  # most recent date, tidy format (one column for countries)
df_tidy_table = df_tidy[['country_region',
                         'value']]  # keep only two columns for Dash DataTable

# ----------- Figures ---------------------
fig1 = make_map(df_tidy)
fig2 = make_timeplot(df, df_prediction)

# ------------ Markdown text ---------------
# maybe later we can break the text in several parts
with open("text_block.md", "r") as f:
    intro_md = f.read()

# -----------App definition-----------------------
app = dash.Dash(
    __name__,
    external_stylesheets=[
        {
            'href': 'https://unpkg.com/[email protected]/build/pure-min.css',
            'rel': 'stylesheet',
            'integrity':
예제 #2
0
# most recent date, tidy format (one column for countries)
df_tidy = tidy_most_recent(df)
df_tidy_fatalities = tidy_most_recent(df, 'death')
df_tidy_recovered = tidy_most_recent(df, 'recovered')
# keep only two columns for Dash DataTable
df_tidy_table = df_tidy[['country_region', 'value']]

df_tidy_table = df_tidy_table.reset_index()
# The indices initially displayed
initial_indices = list(df_tidy_table['value'].nlargest(2).index)
# We hardcode the second index shown as being China, to give a message of
# hope
initial_indices[-1]  = np.where(df_tidy['iso'] == 'CHN')[0][0]

# ----------- Figures ---------------------
fig1 = make_map(df_tidy, df_tidy_fatalities, df_tidy_recovered)
fig2 = make_timeplot(df, df_prediction)

# ------------ Markdown text ---------------
# maybe later we can break the text in several parts
with open("text_block.md", "r") as f:
    intro_md = f.read()


# -----------App definition-----------------------
app = dash.Dash(__name__,
    external_stylesheets = [
        {
            'href': 'https://unpkg.com/[email protected]/build/pure-min.css',
            'rel': 'stylesheet',
            'integrity': 'sha384-oAOxQR6DkCoMliIh8yFnu25d7Eq/PHS21PClpwjOTeU2jRSq11vu66rf90/cZr47',
예제 #3
0
import dash
from dash.dependencies import Input, Output, State, ClientsideFunction
import dash_table
import dash_html_components as html
import dash_core_components as dcc
from make_figures import make_map, make_timeplot
from data_input import get_data, get_mapping, tidy_most_recent

# Data
df = get_data()
mapping = get_mapping()
df_tidy = tidy_most_recent(df)
df_tidy_table = df_tidy[['country_region', 'value']]

# Figures
fig1 = make_map(df_tidy, mapping)
fig2 = make_timeplot(df)

# Markdown text
with open("text_block.md", "r") as f:
    intro_md = f.read()

app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    [
        html.Div(
            [  #row
                html.Div([dcc.Graph(id='map', figure=fig1)],
                         className="seven columns"),
예제 #4
0
df_tidy_fatalities = tidy_most_recent(df, 'death')
# keep only two columns for Dash DataTable
df_tidy_table = df_tidy[['country_region', 'value']]

df_tidy_table = df_tidy_table.reset_index()
# The indices initially displayed
initial_indices = list(df_tidy_table['value'].nlargest(3).index)
# We hardcode the second and third index shown as being China, and Korea
# to give a message of hope
# Not China so far, as it is still the top on in terms of numbers of
# total confirmed cases
#initial_indices[-1]  = np.where(df_tidy['iso'] == 'CHN')[0][0]
initial_indices[-2] = np.where(df_tidy['iso'] == 'KOR')[0][0]

# ----------- Figures ---------------------
fig1 = make_map(df_tidy, df_tidy_fatalities)
fig2 = make_timeplot(df, df_prediction, countries=['France', 'Italy', 'Spain'])
fig_store = make_timeplot(df, df_prediction)

# ------------ Markdown text ---------------
# maybe later we can break the text in several parts
with open("text_block.md", "r") as f:
    intro_md = f.read()

# -----------App definition-----------------------
app = dash.Dash(
    __name__,
    external_stylesheets=[
        {
            'href': 'https://unpkg.com/[email protected]/build/pure-min.css',
            'rel': 'stylesheet',