예제 #1
0
                  width='650',
                  style={'border-width': '0'})

heatmap = html.Iframe(sandbox='allow-scripts',
                      id='heatmap_plot',
                      height='1100',
                      width='1000',
                      style={'border-width': '0'})

#TAB OBJECTS AND CALLBACK
#===================================

tab1_selectors = \
    [dbc.Row([
            dbc.Col(children = [
                html.H5("Damage Type"),
                html.H6("Plot: Both"),
                dropdown_selector_tab1,
                html.Br()
            ])
        ]),
        dbc.Row(children = [
            dbc.Col(children = [
                html.H5("Date Range Between 1990 - 2002"),
                html.H6("Plot: Bird Strike Damage Over Time"),
                rangeslider_selector,
                html.Br(),
                html.Br()]),
            dbc.Col([
                html.H5("Factor"),
                html.H6("Plot: Effect of (factor) on Birdstrikes"),
예제 #2
0
        html.
        Li("Qualité douteuse de certaines thématiques => 'meeting', biaise un peu nos résultats."
           ),
    ]),
    html.Hr()
])

data_exp = pd.read_csv("data/exp_mails.csv")
data_exp = data_exp[["From", "Nombre d'emails envoyés"
                     ]].sort_values(by=['Nombre d\'emails envoyés'],
                                    ascending=False)

figExp = px.bar(data_exp, x="From", y="Nombre d'emails envoyés")

count_mail_exp = html.Div(children=[
    html.H5(children='Le nombre d\'emails envoyé pour chaque expéditeur'),
    dcc.Graph(figure=figExp)
])

data_exp_thematiques_acp = pd.read_csv("data/extracted_data.csv")
tab_exp_thematiques_acp = html.Div(children=[
    dt.DataTable(id='tab',
                 columns=[{
                     "name": i,
                     "id": i
                 } for i in data_exp_thematiques_acp.iloc[:, 0:5]],
                 data=data_exp_thematiques_acp.head().to_dict('records'),
                 sort_action="native",
                 style_cell={'textAlign': 'left'},
                 style_data={
                     'whiteSpace': 'normal',
예제 #3
0
def annotation_tab(initial):
    try:
        global FILE_COUNT, LABELS_LIST_DROPDOWN_NEXT, NUMBER_OF_WAVFILES, LABELS_LIST_CHECKLIST_NEXT, LABELS_LIST_DROPDOWN_INITIAL
        LABELS_LIST_DROPDOWN_NEXT = []
        LABELS_LIST_CHECKLIST_NEXT = []
        LABELS_LIST_DROPDOWN_INITIAL = []

        if initial:
            FILE_COUNT = 0
            TOTAL_FOLDER_WAV_FILES = glob.glob(TEXT_PATH + "/*.wav")
            if os.path.exists(CSV_FILENAME):
                annotated_files = pd.read_csv(CSV_FILENAME,
                                              error_bad_lines=False)
                annotated_files = annotated_files['wav_file'].values.tolist()
                NUMBER_OF_WAVFILES = []
                for i in TOTAL_FOLDER_WAV_FILES:
                    if i.split("/")[-1] not in annotated_files:
                        # print(i)
                        NUMBER_OF_WAVFILES.append(i)
                print len(NUMBER_OF_WAVFILES)
            else:
                NUMBER_OF_WAVFILES = TOTAL_FOLDER_WAV_FILES
            print "total wavfiles :", len(NUMBER_OF_WAVFILES)

        encoded_image_to_play = base64.b64encode(
            open(NUMBER_OF_WAVFILES[FILE_COUNT], 'rb').read())
        dataframe = pd.DataFrame()
        dataframe["Labels Name"] = CHECKLIST_DISPLAY
        return html.Div([
            html.Div([
                html.Br(),
                html.H2(NUMBER_OF_WAVFILES[FILE_COUNT].split("/")[-1],
                        style={
                            "text-align": "center",
                            "color": "green",
                            'text-decoration': 'underline'
                        }),
                html.Audio(id='myaudio',
                           src='data:audio/WAV;base64,{}'.format(
                               encoded_image_to_play),
                           controls=True,
                           style={
                               "margin-top": "20px",
                               "verticalAlign": "middle",
                               "margin-bottom": "30px"
                           })
            ]),
            dash_table.DataTable(id='datatable-interactivity-' +
                                 ('inside' if initial else 'next'),
                                 columns=[{
                                     "name": i,
                                     "id": i,
                                     "deletable": True
                                 } for i in dataframe.columns],
                                 data=dataframe.to_dict("rows"),
                                 row_selectable="multi",
                                 style_table={
                                     "maxHeight": "300px",
                                     "maxWidth": "300px",
                                     "overflowY": "scroll"
                                 },
                                 selected_rows=[]),
            dcc.Dropdown(id="dropdown_data_" +
                         ("initial" if initial else "next"),
                         options=[{
                             'label': 'Nature ',
                             'value': 'Nature'
                         }, {
                             'label': 'Birds Chirping ',
                             'value': 'Bird'
                         }, {
                             'label': 'Wind Gushing',
                             'value': 'Wind'
                         }, {
                             'label': 'Vehicle  ',
                             'value': 'Vehicle'
                         }, {
                             'label': 'Honking  ',
                             'value': 'Honking'
                         }, {
                             'label': 'Conversation  ',
                             'value': 'Conversation'
                         }, {
                             'label': 'Dog Barking  ',
                             'value': 'Dog Barking'
                         }, {
                             'label': 'Tools  ',
                             'value': 'Tools'
                         }, {
                             'label': 'Axe  ',
                             'value': 'Axe'
                         }],
                         value="",
                         placeholder="Search For Label..",
                         style={
                             "fontSize": "17",
                             "margin-top": ("20" if initial else "40") + "px",
                             "display": "inline-block",
                             "font": "bold",
                             "width": "40%"
                         }),
            dcc.Textarea(id="text_area_" + ("inside" if initial else "next"),
                         placeholder='Selected Annotation',
                         value="",
                         style={
                             "width": "50%",
                             "margin-left": "25%",
                             "fontSize": "16",
                             "text-align": "center"
                         }),
            html.Div([
                html.Button("Submit",
                            id="submit_" + ("initial" if initial else "next"),
                            style={
                                "width": "200px",
                                "margin-top": "10px"
                            })
            ],
                     style={"text-align": "center"}),
            html.Footer('\xc2\xa9' + ' Copyright WildlyTech Inc. 2019 ',
                        style={
                            "position": "fixed",
                            "left": "0",
                            "bottom": "0",
                            "height": "2%",
                            "width": "100%",
                            "background-color": "black",
                            "color": "white",
                            "padding": "20px",
                            "textAlign": "center"
                        })
        ])
    except ValueError:
        return html.Div([
            html.H5("Something wrong with Audio: -" +
                    NUMBER_OF_WAVFILES[FILE_COUNT].split("/")[-1],
                    style={"display": "center"})
        ])
예제 #4
0
                                      },
                                      'backgroundColor':
                                      'rgb(248, 248, 248)'
                                  }])
         ],
                  style={'padding-bottom': '50px'})
     ],
             md=12),
 ]),
 #Fleet level overview: Performance when sailing
 dbc.Row([dbc.Col(html.H4("Performance when Sailing"))]),
 dbc.Row([
     dbc.Col(
         [
             html.Div([
                 html.H5("AE"),
                 dcc.Graph(
                     figure={
                         'data': [
                             go.Bar(x=df3['Vessel Name'],
                                    y=df3['AE Consumption'],
                                    marker=dict(color='skyblue')),
                             go.Bar(x=df3['Vessel Name'],
                                    y=df3['AE baseline'],
                                    opacity=1,
                                    marker=dict(color='rgba(0,0,0,0)',
                                                line=dict(color='black',
                                                          width=2)))
                         ],
                         'layout':
                         go.Layout(barmode='overlay')
예제 #5
0
파일: chart.py 프로젝트: fleth/stock_chart
 className="row",
 children=[
     dcc.Location(id="url", refresh=False),
     html.Nav(
         id="stockargs",
         className="col-lg-2 bg-light sidebar",
         children=[
             html.Div(className="card card-body bg-dark",
                      children=[
                          html.H4("Stock Chart",
                                  className="mx-auto text-white")
                      ]),
             html.Div(
                 className="card card-body",
                 children=[
                     html.H5(["Settings"]),
                     html.Div(
                         className="form-group",
                         children=[
                             html.Label("Codes:",
                                        className="col-form-label"),
                             dcc.Input(className="form-control",
                                       id="codes",
                                       type="text",
                                       value="",
                                       placeholder=
                                       "codes e.g. 1111 2222 3333")
                         ]),
                     html.Div(
                         className="form-group",
                         children=[
예제 #6
0
                       'overflowX': 'scroll',
                       'overflowY': 'scroll',
                       'maxHeight': '500px'
                   })
    ])


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

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

app.layout = html.Div(children=[
    html.Div(children=[
        html.H4(children='データ概要'),
        generate_table(df, 5),
        html.H5('shape: {} raws × {} columns'.format(df.shape[0], df.shape[1]))
    ],
             style={'background': '#FFFFCC'}),
    html.Div(children=[
        html.Div(children=[
            html.H5('目的変数を選択してください'),
            dcc.Dropdown(id='select-target',
                         options=[{
                             'label': column,
                             'value': column
                         } for column in df.columns]),
            html.Button(id="target-button", n_clicks=0, children="決定")
        ],
                 style={'width': '40%'}),
        html.Div(id='target_distribution',
                 children=html.H6('カラムが選択されていません'),
예제 #7
0
파일: data_explorer.py 프로젝트: blisc/NeMo

figure_duration = plot_histogram(data, 'duration', 'Duration (sec)')
figure_num_words = plot_histogram(data, 'num_words', '#words')
figure_num_chars = plot_histogram(data, 'num_chars', '#chars')
figure_word_rate = plot_histogram(data, 'word_rate', '#words/sec')
figure_char_rate = plot_histogram(data, 'char_rate', '#chars/sec')

if metrics_available:
    figure_wer = plot_histogram(data, 'WER', 'WER, %')
    figure_cer = plot_histogram(data, 'CER', 'CER, %')
    figure_wmr = plot_histogram(data, 'WMR', 'WMR, %')
    figure_word_acc = plot_word_accuracy(vocabulary)

stats_layout = [
    dbc.Row(dbc.Col(html.H5(children='Global Statistics'), className='text-secondary'), className='mt-3'),
    dbc.Row(
        [
            dbc.Col(html.Div('Number of hours', className='text-secondary'), width=3, className='border-right'),
            dbc.Col(html.Div('Number of utterances', className='text-secondary'), width=3, className='border-right'),
            dbc.Col(html.Div('Vocabulary size', className='text-secondary'), width=3, className='border-right'),
            dbc.Col(html.Div('Alphabet size', className='text-secondary'), width=3),
        ],
        className='bg-light mt-2 rounded-top border-top border-left border-right',
    ),
    dbc.Row(
        [
            dbc.Col(
                html.H5(
                    '{:.2f} hours'.format(num_hours),
                    className='text-center p-1',
예제 #8
0
 html.Div([
     html.Div(dcc.Markdown(
         children=
         """**Fig. 1** relative distances among accessions given cluster profiles selected and analysed. 
 In fact, loadings plot\n of PCA run on the former."""),
              className='six columns'),
     html.Div(dcc.Markdown(
         children=
         """**Table 1** Passport information on accessions shown in Fig. 1. If cluster cloud is selected
 below, then only accessions in red (updated plot) are shown."""),
              className='six columns')
 ],
          className="row"),
 html.Hr(),
 html.Div([
     html.H5(id="header1", className="six columns", children="opacity"),
     html.H5(id="header2",
             className="six columns",
             children="Likelihood threshold")
 ],
          className="row"),
 html.Div([
     dcc.Slider(updatemode="drag",
                className='six columns',
                id='opacity',
                min=.1,
                max=1,
                value=.8,
                step=.1,
                marks={.1 * x: str(round(.1 * x, 1))
                       for x in range(3, 9)}),
예제 #9
0
dropdown_style = {
    'width': '50%',
    'display': 'inline-block',
    'vertical-align': 'middle',
    'padding': '5px'
}

client = bigquery.Client()

click_count = 0

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.title = "LandingSpot"
app.layout = html.Div([
    html.H1("LandingSpot", style={'text-align': 'center'}),
    html.H5("Where will you land?", style={'text-align': 'center'}),
    html.Br(),

    # Preferences
    html.Div(
        [
            html.H6("Tell me what you need...",
                    style={
                        'text-align': 'left',
                        'padding': '5px'
                    }),

            # Bedrooms Button
            html.Div([
                html.Label([
                    "Bedrooms:",
예제 #10
0
                     "display": "flex",
                     "justify-content": "center"
                 }), )
],
                                style={"margin-left": "15rem"})

# ----------------------------------------------------------------------- Content 2
content2 = html.Div([
    html.H1(["Segmentación"], style=CONTENT_STYLE),
    html.
    P("Aca se muestra una clasificación para 25 mil clientes por restricciones de velocidad,\
            la base completa se uso para la hoja 'recomendaciones'."),
    html.Div([
        dbc.Row(
            dbc.Col(
                html.H5("Seleccione un clúster para ver sus estadísticas:"))),
        perfilamiento_header,
        html.Div(id="tabla_resumen_clu")
    ],
             style={}), graphs2
],
                    style={"margin-left": "10rem"})


def content_us(app, visible):
    return html.Div(
        [
            dbc.Row(
                dbc.Col(
                    dbc.Button("< Back",
                               color="primary",
예제 #11
0
        html.A(['Print PDF'],
               className="button no-print",
               style={'position': "absolute", 'top': '-40', 'right': '0'}),

        html.Div([  # subpage 1

            # Row 1 (Header)

            html.Div([

                html.Div([
                    #html.H5(
                    ##
                    #    dict["title"] + " 4-D Report lo"),
                    html.H5(first_dict["title_output"], id='title'),

                    html.H6(first_dict["location_output"], id='location',
                            style={'color': '#7F90AC'}),
                    html.Div([


                        html.Div([
                            dcc.Dropdown(
                                id='locas',
                                options=first_dict["locas_output"],
                                value="All",
                                clearable=False,
                                className="dropper",
                                placeholder="Type Location",
    html.H2('Appendix - Common HTML Components'),
    html.Hr(),
    reusable_components.Markdown('html.H1("H1 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H1('H1 Element'),
    html.Hr(),
    reusable_components.Markdown('html.H2("H2 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H2('H2 Element'),
    html.Hr(),
    reusable_components.Markdown('html.H3("H3 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H3('H3 Element'),
    html.Hr(),
    reusable_components.Markdown('html.H4("H4 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H4('H4 Element'),
    html.Hr(),
    reusable_components.Markdown('html.H5("H5 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H5('H5 Element'),
    html.Hr(),
    reusable_components.Markdown('html.H6("H6 Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.H6('H6 Element'),
    html.Hr(),
    reusable_components.Markdown('html.Div("Generic Div Element")',
                                 style={'borderLeft': 'thin solid lightgrey'}),
    html.Div('Generic Div Element')
])
예제 #13
0
def choose_assist_line(episode, network_graph):
    return html.Div(id="choose_assist_line", className="lineBlock card", children=[
        html.H4("Choose or Assist"),
        html.Div(className="card-body row", children=[
            html.Div(className="col-7", children=[
                html.H5("Network at time step t"),
                dcc.Graph(id="network_graph_choose", figure=network_graph,),
            ]),
            html.Div(className="col-5", children=[
                dbc.Tabs(children=[
                    dbc.Tab(label='Choose', labelClassName="fas fa-user", children=[
                        dbc.Tabs(children=[
                            dbc.Tab(label="Dropdowns", children=[
                                dbc.Tabs(children=[
                                    dbc.Tab(label='Lines', children=[
                                        html.P("Choose a line to act on:", className="mt-1"),
                                        dac.Select(
                                            id='select_lines_simulation',
                                            options=[{'label': line_name,
                                                      'value': line_name}
                                                     for line_name in episode.line_names],
                                            mode='default',
                                            value=episode.line_names[0]
                                        ),
                                        html.P("Choose an action:", className="mt-1"),
                                        dac.Radio(options=[
                                            {"label": "Set", "value": "Set"},
                                            {"label": "Change", "value": "Change"},
                                        ], value="Set", id="select_action_lines", buttonStyle="solid"),
                                    ]),
                                    dbc.Tab(label='Subs', children=[
                                        html.P("Choose a substation to act on:"),
                                        dac.Select(
                                            id='select_subs_simulation',
                                            options=[{'label': name,
                                                      'value': name}
                                                     for name in episode.name_sub],
                                            mode='default',
                                            value=episode.name_sub[0]
                                        ),
                                        html.P("Choose an action:"),
                                        dac.Radio(options=[
                                            {"label": "Set", "value": "Set"},
                                            {"label": "Change", "value": "Change"},
                                        ], value="Set", id="select_action_subs", buttonStyle="solid"),
                                    ]),
                                    dbc.Tab(label='Gens', children=[
                                        html.P("Choose a generator to act on:"),
                                        dac.Select(
                                            id='select_gens_simulation',
                                            options=[{'label': prod_name,
                                                      'value': prod_name}
                                                     for prod_name in episode.prod_names],
                                            mode='default',
                                            value=episode.prod_names[0]
                                        ),
                                        html.P("Choose an action:"),
                                        dac.Radio(options=[
                                            {"label": "Redispatch", "value": "Redispatch"},
                                        ], value="Redispatch", id="select_action_gens", buttonStyle="solid"),
                                    ])
                                ])
                            ]),
                            dbc.Tab(label="Dict", children=[
                                html.P("Enter the action dictionary:"),
                                dbc.Textarea(className="mb-3", placeholder="{set_line_status: []}"),
                            ])
                        ]),
                    ]),
                    dbc.Tab(label='Assist', labelClassName="fas fa-robot", children=[
                        "content"
                    ]),
                ]),
                dbc.Button("Simulate", id="simulate_action", color="danger", className="mt-3 mb-3"),
                html.P("Action dictionary:"),
                html.Div(id="action_dictionary")
            ]),
        ]),
    ])
예제 #14
0
def server_layout(mode=None):
    #return the layout of the GUI
    session_id = str(uuid.uuid4())

    #variable, distribution selection panel
    selection_panel = html.Div(id='selection-panel',children=[
        html.Div(id='selected-column-panel',children=[
            html.Div(id='selected-column-sec1-panel',children=[
                drc.NamedDropdown(
                    name='Select series',
                    id='selected-series',
                    searchable=False,
                    clearable=False
                ),
                dcc.Checklist(
                    id='apply-log-transform',
                    options=[{'label':' Apply log transform','value':'logtransform'}
                ]),
            ]),
            drc.NamedTextarea(
                id='series-characteristics',
                name='Series characteristics',
                cols='50',
                rows='2',
                readOnly='readOnly'
            ),
        ]),
        html.Div(id='apply-panel',children=[
            html.Div(id='apply-sec1-panel',children=[
                drc.NamedDropdown(
                    id='fitted-distributions',
                    name='Fitted distribution',
                    options=[
                        {'label': ' '+ v[0], 'value': k}
                        for k,v in dist_par_template.items() if k != 'native' and v[2]
                    ],
                    value='normal',
                    searchable=False,
                    clearable=False
                ),
            ]),
            # html.Div(id='apply-sec1b-panel',children=[
            #     drc.NamedDropdown(
            #         id='plotting-distributions',
            #         name='Probability scale',
            #         options=[
            #             {'label': ' '+ v[0], 'value': k}
            #             for k,v in dist_par_template.items() if v[2]
            #         ],
            #         value='native',
            #         searchable=False,
            #         clearable=False
            #     ),
            # ]),
            html.Div(id='apply-sec2a-panel',children=[
                html.Button('Fit',id='fit-button',n_clicks=0),
            ]),
            #dcc.Checklist(
            #    id='show-y-log',
            #    options=[{'label':' Show y-axis in log scale','value':'true'}
            #]),
        ]),
        html.Label(id='graph-refresh'),
        dcc.Store(
            id='graph-refresh-hidden',
            data=0
        ),
        html.Div(id='message-panel',children=[""]),

    ])

    #variable, distribution selection panel
    par_panel = html.Div(id='fitted-panel',children=[
        html.Div(id='fitted-sec1-panel',children=[
            drc.NamedTextarea(
                id='fitted-par',
                name='Estimated distribution parameters',
                readOnly='readOnly',
                cols= 40,
                rows= 3
            ),
            drc.NamedTextarea(
                id='estimated-quantiles',
                name='Estimated quantiles',
                readOnly='readOnly',
                cols= 40,
                rows= 3
            ),
        ])
    ])

    upload_panel = html.Div(id='last-card',children=[
        dcc.Upload(
            id='upload-data',
            children=html.Div([
                'Drag and Drop or ',
                html.A('Select File')
            ]),
            style={
                'lineHeight': '60px',
                'borderWidth': '1px',
                'borderStyle': 'dashed',
                'borderRadius': '5px',
                'textAlign': 'center',
            }
        ),
        html.Label('''File upload limited to < %0.0f Kb, containing no more than %d rows and %d columns'''%(configs['max_file_size']/1024,configs['max_file_rows'],configs['max_file_cols'])),
        html.Label('',id='data-filename'),
        html.Label('',id='data-description'),
        html.Div(id='table-panel',children=[
            dash_table.DataTable(
                id='attribute-table',
                columns=[],
                row_selectable='multi',
                editable=False,
                style_header={
                    'textAlign': 'center',
                    'fontWeight': 'bold',
                    'color': 'black',
                },
                style_cell={
                    'padding': '2px',
                    '--selected-background': 'grey',
                    'color': 'black',
                },
                style_data_conditional=[
                    {
                        'if': {'row_index': 'odd'},
                        'backgroundColor': 'rgb(248, 248, 248)'
                    }
                ],
                #locale_format= '0.3',
            )
        ],style={'visibility':'none','display':'none'}),
    ])

    chart_panel = html.Div(id='chart-panel',children=[
        dcc.Loading(id = "loading-icon", children=[
            dcc.Graph(
                id='graph',
                figure={
                },
                responsive=True,
                config=graph_config,
                style={'display':'none'}
            )
        ]),
    ],
    style={'visibility':'none'})


    layout = html.Div(
        id="body",
        className="container scalable",
        children=[
            visdcc.Run_js(id = 'chart-updated-js'),
            visdcc.Run_js(id = 'chart-unupdated-js'),
            visdcc.Run_js(id = 'error-display-js'),
            dcc.Store(id='error-display',data=''),
            html.Title(title=configs['title']),
            #hidden session id
            #row 1 for title
            html.Div(id='top-panel',children=[
                html.H5(id='app-title',children=
                    '''Distribution Fitting and Analysis Tool.
                    This tool is only for demostration porpuses''',
                    style={"margin-bottom": "0px"},
                ),
            ],className="row flex-display"),
            #second row layout
            html.Div(id='main-panel',children=[
                html.Div(id='left-panel',children=[
                    upload_panel
                ]),
                html.Div(id='output-panel',children=[
                    selection_panel,
                    par_panel,
                    chart_panel
                ],style={'visibility':'none','display':'none'}),
            ]),
            #row 4 is the footer
            html.Div(id='footer-panel',children=[
                '''
                    A web application built on top of Dash (v%s) (framework for Python) by
                    Exequiel Sepúlveda and Dmitri Kavetski.'''%(dash.__version__)
            ]),
        ],
    )
    return layout
예제 #15
0
                     y=df_init[selected_col],
                     name=selected_col,
                     line=dict(width=2, color='rgb(229, 151, 50)'),
                     mode='markers')
layout = go.Layout(title='Profit & Loss Plot', hovermode='closest')
fig = go.Figure(data=[trace_1], layout=layout)
fig.update_xaxes(title_text='Year')
fig.update_yaxes(title_text='Profit&Loss ($)')

# Create a Dash layout
app.layout = html.Div([
    # Header
    html.Div(
        [
            html.H1("Trading Strategy Back Testing Dashboard"),
            html.H5("Final testing version 1.0"),
        ],
        style={
            'paddingLeft': '10%',
            'paddingBottom': '2.5%',
            'paddingTop': '3%',
            'backgroundColor': '#74F3FF'
        }),

    # Dropdowns
    html.Div(
        [
            # Sector
            html.Div(
                [
                    html.H5('Select sectors'),
예제 #16
0
students_hybrid_chart = dcc.Graph(id='students-hybrid-chart',
                                  figure=go.Figure(),
                                  config=modebar_config)

students_sps_chart = dcc.Graph(id='students-sps-chart',
                               figure=go.Figure(),
                               config=modebar_config)

students_phd_chart = dcc.Graph(id='students-phd-chart',
                               figure=go.Figure(),
                               config=modebar_config)
"""
Main students tab skeleton
"""
students_tab = html.Div([
    html.H5('Undergraduate', id='students-ug-header', className='text-info'),
    students_ug_chart,
    html.Div([
        html.H5('Masters', id='students-masters-header',
                className='text-info'),
        students_masters_chart,
    ],
             id='students-masters-container'),
    html.Div([
        html.H5('Interdepartmental Masters',
                id='students-interdept-header',
                className='text-info'),
        students_interdept_chart,
    ],
             id='students-interdept-container'),
    html.Div([
예제 #17
0
)

# make a button to run the simulator
run_btn = dbc.Button(children = "Run Simulation", outline=True, size = "lg", color="primary", className="mb-3", id="btn_run", n_clicks = 0)

# make a button for plots
plot_btn = dbc.Button(children = "Add Chart", outline=True, size = "lg", color="primary", className="mb-3", id="btn_plot", n_clicks = 0)

# layout all the components to be displayed
content = html.Div(
    [
        dbc.Row([
            dbc.Col(html.H1(children='Reactor Modeling Sandbox'), width = 9),
        ]),
        dbc.Row([
            dbc.Col(html.H5(children='Beep bop'), width = 9),
            dbc.Col(
                dbc.DropdownMenu(
                    label = "Select a model",
                    children = dropdown_models(0),
                    right=False,
                    id = 'dd_models'
                ),
            )
        ]),
        dbc.Row([
            dbc.Col(html.H1(children=''), width = 12),
        ]),
        dbc.Row([
            dbc.Col(dbc.Col([
                dbc.Row(dsc.collapse([], 'Manipulated Variables', 'mvars-collapse')),
예제 #18
0
def init_attacker(server):
    app = dash.Dash(
        server=server,
        url_base_pathname=URL_BASE,
        suppress_callback_exceptions=True,
    )

    app.layout = html.Div(children=[
        html.H1(children='Fantasy Premier League Attack/Midfield Dashboard',
                style={
                    'textAlign': 'center',
                    'color': '#28D0B4',
                }),
        html.Div(
            children=
            'This interactive web app can be a toolkit for you to select and optimise your player selection based on their previous year\'s performances',
            style={
                'color': '#28D0B4',
            }),
        html.Div(
            id='stats-menu',
            className='dropdowns',
            children=[
                dcc.Dropdown(id='yaxis',
                             className='ydropdown',
                             options=[{
                                 'label': 'Players',
                                 'value': 'player'
                             }, {
                                 'label': 'Games',
                                 'value': 'games'
                             }, {
                                 'label': 'Minutes',
                                 'value': 'minutes'
                             }, {
                                 'label': 'Total 90s',
                                 'value': 'minutes_90s'
                             }, {
                                 'label': 'Goals per90',
                                 'value': 'goals_per90'
                             }, {
                                 'label': 'Assists per90',
                                 'value': 'assists_per90'
                             }, {
                                 'label': 'Penalties Attempted',
                                 'value': 'pens_att'
                             }, {
                                 'label': 'Penalty Conversion %',
                                 'value': 'pens_conv'
                             }, {
                                 'label': 'Yellow Cards',
                                 'value': 'cards_yellow'
                             }, {
                                 'label': 'Red Cards',
                                 'value': 'cards_red'
                             }, {
                                 'label': 'Goals & Assists per90',
                                 'value': 'goals_assists_per90'
                             }, {
                                 'label': 'Goals + Assists - Penalties per90',
                                 'value': 'goals_assists_pen_per90'
                             }, {
                                 'label': 'Expected Goals per90',
                                 'value': 'xg_per90'
                             }, {
                                 'label': 'Expected Assists per90',
                                 'value': 'xa_per90'
                             }, {
                                 'label': 'xG & xA per90',
                                 'value': 'xg_xa_per90'
                             }, {
                                 'label': 'Non-Penalty Expected goals per90',
                                 'value': 'npxg_per90'
                             }, {
                                 'label': 'npxG + xA per90',
                                 'value': 'npxg_xa_per90'
                             }, {
                                 'label': 'xG_net',
                                 'value': 'xg_net'
                             }, {
                                 'label': 'Cost',
                                 'value': 'cost'
                             }, {
                                 'label': 'Points earned',
                                 'value': 'points'
                             }, {
                                 'label': 'Points per game',
                                 'value': 'ppg'
                             }, {
                                 'label': 'Points per cost',
                                 'value': 'ppc'
                             }],
                             placeholder='Choose statistics for Y axis',
                             searchable=True,
                             value='points'),
                dcc.Dropdown(id='xaxis',
                             className='xdropdown',
                             options=[{
                                 'label': 'Players',
                                 'value': 'player'
                             }, {
                                 'label': 'Games',
                                 'value': 'games'
                             }, {
                                 'label': 'Minutes',
                                 'value': 'minutes'
                             }, {
                                 'label': 'Total 90s',
                                 'value': 'minutes_90s'
                             }, {
                                 'label': 'Goals per90',
                                 'value': 'goals_per90'
                             }, {
                                 'label': 'Assists per90',
                                 'value': 'assists_per90'
                             }, {
                                 'label': 'Penalties Attempted',
                                 'value': 'pens_att'
                             }, {
                                 'label': 'Penalty Conversion %',
                                 'value': 'pens_conv'
                             }, {
                                 'label': 'Yellow Cards',
                                 'value': 'cards_yellow'
                             }, {
                                 'label': 'Red Cards',
                                 'value': 'cards_red'
                             }, {
                                 'label': 'Goals & Assists per90',
                                 'value': 'goals_assists_per90'
                             }, {
                                 'label': 'Goals + Assists - Penalties per90',
                                 'value': 'goals_assists_pen_per90'
                             }, {
                                 'label': 'Expected Goals per90',
                                 'value': 'xg_per90'
                             }, {
                                 'label': 'Expected Assists per90',
                                 'value': 'xa_per90'
                             }, {
                                 'label': 'xG & xA per90',
                                 'value': 'xg_xa_per90'
                             }, {
                                 'label': 'Non-Penalty Expected goals per90',
                                 'value': 'npxg_per90'
                             }, {
                                 'label': 'npxG + xA per90',
                                 'value': 'npxg_xa_per90'
                             }, {
                                 'label': 'xG_net',
                                 'value': 'xg_net'
                             }, {
                                 'label': 'Cost',
                                 'value': 'cost'
                             }, {
                                 'label': 'Points earned',
                                 'value': 'points'
                             }, {
                                 'label': 'Points per game',
                                 'value': 'ppg'
                             }, {
                                 'label': 'Points per cost',
                                 'value': 'ppc'
                             }],
                             placeholder='Choose statistics for X axis',
                             searchable=True,
                             value='player'),
                dcc.RadioItems(id='plot',
                               className='plot-select',
                               options=[
                                   {
                                       'label': 'Bar Plot',
                                       'value': 'bar'
                                   },
                                   {
                                       'label': 'Scatter Plot',
                                       'value': 'scatter'
                                   },
                               ],
                               value='scatter'),
            ]),
        dcc.Graph(
            id='stats-graph', className='graph', style={
                'marginTop': 40,
            }),
        html.Div(className='info-panel',
                 children=[
                     html.H5(children='Some of the stats used',
                             style={'marginBottom': -2}),
                     dcc.Markdown('''
            '''),
                     html.
                     A(' - Statisfy -  A collections of Basic Football Analytics',
                       href='https://github.com/sidthakur08/statisfy'),
                     html.Br(),
                     html.A(' - Contact me on Twitter :)',
                            href='https://twitter.com/sidtweetsnow',
                            target='_blank'),
                     html.Br(),
                 ]),
        html.Div(className='link-name',
                 children=[
                     html.A('Link to the github repository',
                            href="https://github.com/sidthakur08/fpl_explore",
                            target='_blank')
                 ]),
        html.Br(),
        html.Br(),
        html.Br(),
    ])

    init_attacker_callbacks(app)

    return app.server
예제 #19
0
파일: app.py 프로젝트: Lionbix/Dashboard
                          children=[
                              html.H4('''Sales remuneration by units : '''),
                              generate_table(
                                  comparaison[['marketplace', 'sales/units']]),
                          ]),
                 html.Div(className="dataframe1",
                          children=[
                              html.H4('''Shipment price by units : '''),
                              generate_table(comparaison[[
                                  'marketplace', 'shipping/units'
                              ]]),
                          ]),
                 html.Div(className="dataframe1",
                          children=[
                              html.H4('''FBA shipping cost per order : '''),
                              html.H5(fba),
                              html.H4('''MFN shipping cost per order : '''),
                              html.H5(mfn),
                          ]),
                 html.Div(children=[
                     dcc.Graph(figure=word_count),
                     dcc.Graph(figure=shipment),
                     dcc.Graph(figure=sunburst),
                     dcc.Graph(figure=commands),
                     dcc.Graph(figure=sell),
                 ]),
             ])
])

if __name__ == '__main__':
    app.run_server(port=8050, host='0.0.0.0', debug=True)
예제 #20
0
app.layout = html.Div([
    Row([
        Col([html.H1('Histogram Comparison for bme data',
                     style = {'margin-bottom':50, 'margin-top':20})],
            width={"size": 12, "offset": 1})
    ]),
    Row([
        Col([
            dcc.Graph(id='hist_1', style={'width':'95%','box-shadow':'2px 2px 2px grey'})
        ], width={"size": 4, "offset": 1}),
        Col([
            html.Div([
                html.Div([
                    html.H3('Hist 1'),
                    dropdown('var_1', var),
                    Row([Col(html.H5('Q0: '), sm=1), Col(checklist('multi_Q0_1',dropdown_options.Q0))]),
                    Row([Col(html.H5('Q1: '), sm=1), Col(checklist('multi_Q1_1',dropdown_options.Q1))]),
                    Row([Col(html.H5('Q2: '), sm=1), Col(checklist('multi_Q2_1',dropdown_options.Q2))]),
                    Row([Col(html.H5('Q3: '), sm=1), Col(checklist('multi_Q3_1',dropdown_options.Q3))]),
                    Row([Col(html.H5('Q4: '), sm=1), Col(rgslider('rgslider_Q4_1',df.Q4, 8))]),
                    Row([Col(html.H5('Q5: '), sm=1), Col(rgslider('rgslider_Q5_1',df.Q5, 5))]),
                    Row([Col(html.H5('Q6: '), sm=1), Col(rgslider('rgslider_Q6_1',df.Q6, 5))]),
                    Row([Col(html.H5('Q7: '), sm=1), Col(checklist('multi_Q7_1',dropdown_options.Q7))]),
                    Row([Col(html.H5('Q8: '), sm=1), Col(rgslider('rgslider_Q8_1',df.Q8, 5))]),
                    Row([Col(html.H5('Q9: '), sm=1), Col(checklist('multi_Q9_1',dropdown_options.Q9))]),
                    Row([Col(html.H5('Q10: '), sm=1), Col(rgslider('rgslider_Q10_1',df.Q10, 5))])
                ], style={'width':'95%'})
            ], style={'width':'95%', 'box-shadow':'2px 2px 2px grey'})
        ])
        
    ]),
예제 #21
0
import datetime
import operator
import os

import base64
import io

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

app.scripts.config.serve_locally = True
app.config['suppress_callback_exceptions'] = True

app.layout = html.Div([
    html.H5("Upload Files"),
    dcc.Upload(id='upload-data',
               children=html.Div(['Drag and Drop or ',
                                  html.A('Select Files')]),
               style={
                   'width': '100%',
                   'height': '60px',
                   'lineHeight': '60px',
                   'borderWidth': '1px',
                   'borderStyle': 'dashed',
                   'borderRadius': '5px',
                   'textAlign': 'center',
                   'margin': '10px'
               },
               multiple=False),
    html.Br(),
예제 #22
0
MAX_RECENT_POSTS = 10

app_colors = {
    "text": "#0C0F0A",
    "background": "#ffffff"
}

app = dash.Dash(__name__)

app.layout = html.Div([
        html.Div(
            className="container-fluid",
            children=[
                html.H1("Live reddit sentiment"),
                html.H5("Search:"),
                dcc.Input(id="keyword", type="text", value="")
            ], style={'width':'50%','margin-left':10,'margin-right':60,'max-width':50000}
        ),

        html.Div(className="row", children=[
            html.Div(id="")
        ]),
        
        html.Div(className="row", children=[
            html.Div(id="recent-reddit-table", className="col s12 m6 l6"),
            html.Div(dcc.Graph(id="sentiment-pie", animate=False), className="col s12 m6 l6")
        ]),

        dcc.Interval(
            id="recent-reddit-table-update",
예제 #23
0
파일: Example.py 프로젝트: YLITID/IPZ_1
colors = {
    'background': '#111111',
    'text': '#009a00'
}

app.layout = html.Div([
    html.Div(
        className="banner",
        children = [html.H2("WorkspaceC.alpha 0.1",
                        style={
                        'color': colors['text'],
                        }),
                    html.Img(src='/assets/stock_icon.png')]),
    html.Div(
        children=html.Div([
            html.H5('Log in'),

        ])),
    html.Div(["Input: ",
              dcc.Input(id='my-input', value='initial value', type='text')]),
    html.Div(["Write: ",
              html.Button(id='time-button', children='Gettime')]),
    html.Br(),
    html.Div(id='my-output'),

])

@app.callback(
    Output(component_id='my-output', component_property='children'),
    [Input(component_id='time-button', component_property='n_clicks')]
)
예제 #24
0
         style={
             'height': '60px',
             'width': 'auto',
             'margin-bottom': '25px',
         },
     )
 ],
          className='one-third column'),
 html.Div(
     [
         html.Div([
             html.H3(
                 'The Best Movie Site Ever',
                 style={'margin-bottom': '0px'},
             ),
             html.H5('Find the right movie for you',
                     style={'margin-top': '0px'}),
         ])
     ],
     className='one-half column',
     id='title',
 ),
 html.Div(
     [
         html.A(
             html.Button("Like it", id="like-it-button"),
             href="https://plot.ly/dash/pricing/",
         )
     ],
     className="one-third column",
     id="button",
 ),
예제 #25
0
            [
                dbc.NavItem(dbc.NavLink("NP Classifier", href="#")),
                dbc.NavItem(dbc.NavLink("Report Feedback", href="https://docs.google.com/forms/d/e/1FAIpQLSf1-sw-P0SQGokyeaOpEmLda0UPJW93qkrI8rfp7D46fHVi6g/viewform?usp=sf_link")),
                dbc.NavItem(dbc.NavLink("Preprint Publication", href="https://chemrxiv.org/articles/preprint/NPClassifier_A_Deep_Neural_Network-Based_Structural_Classification_Tool_for_Natural_Products/12885494/1")),
                dbc.NavItem(dbc.NavLink("API", href="https://ccms-ucsd.github.io/GNPSDocumentation/api/#structure-np-classifier")),
            ],
        navbar=True)
    ],
    color="light",
    dark=False,
    sticky="top",
)

DASHBOARD = [
    dcc.Location(id='url', refresh=False),
    dbc.CardHeader(html.H5("NP Classifier")),
    dbc.CardBody(
        [
            html.Div(id='version', children="Version - 1.5"),
            html.Br(),
            dbc.Textarea(className="mb-3", id='smiles_string', placeholder="Smiles Structure"),
            dcc.Loading(
                id="structure",
                children=[html.Div([html.Div(id="loading-output-5")])],
                type="default",
            ),
            dcc.Loading(
                id="classification_table",
                children=[html.Div([html.Div(id="loading-output-3")])],
                type="default",
            ),
예제 #26
0
                'videoCount': 'Video',
                'voiceParticipantCount': 'Sprecher'}

colors = {
    'bg_black': '#818181',
    'text_green': '#1dcf9d',
    'bg_blue': '#365b6b',
    'bg_blue_graph': '#334f65'
}
#########
### DBC Card
### Sum of meeting, listener, participant, and video
card_content_1 = [
    dbc.CardBody(
        [
            html.H5("Meeting", className="card-title"),
            html.P("", className="card-text", ),
            df.shape[0]
            #dfLog['createTime'].nunique(),
        ]
    ),
]

card_content_2 = [
    dbc.CardBody(
        [
            html.H5("Zuhörer", className="card-title"),
            html.P("", className="card-text", ),
            groupListenerCount['listenerCount'].sum(),
        ]
    ),
예제 #27
0
        figure={
            'data': [
                go.Bar(x=cov_data['Country_Region'],
                       y=cov_data['Recovered'],
                       marker={'color': 'rgb(51,204,153)'})
            ],
            'layout': {
                'title': 'Recovery by contry',
            }
        },
    ),
    dcc.Graph(
        id='example-graph2',
        figure={
            'data': [
                go.Bar(x=cov_data['Country_Region'],
                       y=cov_data['Deaths'],
                       marker={'color': 'rgb(200,204,53)'})
            ],
            'layout': {
                'title': 'Fatalities by country'
            }
        },
    ),
    html.H5("Developed by Natalie Andrade", style={'font-family': "Open Sans"
                                                   }),
])

if __name__ == '__main__':
    app.run_server(debug=True)
예제 #28
0
    def get_evaluation_dash_app(self, dash_=None):
        """
        Evaluation dass app.
        :return:
        """
        external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
        if dash_ is None:
            app = dash.Dash(__name__,
                            external_stylesheets=external_stylesheets,
                            suppress_callback_exceptions=True)
        else:
            app = dash_
        # forward_returns_period = [1, 2, 5, 10]  # period list
        # forward_str = str(forward_returns_period).replace('[', '').replace(']', '')

        para_dcc_list = []
        for k, v in self.alpha_func_paras.items():
            para_dcc_list.append(html.Div(children=k))
            para_dcc_list.append(
                dcc.Input(id="input_{}".format(k),
                          placeholder=str(k),
                          type='number',
                          value=str(v),
                          debounce=True))

        app.layout = html.Div(
            children=[
                html.H1(children=self.factor_name + ' evaluation',
                        style={
                            'font-weight': 'normal',
                            'text-align': 'center',
                            'display': 'block',
                            'fontFamily': 'helvetica neue',
                            'margin': '100px auto'
                        }),
                html.Div([
                    # change forward returns
                    html.Div(
                        [
                            html.Div(id='forward-returns-period'),
                            # add forward returns
                            html.Div(
                                children=
                                'Enter a value to add or remove forward return value'
                            ),
                            dcc.Input(id='forwards-periods-input',
                                      type='text',
                                      value='1, 2, 5, 10'),
                            html.Button('Update', id='UpdateButton'),
                        ],
                        style={
                            'margin-left': '6.25em',
                            'width:': '25em',
                            'float': 'left'
                        }),
                    # change parameter
                    html.Div([
                        html.Div(children='Factor Parameter'),
                        html.Div(para_dcc_list, id='alpha_paras'),
                        html.Button('Submit', id='AlphaButton'),
                        html.Div(id="current-parameter"),
                    ],
                             style={
                                 'margin-left': '20em',
                                 'display': 'inline-block'
                             }),
                ]),
                html.Div([
                    dcc.RadioItems(
                        id='in-out-sample',
                        options=[{
                            'label': i,
                            'value': i
                        } for i in ['In sample', 'Out ot the sample']],
                        value='In sample',
                        labelStyle={'display': 'inline-block'})
                ],
                         style={
                             'display': 'block',
                             'margin': '0px 100px 50px 100px'
                         }),

                # summary table
                html.Div([
                    html.H5(children='Factor Summary Table',
                            style={
                                'text-align': 'center',
                                'margin-bottom': '20px'
                            }),
                    html.Table(id='summary-table',
                               style={
                                   'width:': '40%',
                                   'float': 'left',
                                   'font-size': '1.25em'
                               })
                ],
                         style={
                             'margin-left': '6.25rem',
                             'display': 'inline-block'
                         }),

                # ic_table
                html.Div([
                    html.H5(children='Factor IC Table',
                            style={
                                'display': 'block',
                                'text-align': 'center',
                                'margin-bottom': '20px'
                            }),
                    html.Table(id='ic-table',
                               style={
                                   'width:': '40%',
                                   'font-size': '1.25em'
                               }),
                ],
                         style={
                             'margin-left': '18.75em',
                             'display': 'inline-block'
                         }),

                # beta table
                html.Div([
                    html.H5(children='Factor Beta',
                            style={
                                'text-align': 'center',
                                'margin-bottom': '20px'
                            }),
                    html.Table(id='beta-table',
                               style={
                                   'width': '100%',
                                   'font-size': '1.25em'
                               })
                ],
                         style={
                             'display': 'block',
                             'margin': '20px auto 60px'
                         }),
                html.Div(
                    [
                        html.H5(children='Factor Distribution',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='distribution')
                    ],
                    style={
                        'width': '49%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(
                    [
                        html.H5(children='Q-Q plot ',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='qqplot')
                    ],
                    style={
                        'width': '49%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(
                    [
                        html.H5(children='Factor IC',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='ic_heatmap')
                    ],
                    style={
                        'width': '100%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(
                    [
                        html.H5(children='Price Factor',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='price_factor')
                    ],
                    style={
                        'width': '100%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(
                    [
                        html.H5(children='Factor Return',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='factor-returns')
                    ],
                    style={
                        'width': '100%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(
                    [
                        html.H5(children='Factor Backtesting',
                                style={
                                    'text-align': 'center',
                                    'margin': 'auto'
                                }),
                        dcc.Graph(id='factor-backtest')
                    ],
                    style={
                        'width': '100%',
                        'display': 'inline-block',
                        'margin-bottom': '50px'
                    }),
                html.Div(children=self.factor.to_json(orient='split'),
                         id='in_sample_factor',
                         style={'display': 'none'}),
                html.Div(id='out_sample_factor', style={'display': 'none'}),
                html.Div(children=json.dumps([1, 2, 5, 10]),
                         id='forward_returns_period_saved',
                         style={'display': 'none'}),
                html.Div(id='forward_str', style={'display': 'none'}),
            ],
            style={'margin': '20px'})

        # make input parameter into dict
        def _get_alpha_parameter_from_div(alpha_paras):
            paras = {}
            for child in alpha_paras:
                if child['type'] == 'Input':
                    props = child['props']
                    k = props['id'].replace('input_', '')
                    v = props['value']
                    try:
                        v = int(v)
                    except:
                        v = float(v)
                    paras[k] = v
            return paras

        @app.callback(Output('in_sample_factor', 'children'), [
            Input('AlphaButton', 'n_clicks'),
            Input('alpha_paras', 'children')
        ])
        def update_alpha_insample(n_clicks, alpha_paras):
            # some expensive clean data step
            # print(alpha_paras)
            paras = _get_alpha_parameter_from_div(alpha_paras)
            self.calculate_factor(self.alpha_func, **paras)
            in_sample_factor = self.factor  # type: pd.Series
            # more generally, this line would be
            # json.dumps(cleaned_df)
            return in_sample_factor.to_json(orient='split')

        @app.callback(Output('out_sample_factor', 'children'), [
            Input('AlphaButton', 'n_clicks'),
            Input('alpha_paras', 'children')
        ])
        def update_alpha_out_of_sample(n_clicks, alpha_paras):

            paras = _get_alpha_parameter_from_div(alpha_paras)
            self.calculate_factor(self.alpha_func, **paras)

            out_of_sample_factor = self.alpha_func(self.out_of_sample,
                                                   **paras)  # type: pd.Series

            # more generally, this line would be
            # json.dumps(cleaned_df)
            return out_of_sample_factor.to_json(orient='split')

        @app.callback([
            Output('forward_returns_period_saved', 'children'),
            Output("forward-returns-period", "children")
        ], [Input("UpdateButton", "n_clicks")],
                      [State("forwards-periods-input", "value")])
        def update_forward_return(n_clicks, value):
            fr = list(set([int(p) for p in value.split(',')]))
            fr.sort()
            forward_str = str(fr).replace('[', '').replace(']', '')
            return json.dumps(fr), 'Forward return list: ' + forward_str

        @app.callback([
            Output('distribution', 'figure'),
            Output('ic_heatmap', 'figure'),
            Output('qqplot', 'figure'),
            Output('price_factor', 'figure'),
            Output('factor-returns', 'figure'),
            Output('factor-backtest', 'figure'),
            Output('summary-table', 'children'),
            Output('ic-table', 'children'),
            Output('beta-table', 'children'),
        ], [
            Input("UpdateButton", "n_clicks"),
            Input('in-out-sample', 'value'),
            Input('forward_returns_period_saved', 'children'),
            Input('in_sample_factor', 'children'),
            Input('out_sample_factor', 'children'),
        ])
        def update_forward_returns(n_clicks, value, forward_period, alpha_json,
                                   out_alpha_json):
            forward_returns_period = json.loads(forward_period)

            factor = pd.read_json(alpha_json, orient='split', typ='series')
            if value == 'In sample':
                update_distribution_figure = factor_distribution_plot(factor)

                returns = calculate_forward_returns(self.in_sample,
                                                    forward_returns_period)
                ic_heatmap = get_monthly_ic(returns, factor,
                                            forward_returns_period)
                update_heatmap_figure = monthly_ic_heatmap_plot(ic_heatmap)

                update_qqplot_figure = qq_plot(factor)

                update_factor_plot_figure = price_factor_plot(
                    self.in_sample, factor)

                factor_returns = calculate_ts_factor_returns(
                    self.in_sample, factor, forward_returns_period)
                update_factor_plot_figure1 = returns_plot(
                    factor_returns, self.factor_name)

                factor_returns = calculate_ts_factor_returns(
                    self.in_sample, factor, forward_returns_period)
                cumulative_returns = calculate_cumulative_returns(
                    factor_returns, 1)
                benchmark = self.in_sample['close'] / self.in_sample['close'][0]
                update_factor_plot_figure2 = cumulative_return_plot(
                    cumulative_returns,
                    benchmark=benchmark,
                    factor_name=self.factor_name)
                # tables
                factor_table = pd_to_dash_table(factor_summary(factor),
                                                'summary')
                ic_table = pd_to_dash_table(
                    pd.DataFrame(calculate_ts_information_coefficient(
                        factor, returns),
                                 columns=[self.factor_name]), 'ic')
                ols_table = pd_to_dash_table(
                    factor_ols_regression(factor, returns), 'ols')

                return update_distribution_figure, update_heatmap_figure, \
                       update_qqplot_figure, update_factor_plot_figure, \
                       update_factor_plot_figure1, update_factor_plot_figure2, \
                       factor_table, ic_table, ols_table
            else:
                # out of sample的情况还没搞好
                out_factor = pd.read_json(out_alpha_json,
                                          orient='split',
                                          typ='series')
                # update_distribution_figure = factor_distribution_plot(out_factor)

                returns = calculate_forward_returns(self.out_of_sample,
                                                    forward_returns_period)

                ic_heatmap = get_monthly_ic(returns, out_factor,
                                            forward_returns_period)
                update_heatmap_figure = monthly_ic_heatmap_plot(ic_heatmap)

                # update_qqplot_figure = qq_plot(out_factor)

                update_factor_plot_figure = price_factor_plot(
                    self.out_of_sample, out_factor)

                factor_returns = calculate_ts_factor_returns(
                    self.out_of_sample, out_factor, forward_returns_period)
                update_factor_plot_figure1 = returns_plot(
                    factor_returns, self.factor_name)

                factor_returns = calculate_ts_factor_returns(
                    self.out_of_sample, out_factor, forward_returns_period)
                cumulative_returns = calculate_cumulative_returns(
                    factor_returns, 1)
                benchmark = self.out_of_sample['close'] / self.out_of_sample[
                    'close'][0]
                update_factor_plot_figure2 = cumulative_return_plot(
                    cumulative_returns,
                    benchmark=benchmark,
                    factor_name=self.factor_name)
                # for out of sample data onlye
                in_out_distplot = overlaid_factor_distribution_plot(
                    factor, out_factor)
                inout_qqplot = observed_qq_plot(factor, out_factor)
                # inout_qqplot.show()

                factor_table = pd_to_dash_table(factor_summary(out_factor),
                                                'summary')
                ic_table = pd_to_dash_table(
                    pd.DataFrame(calculate_ts_information_coefficient(
                        out_factor, returns),
                                 columns=[self.factor_name]), 'ic')
                ols_table = pd_to_dash_table(
                    factor_ols_regression(out_factor, returns), 'ols')

                return in_out_distplot, update_heatmap_figure, \
                       inout_qqplot, update_factor_plot_figure, \
                       update_factor_plot_figure1, update_factor_plot_figure2, \
                       factor_table, ic_table, ols_table

        return app
예제 #29
0
def tri_community():
    return html.Div(
        id='tri_community',
        style={
            'position': 'relative',
            'float': 'center',
            'border': '3px solid #319997',
            'border-radius': '6px',
            'margin': '0.25%',
            'padding': '1%',
            'width': '100%',
            'margin-bottom': '2vH'
        },
        children=[
            html.Div(id='comm_filled', style={'display': 'none'}),
            html.Div(
                children=[dbc.Input(id='data_com', type='text', value='')],
                style={'display': 'none'}),
            html.Div([
                html.H6('COVID Triage - Community',
                        style={'font-weight': '600'}),
            ]),
            html.Br(),
            html.Div(
                style={},
                children=[
                    html.Div(
                        [
                            html.H5('Pregnancy - Demographics',
                                    style={'font-weight': 'bold'}),
                            html.Br(),
                            html.Br(),
                            html.Br(),
                            dbc.Row([
                                # Q1
                                dbc.Col(surname_qc, width=1),
                                dbc.Col(surname_rc, width=1),
                                dbc.Col(html.P(), width=1),
                                # Q2
                                dbc.Col(nhs_qc, width=1),
                                dbc.Col(nhs_rc, width=1),
                                dbc.Col(html.P(), width=1),
                                # Q3
                                dbc.Col(doby_qc, width=1),
                                dbc.Col(doby_rc, width=1),
                                dbc.Col(html.P(), width=1),
                                # Q4
                                dbc.Col(parity_qc, width=1),
                                dbc.Col(parity_rc, width=2),
                            ]),
                            html.Br(),
                            dbc.Row([
                                # Q5
                                dbc.Col(del_qc, width=1),
                                dbc.Col(del_rc, width=2),
                                # Q6
                                dbc.Col(edd_qc, width=1),
                                dbc.Col(edd_rc, width=1),
                                dbc.Col(html.P(), width=1),
                                # Q7
                                dbc.Col(deldate_qc, width=1),
                                dbc.Col(deldate_rc, width=2),
                                # Q7
                                dbc.Col(tel_qc, width=1),
                                dbc.Col(tel_rc, width=2),
                            ])
                        ],
                        style={
                            'border': '1px solid #319997',
                            'border-radius': '6px',
                            'padding': '0.5%',
                            'padding-bottom': '20px'
                        }),
                    html.Br(),
                    html.Br(),
                    html.Br(),
                    html.Div(
                        [
                            html.H5('COVID - Test Status',
                                    style={'font-weight': 'bold'}),
                            html.Br(),
                            html.Br(),
                            html.Br(),
                            dbc.Row([
                                # Q9
                                dbc.Col(vacc_qc, width=1),
                                dbc.Col(vacc_rc, width=2),
                                # Q10
                                dbc.Col(vacwhich_qc, width=1),
                                dbc.Col(vacwhich1_rc, width=1),
                                dbc.Col(vacwhich2_rc, width=1),
                                # Q11
                                dbc.Col(vac1date_qc, width=1),
                                dbc.Col(vac1date_rc, width=2),
                                # Q12
                                dbc.Col(vac2date_qc, width=1),
                                dbc.Col(vac2date_rc, width=2),
                            ]),
                            html.Br(),
                            dbc.Row([
                                # Q13
                                dbc.Col(covidtest_qc, width=1),
                                dbc.Col(covidtest_rc, width=2),
                                # Q14
                                dbc.Col(covidstatus_qc, width=1),
                                dbc.Col(covidstatus_rc, width=2),
                                # Q15
                                dbc.Col(covswabdate_qc, width=1),
                                dbc.Col(covswabdate_rc, width=2),
                            ]),
                            html.Br(),
                            dbc.Row([
                                # Q16
                                dbc.Col(covadmit_qc, width=1),
                                dbc.Col(covadmit_rc, width=2),
                                # Q17
                                dbc.Col(covadmitdate_qc, width=1),
                                dbc.Col(covadmitdate_rc, width=2),
                                # Q18
                                dbc.Col(covdischargedate_qc, width=1),
                                dbc.Col(covdischargedate_rc, width=2),
                            ]),
                            html.Br(),
                            html.Br(),
                        ],
                        style={
                            'border': '1px solid #319997',
                            'border-radius': '6px',
                            'padding': '0.5%',
                            'padding-bottom': '20px'
                        }),
                ]),
            ### Row ###
            html.Br(),
            html.Br(),
            html.Br(),
            html.Div(
                style={},
                children=[
                    html.Div(
                        [
                            html.H5('COVID - Clinical Assessment',
                                    style={'font-weight': 'bold'}),
                            html.Br(),
                            html.Br(),
                            html.Br(),
                            dbc.Row([
                                # Q19
                                dbc.Col(sentences_qc, width=2),
                                dbc.Col(sentences_rc, width=2),
                                dbc.Col(rwt_qc, width=1),
                                dbc.Col(rwt_rc, width=4),
                            ]),
                            html.Br(),
                            dbc.Row([
                                # Q20
                                dbc.Col(covsymp_qc, width=2),
                                dbc.Col(tsym1_rc, width=2),
                                dbc.Col(tsym2_rc, width=2),
                                # 21
                                dbc.Col(tsym3_rc, width=2),
                                # 22
                                dbc.Col(tsym4_rc, width=2),
                            ]),
                            ### Row ###
                            html.Br(),
                            dbc.Row([
                                dbc.Col(covrisksw_qc, width=2),
                                dbc.Col(risksw1_rc, width=2),
                                # Q24
                                dbc.Col(risksw2_rc, width=2),
                                # Q25
                                dbc.Col(risksw3_rc, width=2),
                                # Q26
                                dbc.Col(risksw4_rc, width=2),
                            ]),
                            html.Br(),
                            ### Row ###
                            dbc.Row([
                                dbc.Col(covrisksb_qc, width=2),
                                # Q27
                                dbc.Col(risksb1_rc, width=2),
                                # Q28
                                dbc.Col(risksb2_rc, width=2),
                                # Q29
                                dbc.Col(risksb3_rc, width=2),
                                # Q30
                                dbc.Col(risksb4_rc, width=2),
                            ]),
                            html.Br(),
                            ### Row ###
                            dbc.Row([
                                # Q31
                                dbc.Col(covrx_qc, width=2),
                                dbc.Col(covrxw1_rc, width=2),
                                # Q32
                                dbc.Col(covrxw2_rc, width=2),
                                # Q33
                                dbc.Col(covrxw3_rc, width=2),
                                # Q34
                                dbc.Col(covrxw4_rc, width=2),
                            ]),
                            html.Br(),
                            ### Row ###
                            dbc.Row([
                                dbc.Col(covclinassess_qc, width=2),
                                # Q27
                                dbc.Col(clin1assess1_rc, width=2),
                                # Q28
                                dbc.Col(clin1assess2_rc, width=2),
                                # Q29
                                dbc.Col(clin1assess3_rc, width=2),
                                # Q30
                                dbc.Col(clin1assess4_rc, width=2)
                            ]),
                            html.Br(),
                            dbc.Row([
                                dbc.Col(labour_qc, width=2),
                                # Q27
                                dbc.Col(labour_rc, width=2),
                                dbc.Col(fetalconcerns_qc, width=2),
                                # Q29
                                dbc.Col(fetalconcerns_rc, width=2),
                            ]),
                            html.Br(),
                            dbc.Row([
                                dbc.Col(fetalheart_qc, width=2),
                                # Q30
                                dbc.Col(fhr_rc, width=2),
                            ]),
                            ### Row ###
                            #    dbc.Col(covfreetext_qc, width=2),
                            # ]),
                            # dbc.Row([
                            #    dbc.Col(covfreetext_rc, width=10),

                            # ]),
                        ],
                        style={
                            'border': '1px solid #319997',
                            'border-radius': '6px',
                            'padding': '0.5%',
                            'padding-bottom': '20px'
                        }),
                    html.Br(),
                    html.Div(children=[
                        html.Div([
                            html.Button(id='communitytriage_btn_confirm',
                                        children='Confirm',
                                        n_clicks=0)
                        ],
                                 style={
                                     'margin-right': '10px',
                                     'display': 'inline-block'
                                 }),
                        # html.Div([html.A(html.Button(id='communitytriage_btn_confirm', children='Confirm', n_clicks=0),
                        #                  href='/experiment')],
                        #          style={'margin-right': '10px', 'display': 'inline-block'}),
                        html.Div([
                            html.Button(id='communitytriage_btn_cancel',
                                        children='Cancel',
                                        n_clicks=0)
                        ],
                                 style={'display': 'inline-block'})
                    ])
                ])
        ])
예제 #30
0
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

card_content_1 = [
    dbc.CardHeader("Card header"),
    dbc.CardBody([
        html.H5("Card title", className="card-title"),
        html.P(
            "This is some card content that we'll reuse",
            className="card-text",
        ),
    ]),
]

card_content_2 = dbc.CardBody([
    html.Blockquote(
        [
            html.P("A learning experience is one of those things that says, "
                   "'You know that thing you just did? Don't do that.'"),
            html.Footer(html.Small("Douglas Adams", className="text-muted")),
        ],
        className="blockquote",
    )
])

card_content_3 = [
    dbc.CardImg(src="./assets/placeholder286x180.png", top=True),
    dbc.CardBody([