コード例 #1
0
ファイル: app.py プロジェクト: TACC/a2cps-weekly-dash
def serve_layout():
    section1, section2, section3, section4 = build_content(datetime.now(), ASSETS_PATH, display_terms_file, weekly_csv, multi_row_json)
    content_dict = get_content_dict_for_store(section1, section2, section3, section4)
    try:
        page_layout = html.Div(id='page_layout')#build_page_layout(section1, section2, section3, section4)
    except:
        page_layout = html.Div(['There has been a problem accessing the data for this Report.'])

    s_layout = html.Div([
        dcc.Store(id='store_sections', data = [content_dict]),
        Download(id="download-dataframe-xlxs"),
        Download(id="download-dataframe-html"),
        html.Div([
            html.Div([
                # html.Button("Download Report as HTML",n_clicks=0, id="btn_html",style =EXCEL_EXPORT_STYLE ),
                html.Button("Download Report as Excel",n_clicks=0, id="btn_xlxs",style =EXCEL_EXPORT_STYLE ),
                daq.ToggleSwitch(
                    id='toggle-view',
                    label=['Tabs','Single Page'],
                    value=False,
                    style =EXCEL_EXPORT_STYLE
                ),
            ],id='print-hide', className='print-hide'),
            html.H2(['A2CPS Weekly Report']),
            html.Div(id='download-msg'),
            page_layout,
        ]
        , style =CONTENT_STYLE)
    ],style=TACC_IFRAME_SIZE)
    return s_layout
コード例 #2
0
ファイル: BaseClasses.py プロジェクト: TimChild/dat_analysis
 def _download_button(self, graph_id, file_type: str):
     if file_type not in ['html', 'jpg', 'svg']:
         raise ValueError(f'{file_type} not supported')
     button = [
         dbc.Button(f'Download {file_type.upper()}',
                    id=f'{graph_id}_but-{file_type}-download'),
         Download(id=f'{graph_id}_download-{file_type}')
     ]
     return button
コード例 #3
0
 def downloadButton(self, viewName, **kwags):
     return [
         dbc.Button([html.I(className="fas fa-download fa-lg")], **kwags),
         dcc.Loading(Download(id={
             'type': 'download',
             'view': viewName
         }),
                     color=self.loadingColor)
     ]
コード例 #4
0
def elisaquant(data, y, template):
    """
    """
    #Average the standards OD
    standards_x = data.loc[:, 0:1].mean(axis=1)
    #Avcerage the replicate samples
    if template == 1:
        samples_x = []
        for i in [3,5,7,9,11]:
            samples_x = np.concatenate([samples_x,data.loc[:, i:i+1].mean(axis=1).values])
    else:
        samples_x = []
        for i in range(2, 12):
            samples_x = np.concatenate([samples_x,[data[i].iloc[j:j+2,].values.mean() for j in [0,2,4,6]]])
        import pdb; pdb.set_trace()


    params, params_covariance = opt.curve_fit(logistic5, standards_x, y)
    #evaluation
    preds = pd.DataFrame({'Predictions':logistic5(samples_x, *params)})
    preds = preds.reset_index()
    preds = preds.rename(columns={'index':'Samples'})
    preds['Samples'] += 1
    #provide ability to download preds
    fig = go.Figure()
    fig.add_trace(go.Scatter(name = 'Standards', x = standards_x.values, y = y, mode='markers'))
    fig.add_trace(go.Scatter(name = 'Samples', x = samples_x, y = preds['Predictions'], mode='markers'))
    fig.update_layout(template='plotly_white', title='5-Parameter Logistic Regression Fit and Predictions')
    #fig.add_trace(go.Scatter(name = 'Curve'))
    children = [html.Div([
        dcc.Graph(figure = fig),
        html.Br(),
        html.Div([
            dbc.Label("Sample Predictions", style = {'margin-right':'5px'}),
            dbc.Button("Download csv", id="btn"), Download(id="download")
        ], style = {'display':'inline-block'}),
        dt.DataTable(
            id='table',
            columns=[{"name": i, "id": i} for i in preds.columns],
            data=preds.to_dict('records'),
            style_table = {'overflowY': 'scroll', 'height':'500px'},
            style_cell={'textAlign': 'center'},
            style_cell_conditional=[
                {'if': {'column_id': 'Samples'},'width': '33%'},
                {'if': {'column_id': 'Predictions'},'width': '66%'}])
    ], style = {'height':'750px', 'overflow':'scroll'})]
    return children, preds
コード例 #5
0
ファイル: data_card.py プロジェクト: DalbergDataInsights/cehs
 def __get_link_layout(self):
     text_section_layout = dbc.Col(
         [
             html.A(
                 html.Span("cloud_download",
                           className="material-icons align-middle"),
                 className="data-card__download-button",
                 id=f"{self.my_name}_download_button",
             ),
             Download(id=f"{self.my_name}_download_data"),
         ],
         width={
             "size": 1,
             "offset": 11
         },
     )
     return text_section_layout
コード例 #6
0
ファイル: dash.py プロジェクト: goncalovalverde/seshat
    def show_raw_data(self, team=0):
        tm = self.projects[team]
        df = tm.cycle_data

        layout = (
            html.Div([
                html.Button("Download data as CSV file",
                            id="download_csv_btn",
                            n_clicks=0),
                Download(id="download"),
            ]),
            dash_table.DataTable(
                id="table",
                columns=[{
                    "name": i,
                    "id": i
                } for i in df.columns],
                data=df.to_dict("records"),
            ),
        )
        return layout
コード例 #7
0
ファイル: app.py プロジェクト: RishabhGhora/OCR
def parse_contents(contents, filename, date):
    """
    Converts input image encodes as b64 string to 
    numpy array then runs OCR.py on that array and 
    returns a Div with the image and extracted text
    contents: image inputed by user as b64 
    filename: filename for image
    date: date uploaded
    Div: returns Div with image and extracted text
    """
    b64_img = contents.split(',')[1]
    decoded = base64.b64decode(b64_img)
    buffer = io.BytesIO(decoded)
    im = Image.open(buffer)
    arr = np.asarray(im)
    text = get_text(arr)
    contents = resize_input(im)
    return html.Div(
        [
            html.H5(
                'Original Filename: ' + filename, id='filename', key=filename),
            # HTML images accept base64 encoded strings in the same format
            # that is supplied by the upload
            html.Img(src=contents, style={'padding-top': '1%'}),
            html.Br(),
            html.Br(),
            html.H5("Detected Text: " + text, id='txt', key=text),
            html.Div([
                html.Button("Download .txt File", id="btn"),
                Download(id="download")
            ]),
            html.Hr(),
        ],
        style={
            'text-align': 'center',
        })
コード例 #8
0
                 min_date_allowed=date(2020, 1, 1),
                 max_date_allowed=date(2040, 12, 31),
                 start_date=date(2020, 1, 1),
                 end_date=date(2023, 12, 31),
                 className="pl-3 mb-1", 
                 id="date-picker"),  
             dcc.RangeSlider(id='range-slider',min=0,max=252,step=1,value=[0, 59],allowCross=False)
             ],
                 style={'width': '400px','height': '75px'}),
         html.Div([
             dbc.DropdownMenu(
                 label="Exportar Dados",
                 className="d-inline-block mr-3",
                 toggleClassName="btn-exportacao",
                 children=[
                     dbc.DropdownMenuItem(['Exportar os dados do gráfico',Download(id="download-grafico")], id="btn-exp-grafico"),
                     dbc.DropdownMenuItem(['Exportar os dados da tabela',Download(id="download-tabela")], id="btn-exp-tabela"),
                 ],
             ),
             html.Button(
                 html.Img(src="assets/imgs/eraser-solid.png",className="botao-limpa"),
                 id="borracha",
                 style={'width': '30px', 'height':'30px', 'padding': '0px','border':'2px #4479F5 solid', 'border-radius': '.25rem', 'marginRight': '15px'}),
             dbc.Button("Filtros", id="open", className="btn-filtros mr-3"),
             dbc.Button("Estimativa IPCA", id="open2", className="btn-filtros", style={'fontSize': '13px'}),
             ], style={'display':'inline-block'})
     ], className="slider-filtros mb-4"),
     dcc.Loading(id="loading-2", children=[html.Div(id="container-tabela")], type="circle"),
     ]
     ,className="px-4 pt-4 pb-5"),  
 className="bg-branco"
コード例 #9
0
def create_actions_tab(projname, vername):
    return [
        dbc.Row(dbc.Col(html.H2("Actions")), ),
        dbc.Row(
            dbc.Col(html.H4("Project: - Version: - "),
                    id='actions_projver'), ),
        dbc.Row(
            [
                dbc.Col(
                    dbc.Card(
                        [
                            dbc.CardHeader("Export SPDX JSON file",
                                           style={'classname': 'card-title'},
                                           id='spdxtitle'),
                            dbc.CardBody(
                                [
                                    dcc.Interval(
                                        id='spdx_interval',
                                        disabled=True,
                                        interval=1 * 6000,  # in milliseconds
                                        n_intervals=0,
                                        max_intervals=400),
                                    dbc.Form([
                                        dbc.FormGroup(
                                            [
                                                dbc.Label("Filename",
                                                          className="mr-2"),
                                                dbc.Input(
                                                    type="text",
                                                    id="spdx_file",
                                                    placeholder=
                                                    "Enter output SPDX file"),
                                            ],
                                            className="mr-3",
                                        ),
                                        dbc.FormGroup(
                                            [
                                                dbc.Checklist(
                                                    id="spdx_recursive",
                                                    options=[
                                                        {
                                                            "label":
                                                            "Recursive (Projects in Projects)",
                                                            "value": 1
                                                        },
                                                    ],
                                                    value=[],
                                                    switch=True,
                                                )
                                            ],
                                            className="mr-3",
                                        ),
                                        dbc.Button("Export SPDX",
                                                   id="buttons_export_spdx",
                                                   color="primary"),
                                    ],
                                             # inline=True,
                                             ),
                                    html.Div('', id='spdx_status'),
                                    dbc.Collapse(
                                        [
                                            dbc.Button(
                                                "Download SPDX",
                                                id="button_download_spdx",
                                                color="primary"),
                                            Download(id="download_spdx"),
                                        ],
                                        id="spdx_collapse",
                                        is_open=False,
                                    ),
                                ], ),
                            # dbc.CardFooter(dbc.CardLink('Project Version link', href=projlink)),
                        ],
                        id="spdxcard",
                    ),
                    width=4,
                ),
                dbc.Col(
                    dbc.Card(
                        [
                            dbc.CardHeader("Ignore CVEs with BDSA Mismatch",
                                           style={'classname': 'card-title'},
                                           id='fixcvestitle'),
                            dbc.CardBody(
                                [
                                    dcc.Interval(
                                        id='fixcves_interval',
                                        disabled=True,
                                        interval=1 * 6000,  # in milliseconds
                                        n_intervals=0,
                                        max_intervals=400),
                                    dbc.Form([
                                        dbc.Button(
                                            "Ignore CVEs with Mismatched BDSA Versions",
                                            id="buttons_fixcves",
                                            color="primary"),
                                    ],
                                             # inline=True,
                                             ),
                                    html.Div('', id='fixcves_status'),
                                ], ),
                            # dbc.CardFooter(dbc.CardLink('Project Version link', href=projlink)),
                        ],
                        id="fixcvescard",
                    ),
                    width=4,
                ),
            ], )
    ]
コード例 #10
0
info_4 = dbc.Card(
    [
        dbc.CardBody([
            html.H4("Shortest Main Branch", className="card-title"),
            html.P(id="info_s_m_b", className="card-text", children="")
        ]),
    ],
    style={},
)

info_5 = dbc.Card(
    [
        dbc.CardBody([
            html.Button("Download Raw CSV", id="btn-raw", n_clicks=0),
            Download(id="download-raw")
        ])
    ],
    style={},
)

info_6 = dbc.Card(
    [
        dbc.CardBody([
            html.Button("Download Analysis CSV", id="btn-analysis",
                        n_clicks=0),
            Download(id="download-analysis")
        ])
    ],
    style={},
)
                    children="download all",
                    n_clicks=None,
                    style={
                        "margin": "10px",
                        "width": "300px",
                        "text-align": "center",
                        "font-size": 14,
                        "font-family": "Arial Black",
                    },
                ),
            ],
        ),
        # upload and download up to 5 files, you may set the upper limit to any number
        # you want, ideally more than what you need. It should not affect the performance
        # significantly
        html.Div([Download(id=f"download-df-{i}") for i in range(5)]),
    ],
    style={"display": "inline-block"},
)


@app.callback(
    [Output(f"download-df-{i}", "data") for i in range(5)],
    Input("confirm-download", "n_clicks"),
    [
        State("upload-techSheets", "filename"),
        State("upload-techSheets", "contents"),
    ],
)
def update_uploads(
    n_clicks,
コード例 #12
0
def body():
    return html.Div(children=[
            html.Div(id='left-column', children=[
                dcc.Tabs(
                    id='tabs', value='About this App',
                    children=[
                        dcc.Tab(
                            label='About this App',
                            value='About this App',
                            children=html.Div(children=[
                                html.Br(),
                                html.H4('What is this app?', style={"text-align":"center"}),
                                html.P(f"""This app computes the replication strategy of European options on a set of given inputs, in the Cox-Ross-Rubinstein framework"""),
                                html.P(f"""The goal is to showcase that under the Cox-Ross-Rubinstein model assumptions (see "Model" tab), the price \(V_0\) given by the pricing formula is "arbitrage-free". 
                                           Indeed, we show that in this case, it is possible to build a strategy that"""),
                                html.Ul([html.Li("Can be initiated with \(V_0\) cash at time \(0\)."), 
                                         html.Li('Is self-financing (i.e., no need to "feed" the strategy  with extra cash later'),
                                         html.Li("Will deliver exactly the payoff of the option at maturity")
                                       ]),
                                html.Hr(),
                                html.P(["""
                                	    The considered options are European options paying \(\psi(S_T)\) at maturity \(T\) where \(\psi(X)\) is the payoff function. 
						   				                 For a call, the payoff function is \(\psi(S_T)=max(0,S_T-K)\) and for a put \(\psi(S_T)=max(0,K-S_T)\) where K is the strike price.
                                       """]),
                                html.Hr(),
                                html.P("""Read more about options: https://en.wikipedia.org/wiki/Option_(finance)"""),
                            ])
                        ),
                        dcc.Tab(
                            label="Model",
                            value="Model",
                            children=[html.Div(children=[
                                html.Br(),
                                html.H4("Model assumptions", style={"text-align":"center"}),
                                "Its main assumptions are:",
                                html.Ul([html.Li("Does not consider dividends and transaction costs"), 
                                         html.Li("The volatility and risk-free rate are assumed constant"),
                                         html.Li("Fraction of shares can be traded"),
                                         html.Li("The underlying asset can only either go 'up' by a fixed factor \(u<1\) or 'down' by \(0<d<1\)."),
                                         html.Li("The log-returns are independent at all periods")]),
                                html.Hr(),
                                html.H4("Underlying asset dynamics", style={"text-align":"center"}),
                                html.P([
                                    """
                                    Under CRR, the underlying asset follows a geometric random walk with drift \(\mu\delta\) and volatility \(\sigma\sqrt{\delta}\). The probability to go 
                          					'up' and 'down' are respectively \(p\) and \(q=1-p\) (under \(\mathcal{P}\)).The stock price at period \(i\) can be modeled as a function of a binomial 
                          					random variable, and the constant 'up' and 'down' factors computed: $$u=e^{\mu\delta+\sigma\sqrt{\delta}}$$ $$d=e^{\mu\delta-\sigma\sqrt{\delta}}$$ 
                          					where \(\\delta=\\frac{T}{tree periods}\). The \(\mathcal{Q}\)-probability allowing the discounted stock price to be a martingale amounts to the \(\\tilde{p}\) value (under \(\mathcal{Q}\)) 
                          					that leads to the martingale property: \(\\tilde{p}=\\frac{e^{r\\delta}-d}{u-d}\) and \(\\tilde{q}=1-\\tilde{p}\).
                                    """]),
                                html.Hr(),
                                html.H4("Option price", style={"text-align":"center"}),
                                html.P(["""
										                    With the CRR, the stock tree and the option intrinsic value are easily computed at all nodes. Under the pricing measure \(\mathcal{Q}\), 
                           							the option price of a node is simply the discounted value of the two children nodes. The price tree is therefore filled backwards, starting from the leaves (i.e. the payoff).
                           							The pricing formula is thus $$V_i=e^{-r\\delta}(V_{i+1}\\tilde{p}+V_{i+1}\\tilde{q})$$
                                		"""]),
                                html.Hr(),
                                html.H4("Academic references", style={"text-align":"center"}),
                                html.Ul([html.Li("Vrins, F.  (2020). Course notes for LLSM2225:  Derivatives Pricing. (Financial Engineering Program, Louvain School of Management, Université catholique de Louvain)"), 
                                         html.Li("Shreve, S. E. (2004). Stochastic Calculus for Finance I The Binomial Asset Pricing Model (2nd ed.). Springer Finance.")
                                       ]),                                
                                ])]),
                        #
                        #
                        dcc.Tab(
                            label="Appro-ach",
                            value="Appro-ach",
                            children=[html.Div(children=[
                                html.Br(),
                                html.H4("Methodology followed", style={"text-align":"center"}),
                                html.P([
                                    """
                                    To prove that the CRR option price is arbitrage-free, let us try to perfectly replicate it with a strategy. 
                                    If the strategy is successful, then the option price is unique and therefore arbitrage-free.
                                    """]),
                                html.Hr(),
                                html.H4("Replicating portfolio", style={"text-align":"center"}),
                                html.P([
                                    """
                  									Let us start a replication strategy based on the option price: \(\Pi_{0} = V_{0}\). The portfolio is composed of a cash account and a equity account. 
                  									At the begining of each period, the number of shares to hold is given by $$\Delta_{i}^{j} = \\frac{v_{i+1}^{j}-v_{i+1}^{j+1}}{s_{i+1}^{j}-s_{i+1}^{j+1}}$$ 
                  									The initial amount of cash will thus be \(c_{0} = \Pi_{0} - \Delta_{0}s_{0}\). At each node, a portfolio rebalancing is needed to ensure that the portfolio value is 
                  									equal to the option price. Before the rebalancing, \(\Delta\) is the same from node to node. Mathematically speaking, we have that $$\Delta_{i}^{j}=\Delta_{i-1}^{j}$$ 
                  									The cash account grew at the risk-free rate \(c_{i}^{j}=c_{i-1}^{j}e^{r\\delta}\), and the portfolio is the sum of both equity and cash positions $$\pi_{i}^{j}=c_{i}^{j}+\Delta_{i}^{j}s_{i}^{j}$$ 
                  									The rebalancing is done by updating the number of shares to hold $$\Delta_{i}^{j}=\\frac{v_{i+1}^{j}-v_{i+1}^{j+1}}{s_{i+1}^{j}-s_{i+1}^{j+1}}$$ 
                  									and ensuring the of value of the strategy before and after the rebalancing is the same $$c_{i}^{j}=\pi_{i}^{j}-(\Delta_{i-1}^{j}-\Delta_{i}^{j})s_{i}^{j}$$ 
                  									The tree is computed forward, and will at all times replicate with option price. At the end of it we obtain the option payoff.
                                    """]),
                                ])]),
                        #
                        #
                        dcc.Tab(
                            label='Input',
                            value='Input',
                            children=html.Div(children=[
                                                html.Br(),
                                                #
                                                html.P(
                                                    """
                                                    Hover your mouse over any input to get its definition.                           
                                                    """
                                                ),
                                                dcc.Dropdown(
                                                    id='CallOrPut',
                                                    options=[{'label':'European Call option', 'value':"Call"},
                                                             {'label':'European Put option', 'value':"Put"}],
                                                    value='Call'),
                                                #
                                                html.Br(),
                                                #
                                               html.Div(children=[html.Label('Spot price', title=list_input["Spot price"], style={'font-weight': 'bold', "text-align":"left", "width":"25%",'display': 'inline-block'} ),
                                                                  dcc.Input(id="S", value=100, type='number', style={"width":"16%", 'display': 'inline-block'}),
                                                                  html.P("",id="message_S", style={"font-size":12, "color":"red", "padding":5, 'width': '55%', "text-align":"left", 'display': 'inline-block'})
                                                                  ]
                                                        ),

                                              html.Div(children=[html.Label("Strike", title=list_input["Strike"], style={'font-weight': 'bold',"text-align":"left", "width":"25%",'display': 'inline-block'} ),
                                                                 dcc.Input(id="K", value=100, type='number', style={"width":"16%", 'display': 'inline-block'}),
                                                                 html.P("",id="message_K", style={"font-size":12, "color":"red", "padding":5, 'width': '55%', "text-align":"left", 'display': 'inline-block'})
                                                                ],
                                                      ),                   
                                                #
                                                html.Div(children=[html.Label("Drift", title=list_input["Drift"], style={'font-weight': 'bold', 'display': 'inline-block'}),
                                                                   html.Label(id="drift", style={'display': 'inline-block'}),
                                                                  ]),
                                                #
                                                dcc.Slider(id='mu', min=-0.30, max=0.30, value=0.10, step=0.01, marks={-0.30: '-30%', 0:"0%", 0.30: '30%'}),
                                                #
                                                html.Div([html.Label('Volatility', title=list_input["Volatility"], style={'font-weight': 'bold', "display":"inline-block"}),
                                                          html.Label(id="sigma", style={"display":"inline-block"}),]),  
                                                #
                                                dcc.Slider(id='vol', min=0, max=1, step=0.01, value=0.20, marks={0:"0%", 0.50:"50%", 1:"100%"}),
                                                #
                                                html.Div([html.Label('Risk-free rate', title=list_input["Risk-free rate"], style={'font-weight': 'bold', "display":"inline-block"}),
                                                          html.Label(id="riskfree", style={"display":"inline-block"}),]),  
                                                dcc.Slider(id='Rf', min=0, max=0.1, step=0.01, value=0.05, marks={0:"0%", 0.05:"5%", 0.1:"10%"}),
                                                #
                                                html.Div([html.Label('Maturity', title=list_input["Maturity"], style={'font-weight':'bold', "display":"inline-block"}),
                                                          html.Label(id="matu", style={"display":"inline-block"}),]),                                        
                                                dcc.Slider(id='T', min=0.25, max=5, 
                                                           marks={0.25:"3 months", 3:"3 years", 5:"5 years"}, step=0.25, value=3),
                                                #
                                                html.Br(),
                                                html.Div(children=[html.Label('Tree periods: ', title=list_input["Tree periods"], style={'font-weight': 'bold', "text-align":"left", "width":"30%",'display': 'inline-block'} ),
                                                                   dcc.Input(id="tree_periods", value=4, type='number', style={"width":"16%", 'display': 'inline-block'}),
                                                                   html.P("",id="message_tree", style={"font-size":12, "color":"red", "padding":5, 'width': '40%', "text-align":"left", 'display': 'inline-block'})
                                                                  ],
                                                        ),
                                                html.Div(children=[html.Label("Graph type: ", style={'font-weight': 'bold', "text-align":"center",'display': 'inline-block'} ),
                                                                   dcc.RadioItems(id="GraphType",
                                                                                  options=[{'label': 'Spatial', 'value': 'spatial'},
                                                                                           {'label': 'Tree', 'value': 'tree'}
                                                                                          ],
                                                                                  value='tree',
                                                                                  labelStyle={'padding':5, 'font-weight': 'bold', 'display': 'inline-block'},
                                                                                  style={'font-weight': 'bold', "text-align":"center",'display': 'inline-block'}
                                                                                 ), 
                                                                  ]),
                                                html.P("""Note that some errors are possible due to rounding decimals when displaying the values in the chart. Download the exact values in excel format if you wish to check. """),
                                                html.Br(),
                                                html.Div([html.Button("Download xlsx", id="btn", n_clicks=0), Download(id="download")]),
                                                html.P("""Note: requires excel decimal separator to be a dot.""", style={"font-size":12}),

                                                ])),
        ],),], style={'float': 'left', 'width': '25%', 'margin':"30px"}), 
    ])
コード例 #13
0
                     value=[0, 59],
                     allowCross=False)
 ],
          style={
              'width': '400px',
              'height': '75px'
          }),
 html.Div([
     dbc.DropdownMenu(
         label="Exportar Dados",
         className="d-inline-block mr-3",
         toggleClassName="btn-exportacao",
         children=[
             dbc.DropdownMenuItem([
                 'Exportar os dados do gráfico',
                 Download(id="download-grafico")
             ],
                                  id="btn-exp-grafico"),
             dbc.DropdownMenuItem([
                 'Exportar os dados da tabela',
                 Download(id="download-tabela")
             ],
                                  id="btn-exp-tabela"),
         ],
     ),
     html.Button(html.Img(src="assets/imgs/eraser-solid.png",
                          className="botao-limpa"),
                 id="borracha",
                 style={
                     'width': '30px',
                     'height': '30px',
コード例 #14
0
import dash_core_components as dcc
import dash_html_components as html

from dash_extensions import Download
from static_data import filter_options, transform_options, data_sample_options

plot_layout = html.Div(children=[
    html.Div(children=[
        html.H2(children='Plots'),
        html.Div(children=[
            html.Div(children=[dcc.Dropdown(id='plot_figure_name')]),
            html.Div(id='transform_option_groups',children=[html.Label(["X axis transform", dcc.RadioItems(
            options=transform_options, id='x_axis_transform', value='log')], style={'display': 'none'}),
        html.Label(["Y axis transform", dcc.RadioItems(
            options=transform_options, id='y_axis_transform', value='log')],style={'display': 'none'})]),
            html.Label(["Scale", dcc.Dropdown(
                options=filter_options, id='scale', value='all')]),
            html.Button('Add plot', id='add_plot', n_clicks=0),
        ]),
        html.Div(id='plot_tabs_div',children=dcc.Tabs(id='plot_tabs', children=[])),
        dcc.Loading(
        children=[html.Button(
            "Download all figures", id="download-all-figures-btn"), Download(id='download-all-figures-action')],
        type="circle")
    ])
])
コード例 #15
0
ファイル: pv_app.py プロジェクト: gcroci2/Photovoltaics
                            id='signal2_ticker',
                            options=[
                                {'label': i, 'value': i} for i in ['TempOut', 'SolarRad',
                                'SolarEnergy', 'HiSolarRad', 'OutHum', 'WindSpeed', 'WindDir',
                                'WindRun', 'Rain']
                                ], multi=True,
                            value=[],
                            style={'color': colors['text']},
                        ),
                    ], style={"width": "40%"}, className="six columns")
                ], className="row"),

                html.H3('Download displayed traces:', style={'paddingRight': '30px', 'fontSize': 18, 'color': colors['text']}),
                html.Div([
                    html.Div([
                        html.Button("Substations Traces", id="btn1"), Download(id="download1")
                    ], className="six columns", style={"width": "20%", 'color': colors['text']}),
                    html.Div([
                        html.Button("Weather Traces", id="btn2"), Download(id="download2")
                    ], className="six columns", style={"width": "20%", 'color': colors['text'], 'padding-left':'25%'})
                ], className="row"),

            ], className="six columns"),
            #------------------

            html.Div([
                dcc.Graph(id='map')
            ], className="six columns"),
        ], className="row", style={'marginTop': '5em','padding-left':'10%', 'padding-right':'15%', 'verical-align': 'center'}),
        #---------------
コード例 #16
0
 html.Br(),
 html.Br(),
 html.A(html.Button(
     'Link to access all predictions for protein coding genes',
     className='downloads'),
        href=
        'https://drive.google.com/file/d/1DGqWXcGLWc9bntlWtl0NB3aJ7WLGb3qi/view?usp=sharing'
        ),
 html.Br(),
 html.Br(),
 html.Div([
     html.Button(
         "Download top predictions for protein coding genes",
         id="pc-btn",
         className='downloads'),
     Download(id="pc-download")
 ]),
 html.Br(),
 html.Div([
     html.Button(
         "Download predictions for lncrna genes",
         id="lncrna-btn",
         className='downloads'),
     Download(id="lncrna-download")
 ]),
 html.Br(),
 html.Div([
     html.Button("Download the HGv1 Gene Dataset",
                 id="hgv1-gene-btn",
                 className='downloads'),
     Download(id="hgv1-gene-download")
コード例 #17
0
ファイル: layout.py プロジェクト: apopheniac/insight
def set_layout(
    app: dash.Dash,
    df: pd.DataFrame,
) -> None:
    departments = df["Department"].unique()
    products = df["Product"].unique()
    fig = create_pnl_chart(monthly_totals(df))

    app.layout = dbc.Container(
        html.Div(
            [
                dbc.NavbarSimple(
                    [
                        dbc.NavItem(
                            dbc.NavLink("Log out", href="/logout", external_link=True)
                        ),
                    ],
                    brand="Insight | Business Analytics",
                    brand_href="#",
                    color="primary",
                    dark=True,
                ),
                dbc.Row(
                    dbc.Col(
                        html.Div(
                            [
                                dcc.Graph(id="bar-chart", figure=fig),
                            ]
                        )
                    )
                ),
                dbc.Row(
                    [
                        dbc.Col(
                            dbc.FormGroup(
                                [
                                    dcc.Dropdown(
                                        id="department-filter",
                                        options=[
                                            {"label": d, "value": d}
                                            for d in departments
                                        ],
                                        placeholder="Filter by department",
                                    ),
                                ],
                            )
                        ),
                        dbc.Col(
                            dbc.FormGroup(
                                [
                                    dcc.Dropdown(
                                        id="product-filter",
                                        options=[
                                            {"label": p, "value": p} for p in products
                                        ],
                                        placeholder="Filter by product",
                                    ),
                                ],
                            )
                        ),
                        dbc.Col(
                            [
                                dbc.Button("Export", id="download-button"),
                                Download(id="download"),
                            ]
                        ),
                    ],
                ),
                dbc.Row(
                    [
                        dbc.Col(
                            DataTable(
                                id="sales-table",
                                columns=table_columns,
                                data=df.to_dict("records"),
                                page_size=20,
                                style_cell_conditional=[
                                    {
                                        "if": {"column_id": c},
                                        "textAlign": "left",
                                    }
                                    for c in ["Date", "Department", "Product"]
                                ],
                                style_as_list_view=True,
                            )
                        )
                    ]
                ),
            ]
        )
    )
コード例 #18
0
# df = pd.merge(munis_apls_stack, apls_cnaes, on='id_apl')
# df = pd.merge(df, apls, on='id_apl')
# df = pd.merge(df, municipios[['id_munic_6', 'município']], on='id_munic_6')
# df['sede'] = [1 if i in j else 0 for i,
#               j in zip(df['município'], df['sede_apl'])]
# df = pd.merge(df, bq[['ano', 'estabs', 'vinculos',
#                       'classe', 'subclasse',
#                       'id_munic_6']], on=['id_munic_6', 'classe'])
# df = pd.merge(df, cnaes[['classe', 'nome_classe']], on='classe', how='left')
# 
# del apls_cnaes, bq, cnaes, munis_apls_stack, mun_apls
# =============================================================================

df = pd.read_csv('assets/data_apls.csv', encoding='latin1')

app.layout = html.Div([html.Button("Download base de APLs", id="btn"), Download(id="download"),
                       html.Div([
    html.Div([html.P("Setor do APL"),
              dcc.Dropdown(id='setor-apl-dropdown',
                           options=sorted([{'label': i, 'value': i} for i in df['setor_apl'].unique()],
                                          key=itemgetter('label')),
                           value='Aeroespacial e Defesa'
                           )
              ],
             style={'width': '48%', 'display': 'inline-block'}),
    html.Div([html.P("Município sede do APL"),
              dcc.Dropdown(id='sede-apl-dropdown')
              ],
             style={'width': '48%', 'float': 'right', 'display': 'inline-block'})
]),
    html.H3(html.Div(id='display-selected-values')),
コード例 #19
0
         ],
         width=12),
 ]),
 dbc.Row([
     dbc.Col([
         dcc.Store(id="aligned-B"),
         dcc.Loading(id='waterman-loading',
                     children=[html.Div(id="waterman-output")],
                     type="cube")
     ],
             width=12),
 ]),
 dbc.Row([
     dbc.Col([
         dcc.Store(id="aligned-fasta-store"),
         Download(id="download-aligned-fasta"),
         dbc.Button("Make aligned Fasta for chart",
                    id='btn-align-fasta',
                    color="primary",
                    n_clicks=0),
         html.Br(),
         html.Br(),
         dbc.Button("Download Aligned Fasta",
                    id="download-btn",
                    color="secondary",
                    n_clicks=0)
     ],
             width=12),
     dbc.Col([
         dcc.Loading(id='aligned-fasta-loading',
                     children=[html.Div(id="aligned-fasta-output")],
コード例 #20
0
    dbc.Row([
        dbc.Col([
            html.Button(id='submit-button',
                        type='submit',
                        children='Submit',
                        style={'width': '300px'}),
        ],
                width={"order": "first"},
                style={
                    'margin-top': 20,
                    'margin-left': -235
                }),
        # dbc.Col([
        #     html.Div(id='output_div-ga'),
        # ])
        dbc.Col([html.Div(Download(id="download_ga"))])
    ])
])

row11 = html.Div([
    dbc.Row([
        dbc.Col(
            [
                dbc.Input(id="save-report",
                          type="text",
                          placeholder="Save Report as",
                          style={'width': '300px'},
                          persistence=True,
                          persistence_type='memory'),
            ],
            style={
コード例 #21
0
                     id="input_cep", placeholder="CEP", type="text"),
                 html.P(),
                 dbc.Row(
                     dbc.Col([
                         dbc.Spinner(dbc.Collapse(
                             [
                                 html.Div(id="status_code_cep"),
                                 dbc.Col(id="card_output_cep"),
                                 html.P(),
                             ],
                             id="collapse_output_cep",
                         ),
                                     type="grow",
                                     color="danger"),
                         dbc.Col([
                             Download(id='download_json_cep'),
                             Download(id='download_csv_cep')
                         ], ),
                     ]), ),
             ],
                      body=True),
         ]),
     ],
     lg=5,
 ),
 dbc.Collapse(
     dbc.Col([
         dbc.Row(
             dbc.Card(
                 [
                     html.Iframe(id="iframe_mapa_cep",
コード例 #22
0
def cargar_contenido_reporte_general(escuelas) :
    """
    Carga el layout del reporte general dados los datos de las escuelas.
    
    Args:
        escuelas (:obj: `OrderedDict`): diccionario ordenado con los datos de las
            escuelas del reporte.
    Returns:
        Layout del reporte general para mostrarlo en la plantilla del reporte.
    """
    
    mapa = GeneradorDeGraficas.generar_mapa(escuelas)
    
    contador_escuelas = {
        "Preescolar": 0,
        "Primaria": 0,
        "Secundaria": 0
    }
    
    for cct in escuelas :
        contador_escuelas[escuelas[cct]['nivel']] += 1
    
    num_paginas = 1
    if len(escuelas) <= ESCUELAS_POR_PAGINA :
        # Hack para no mostrar el slider si existe una sola página
        slider = dcc.Input(
            type = 'hidden', 
            value = 1,
            id = 'slider-paginacion'
        )
    else :
        num_paginas = len(escuelas) // ESCUELAS_POR_PAGINA + (1 if len(escuelas) % ESCUELAS_POR_PAGINA != 0 else 0)
        
        marcas = dict()
        for i in range(1, num_paginas + 1) :
            marcas[i] = {'label': "%d" % (i)}
        
        slider = dcc.Slider(
            min = 1,
            max = num_paginas,
            value = 1,
            marks = marcas,
            included = False, 
            id = 'slider-paginacion'
        )
    
    # Crear layout de la página
    layout_reporte = dbc.Container([
        # Renglón del mapa y el scatterplot
        dbc.Row([
            # Layout del Scatterplot
            dbc.Col([
                html.H5(
                    "Reporte general",
                    style = {
                        "color": "#1199EE",
                        "font-weight": "bold"
                    },
                ),
                html.H3(
                    "Resumen con la información general de las escuelas",
                    style = {"font-weight": "bold"}
                ),
                html.P(
                    "Explora la proyección, medidas de tendencia central y la " +
                    "función de autocorrelación de la matrícula de las escuelas, " + 
                    "así como su ubicación en el mapa. Da click sobre la clave " + 
                    "del centro de trabajo de una escuela para obtener más detalles de ella.",
                    style = {
                        "text-align": "justify"
                    }
                ),
                html.P("Este reporte contiene:", style = {"font-weight": "bold"}),
                html.P([
                    html.B("Preescolar: "),
                    "%d %s" % (contador_escuelas['Preescolar'], "escuela" if contador_escuelas['Preescolar'] == 1 else "escuelas")],
                    style = {"margin": "0"}
                ),
                html.P([
                    html.B("Primarias: "),
                    "%d %s" % (contador_escuelas['Primaria'], "escuela" if contador_escuelas['Primaria'] == 1 else "escuelas")],
                    style = {"margin": "0"}
                ),
                html.P([
                    html.B("Secundarias: "),
                    "%d %s" % (contador_escuelas['Secundaria'], "escuela" if contador_escuelas['Secundaria'] == 1 else "escuelas")],
                    style = {"margin": "0"}
                )],
                md = 6,
                style = {
                    "margin-top": "4rem",
                }
            ),
            # Layout del mapa
            dbc.Col(
                dcc.Graph(figure = mapa, id = 'mapa-general'),
                md = 6,
            )],
            justify = "center",
            style = {"padding-left": "1rem"}
        ),
        # Renglón del scatterplot
        dbc.Row(
            dbc.Col([
                dcc.Graph(
                    #figure = scatterplot, 
                    id = 'scatterplot-general',
                    style = {
                        "margin-bottom" : "0", 
                        "padding-bottom": "0"
                    },
                ),
                html.P(
                    u"* Fuente: estadística 911",
                    className = "text-secondary",
                    style = {
                        "font-size" : "0.5rem", 
                        "margin" : "0", 
                        "padding" : "0"
                    }
                )],
                md = 12
            )
        ),
        # Renglón del boxplot
        dbc.Row(
            dbc.Col(
                dcc.Graph(
                    #figure = boxplot, 
                    id = 'boxplot-general'
                ),
                md = 12
            )
        ),
        # Controles de paginación
        dcc.Loading(
            id = "loading-graficas",
            type = "default",
            children = html.Div(id = "salida-loading-graficas"),
            style = {"margin-top": "-2rem"}
        ),
        slider,
        # Renglón de las tablas de métricas y de matrícula
        dbc.Row([
            # Layout de la tabla de matrícula
            dbc.Col([
                dbc.Container(dbc.Row([
                    html.H4(u"Matrícula por ciclo escolar"), 
                    dbc.Button([
                        u"Descargar csv ",
                        html.I(className="far fa-arrow-alt-circle-down")],
                        color = "info",
                        style = {
                            "padding" : "0.2rem", 
                            "margin" : "0 0.2rem 0.2rem 0.2rem", 
                            "background" : "#1199EE"
                        },
                        id = "descargar_csv_button"
                    ),
                    Download(id = "descargar_csv")]
                )),
                html.Div(
                    #tabla_matricula,
                    id = 'div-tabla-matricula'
                )],
                md = 6,
            ),
            # Layout de la tabla de métricas
            dbc.Col([
                html.H4(u"Métricas de la proyección"),
                html.Div(
                    #tabla_metricas,
                    id = 'div-tabla-metricas'
                )],
                md = 6,
            )]
        )],
        # Estilos del layout general
        style = {"background" : "#FFFFFF"},
        fluid = True
    )
    return layout_reporte
コード例 #23
0
ファイル: endereco.py プロジェクト: serenozin/ViaCep-vamoAI
                         dbc.Spinner(dbc.Collapse(
                             [
                                 dbc.Row([
                                     dbc.Col(
                                         html.Div(id="status_code")),
                                     dbc.Col(html.Div(id="counter")),
                                     html.P(),
                                 ]),
                                 dbc.Row(dbc.Col(id="card_output")),
                             ],
                             id="collapse_output",
                         ),
                                     type="grow",
                                     color="danger"),
                         dbc.Col([
                             Download(id='download_json'),
                             Download(id='download_csv')
                         ], ),
                     ]), ),
             ],
                      body=True),
         ]),
     ],
     lg=5,
 ),
 dbc.Collapse(
     dbc.Col([
         dbc.Row(
             dbc.Card(
                 html.Iframe(id="iframe_mapa",
                             height=400,
コード例 #24
0
         "padding-top": "20px",
     },
 ),
 dcc.Graph(id="data-plot", style={"height": 600}),
 html.Button(
     "Export Data",
     id="export_btn",
     n_clicks=0,
     style={
         "padding": "0px",
         "width": "100px",
         "margin-top": "33px",
         "margin-bottom": "20px",
     },
 ),
 Download(id="download"),
 dash_table.DataTable(
     id="table",
     columns=[
         {
             "id": "name",
             "name": "Name"
         },
         {
             "id": "peak",
             "name": "Peak"
         },
         {
             "id": "avg",
             "name": "Average"
         },
コード例 #25
0
                                style={
                                    "margin-bottom": "15px",
                                    "color": "maroon"
                                }),
                        html.P(
                            'If you selected additional output options, buttons to download the selected files will appear below:',
                            style={'margin': '15px'},
                        ),
                        html.Div(
                            [
                                html.Button(
                                    "Download CSV File",
                                    id='d_btn_csv',
                                    style={'margin': '15px'},
                                ),
                                Download(id="t2_download_csv")
                            ],
                            id="csv_btn",
                        ),
                        html.Div(
                            [
                                html.Button(
                                    "Download FDS File",
                                    id='d_btn_fds',
                                    style={'margin': '15px'},
                                ),
                                Download(id="t2_download_fds")

                                #---------FILE DOWLOAD LINK TEST BUTTON
                                # html.A(
                                #     html.Button("Download Test File",
コード例 #26
0
ファイル: app_dash.py プロジェクト: ErikinBC/mirror_alphabet
    html.Br(),
    html.Div([
        html.Div(dcc.Textarea(id='text1',value=lipsum,style=style_textarea), style=style_row),
        html.Div(id='text_output1', style={**style_output,**{'padding-right':100}}),
        html.Div(id='text_output2', style={**style_output,**{'padding':0}})
    ]),
    html.Button('Submit', id='submit_button', n_clicks=0),
    html.Br(), html.Br(),
    html.H3('Pick an index from 0-10394 (0 has most words, 10394 has the fewest)'),
    dcc.Input(id='user_idx',placeholder='Enter an interger...',type='number', value=0,min=0,max=10394,step=1),
    html.Br(), 
    html.Div(id='text_output3', style={**style_output,**{'padding-right':100}}),
    html.Div(id='text_output4', style={**style_output,**{'padding-right':100}}),
    html.Div(id='text_output5', style={**style_output,**{'padding-right':100}}),
    html.Br(), html.Br(),
    html.Div([html.Button("Download", id="btn"), Download(id="download")]),
    html.Br(), html.Br(), html.Br(), html.Br(), 
    html.Div(id='table-container',  className='tableDiv'),
    html.Br(), html.Br(), html.Br(), html.Br(), 
])

#df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': [2, 1, 5, 6], 'c': ['x', 'x', 'y', 'y']})
@app.callback(
    Output("download", "data"),
    [Input("btn", "n_clicks")]
)
def func(n_clicks):
    if os.path.exists('tmp.csv'):
        print('exists')
        df = pd.read_csv('tmp.csv')
        fn = 'poem_' + datetime.now().strftime('%Y_%m_%d_%H_%M_%S') + '.csv'
コード例 #27
0
def generate_layout(graphs, configs):
    if configs is None:
        configs = {}

    # Read-out graph view configs
    elements = configs["elements"] if "elements" in configs else None
    current_graph = configs[
        "current_graph"] if "current_graph" in configs else ""
    nodes_to_keep = configs["nodestokeep"] if "nodestokeep" in configs else []
    top_n_slider_value = configs["top_n"] if "top_n" in configs else None
    node_freq_type = configs[
        "node_weight"] if "node_weight" in configs else "degree_frequency"
    edge_freq_type = configs[
        "edge_weight"] if "edge_weight" in configs else "npmi"
    nodefreqslider = configs[
        "nodefreqslider"] if "nodefreqslider" in configs else [0, 100000]
    edgefreqslider = configs[
        "edgefreqslider"] if "edgefreqslider" in configs else [0, 100000]
    cluster_type = configs[
        "cluster_type"] if "cluster_type" in configs else "entity_type"
    clustersearch = configs[
        "clustersearch"] if "clustersearch" in configs else []
    current_layout = configs[
        "current_layout"] if "current_layout" in configs else DEFAULT_LAYOUT

    # Read-out old path search configs
    searchpathfrom = configs[
        "searchpathfrom"] if "searchpathfrom" in configs else None
    searchpathto = configs[
        "searchpathto"] if "searchpathto" in configs else None
    searchnodetotraverse = configs[
        "searchnodetotraverse"] if "searchnodetotraverse" in configs else None
    searchpathlimit = configs[
        "searchpathlimit"] if "searchpathlimit" in configs else 10
    searchpathoverlap = configs[
        "searchpathoverlap"] if "searchpathoverlap" in configs else [1]
    nestedpaths = configs["nestedpaths"] if "nestedpaths" in configs else []
    pathdepth = configs["pathdepth"] if "pathdepth" in configs else 2

    global_button_group = dbc.FormGroup([
        dbc.Col([
            dbc.Button(html.Span(
                [html.I(className="fas fa-redo"), " Reset view"]),
                       color="secondary",
                       className="mr-1",
                       id='bt-reset',
                       style={"margin": "2pt"}),
            dbc.Tooltip(
                "Reset the display to default values",
                target="bt-reset",
                placement="bottom",
            )
        ],
                width=6,
                style={"padding-left": "0pt"}),
        dbc.Col([
            dbc.Label(html.Span("Recompute spanning tree", id="recomp-label"),
                      html_for="recompute-spanning-tree"),
            dbc.Checklist(options=[{
                "value": 1
            }],
                          value=[1],
                          id="recompute-spanning-tree",
                          switch=True,
                          style={"margin-left": "5pt"}),
            dbc.Tooltip(
                "If enabled, the minimum spanning tree will be "
                "recomputed on the nodes selected in the current "
                "graph view (does not apply to filtering)",
                target="recomp-label",
                placement="bottom",
            )
        ],
                width=6)
    ],
                                        row=True,
                                        style={"margin-left": "5pt"})

    editing_mode_radio = dbc.FormGroup([
        dbc.Label("Choose the editing mode"),
        dbc.RadioItems(
            options=[
                {
                    "label": "Editing (edit the graph object)",
                    "value": 1
                },
                {
                    "label": "Masking (edit the current view)",
                    "value": 2
                },
            ],
            value=1,
            id="edit-mode",
        ),
    ])

    edit_button_group = dbc.InputGroup([
        dbc.Button(html.Span([html.I(className="fas fa-minus"), " Remove"]),
                   color="primary",
                   className="mr-1",
                   id='remove-button',
                   disabled=True,
                   style={"margin": "2pt"}),
        dbc.Button(html.Span(
            [html.I(className="fas fa-compress-alt"), " Merge"]),
                   color="primary",
                   className="mr-1",
                   id='merge-button',
                   style={"margin": "2pt"},
                   disabled=True),
        dbc.Button(html.Span([html.I(className="fas fa-edit"), " Rename"]),
                   color="primary",
                   className="mr-1",
                   id='rename-button',
                   style={"margin": "2pt"},
                   disabled=True),
        dbc.Button(html.Span([html.I(className="fas fa-redo"), " Reset"]),
                   color="secondary",
                   className="mr-1",
                   id='reset-elements-button',
                   style={
                       "float": "right",
                       "margin": "2pt"
                   },
                   disabled=False),
        dbc.Modal(
            [
                dbc.ModalHeader("Merged label"),
                dbc.ModalBody([
                    dbc.FormGroup([
                        dbc.Label("Would you like to"),
                        dbc.RadioItems(
                            options=[{
                                "label": "merge into one of the entities",
                                "value": 1
                            }, {
                                "label": "merge as a new entity",
                                "value": 2
                            }],
                            value=1,
                            id="merge-options",
                        ),
                    ]),
                    dbc.FormGroup([dbc.Input(id="merge-label-input")],
                                  id="merge-input")
                ]),
                dbc.ModalFooter([
                    dbc.Button("Apply",
                               id="merge-apply",
                               color="primary",
                               className="ml-auto"),
                    dbc.Button("Close",
                               id="merge-close",
                               color="default",
                               className="ml-auto")
                ]),
            ],
            id="merge-modal",
        ),
        dbc.Modal(
            [
                dbc.ModalHeader("Rename the selected node"),
                dbc.ModalBody([
                    html.P(id="rename-error-message", style={"color": "red"}),
                    dbc.FormGroup([
                        dbc.Col(dbc.Label("New label"), width=3),
                        dbc.Col(dbc.Input(id="rename-input"), width=9)
                    ],
                                  row=True),
                ]),
                dbc.ModalFooter([
                    dbc.Button("Apply",
                               id="rename-apply",
                               color="primary",
                               className="ml-auto"),
                    dbc.Button("Close",
                               id="rename-close",
                               color="default",
                               className="ml-auto")
                ]),
            ],
            id="rename-modal",
        ),
    ])

    dropdown_items = dcc.Dropdown(id="showgraph",
                                  value=current_graph,
                                  options=[{
                                      'label': val.capitalize(),
                                      'value': val
                                  } for val in graphs],
                                  style={"width": "100%"})

    graph_type_dropdown = dbc.FormGroup([
        dbc.Label(html.Span("Graph to display", id="showgraph-label"),
                  html_for="showgraph"),
        dbc.Tooltip(
            "Switch between different loaded graphs to display.",
            target="showgraph-label",
            placement="top",
        ), dropdown_items
    ])

    search = dbc.FormGroup([
        dbc.Label("Search node",
                  html_for="searchdropdown",
                  width=3,
                  style={
                      "text-align": "right",
                      "padding-right": "0pt"
                  }),
        dbc.Col(dcc.Dropdown(id="searchdropdown", multi=False), width=6),
        dbc.Col([
            dbc.DropdownMenu([
                dbc.DropdownMenuItem("png", id="png-menu"),
                dbc.DropdownMenuItem(divider=True),
                dbc.DropdownMenuItem("jpg", id="jpg-menu"),
                dbc.DropdownMenuItem(divider=True),
                dbc.DropdownMenuItem("svg", id="svg-menu"),
                dbc.DropdownMenuItem(divider=True),
                dbc.DropdownMenuItem(
                    "gml", id="gml-menu", href="/download/graph.gml")
            ] + [Download(id="download-gml")],
                             label="Download",
                             id='dropdown-download',
                             color="primary",
                             group=True,
                             className="mr-1",
                             in_navbar=True),
        ],
                width=3)
    ],
                           row=True,
                           style={"margin": "3pt"})

    freq_input_group = dbc.InputGroup([
        dbc.Label(html.Span("Node Weight", id="node_freq_type-label"),
                  html_for="node_freq_type"),
        dbc.Tooltip(
            "Select a metric to use as the node weight "
            "(node sizes are proportional to the selected weight)",
            target="node_freq_type-label",
            placement="top",
        ),
        dcc.Dropdown(id="node_freq_type",
                     value=node_freq_type,
                     options=[{
                         'label': val[0],
                         'value': val[1]
                     } for val in node_frequency_type],
                     style={"width": "100%"}),
    ],
                                      className="mb-1")

    node_range_group = dbc.FormGroup([
        dbc.Label(html.Span("Display Range", id="nodefreqslider-label"),
                  html_for="nodefreqslider"),
        html.Div([
            dcc.RangeSlider(id="nodefreqslider_content",
                            min=0,
                            max=100000,
                            value=nodefreqslider)
        ],
                 id="nodefreqslider"),
        dbc.Tooltip(
            "Adjust the node weight range (only the nodes having "
            "the weight in the selected range will be displayed)",
            target="nodefreqslider-label",
            placement="bottom",
        ),
    ])

    edge_input_group = dbc.InputGroup([
        dbc.Label(html.Span("Edge Weight", id="edge_freq_type-label"),
                  html_for="edge_freq_type"),
        dbc.Tooltip(
            "Select a metric to use as the edge weight (edge thickness "
            "is proportional to the selected weight)",
            target="edge_freq_type-label",
            placement="top",
        ),
        dcc.Dropdown(id="edge_freq_type",
                     value=edge_freq_type,
                     options=[{
                         'label': val[0],
                         'value': val[1]
                     } for val in edge_frequency_type],
                     style={"width": "100%"})
    ],
                                      className="mb-1")

    edge_range_group = dbc.FormGroup([
        dbc.Label(html.Span("Display Range", id="edgefreqslider-label"),
                  html_for="edgefreqslider"),
        html.Div([
            dcc.RangeSlider(id="edgefreqslider_content",
                            min=0,
                            max=100000,
                            value=edgefreqslider)
        ],
                 id="edgefreqslider"),
        dbc.Tooltip(
            "Adjust the edge weight range (only the edge having the "
            "weight in the selected range will be displayed)",
            target="edgefreqslider-label",
            placement="bottom",
        ),
    ])

    frequencies_form = dbc.FormGroup([
        dbc.Col([freq_input_group, node_range_group], width=6),
        dbc.Col([edge_input_group, edge_range_group], width=6)
    ],
                                     style={"margin-bottom": "0pt"},
                                     row=True)

    display_message = html.P("Displaying top 100 most frequent entities",
                             id="display-message")

    top_n_button = dbc.Button("Show N most frequent",
                              color="primary",
                              className="mr-1",
                              id='top-n-button',
                              style={"margin": "5pt"})

    top_n_slider = daq.NumericInput(
        id="top-n-slider",
        min=1,
        max=1000,
        value=top_n_slider_value if top_n_slider_value else 100,
        className="mr-1",
        disabled=False,
        style={"margin": "5pt"})
    show_all_button = dbc.Button("Show all entities",
                                 id="show-all-button",
                                 color="primary",
                                 className="mr-1",
                                 style={
                                     "float": "right",
                                     "margin": "5pt"
                                 })

    top_n_groups = dbc.InputGroup([
        top_n_button,
        dbc.Tooltip(
            "Display N nodes with the highest paper occurrence frequency, "
            "where N is defined by the slider on the right.",
            target="top-n-button",
            placement="top",
        ), top_n_slider, show_all_button,
        dbc.Tooltip(
            "Display all the nodes of the current graph.",
            target="show-all-button",
            placement="top",
        )
    ],
                                  style={"margin-bottom": "10pt"})

    item_details_card = dbc.Card(
        dbc.CardBody([
            html.H5("", className="card-title"),
            html.H6("", className="card-subtitle"),
            html.P("", className="card-text"),
            dbc.Button("", color="primary", id="see-more-card")
        ],
                     id="item-card-body"))

    view_selection_card = dbc.Card(dbc.CardBody([
        html.H6("View selection", className="card-title"), graph_type_dropdown,
        display_message, top_n_groups, frequencies_form
    ]),
                                   id="view-selection-card",
                                   style={"margin-bottom": "10pt"})

    cluster_group = dbc.InputGroup([
        dbc.Label(html.Span("Group by", id="group-by-label"),
                  html_for="cluster_type"),
        dbc.Tooltip(
            "Select a grouping factor for the nodes.",
            target="group-by-label",
            placement="top",
        ),
        dcc.Dropdown(id="cluster_type",
                     value=cluster_type,
                     options=[{
                         'label': val[0],
                         'value': val[1]
                     } for val in cluster_types],
                     style={"width": "100%"})
    ],
                                   className="mb-1")

    cluster_filter = dcc.Dropdown(id="clustersearch",
                                  multi=True,
                                  options=[{
                                      "label": el,
                                      "value": el
                                  } for el in clustersearch],
                                  value=clustersearch)

    filter_by_cluster = dbc.FormGroup([
        dbc.Label(html.Span("Groups to display", id="clustersearch-label"),
                  html_for="clustersearch"),
        dbc.Tooltip(
            "Only the nodes beloning to the groups selected in the field "
            "below will be displayed. You click or start typing to add new "
            "groups to display, or click on the cross icon to remove a group.",
            target="clustersearch-label",
            placement="top",
        ), cluster_filter,
        dbc.Button("Add all groups",
                   color="primary",
                   className="mr-1",
                   id='addAllClusters',
                   style={"margin-top": "10pt"}),
        dbc.Tooltip(
            "Add all available node groups to display.",
            target="addAllClusters",
            placement="bottom",
        )
    ],
                                      style={"margin-top": "10pt"})

    cluster_layout_button = dbc.InputGroup([
        dbc.Checklist(
            options=[{
                "value": 1,
                "disabled": False
            }],
            value=[],
            id="groupedLayout",
            switch=True,
        ),
        dbc.Label("Grouped Layout", html_for="groupedLayout"),
    ])

    cluster_selection_card = dbc.Card(dbc.CardBody([
        html.H6("Grouping", className="card-title"), cluster_group,
        filter_by_cluster, cluster_layout_button
    ]),
                                      style={"margin-bottom": "10pt"})

    nodes_to_keep = dbc.FormGroup([
        dbc.Label(html.Span("Nodes to keep", id="nodestokeep-label"),
                  html_for="nodestokeep"),
        dcc.Dropdown(id="nodestokeep",
                     multi=True,
                     options=[{
                         "label": n,
                         "value": n
                     } for n in nodes_to_keep],
                     value=nodes_to_keep,
                     placeholder="Nodes to fix in the view..."),
        dbc.Tooltip(
            "The selected nodes will be fixed in the graph view "
            "and will not be filtered by 'top N' or group filters "
            "(start typing to obtain the nodes to select from).",
            target="nodestokeep-label",
            placement="top",
        )
    ], )

    form = dbc.Form([
        global_button_group,
        nodes_to_keep,
        view_selection_card,
        cluster_selection_card,
    ])

    legend = dbc.FormGroup([html.Div(id="cluster_board", children=[])])

    # ------ Path search form --------

    path_from = dbc.FormGroup([
        dbc.Label(html.Span("From", id="searchpathfrom-label"),
                  html_for="searchpathfrom",
                  width=3),
        dbc.Tooltip(
            "Select a node to use as the source in the path search",
            target="searchpathfrom-label",
            placement="top",
        ),
        dbc.Col(dcc.Dropdown(id="searchpathfrom",
                             value=searchpathfrom,
                             options=([{
                                 "label": searchpathfrom,
                                 "value": searchpathfrom
                             }] if searchpathfrom else [])),
                width=9)
    ],
                              row=True)

    path_to = dbc.FormGroup([
        dbc.Label(html.Span("To", id="searchpathto-label"),
                  html_for="searchpathto",
                  width=3),
        dbc.Tooltip(
            "Select a node to use as the target in the path search",
            target="searchpathto-label",
            placement="top",
        ),
        dbc.Col(dcc.Dropdown(id="searchpathto",
                             options=([{
                                 "label": searchpathto,
                                 "value": searchpathto
                             }] if searchpathto else []),
                             value=searchpathto),
                width=9)
    ],
                            row=True)

    neighbor_control_group = html.Div([
        dbc.FormGroup([
            dbc.Col(dbc.Button("Find top N neighbors",
                               color="primary",
                               className="mr-1",
                               id='bt-neighbors',
                               style={"float": "right"}),
                    width=10),
            dbc.Tooltip(
                "Search for the neighbors with the highest mutual information "
                "score.",
                target="bt-neighbors",
                placement="top",
            ),
            dbc.Col(daq.NumericInput(
                id="neighborlimit", min=1, max=100, value=10,
                className="mr-1"),
                    width=2),
        ],
                      row=True)
    ])

    neighbor_view_card = dbc.Card(dbc.CardBody([], id="neighbors-card-body"),
                                  style={
                                      "overflow-y": "scroll",
                                      "height": "150pt"
                                  })

    top_n_paths = dbc.FormGroup([
        dbc.Label(html.Span("Top N", id="searchpathlimit-label"),
                  html_for="searchpathlimit",
                  width=3),
        dbc.Tooltip(
            "Set a number of best paths to search for (the best paths are the "
            "ones that maximize the mutual information)",
            target="searchpathlimit-label",
            placement="top",
        ),
        dbc.Col(daq.NumericInput(id="searchpathlimit",
                                 min=1,
                                 max=50,
                                 value=searchpathlimit,
                                 className="mr-1"),
                width=9)
    ],
                                row=True)

    path_condition = dbc.FormGroup([
        dbc.Label("Traversal conditions"),
        dbc.FormGroup([
            dbc.Col([
                dbc.Label(html.Span("Entity to traverse",
                                    id="searchnodetotraverse-label"),
                          html_for="searchnodetotraverse"),
                dbc.Tooltip(
                    "Select an entity to traverse in the path search (if "
                    "selected, the search is performed in two steps: "
                    "from the source to the selected entity, and from "
                    "the selected entity to the target)",
                    target="searchnodetotraverse-label",
                    placement="top",
                ),
                dcc.Dropdown(id="searchnodetotraverse",
                             value=searchnodetotraverse,
                             options=([{
                                 "label": searchnodetotraverse,
                                 "value": searchnodetotraverse
                             }] if searchnodetotraverse else []))
            ],
                    width=6),
            dbc.Col([
                dbc.Label(html.Span("Allow Overlap",
                                    id="searchpathoverlap-label"),
                          html_for="searchpathoverlap"),
                dbc.Tooltip(
                    "If the overlap is allowed, then the the paths "
                    "from the source to the intermediate entity can go "
                    "through the same entities as the paths from the "
                    "intermediary to the target. Otherwise the paths "
                    "should go through distinct entities",
                    target="searchpathoverlap-label",
                    placement="top",
                ),
                dbc.Checklist(
                    options=[{
                        "value": 1
                    }],
                    value=searchpathoverlap,
                    id="searchpathoverlap",
                    switch=True,
                )
            ],
                    width=6)
        ],
                      row=True)
    ])

    nested_path = dbc.FormGroup([
        dbc.Label("Nested path search"),
        dbc.FormGroup([
            dbc.Col(children=[
                dbc.Label(html.Span("Nested", id="nestedpaths-label"),
                          html_for="nestedpaths"),
                dbc.Tooltip(
                    "If enabled, the nested paths are found, i.e. for "
                    "every edge found in a path we search for other N "
                    "best paths from the source to the target of this "
                    "edge for <depth> times",
                    target="nestedpaths-label",
                    placement="top",
                ),
                dbc.Checklist(
                    options=[{
                        "value": 1
                    }],
                    value=nestedpaths,
                    id="nestedpaths",
                    switch=True,
                )
            ],
                    width=6),
            dbc.Col([
                dbc.Label(html.Span("Depth", id="pathdepth-label"),
                          html_for="pathdepth"),
                dbc.Tooltip(
                    "Select the depth of nesting indicating for how many "
                    "iterations we expand the encountered edges into the "
                    "best paths.",
                    target="pathdepth-label",
                    placement="top",
                ),
                daq.NumericInput(id="pathdepth",
                                 min=1,
                                 max=4,
                                 value=pathdepth,
                                 disabled=True,
                                 className="mr-1")
            ],
                    width=6)
        ],
                      row=True)
    ])

    search_path = dbc.InputGroup([
        html.P("",
               id="noPathMessage",
               style={
                   "color": "red",
                   "margin-right": "10pt"
               }),
        dbc.Button(html.Span([html.I(className="fas fa-route"), " Find Paths"
                              ]),
                   color="primary",
                   className="mr-1",
                   id='bt-path',
                   style={"float": "right"}),
        dbc.Tooltip(
            "Find paths between selected entities",
            target="bt-path",
            placement="bottom",
        )
    ],
                                 style={"float": "right"})

    expand_edge = dbc.FormGroup([
        dbc.Label("Edge expansion"),
        dbc.FormGroup([
            dbc.Col(dbc.Button("Expand edge",
                               color="primary",
                               className="mr-1",
                               id='bt-expand-edge',
                               disabled=True),
                    width=6),
            dbc.Col(dbc.Label("N best paths",
                              html_for="expand-edge-n",
                              style={"margin-top": "5pt"}),
                    width=3),
            dbc.Col(daq.NumericInput(
                id="expand-edge-n", min=1, max=20, value=5, className="mr-1"),
                    width=3),
        ],
                      row=True)
    ])

    form_path_finder = dbc.Form([
        path_from, path_to, top_n_paths,
        html.Hr(), path_condition,
        html.Hr(), nested_path,
        html.Hr(), expand_edge,
        html.Hr(), search_path
    ])

    graph_layout = dbc.FormGroup([
        dbc.Label("Layout", html_for="searchdropdown", width=3),
        dbc.Col(dcc.Dropdown(id='dropdown-layout',
                             options=[{
                                 'label':
                                 "{}{}".format(
                                     val.capitalize(),
                                     " ({})".format(graph_layout_options[val])
                                     if graph_layout_options[val] else ""),
                                 'value':
                                 val
                             } for val in graph_layout_options.keys()],
                             value=current_layout,
                             clearable=False),
                width=9)
    ],
                                 row=True)

    node_shape = dbc.FormGroup([
        dbc.Label("Node Shape", html_for="dropdown-node-shape", width=3),
        dbc.Col(dcc.Dropdown(id='dropdown-node-shape',
                             value='ellipse',
                             clearable=False,
                             options=([{
                                 'label': val.capitalize(),
                                 'value': val
                             } for val in node_shape_option_list])),
                width=9)
    ],
                               row=True)

    link_color_picker = dbc.FormGroup([
        dbc.Col(
            daq.ColorPicker(id='input-follower-color',
                            value=dict(rgb=dict(r=190, g=36, b=37, a=0)),
                            label="Highlight Color"))
    ],
                                      row=True)

    conf_form = dbc.Form([graph_layout, node_shape, link_color_picker])

    # ---- Create a layout from components ----------------

    cyto = cyto_module.Cytoscape(
        id='cytoscape',
        elements=elements,
        stylesheet=CYTOSCAPE_STYLE_STYLESHEET,
        style={
            "width": "100%",
            "height": "100%"
        },
    )

    layout = html.Div([
        dcc.Store(id='memory',
                  data={
                      "removed_nodes": [],
                      "removed_edges": [],
                      "added_nodes": [],
                      "added_edges": [],
                      "filtered_elements": [],
                      "removed_elements": {},
                      "renamed_elements": {},
                      "merging_backup": {
                          "added_elements": [],
                          "removed_elements": {}
                      },
                      "paper_backup": {}
                  }),
        dbc.Row([]),
        dbc.Row([
            dbc.Col([
                html.Div(style=VISUALIZATION_CONTENT_STYLE,
                         children=[cyto],
                         id="cyto-container"),
                html.Div([
                    dcc.Loading(id="loading",
                                children=[html.Div(id="loading-output")],
                                type="default"),
                ],
                         id="loader-container",
                         className="fixed-top",
                         style={
                             "width": "60pt",
                             "height": "60pt",
                             "margin": "20pt"
                         }),
                html.Div([
                    search,
                ],
                         id="search-container",
                         className="fixed-top",
                         style={
                             "width": "30%",
                             "margin-left": "80pt"
                         }),
                html.Div([
                    dbc.Button(html.Span(
                        [html.I(className="fas fa-binoculars"), " Legend"]),
                               id="toggle-legend",
                               color="primary",
                               className="mr-1"),
                    dbc.Button(html.Span(
                        [html.I(className="fas fa-search-plus"), " Details"]),
                               id="toggle-details",
                               color="primary",
                               className="mr-1"),
                    dbc.Button(html.Span(
                        [html.I(className="fas fa-pen"), " Editing"]),
                               id="toggle-edit",
                               color="primary",
                               className="mr-1"),
                    dbc.Button(html.Span([
                        html.I(className="fas fa-star-of-life"), " Neighbors"
                    ]),
                               id="toggle-neighbors",
                               color="primary",
                               className="mr-1"),
                    dbc.Button(html.Span(
                        [html.I(className="fas fa-angle-down"), ""]),
                               id="toggle-hide",
                               color="light",
                               className="mr-1"),
                    dbc.Collapse(dbc.Card([
                        dbc.CardHeader([
                            html.H6("Legend (colored by Entity Type)",
                                    className="card-title",
                                    style={"margin-bottom": "0pt"},
                                    id="legend-title")
                        ],
                                       style={"margin-botton": "0pt"}),
                        dbc.CardBody([legend]),
                    ],
                                          style={"height": "100%"}),
                                 style={"height": "150pt"},
                                 id="collapse-legend"),
                    dbc.Collapse(dbc.Card([
                        dbc.CardHeader([
                            html.H6("Details",
                                    className="card-title",
                                    style={"margin-bottom": "0pt"})
                        ],
                                       style={"margin-botton": "0pt"}),
                        dbc.CardBody([item_details_card],
                                     style={"overflow-y": "scroll"})
                    ],
                                          style={"height": "100%"}),
                                 style={"height": "250pt"},
                                 id="collapse-details"),
                    dbc.Collapse(dbc.Card([
                        dbc.CardHeader([
                            html.H6("Edit graph",
                                    className="card-title",
                                    style={"margin-bottom": "0pt"})
                        ],
                                       style={"margin-botton": "0pt"}),
                        dbc.CardBody([
                            dbc.Row([
                                dbc.Col([editing_mode_radio], width=5),
                                dbc.Col([edit_button_group], width=7)
                            ])
                        ])
                    ],
                                          style={"height": "100%"}),
                                 style={"height": "150pt"},
                                 id="collapse-edit"),
                    dbc.Collapse(dbc.Card([
                        dbc.CardHeader([
                            html.H6("Neighbors view",
                                    className="card-title",
                                    style={"margin-bottom": "0pt"})
                        ],
                                       style={"margin-botton": "0pt"}),
                        dbc.CardBody(
                            [neighbor_control_group, neighbor_view_card])
                    ],
                                          style={"height": "100%"}),
                                 style={"height": "250pt"},
                                 id="collapse-neighbors"),
                ],
                         className="fixed-bottom",
                         style={
                             "width": "55%",
                         })
            ],
                    width=8),
            dbc.Col(html.Div(children=[
                dbc.Button(html.Span(
                    [html.I(className="fas fa-cog"), " Controls"]),
                           id="collapse-button",
                           color="primary",
                           style={
                               "margin": "10pt",
                               "margin-left": "60%"
                           }),
                dbc.Collapse(dbc.Tabs(
                    id='tabs',
                    children=[
                        dbc.Tab(id="graph-view-tab",
                                label='Graph view',
                                label_style={
                                    "color": "#00AEF9",
                                    "border-radius": "4px",
                                    "background-color": "white"
                                },
                                children=[dbc.Card(dbc.CardBody([form]))]),
                        dbc.Tab(id="layout-tab",
                                label='Layout',
                                label_style={
                                    "color": "#00AEF9",
                                    "border-radius": "4px",
                                    "background-color": "white"
                                },
                                children=[dbc.Card(dbc.CardBody([conf_form]))
                                          ]),
                        dbc.Tab(id="path-finder-tab",
                                label='Path finder',
                                label_style={
                                    "color": "#00AEF9",
                                    "border-radius": "4px",
                                    "background-color": "white"
                                },
                                children=[
                                    dbc.Card(dbc.CardBody([form_path_finder]))
                                ])
                    ]),
                             id="collapse"),
            ]),
                    width=4)
        ])
    ],
                      style={"overflow-x": "hidden"})
    return cyto, layout, dropdown_items, cluster_filter
コード例 #28
0
                                }
                            })
                        # tooltip_conditional=[{'if': {'column_id': 'SVM score'}},
                        # 				{'value': "My tooltip"},
                        # 			    {'type': 'text'}]),
                    )
                ])
            ]),
        dcc.Tab(
            label="Downloads",
            children=[
                #html.A('Download all hormone-gene predictions', id='hg-link',href="./bioembeds_nonsmote_pos_preds.csv")
                html.Div([
                    html.Button("Download all hormone-gene predictions",
                                id="hg-btn"),
                    Download(id="hg-download")
                ]),
                html.Div([
                    html.Button(
                        "Download predictions for protein coding genes",
                        id="pc-btn"),
                    Download(id="pc-download")
                ]),
                html.Div([
                    html.Button("Download predictions for lncrna genes",
                                id="lncrna-btn"),
                    Download(id="lncrna-download")
                ])
            ])
    ])
])
コード例 #29
0
ファイル: DESA_app.py プロジェクト: Senejohnny/DESA_App
                     html.Div(id='hidden-MFI-data',
                              style={'display': 'none'}),
                     html.Div(id='hidden-HLA-data',
                              style={'display': 'none'}),
                     html.Div(id='hidden-Results',
                              style={'display': 'none'}),
                     # progress bar
                     dbc.Progress(id="progress",
                                  value=0,
                                  striped=True,
                                  animated=True),
                     # Download the results in csv File
                     html.H2("Download Results"),
                     html.Div([
                         html.Button("Download", id="download-buttion"),
                         Download(id="download"),
                     ]),
                 ]),
             # Right Section
             html.Div(
                 className='four columns div-for-about',
                 children=[
                     html.H3('About'),
                     html.
                     P('The luminex data only takes into account the DP locus'
                       )
                 ],
             ),
         ],
     ),
 ], )
コード例 #30
0
ファイル: index.py プロジェクト: YupeiChen94/ECAT
def control_tabs():
    """
    :return: A Div containing Intro, Query and Graphing Option tabs
    """
    return html.Div(
        id='ecat-control-tabs',
        children=[
            dcc.Tabs(id='ecat-tabs', value='what-is', children=[
                dcc.Tab(
                    label='About',
                    value='what-is',
                    children=html.Div(children=[
                        html.H4(children='Purpose?'),
                        html.P('ECAT Reporting Tool is a visualizer that allows you to explore ECAT data '
                               'in multiple representations.'),
                        html.P('You can query by sample type, refinery, and date ranges '),
                        html.P('Version 0.5 - 11/19/20'),
                        dcc.Markdown("""Author: [Yupei Chen](mailto:[email protected])""")
                    ])
                ),
                dcc.Tab(
                    label='Database Query',
                    value='query',
                    children=html.Div(children=[
                        html.Div(
                            id='query-card', children=[
                                html.Br(),
                                html.Div([
                                    html.Div(html.P(id='benchmark-text', children=['Benchmarking OFF']),
                                             style={'display': 'inline-block', 'marginRight': 40}),
                                    html.Div(
                                        daq.ToggleSwitch(
                                            id='benchmark-toggle',
                                            value=False,
                                        ), style={'display': 'inline-block'}
                                    ),
                                ]),
                                html.Br(),
                                html.P('Select Sample Type'),
                                dcc.Dropdown(
                                    id='sample-type-select',
                                    # ECAT_LO disabled, confidential data
                                    options=[{'label': str(c), 'value': str(c),
                                              'disabled': True if c == 'ECAT_LO' else False} for c in q_sample_types],
                                    multi=False,
                                    searchable=False,
                                    value=q_sample_types[0],
                                    persistence=True,
                                    persisted_props=['value'],
                                    persistence_type='local',
                                ),
                                html.Br(),
                                html.P('Select Date Range'),
                                dcc.DatePickerRange(
                                    id='date-picker-select',
                                    min_date_allowed=date(1999, 1, 1),
                                    max_date_allowed=date.today(),
                                    initial_visible_month=date.today(),
                                    end_date=date.today(),
                                    updatemode='singledate',
                                    stay_open_on_select=True,
                                    persistence=True,
                                    persisted_props=['start_date', 'end_date'],
                                    persistence_type='local',
                                ),
                                html.Br(),
                                html.Div(id='refinery-div', children=[
                                    html.Br(),
                                    html.P('Select Refinery Unit(s)'),
                                    dcc.Dropdown(
                                        id='refinery-select',
                                        options=[{'label': str(c), 'value': str(c)} for c in q_units_list],
                                        multi=True,
                                        persistence=True,
                                        persisted_props=['value'],
                                        persistence_type='local',
                                    ),
                                ]),
                                html.Br(),
                                dbc.Button('Query ECAT DB', color='primary', id='query-button', n_clicks=0,
                                           className='mr-5'),
                                dbc.Button('Download CSV', color='info', id='dl-button', n_clicks=0,
                                           style=dict(display='none')),
                                Download(id='query-data-dl')
                            ]
                        )
                    ])
                ),
                dcc.Tab(
                    label='Graph Options',
                    value='graph-options',
                    children=html.Div(children=[
                        html.Div(
                            id='graph-card', children=[
                                html.Br(),
                                html.Div([
                                    dbc.Button('Data', color='primary', id='option-data-btn', className='mr-3'),
                                    dbc.Button('Analysis', color='primary', id='option-analysis-btn', className='mr-3'),
                                    dbc.Button('Customizations', color='primary', id='option-customization-btn',
                                               className='mr-3'),
                                    dbc.Button('Render Graphs', color='success', id='render-button', n_clicks=0),
                                ]),
                                dbc.Collapse(
                                    id='data-collapse', is_open=True, children=[
                                        html.Div(id='graph-type-div', children=[
                                            html.Br(),
                                            html.P('Graph Type'),
                                            dcc.Dropdown(
                                                id='graph-type',
                                                options=[{'label': i, 'value': i} for i in graph_types],
                                                value=graph_types[0],
                                                searchable=False,
                                            ),
                                        ]),
                                        html.Div(id='legend-div', children=[
                                            html.Br(),
                                            html.P('Legend'),
                                            dcc.Dropdown(
                                                id='legend-col',
                                                options=[{'label': i, 'value': i} for i in
                                                         ['Refinery_Name', 'Current_Catalyst']],
                                                value='Refinery_Name',
                                                searchable=False,
                                            ),
                                        ]),
                                        html.Div(id='highlight-div', children=[
                                            html.Br(),
                                            html.P('Highlight'),
                                            dcc.Dropdown(
                                                id='highlight',
                                                options=[{'label': str(c), 'value': str(c)} for c in q_units_list],
                                                multi=True,
                                                persistence=True,
                                                persisted_props=['value'],
                                                persistence_type='local',
                                            ),
                                        ]),
                                        html.Div(id='select-div', children=[
                                            html.Br(),
                                            html.P('Select'),
                                            dcc.Dropdown(
                                                id='select',
                                                # options=[{'label': str(c), 'value': str(c)} for c in q_units_list],
                                                multi=False,
                                                persistence=True,
                                                persisted_props=['value'],
                                                persistence_type='local',
                                            ),
                                        ]),
                                        html.Div(id='axis-selectors', children=[
                                            html.Br(),
                                            html.P('X-Axis', id='x-text'),
                                            dcc.Dropdown(id='x-col'),
                                            html.Br(),
                                            html.P('Y-Axis', id='y-text'),
                                            dcc.Dropdown(id='y-col'),
                                            html.Div(id='y2-div', children=[
                                                html.Br(),
                                                html.P('Y2-Axis', id='y2-text'),
                                                dcc.Dropdown(id='y2-col'),
                                            ]),
                                        ]),
                                    ]
                                ),
                                dbc.Collapse(
                                    id='analysis-collapse', is_open=False, children=[
                                        html.Br(),
                                        html.Div(id='trend-div', children=[
                                            html.Div(html.P('Trend Type'),
                                                     style={'display': 'inline-block', 'marginRight': 40}),
                                            html.Div(
                                                dcc.RadioItems(
                                                    id='trend-type',
                                                    options=[
                                                        {'label': 'OFF', 'value': 'off'},
                                                        {'label': 'LOWESS', 'value': 'lowess'},
                                                        {'label': 'OLS', 'value': 'ols'}
                                                    ],
                                                    value='off',
                                                    labelStyle={'display': 'inline-block'},
                                                    inputStyle={"margin-left": "20px"}
                                                ),
                                                style={'display': 'inline-block'}
                                            ),
                                        ])
                                    ]
                                ),
                                dbc.Collapse(
                                    id='customization-collapse', is_open=False, children=[
                                        html.P('Insert Customizations Here')
                                    ]
                                )
                            ]
                        )
                    ])
                )
            ])
        ]
    )