Beispiel #1
0
def get_summary(oid, dr, different_filter, different_field, radius_ids,
                radius_values):
    if None in radius_values:
        raise PreventUpdate
    radii = {
        id['index']: float(value)
        for id, value in zip(radius_ids, radius_values)
    }
    ra, dec = find_ztf_oid.get_coord(oid, dr)
    coord = find_ztf_oid.get_sky_coord(oid, dr)

    elements = {}
    for catalog, query in catalog_query_objects().items():
        try:
            table = query.find(ra, dec, radii[catalog])
        except (NotFound, CatalogUnavailable, KeyError):
            continue
        row = table[np.argmin(table['separation'])]
        for table_field, display_name in SUMMARY_FIELDS.items():
            try:
                value = to_str(row[table_field]).strip()
            except KeyError:
                continue
            if value == '':
                continue

            bra = ''
            cket = ''
            if table_field == '__distance' and '__redshift' in row.columns:
                cket = f' z={to_str(row["__redshift"])}'

            values = elements.setdefault(display_name, [])
            values.append(
                html.Div(
                    [
                        f'{value} ({bra}{row["separation"]:.3f}″ ',
                        html.A(
                            query.query_name,
                            href=f'#{catalog}',
                            style={
                                'border-bottom': '1px dashed',
                                'text-decoration': 'none'
                            },
                        ),
                        f'{cket})',
                    ],
                    style={'display': 'inline'},
                ))
    try:
        features = light_curve_features(oid, dr)
        el = elements.setdefault('Period, days', [])
        el.insert(
            0,
            html.Div(
                [
                    f'{features["period_0"]:.3f} (',
                    html.A(
                        'periodogram',
                        href='#features',
                        style={
                            'border-bottom': '1px dashed',
                            'text-decoration': 'none'
                        },
                    ), f' S/N={features["period_s_to_n_0"]:.3f})'
                ],
                style={'display': 'inline'},
            ))
    except NotFound:
        pass

    other_oids = neighbour_oids(different_filter, different_field)
    lcs = get_plot_data(oid, dr, other_oids=other_oids)
    mags = {}
    for obs in chain.from_iterable(lcs.values()):
        mags.setdefault(obs['filter'], []).append(obs['mag'])
    mean_mag = {fltr: np.mean(m) for fltr, m in mags.items()}
    elements['Average mag (including neighbourhood)'] = [
        f'{fltr} {mean_mag[fltr]: .2f}' for fltr in ZTF_FILTERS
        if fltr in mean_mag
    ]
    if 'zg' in mean_mag and 'zr' in mean_mag:
        elements['Average mag (including neighbourhood)'].append(
            f'(zg–zr) {mean_mag["zg"] - mean_mag["zr"]: .2f}')

    elements['Extinction'] = [f'SFD E(B-V) = {sfd.ebv(coord):.2f}']
    try:
        table = get_catalog_query('Gaia EDR3 Distances').find(ra, dec, 1)
        row = QTable(table[np.argmin(table['separation'])])
        import logging
        distance = row['__distance']
        af = bayestar(SkyCoord(coord, distance=distance))
        elements['Extinction'].append(
            f'Bayestar & Gaia EDR distance Ag = {af["zg"]:.2f} Ar = {af["zr"]:.2f} Ai = {af["zi"]:.2f}'
        )
    except (NotFound, CatalogUnavailable):
        pass

    elements['Search in brokers'] = [
        brokers.alerce_tag(ra, dec),
        brokers.antares_tag(ra, dec, oid=oid),
        brokers.fink_tag(ra, dec),
        brokers.mars_tag(ra, dec),
    ]

    elements['Coordinates'] = [
        f'Eq {find_ztf_oid.get_coord_string(oid, dr, frame=None)}',
        f'Gal {find_ztf_oid.get_coord_string(oid, dr, frame="galactic")}',
    ]

    div = html.Div(
        html.Ul(
            [
                html.Li([html.B(k), ': '] + list(joiner(', ', v)))
                for k, v in elements.items()
            ],
            style={'list-style-type': 'none'},
        ), )
    return div
Beispiel #2
0
                 "type": "bar",
                 "name": u"Montréal",
             },
         ],
         "layout": {
             "title": "Dash Data Visualization"
         },
     },
 ),
 dcc.Upload(
     id="upload-image",
     children=html.Div([
         "Drag and Drop or ",
         html.A("Select Files"),
         " of ",
         html.B("Reference Sequnece(*.gb)"),
     ]),
     style={
         "width": "100%",
         "height": "60px",
         "lineHeight": "60px",
         "borderWidth": "1px",
         "borderStyle": "dashed",
         "borderRadius": "5px",
         "textAlign": "center",
         "margin": "10px",
     },
     # Allow multiple files to be uploaded
     multiple=True,
 ),
 html.Div(id="output-image-upload"),
Beispiel #3
0
 def update_output(cnt_trees):
     return html.B('{:,}'.format(int(cnt_trees * CO2_SEQUESTRATION_YEAR_KG)), id='co2-sequestered')
Beispiel #4
0
def showDetails(name):
    """ Create tabular view of additional data

    Positional arguments:
    name -- Gene name for initialization.
    """
    if cfg.advancedDesc is not None:
        try:
            df = cfg.advancedDesc[cfg.advancedDesc['gene_ids'].str.contains(
                name)]
        except TypeError:
            df = pandas.DataFrame()
    else:
        df = pandas.DataFrame()
    columns = list(df.columns.values)
    rowCounter = 1  # Keep track of the row number to alternate coloring
    usedColumns = [
    ]  # Keeps track of preset columns already added, needed later
    usedColumns.append('gene_ids')
    content = []  # Table content to be displayed
    generalColumns = [
        'symbol', 'brief_description', 'is_obsolete',
        'computational_description', 'curator_summary', 'name'
    ]
    tableRows = []  # Will contain the table rows
    for i in generalColumns:
        if i in columns:
            if str(df.iloc[0][i]) not in ['nan', ';""']:
                tableRows.append(
                    html.Tr(children=[
                        html.Td(html.B(i.replace('_', ' ').title())),
                        html.Td(str(df.iloc[0][i]).strip())
                    ],
                            style={
                                'background-color': tableColors[rowCounter % 2]
                            }))
                usedColumns.append(i)
                rowCounter += 1
    # Go through a number of predefined columns
    if 'synonyms' in columns:
        synonyms = str(df.iloc[0]['synonyms'])
        usedColumns.append('synonyms')
        if synonyms not in ['nan', ';""']:
            tableRows.append(createDetailRow(synonyms, 'synonyms', rowCounter))
            rowCounter += 1
    if 'publications' in columns:
        usedColumns.append('publications')
        publications = str(df.iloc[0]['publications'])
        if publications not in ['nan', ';""']:
            tableRows.append(
                createDetailRow(publications, 'publications', rowCounter))
            rowCounter += 1
    if 'proteins' in columns:
        usedColumns.append('proteins')
        proteins = str(df.iloc[0]['proteins'])
        if publications not in ['nan', ';""']:
            tableRows.append(createDetailRow(proteins, 'proteins', rowCounter))
            rowCounter += 1
    if 'gene_ontology' in columns:
        usedColumns.append('gene_ontology')
        geneOntology = str(df.iloc[0]['gene_ontology'])
        if geneOntology not in ['nan', ';""']:
            tableRows.append(
                createDetailRow(geneOntology, 'gene_ontology', rowCounter))
            rowCounter += 1
    if 'pathways' in columns:
        usedColumns.append('pathways')
        pathways = str(df.iloc[0]['pathways'])
        if pathways not in ['nan', ';""']:
            tableRows.append(createDetailRow(pathways, 'pathways', rowCounter))
            rowCounter += 1
    if 'plant_ontology' in columns:
        usedColumns.append('plant_ontology')
        plantOntology = str(df.iloc[0]['plant_ontology'])
        if plantOntology not in ['nan', ';""']:
            tableRows.append(
                createDetailRow(plantOntology, 'plant_ontology', rowCounter))
            rowCounter += 1
    # Go through all remaining columns using formatting standard
    remainingColumns = [x for x in columns if x not in usedColumns]
    for i in remainingColumns:
        value = str(df.iloc[0][i])
        if value not in ['nan', ';""']:
            tableRows.append(createDetailRow(value, i, rowCounter))
            rowCounter += 1

    if len(tableRows) >= 1:
        content.append(html.Table(tableRows))
    else:
        content.append(
            html.
            B('No additional information available for the currently selected gene'
              ))
    return content
Beispiel #5
0
# app layout
app.layout = html.Div([
    html.Div([html.H2('Taxation of Sigmoidal Token Bonding Curves')]),
    html.Div([
        html.P([
            'This interactive dashboard refers to the different fundraising scenarios outlined in our ',
            html.
            A('Medium Post',
              href=
              'https://medium.com/molecule-blog/designing-different-fundraising-scenarios-with-sigmoidal-token-bonding-curves-ceafc734ed97'
              ),
            ' about Sigmoidal Token Bonding Curves. Please refer to the article for more details about the mathematical functions used for plotting.',
        ]),
        html.P([
            'Select a ',
            html.B('Token Supply'),
            ', choose a ',
            html.B('Scenario'),
            ' and use the sliders to see how the different parameters influence the curves.',
        ]),
        html.P([
            'The parameters control the following properties:',
            html.Ul([
                html.Li([html.B('a'), ': Maximum Token Price'],
                        style={'margin': '10px 5px 0 0'}),
                html.Li([html.B('b'), ': Curve Inflection Point'],
                        style={'margin': '0 5px 0 0'}),
                html.Li([html.B('c'), ': Curve Slope'],
                        style={'margin': '0 5px 0 0'}),
                html.Li([html.B('k'), ': Vertical Displacement'],
                        style={'margin': '0 5px 0 0'}),
Beispiel #6
0
                 html.P("Valor Exportado")],
                id="valor-exportado",
                className="mini_container",
            )
        ]),

        # Coluna Direita
        html.Div(
            id="coluna-direita",
            className="eight columns",
            children=[

                # Grafico de barra
                html.Div(id="grafico1",
                         children=[
                             html.B("Valor Financeira"),
                             html.Hr(),
                             dcc.Graph(id="grafico-valor-financeiro-mensal")
                         ]),

                # Grafico de pizza
                html.Div(id="grafico2",
                         children=[
                             html.B("Segmentação por VIA"),
                             html.Hr(),
                             dcc.Graph(id="grafico-via")
                         ]),

                # Tabela
                html.B("Comparação por Estado"),
                html.Hr(),
Beispiel #7
0
    dbc.Label("Description ", html_for="sell_game_desc"),
    dbc.Input(
        type="text",
        id="sell_game_desc",
        placeholder="Enter a short description",
    ),
])

layout = html.Div([
    dbc.Navbar(
        [
            dbc.Col(
                dbc.Row(
                    html.A(
                        html.B(
                            dbc.NavbarBrand("<"),
                            # html.I(className="fa fa-arrow-left"),
                            className="padding-small"),
                        href="/buy_sell_rent",
                    ),
                    justify="center"),
                width="auto"),
            dbc.Col(
                dbc.Row(
                    # html.A(
                    dbc.NavbarBrand("Sell a Game"),
                    # href="/large",
                    # ),
                    justify="center")),
            dbc.Col(
                dbc.Row(
                    html.B(
Beispiel #8
0
                  'font-weight': 'bold',
                  'padding-left': '140px',
                  'padding-top': '10px'
              },
                     children='NBA Players since 1950')
          ]),
 html.Br(),
 dcc.Tabs(id='tabs',
          children=[
              dcc.Tab(
                  label='Player Stats',
                  children=[
                      html.Div(id='filtros',
                               style={'width': '50%'},
                               children=[
                                   html.B(children='Select a player'),
                                   dcc.Dropdown(id='player-select',
                                                options=[{
                                                    'label': p,
                                                    'value': p
                                                } for p in players],
                                                multi=False)
                               ]),
                      html.Div(style={'width': '50%'}),
                      html.Div(id='photo_area',
                               style={
                                   'float': 'left',
                                   'width': '100%',
                                   'textAlign': 'center',
                                   'marginTop': '50px'
                               },
Beispiel #9
0
            "label": "Essence",
            "value": "F"
        },
        {
            "label": "Diesel",
            "value": "D"
        },
    ],
)

layout = html.Div(
    [
        # Cards row
        dbc.Row([
            dbc.Col([
                html.B("", id="selected-odrive-vehicle_type"),
                dbc.Card(
                    dbc.CardBody([
                        html.H3("Filtres"),
                        html.Br(),
                        dbc.FormGroup([
                            dbc.Label("Selectionner Type véhicule"),
                            select_odrive_vehicle_type
                        ]),
                    ]),
                    className="pretty_container",
                ),
                dbc.Card(
                    dbc.CardBody([
                        html.H3("Exporter les données"),
                        html.Br(),
    ], className="row"),

    # including some markdown text
    html.Div([
        html.Div([
                dcc.Markdown('''

                ''')
        ], className="col-md-12")
    ], className="row"),

    # box for filtering tweets
    html.Div([
        html.Div([
            html.P([
                html.B("Filter the tweets:  "),
                dcc.Input(
                    placeholder="Try 'Modi'",
                    id="tweet-filter",
                    value="")
            ]),
        ], className="col-md-12"),
        ], className="row"),
    
    # row: line chart + donut chart
    html.Div([
        html.Div([
            dcc.Graph(id="tweet-by-date")
        ], className="col-md-8"),
        html.Div([
            dcc.Graph(id="tweet-class")
Beispiel #11
0
            className="four columns",
            children=[generate_control_card()] + [
                html.Div(["initial child"],
                         id="output-clientside",
                         style={"display": "none"})
            ],
        ),
        # Right column
        html.Div(
            id="right-column",
            className="eight columns",
            children=[
                # Series Volume Heatmap
                html.Div(id="imdb_ratings_card",
                         children=[
                             html.B(""),
                             html.Hr(),
                             dcc.Graph(id="series_hm"),
                         ])
            ],
        ),
    ],
)


@app.callback(
    Output("series_hm", "figure"),
    [
        Input("title-input", "value"),
        Input("series_hm", "clickData"),
    ],
Beispiel #12
0
    def parse_contents(contents, filename):
        content_type, content_string = contents.split(',')

        decoded = base64.b64decode(content_string)
        try:
            if 'csv' in filename:
                # Assume that the user uploaded a CSV file
                df = pd.read_csv(
                    io.StringIO(decoded.decode('utf-8')))
                global original_df
                original_df=df
               
            elif 'xls' in filename:
                # Assume that the user uploaded an excel file
                df = pd.read_excel(io.BytesIO(decoded))
                original_df=df
        except Exception as e:
            print(e)
            return html.Div([
                'There was an error processing this file.'
            ])
        df=df.head(5)
        return html.Div([
            html.Div([html.A('Lets go',id='visualize',className='btn btn-primary',href='statistics'),
            html.Div(['Please note that the following are only the first 5 rows of your uploaded file: ',html.B(filename)])
            ]),
            dash_table.DataTable(
                data=df.to_dict('records'),
                columns=[{'name': i, 'id': i} for i in df.columns]
            ),
        ],style={"overflow-x": "scroll"})
Beispiel #13
0
              children=[
                  html.Div(style={"height": "90%"},
                           className="col-sm-1"),
                  dcc.Graph(style={
                      "height": "90%",
                      "margin": "auto"
                  },
                            id="graph-with-slider4",
                            className="col-10"),
                  html.Div(style={"height": "90%"},
                           className="col-sm-1")
              ]),
     html.Div(style={"font-size": "15px"},
              className="row",
              children=[
                  html.B("Select Date: ", className="col-2"),
                  dcc.Slider(id="day-slider2",
                             min=min(df.index),
                             max=len(df.Datetime),
                             value=2,
                             className="col-8"),
                  html.B(id="html-date2", className="col-2")
              ]),
     html.
     P("""The Bullet graph listed above represents real time changes in pressure drop, 
 salt passage and product flow rate. On the Flow Rate Graph the grey indicates 
 the current flow rate at reference pressure, the blue is current product flow rate, 
 and the red line is what the flow rate could be given a new membrane. For Salt Passage which is 
 affected differently by conditions and fouling, the blue once again represents real-time Salt Passage, 
 the grey is Salt Passage as reference temp but otherwise current conditions and the red line is salt 
 passage with a new membrane at the current conditions. For Differential Pressure or Pressure Drop, the blue is real-
                      generate_control_card()] + [
                          html.Div(["initial child"],
                                   id="output-clientside",
                                   style={"display": "none"})
                      ],
        ),
        # Right column
        html.Div(
            id="right-column",
            className="eight columns",
            children=[
                # Barrels Heatmap
                html.Div(
                    id="barrel_heatmap_card",  #todo update
                    children=[
                        html.B("Barrels (# of BusObservations)"),
                        html.Hr(),
                        dcc.Graph(id="barrel_heatmap"),  #todo update
                    ],
                ),

                # Patient Wait time by Department
                html.Div(
                    id="shipment_heatmap_card",
                    children=[
                        html.B("Shipments (# of Buses)"),
                        html.Hr(),
                        dcc.Graph(id="shipment_heatmap"),  #todo update
                    ],
                ),
            ],
Beispiel #15
0
def generate_table_row_helper(department):
    """Helper function.

    :param: department (string): Name of department.
    :return: Table row.
    """
    return generate_table_row(
        department,
        {},
        {
            "id": department + "_department",
            "children": html.B(department)
        },
        {
            "id":
            department + "wait_time",
            "children":
            dcc.Graph(
                id=department + "_wait_time_graph",
                style={
                    "height": "100%",
                    "width": "100%"
                },
                className="wait_time_graph",
                config={
                    "staticPlot": False,
                    "editable": False,
                    "displayModeBar": False,
                },
                figure={
                    "layout":
                    dict(
                        margin=dict(l=0, r=0, b=0, t=0, pad=0),
                        xaxis=dict(
                            showgrid=False,
                            showline=False,
                            showticklabels=False,
                            zeroline=False,
                        ),
                        yaxis=dict(
                            showgrid=False,
                            showline=False,
                            showticklabels=False,
                            zeroline=False,
                        ),
                        paper_bgcolor="rgba(0,0,0,0)",
                        plot_bgcolor="rgba(0,0,0,0)",
                    )
                },
            ),
        },
        {
            "id":
            department + "_patient_score",
            "children":
            dcc.Graph(
                id=department + "_score_graph",
                style={
                    "height": "100%",
                    "width": "100%"
                },
                className="patient_score_graph",
                config={
                    "staticPlot": False,
                    "editable": False,
                    "displayModeBar": False,
                },
                figure={
                    "layout":
                    dict(
                        margin=dict(l=0, r=0, b=0, t=0, pad=0),
                        xaxis=dict(
                            showgrid=False,
                            showline=False,
                            showticklabels=False,
                            zeroline=False,
                        ),
                        yaxis=dict(
                            showgrid=False,
                            showline=False,
                            showticklabels=False,
                            zeroline=False,
                        ),
                        paper_bgcolor="rgba(0,0,0,0)",
                        plot_bgcolor="rgba(0,0,0,0)",
                    )
                },
            ),
        },
    )
def update_data(region_filter, start_date, end_date, btn_cloud):
    df2 = df.copy()
    df2 = df2[df2['regpark'] == region_filter]
    df2 = df2[df2['TotalParkings'] != 0]

    start_date_converted = pd.to_datetime(start_date).date()
    end_date_converted = pd.to_datetime(end_date).date()

    # Apply Date Range
    date_mask = (df2.index.date >= start_date_converted) & (df2.index.date <=
                                                            end_date_converted)
    df2 = df2.loc[date_mask]

    # GroupBy Hour
    df3 = df2.copy()
    df3 = df3.groupby(by=['hour']).mean()
    df3_dif = []
    is_first = True
    for index in range(0, len(df3)):
        if not is_first:
            dif_math = round(
                (100 - ((df3.iloc[index - 1][3] * 100) / df3.iloc[index][3])),
                2)
            res = '+'
            if dif_math < 0:
                res = ""
            df3_dif.append(res + str(dif_math) + "%")
        else:
            is_first = False
            df3_dif.append("0%")
    df3['dif'] = df3_dif

    # Apply Legend
    adv1_mainchart = px.line(df3,
                             x=df3.index,
                             y="TotalParkings",
                             custom_data=['dif'],
                             height=250)
    adv1_mainchart.update_layout(
        title="Total Parkings grouped by Hour of Day",
        xaxis_title="Hour",
        yaxis_title="Total Parkings",
    )
    adv1_mainchart.update_traces(hoverinfo='skip',
                                 mode='lines+markers',
                                 hovertemplate='Hour: <b>%{x}</b><br>' +
                                 'Total Parkings: <b>%{y}</b><br><br>' +
                                 'Difference: <b>%{customdata[0]}</b>' +
                                 '<extra></extra>')

    # Only Rain
    df4 = df2.copy()
    df_rain0 = df4[df4['isRain'] == 0].groupby(by=['hour']).mean()
    df_rain1 = df4[df4['isRain'] == 1].groupby(by=['hour']).mean()

    adv2_mainchart = go.Figure()
    adv2_mainchart.add_trace(
        go.Scatter(x=df_rain0.index,
                   y=df_rain0["TotalParkings"],
                   mode='lines+markers',
                   name='False'))
    adv2_mainchart.add_trace(
        go.Scatter(x=df_rain1.index,
                   y=df_rain1["TotalParkings"],
                   mode='lines+markers',
                   name='True'))
    adv2_mainchart.update_layout(
        title="Total Parkings grouped by Hour of Day (isRain)",
        xaxis_title="Hour",
        yaxis_title="Total Parkings",
        legend_title='isRain',
    )
    adv2_mainchart.layout.update(
        height=250,
        hovermode='x unified',
        margin=dict(l=20, r=20, t=40, b=5),
    )

    # Only Holiday
    df5 = df2.copy()
    df_holy0 = df5[df5['isHoliday'] == 0].groupby(by=['hour']).mean()
    df_holy1 = df5[df5['isHoliday'] == 1].groupby(by=['hour']).mean()
    adv3_mainchart = go.Figure()
    adv3_mainchart.add_trace(
        go.Scatter(x=df_holy0.index,
                   y=df_holy0["TotalParkings"],
                   mode='lines+markers',
                   name='False'))
    adv3_mainchart.add_trace(
        go.Scatter(x=df_holy1.index,
                   y=df_holy1["TotalParkings"],
                   mode='lines+markers',
                   name='True'))
    adv3_mainchart.update_layout(
        title="Total Parkings grouped by Hour of Day (Holiday)",
        xaxis_title="Hour",
        yaxis_title="Total Parkings",
        legend_title="isHoliday",
    )
    adv3_mainchart.layout.update(
        height=250,
        hovermode='x unified',
        margin=dict(l=20, r=20, t=40, b=5),
    )

    # Only WeekDays
    df5 = df2.copy()
    df_week0 = df5[df5['isWeekday'] == 0].groupby(by=['hour']).mean()
    df_week1 = df5[df5['isWeekday'] == 1].groupby(by=['hour']).mean()
    adv4_mainchart = go.Figure()
    adv4_mainchart.add_trace(
        go.Scatter(x=df_week0.index,
                   y=df_week0["TotalParkings"],
                   mode='lines+markers',
                   name='False'))
    adv4_mainchart.add_trace(
        go.Scatter(x=df_week1.index,
                   y=df_week1["TotalParkings"],
                   mode='lines+markers',
                   name='True'))
    adv4_mainchart.update_layout(
        title="Total Parkings grouped by Hour of Day (Week Days)",
        xaxis_title="Hour",
        yaxis_title="Total Parkings",
        legend_title="isWeekday",
    )
    adv4_mainchart.layout.update(
        height=250,
        hovermode='x unified',
        margin=dict(l=20, r=20, t=40, b=5),
    )

    # Total Records
    total_records = len(df2)

    # Statistics
    statistics = pd.DataFrame({
        "Statistic": [
            'Total Records (H)', 'Total Records (D)', '',
            'Rainy Weather Records', 'Sunny Weather Records', '',
            'Total Holidays', 'Total Non-Holidays'
        ],
        "Value": [
            str(total_records) + ' hours',
            str(round(total_records / len(df3), 0)) + ' days',
            '',
            str(len(df2[df2['isRain'] == 0])) + ' hours',
            str(len(df2[df2['isRain'] == 1])) + ' hours',
            '',
            str(round(len(df2[df2['isHoliday'] == 1]) / len(df3), 0)) +
            ' day(s)',
            str(round(len(df2[df2['isHoliday'] == 0]) / len(df3), 0)) +
            ' day(s)',
        ]
    })

    adv1_table_statistics = dbc.Table.from_dataframe(statistics,
                                                     bordered=True,
                                                     dark=True,
                                                     hover=True,
                                                     responsive=True,
                                                     striped=True)

    stats_label0 = [
        'The highest daily flow occurs at ', ' hours',
        ' and has an average flow ', '% higher', ' than the general average'
    ]
    stats_label0_v = round(
        ((df3['TotalParkings'].max() * 100) / df3['TotalParkings'].mean()) -
        100, 2)
    stats_label0_h = df3[df3['TotalParkings'] ==
                         df3['TotalParkings'].max()].index.values[0]

    stats_label1 = [
        'The lowest daily flow occurs at ', ' hours',
        ' and has an average flow ', '% lower', ' than the general average'
    ]
    stats_label1_v = round(
        (df3['TotalParkings'].min() * 100) / df3['TotalParkings'].mean(), 2)
    stats_label1_h = df3[df3['TotalParkings'] ==
                         df3['TotalParkings'].min()].index.values[0]

    stats_label2 = [
        'Rainy', 'Sunny', ' hours have an average of ', '% more flow than ',
        ' hours'
    ]
    stats_label2_v = '-'
    if len(df_rain0) > 0 and len(df_rain1) > 0:
        if df_rain0['TotalParkings'].mean() > df_rain1['TotalParkings'].mean():
            stats_label2 = [
                'Sunny', 'Rainy', ' days have an average of ',
                '% more flow than ', ' days'
            ]
            stats_label2_v = round(
                df_rain1['TotalParkings'].mean() * 100 /
                df_rain0['TotalParkings'].mean(), 2)
        else:
            stats_label2_v = round(
                df_rain0['TotalParkings'].mean() * 100 /
                df_rain1['TotalParkings'].mean(), 2)

    stats_label3 = [
        'Holidays', 'Non-Holidays', ' have an average of ', '% more flow than '
    ]
    stats_label3_v = '-'
    if len(df_holy0) > 0 and len(df_holy1) > 0:
        if df_holy0['TotalParkings'].mean() > df_holy1['TotalParkings'].mean():
            stats_label3 = [
                'Non-Holidays', 'Holidays', ' have an average of ',
                '% more flow than '
            ]
            stats_label3_v = round(
                df_holy1['TotalParkings'].mean() * 100 /
                df_holy0['TotalParkings'].mean(), 2)
        else:
            stats_label3_v = round(
                df_holy0['TotalParkings'].mean() * 100 /
                df_holy1['TotalParkings'].mean(), 2)

    stats_label4 = [
        'Weekdays', 'Weekend days', ' have an average of ', '% more flow than '
    ]
    stats_label4_v = '-'
    if len(df_week0) > 0 and len(df_week1) > 0:
        if df_week0['TotalParkings'].mean() > df_week1['TotalParkings'].mean():
            stats_label4 = [
                'Weekend days', 'Weekdays', ' have an average of ',
                '% more flow than '
            ]
            stats_label4_v = round(
                df_week1['TotalParkings'].mean() * 100 /
                df_week0['TotalParkings'].mean(), 2)
        else:
            stats_label4_v = round(
                df_week0['TotalParkings'].mean() * 100 /
                df_week1['TotalParkings'].mean(), 2)

    adv1_stats_div = html.Div([
        html.Br(),
        html.Br(),
        html.H4('Parking Characteristics:'),
        html.Br(),
        html.Div([
            stats_label0[0],
            html.B([stats_label0_h, stats_label0[1]]), stats_label0[2],
            html.B([stats_label0_v, stats_label0[3]]), stats_label0[4], '.'
        ]),
        html.Br(),
        html.Div([
            stats_label1[0],
            html.B([stats_label1_h, stats_label1[1]]), stats_label1[2],
            html.B([stats_label1_v, stats_label1[3]]), stats_label1[4], '.'
        ]),
        html.Br(),
        html.Div([
            html.B([stats_label2[0]]), stats_label2[2],
            html.B([stats_label2_v]), stats_label2[3],
            html.B([stats_label2[1]]), stats_label2[4], '.'
        ]),
        html.Br(),
        html.Div([
            html.B([stats_label3[0]]), stats_label3[2],
            html.B([stats_label3_v]), stats_label3[3],
            html.B([stats_label3[1]]), '.'
        ]),
        html.Br(),
        html.Div([
            html.B([stats_label4[0]]), stats_label4[2],
            html.B([stats_label4_v]), stats_label4[3],
            html.B([stats_label4[1]]), '.'
        ]),
        html.Br(),
    ])

    card_content_1 = [
        dbc.CardHeader("Daily Flow"),
        dbc.CardBody([
            html.H6([
                html.B(["+", stats_label0_v, "%"]), " at ",
                html.B([stats_label0_h, stats_label0[1]]), " (Highest)"
            ],
                    className="card-title"),
            html.H6([
                html.B(["-", stats_label1_v, "%"]), " at ",
                html.B([stats_label1_h, stats_label1[1]]), " (Lowest)"
            ],
                    className="card-title"),
        ]),
    ]

    card_content_2 = [
        dbc.CardHeader("Weather Impact"),
        dbc.CardBody([
            html.H5([
                html.B(["+", stats_label2_v, "%"]), " in ",
                html.B([stats_label2[0], " Hours"])
            ],
                    className="card-title")
        ]),
    ]

    card_content_3 = [
        dbc.CardHeader("Holidays Impact"),
        dbc.CardBody([
            html.H5([
                html.B(["+", stats_label3_v, "%"]), " in ",
                html.B([stats_label3[0]])
            ],
                    className="card-title")
        ]),
    ]

    card_content_4 = [
        dbc.CardHeader("Weekdays Impact"),
        dbc.CardBody([
            html.H5([
                html.B(["+", stats_label4_v, "%"]), " in ",
                html.B([stats_label4[0]])
            ],
                    className="card-title")
        ]),
    ]

    adv1_stats_div = html.Div([
        dbc.Card(card_content_1, color="info", inverse=True),
        html.Br(),
        dbc.Card(card_content_2, color="info", inverse=True),
        html.Br(),
        dbc.Card(card_content_3, color="info", inverse=True),
        html.Br(),
        dbc.Card(card_content_4, color="info", inverse=True),
    ])

    # Check if UpdateSync Cloud Button has fired
    changed_id = [p['prop_id'] for p in callback_context.triggered][0]
    if 'adv1_btn_cloud' in changed_id:
        print("---------")
        db = firestore.client()

        if region_filter == 'IPB - Cantina':
            parking_ref = db.collection(u'Parkings').document(u'IPB')
        else:
            parking_ref = db.collection(u'Parkings').document(u'Continente')

        if stats_label2[0] == "Sunny":
            isRain = round((100 - stats_label2_v) / 100, 2)
        else:
            isRain = round((100 + stats_label2_v) / 100, 2)

        if stats_label3[0] == "Non-Holidays":
            isHoliday = round((100 - stats_label3_v) / 100, 2)
        else:
            isHoliday = round((100 + stats_label3_v) / 100, 2)

        if stats_label4[0] == "Weekdays":
            isWeekend = round((100 - stats_label4_v) / 100, 2)
        else:
            isWeekend = round((100 + stats_label4_v) / 100, 2)

        parking_ref.set(
            {
                u'statistics': {
                    u'isRainy': isRain,
                    u'isHoliday': isHoliday,
                    u'isWeekend': isWeekend,
                }
            },
            merge=True)
        print("Finished")
        return no_update

    return (adv1_mainchart, adv2_mainchart, adv3_mainchart, adv4_mainchart,
            adv1_table_statistics, adv1_stats_div)
Beispiel #17
0
def generate_patient_table(figure_list, departments, wait_time_xrange,
                           score_xrange):
    """
    :param score_xrange: score plot xrange [min, max].
    :param wait_time_xrange: wait time plot xrange [min, max].
    :param figure_list:  A list of figures from current selected metrix.
    :param departments:  List of departments for making table.
    :return: Patient table.
    """
    # header_row
    header = [
        generate_table_row(
            "header",
            {"height": "50px"},
            {
                "id": "header_department",
                "children": html.B("Department")
            },
            {
                "id": "header_wait_time_min",
                "children": html.B("Wait Time Minutes")
            },
            {
                "id": "header_care_score",
                "children": html.B("Care Score")
            },
        )
    ]

    # department_row
    rows = [
        generate_table_row_helper(department) for department in departments
    ]
    # empty_row
    empty_departments = [
        item for item in all_departments if item not in departments
    ]
    empty_rows = [
        generate_table_row_helper(department)
        for department in empty_departments
    ]

    # fill figures into row contents and hide empty rows
    for ind, department in enumerate(departments):
        rows[ind].children[1].children.figure = figure_list[ind]
        rows[ind].children[2].children.figure = figure_list[ind +
                                                            len(departments)]
    for row in empty_rows[1:]:
        row.style = {"display": "none"}

    # convert empty row[0] to axis row
    empty_rows[0].children[0].children = html.B("graph_ax",
                                                style={"visibility": "hidden"})

    empty_rows[0].children[1].children.figure["layout"].update(
        dict(margin=dict(t=-70, b=50, l=0, r=0, pad=0)))

    empty_rows[0].children[1].children.config["staticPlot"] = True

    empty_rows[0].children[1].children.figure["layout"]["xaxis"].update(
        dict(
            showline=True,
            showticklabels=True,
            tick0=0,
            dtick=20,
            range=wait_time_xrange,
        ))
    empty_rows[0].children[2].children.figure["layout"].update(
        dict(margin=dict(t=-70, b=50, l=0, r=0, pad=0)))

    empty_rows[0].children[2].children.config["staticPlot"] = True

    empty_rows[0].children[2].children.figure["layout"]["xaxis"].update(
        dict(showline=True,
             showticklabels=True,
             tick0=0,
             dtick=0.5,
             range=score_xrange))

    header.extend(rows)
    header.extend(empty_rows)
    return header
def render_main_section_part1(camp, profile):
    mr, profile_df, params, report = get_model_result(camp, profile)

    prevalence = prevalence_all_table(report)
    peak_critical_care_demand = prevalence[
        prevalence['Outcome'] ==
        'Critical Care Demand']['Peak Number IQR'].iloc[0]

    prevalence_age = prevalence_age_table(report).reset_index()
    prevalence_age = prevalence_age.rename(columns={"level_1": "Age"})

    return [
        dcc.Markdown(
            textwrap.dedent(f'''
         ## 2. Base COVID-19 Epidemic Trajectory for profile "{profile}"

         Following parameters were used during modelling 
         ''')),
        dbc.Row([
            dbc.Col([
                html.Div(html.B(f'{profile} profile details')),
                dbc.Table.from_dataframe(render_profile_df(profile_df, params),
                                         bordered=True,
                                         hover=True,
                                         striped=True),
            ],
                    width=4)
        ]),
        dcc.Markdown(
            textwrap.dedent(f'''
        Here we assume the epidemic spreads through the camp without any non-pharmaceutical intervention in place and the peak incidence 
        (number of cases), the timing and the cumulative case counts are all presented by interquartile range values (25%-75% quantiles)
        and they respectively represent the optimistic and pessimistic estimates of the spread of the virus given the uncertainty 
        in parameters estimated from epidemiological studies. In the simulations, we explore a range of reproduction numbers, 
        pre-symptomatic duration, rate of recovery, rate of severe infections and death rates based on estimates in the European 
        and Asian settings to nearly what is estimated from a high population density location like a cruise ship. 
        ''')),
        dbc.Row([
            dbc.Col([
                html.Div(
                    html.
                    B(f'Peak day and peak number for prevalences of different disease states of COVID-19'
                      )),
                dbc.Table.from_dataframe(
                    prevalence, striped=True, bordered=True, hover=True)
            ],
                    width=4)
        ]),
        dcc.Markdown(
            textwrap.dedent(f'''
        The death estimate is based on the fact the patients require critical care will receive appropriate treatment from the 
        {params.icu_count} ICU beds that are currently available in {params.camp}. The prevalence of death could be as 
        high as the peak critical care demand ({peak_critical_care_demand}) if camp residents are denied treatment at the 
        ICU facility on the island.  
        ''')),
        dbc.Row([
            dbc.Col([
                html.Div([
                    html.
                    B(f'Peak day and peak prevalences of different disease states of COVID-19 breakdown by age'
                      ),
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                html.B(f'Incident Cases'),
                dbc.Table.from_dataframe(
                    prevalence_age[prevalence_age['level_0'] ==
                                   'Incident Cases'].drop(columns=['level_0']),
                    striped=True,
                    bordered=True,
                    hover=True)
            ],
                    width=4),
            dbc.Col([
                html.B(f'Hospital Demand'),
                dbc.Table.from_dataframe(prevalence_age[
                    prevalence_age['level_0'] == 'Hospital Demand'].drop(
                        columns=['level_0']),
                                         striped=True,
                                         bordered=True,
                                         hover=True)
            ],
                    width=4),
            dbc.Col([
                html.B(f'Critical Demand'),
                dbc.Table.from_dataframe(prevalence_age[
                    prevalence_age['level_0'] == 'Critical Demand'].drop(
                        columns=['level_0']),
                                         striped=True,
                                         bordered=True,
                                         hover=True)
            ],
                    width=4),
        ])
    ]
Beispiel #19
0
nav_bar = html.Nav(
    className='menu',
    style={
        # "background-color": "#6699ff",
        "background-color": "#3366cc",
        "height": "10%"
    },
    children=[
        html.Ul(
            children=[
                html.Li(
                    className='',
                    children=[
                        html.B(
                            "Global Terrorism Database - Top 5 Group",
                            style={
                                "font-size": "30px",
                            }
                        )
                    ],
                    style={
                        "display": "inline-block",
                        "vertical-align": "middle",
                        "padding-top": "10px",
                        "padding-left": "20px",
                    }
                ),
                html.Li(
                    className='',
                    children=[
                        html.A(
                            id='github_link',
def render_main_section_part2(camp, profile):
    mr, profile_df, params, report = get_model_result(camp, profile)

    t_sim = params.control_dict['t_sim']
    cumulative_all = cumulative_all_table(report, params.population)
    cumulative_age = cumulative_age_table(report).reset_index()
    cumulative_age = cumulative_age.rename(columns={"level_1": "Age"})

    return [
        dbc.Row([
            dbc.Col([
                html.
                B(f'Cumulative case counts of different disease states of COVID-19 spanning {t_sim} days'
                  ),
                dbc.Table.from_dataframe(
                    cumulative_all, striped=True, bordered=True, hover=True)
            ],
                    width=4),
        ]),
        dcc.Markdown(
            textwrap.dedent(
                f'''Table above show cumulative counts, hospital-person days can be translated into
          projected medical costs or time required from medical staff if the medical cost and time taken is known for 
          treating one patient for a day.''')),
        dbc.Row([
            dbc.Col([
                html.Div([
                    html.
                    B(f'Cumulative case counts of different disease states of COVID-19 breakdown by age'
                      ),
                ])
            ])
        ]),
        dbc.Row([
            dbc.Col([
                html.B(f'Symptomatic Cases'),
                dbc.Table.from_dataframe(cumulative_age[
                    cumulative_age['level_0'] == 'Symptomatic Cases'].drop(
                        columns=['level_0']),
                                         striped=True,
                                         bordered=True,
                                         hover=True)
            ],
                    width=4),
            dbc.Col([
                html.B(f'Hospital Person-Days'),
                dbc.Table.from_dataframe(cumulative_age[
                    cumulative_age['level_0'] == 'Hospital Person-Days'].drop(
                        columns=['level_0']),
                                         striped=True,
                                         bordered=True,
                                         hover=True)
            ],
                    width=4)
        ]),
        dbc.Row([
            dbc.Col([
                html.B(f'Critical Person-days'),
                dbc.Table.from_dataframe(cumulative_age[
                    cumulative_age['level_0'] == 'Critical Person-days'].drop(
                        columns=['level_0']),
                                         striped=True,
                                         bordered=True,
                                         hover=True)
            ],
                    width=4),
            dbc.Col([
                html.B(f'Deaths'),
                dbc.Table.from_dataframe(
                    cumulative_age[cumulative_age['level_0'] == 'Deaths'].drop(
                        columns=['level_0']),
                    striped=True,
                    bordered=True,
                    hover=True)
            ],
                    width=4)
        ])
    ]
Beispiel #21
0
def createDetailRow(content, name, rowNumber):
    """ Returns a single row for the details table

    Positional arguments:
    content -- The attribute data as String.
    name -- Name for the attribute.
    rowNumber -- Used for odd/even coloring.
    """
    # Check subtable information
    try:
        headerLine = [cfg.subTables['column_id'].str.contains(name)]
    except (TypeError, AttributeError, KeyError):
        headerLine = None
    try:
        headers = str(headerLine.iloc[0]['columns']).split(';')
    except (TypeError, AttributeError, KeyError):
        headers = None
    if content == None or name == None:
        return None
    subRows = []  # Holds elements for multivalue attributes
    subTable = []  # Holds elements for subtables
    if headers != None:  # We have subtable information, so try and create one
        headerRow = []
        for k in headers:  # Build table header line
            headerRow.append(html.Th(k))
        subTable.append(html.Tr(children=headerRow))
        tableError = False
        for i in content.split(
                ';'):  # Build subtable rows dictated by ; delimitation
            subSubRow = []
            if len(i.split(',')) == len(headers):
                for j in i.split(
                        ','
                ):  # Build subtable columns dictated by , delimitation
                    if j != '':
                        if j[0] == '?':
                            subSubRow.append(
                                html.Td(
                                    html.A(j[1:],
                                           href=j[1:].strip(),
                                           target='_blank')))
                        else:
                            subSubRow.append(html.Td(j.strip()))
                subTable.append(html.Tr(children=subSubRow))
            else:
                tableError = True
        if tableError == True:  # Column numbers didn't match, default display
            print(
                'Warning: Number of columns specified in subtable file do not match number of columns in description file'
            )
            subTable = []
            for l in content.split(';'):
                if l != '':
                    if l[0] == '?':  # Create hyperlinks
                        subRows.append(
                            html.Tr(
                                html.Td(
                                    html.A(l[1:],
                                           href=l[1:].strip(),
                                           target='_blank'))))
                    else:
                        subRows.append(html.Tr(html.Td(l.strip())))
    else:  # No subtable information
        for i in content.split(';'):
            if i != '':
                if i[0] == '?':
                    subRows.append(
                        html.Tr(
                            html.Td(
                                html.A(i[1:],
                                       href=i[1:].strip(),
                                       target='_blank'))))
                else:
                    subRows.append(html.Tr(html.Td(i.strip())))
    if len(subRows
           ) > 5:  # Hide values in details element if more than 5 values
        tableRow = html.Tr(children=[
            html.Td(html.B(name.replace('_', ' ').title())),
            html.Td(
                html.Details(title=str(len(subRows)) + ' values',
                             children=[
                                 html.Summary(str(len(subRows)) + ' values'),
                                 html.Table(children=subRows)
                             ]))
        ],
                           style={
                               'background-color': tableColors[rowNumber % 2]
                           })
    else:
        tableRow = html.Tr(
            children=[
                html.Td(html.B(name.replace('_', ' ').title())),
                html.Td(html.Table(children=subRows))
            ],
            style={'background-color': tableColors[rowNumber % 2]})
    if len(subTable) > 0:
        return html.Tr(children=[
            html.Td(html.B(name.replace('_', ' ').title())),
            html.Td(html.Table(children=subTable))
        ],
                       style={'background-color': tableColors[rowNumber % 2]})
    else:
        return tableRow
Beispiel #22
0
    def create_layouts(self):
        self.page_content = html.Div([
            dcc.Location(id='url', refresh=False),
            html.Div(id='page-content')
        ])

        link_bar_dict = {'Aggregated': '/aggregated'}

        markout_cols = self._util_func.flatten_list_of_lists([
            'Date', 'exec not', 'not cur', 'side',
            [
                str(x) + constants.markout_unit_of_measure
                for x in constants.markout_windows
            ], 'markout'
        ])

        # Main page for detailed analysing of (eg. over the course of a few days)

        ########################################################################################################################

        # Secondary page for analysing aggregated statistics over long periods of time, eg. who is the best broker?

        self.pages['aggregated'] = html.Div(
            [
                self.header_bar('FX: Aggregated - Trader Analysis'),
                self.link_bar(link_bar_dict),
                self.width_cel(html.B("Status: ok", id='aggregated-status'),
                               margin_left=5),
                self.horizontal_bar(),

                # dropdown selection boxes
                html.Div([
                    self.drop_down(
                        caption='Market Data',
                        id='market-data-val',
                        prefix_id='aggregated',
                        drop_down_values=self.available_market_data),
                ]),
                self.horizontal_bar(),
                self.uploadbox(caption='Aggregated trade CSV',
                               id='csv-uploadbox',
                               prefix_id='aggregated'),
                self.horizontal_bar(),
                self.button(caption='Calculate',
                            id='calculation-button',
                            prefix_id='aggregated'),

                # , msg_id='aggregated-status'),
                self.horizontal_bar(),

                # self.date_picker_range(caption='Start/Finish Dates', id='aggregated-date-val', offset=[-7,-1]),
                self.plot(caption='Aggregated Trader: Summary',
                          id=[
                              'execution-by-ticker-bar-plot',
                              'execution-by-venue-bar-plot',
                              'execution-by-broker_id-bar-plot'
                          ],
                          prefix_id='aggregated'),
                self.horizontal_bar(),
                self.plot(caption='Aggregated Trader: Timeline',
                          id='execution-by-ticker-timeline-plot',
                          prefix_id='aggregated'),
                self.horizontal_bar(),
                self.plot(caption='Aggregated Trader: PDF fit (' +
                          constants.reporting_currency + ' notional)',
                          id=[
                              'execution-by-ticker-dist-plot',
                              'execution-by-broker_id-dist-plot',
                              'execution-by-venue-dist-plot'
                          ],
                          prefix_id='aggregated'),
                self.horizontal_bar(),
                self.table(
                    caption='Executions: Markout Table',
                    id='execution-table',
                    prefix_id='aggregated',
                    columns=markout_cols,
                    downloadplot_caption=['Markout CSV', 'Full execution CSV'],
                    downloadplot_tag=[
                        'execution-markout-download-link',
                        'execution-full-download-link'
                    ],
                    download_file=[
                        'download_execution_markout.csv',
                        'download_execution_full.csv'
                    ]),
            ],
            style={
                'width': '1000px',
                'marginRight': 'auto',
                'marginLeft': 'auto'
            })

        # ID flags
        self.id_flags = {

            # aggregated trader page
            'aggregated_bar_trade_order': {
                'execution-by-ticker': 'bar_trade_df_by/mean/ticker',
                'execution-by-broker_id': 'bar_trade_df_by/mean/broker_id',
                'execution-by-venue': 'bar_trade_df_by/mean/venue'
            },
            'aggregated_timeline_trade_order': {
                'execution-by-ticker': 'timeline_trade_df_by/mean_date/ticker'
            },
            'aggregated_dist_trade_order': {
                'execution-by-ticker': 'dist_trade_df_by/pdf/ticker',
                'execution-by-broker_id': 'dist_trade_df_by/pdf/broker_id',
                'execution-by-venue': 'dist_trade_df_by/pdf/venue'
            },
            'aggregated_table_trade_order': {
                'execution': 'table_trade_df_markout_by_all'
            },
            'aggregated_download_link_trade_order': {
                'execution-full': 'trade_df',
                'execution-markout': 'table_trade_df_markout_by_all'
            },
        }
Beispiel #23
0
                            #
                            # ),

                            dbc.Row(
                                [
                                    dbc.Col(
                                        dbc.Jumbotron(
                                            [
                                                html.H6(

                                                    id='publication-name',
                                                    className='text-muted',
                                                    style={"font-variant": 'small-caps'}
                                                ),
                                                html.H1(
                                                    html.B(id='headline'),
                                                    className="display-3",

                                                ),

                                                html.P(

                                                    className="lead",
                                                    id='description'
                                                ),
                                                # html.Hr(className="my-2"),
                                                dbc.Card([dbc.CardImg(id='image-url')], style={"margin": "1.5vh 3.37vh 1.5vh 0.57vh"}),
                                                html.P(className='article-content', id='article-content'),

                                            ],
                                            style={"padding": "20px"},
Beispiel #24
0
modeBarButtonsToRemove = [
    'lasso2d', 'select2d', 'hoverClosestGeo', 'pan2d', 'select2d', 'lasso2d',
    'autoScale2d', 'toggleSpikelines', 'hoverClosestCartesian',
    'hoverCompareCartesian'
]

modeBarButtonsToAdd = [
    'drawline', 'drawopenpath', 'drawcircle', 'drawrect', 'eraseshape'
]

app.layout = dbc.Container([
    html.Br(),
    html.Br(),
    dbc.Row([
        dbc.Col([
            html.H2(html.B('My Gold Dashboard'), style={'color': '#A29061'}),
        ]),
    ],
            style={'text-align': 'center'}),
    dbc.Row([
        dbc.Col(lg=1),
        dbc.Col([
            html.Div(id='slider_output_quarter'),
            dcc.Slider(id='quarter',
                       included=False,
                       marks={
                           i: str(periods[i])
                           for i in range(0,
                                          len(periods) - 1, 16)
                       },
                       min=0,
Beispiel #25
0
map_div = html.Div(html.Div(dcc.Graph(id='graph-map'), className='my-auto'),
                   className='shadow bg-light rounded')

bar_chart_div = html.Div(dcc.Graph(id='bar-chart'),
                         id='bar-chart-div',
                         className='shadow bg-light rounded')

card_title = [
    'Total Crimes', 'Average Crimes', 'Top Crime', 'Top Criminal Area',
    'Percentage Arrests'
]
card_div = html.Div([
    html.Div([
        html.Div(title, className='text-center', style={'fontSize': '14px'}),
        html.Div(html.B(id='card-{}'.format(n + 1)),
                 className='text-center',
                 style={'fontSize': '24px'})
    ],
             className='shadow bg-light rounded mb-4 mt-4')
    for n, title in enumerate(card_title)
],
                    className='mr-2')

app = dash.Dash(__name__, external_stylesheets=external_css)
server = app.server

app.layout = html.Div([
    html.Div(html.H1('Crime in Chicago'),
             className='row justify-content-center',
             style={'color': css_color_light}),
Beispiel #26
0
# Dash layout
app.layout = dbc.Container([
    dbc.Row(html.H3('  ')),
    #dbc.Row(html.H5('ATP Explorer')),
    dbc.Row(html.H5('Top Player Rank and Rank Points  by Year')),
    dbc.Row(
        html.P('''
            Select a year and number of top players and see how their rank and ranking points changed over this time period.
            Below see the matches played between these top players.
        ''')),
    dbc.Row([
        dbc.Col(top_player_card, width=12),
    ]),
    dbc.Row([
        dbc.Col([
            html.B("Rank and Ranking Points"),
            html.Hr(),
            dcc.Loading(
                dcc.Graph(id='ranking-graph',
                          #config={"displayModeBar":False}
                          #responsive=True
                          ))
        ]  #, style={"height": "90vh"}
                )
    ]),
    dbc.Row([
        dbc.Col(
            id="player--heatmap",
            children=[
                html.B("Player Match Results"),
                html.P("Click on a square to see the match details"),
Beispiel #27
0
 def update_output(value):
     return html.Span(
         children=[
             'Planted ', html.B(children=[value]), ' trees'
         ]
     )
Beispiel #28
0
               generate_control_card()] + [
                   html.Div(["initial child"],
                            id="output-clientside",
                            style={"display": "none"})
               ],
 ),
 # Right column
 html.Div(
     id="right-column",
     className="eight columns",
     children=[
         # Patient Volume Heatmap
         html.Div(
             id="patient_volume_card",
             children=[
                 html.B("Patient Volume"),
                 html.Hr(),
                 dcc.Graph(id="patient_volume_hm"),
             ],
         ),
         # Patient Wait time by Department
         html.Div(
             id="wait_time_card",
             children=[
                 html.B("Patient Wait Time and Satisfactory Scores"),
                 html.Hr(),
                 html.Div(id="wait_time_table",
                          children=initialize_table()),
             ],
         ),
     ],
Beispiel #29
0
 def update_output(cnt_trees):
     return html.B('{:,}'.format(int(self.bus_df_co2['co2_per_year'].sum())), id='co2-produced')
Beispiel #30
0
 id="right-column1",
 className="nine columns",
 children=[
     
     html.Div(
             id="Figure1",
             children=[dcc.Loading(
                 id="loading-1",
                 type="default",
                 fullscreen=False,
                 children=[
                     # Plot of model forecast
                     html.Div(
                         id="model_forecasts1",
                         children=[
                             html.B("Model Forecasts. Exponential and Quadratic models run quickly." +
                                    " Other models are more intensive and may take several seconds."),
                             html.Hr(),
                             dcc.Graph(id="model_forecasts_plot1"),
                         ],
                         style={'border-radius': '15px',
                                'box-shadow': '1px 1px 1px grey',
                                'background-color': '#f0f0f0',
                                'padding': '10px',
                                'margin-bottom': '10px',
                                'fontSize':16
                                 },
                     ),
                 ],
             ),],),