Esempio n. 1
0
def move_items(add_one, add_all, rem_one, rem_all, left_dd, right_dd,
               left_list, right_list):
    add_one = 0 if add_one is None else add_one
    add_all = 0 if add_all is None else add_all
    rem_one = 0 if rem_one is None else rem_one
    rem_all = 0 if rem_all is None else rem_all

    opts = [('One', '1'), ('Two', '2'), ('Three', '3'), ('Four', '4'),
            ('Five', '5'), ('Six', '6'), ('Seven', '7'), ('Eight', '8'),
            ('Nine', '9'), ('Ten', '10')]

    dd_opts = [{'label': k[0], 'value': k[1]} for k in opts]

    list_opts = [html.Option(k[0], id=k[1]) for k in opts]

    if all(add_one > x for x in (add_all, rem_one, rem_all)):
        l_dd = [x for x in dd_opts if x['value'] not in left_dd]
        r_dd = [x for x in dd_opts if x['value'] in left_dd]
        l_list = [html.Option(x['label'], id=x['value']) for x in l_dd]
        r_list = [html.Option(x['label'], id=x['value']) for x in r_dd]
        return l_dd, r_dd, l_list, r_list
    elif all(add_all > x for x in (add_one, rem_one, rem_all)):
        return [], dd_opts, [], list_opts
    elif all(rem_one > x for x in (add_one, add_all, rem_all)):
        l_dd = [x for x in dd_opts if x['value'] not in right_dd]
        r_dd = [x for x in dd_opts if x['value'] in right_dd]
        l_list = [html.Option(x['label'], id=x['value']) for x in l_dd]
        r_list = [html.Option(x['label'], id=x['value']) for x in r_dd]
        return l_dd, r_dd, l_list, r_list
    elif all(rem_all > x for x in (add_one, add_all, rem_one)):
        return dd_opts, [], list_opts, []
    else:
        return dd_opts, [], list_opts, []
Esempio n. 2
0
 def content_path(path):
     if path != '' and not path.endswith('/'):
         raise PreventUpdate
     ret = []
     try:
         for filepath in scandir(path if path != '' else '.'):
             if filepath.is_dir():
                 ret.append(html.Option(value=path + filepath.name + '/'))
             else:
                 if filepath.name.endswith('.fast5'):
                     ret.append(html.Option(value=path + filepath.name))
     except FileNotFoundError:
         raise PreventUpdate
     return ret
Esempio n. 3
0
    def update_filter(self, df, uniqueColumnID, selectednode):
        tnodeids = set(df[uniqueColumnID])
        unselectedchildren = []
        selectedchildren = []
        columnoptions = []
        for node in tnodeids:
            node = str(node)
            if node in selectednode:
                selectedchildren.append(
                    html.Option(value=str(node), children=[node]))
            else:
                unselectedchildren.append(
                    html.Option(value=str(node), children=[node]))

        return unselectedchildren, selectedchildren, columnoptions
def create_hyperparameter_fields():
    if hasattr(project, 'model'):
        children = []
        hyperparameter_list = project.model.get_params()
        for k, v in hyperparameter_list.items():
            target_id = "{}_tooltip".format(k)
            tooltip_message = "{}".format(v['tooltip_message'])
            tooltip = html.Div(
                [
                    html.A(href=v['link'], target="_blank",
                           className="fas fa-question-circle fa-lg", id=target_id),
                    dbc.Tooltip(tooltip_message, target=target_id),
                ],
            )

            children.append(html.Div(
                dbc.Row([dbc.Col(html.Label(k)), dbc.Col(tooltip)], style={'width': '100%', 'padding': '10px'})))
            if 'string' in v['param_values'] and len(v['param_values']['string']) > 0:
                options = [html.Option(i) for i in v['param_values']['string']]
                children.append(
                    dcc.Input(type="text", id={'type': 'hyperparameter', 'name': k}, list=k + '_datalist',
                              value=v['default'], style={'padding': '10px'}),
                )
                children.append(html.Datalist(options, id=k + '_datalist', style={'width': '100%', 'padding': '10px'}))
                children.append(html.Br())
            else:
                children.append(
                    dcc.Input(type="text", id={'type': 'hyperparameter', 'name': k}, value=v['default'],
                              style={'padding': '10px'}),
                )
                children.append(html.Br())

        return children
    else:
        return html.Div("Please Select the algorithm and dataset attributes.")
Esempio n. 5
0
def app_history(n_clicks, value):
    if not value:
        pass
    else:
        system.url_history(value)
    urls = system.get_url_history()
    if not urls:
        return
    urls.reverse()
    return [html.Option(value='{}'.format(url)) for url in urls]
Esempio n. 6
0
def upload_data_layout():
    """Function for generating layout section for uploading data from web or file

    :return: Generated layout
    :rtype: dash.development.base_component.ComponentMeta
    """
    return html.Div([
        dcc.Input(
            id='url',
            placeholder='URL to data csv',
            list='url_history',
            style={
                "textAlign": "center",
            },
        ),
        html.Datalist(id='url_history',
                      children=[html.Option(value=DEFAULT_WEB_DATA)]),
        html.Button(id='url-button',
                    n_clicks=0,
                    children='Load',
                    style={
                        'margin': style.PADDING,
                        'backgroundColor': style.BUTTON_COLOR
                    }),
        html.H4(children='or', ),
        dcc.Upload(
            id='upload-data',
            children=html.Div(
                ["Drap and drop or click to select a file to upload"]),
            style={
                "width": "40%",
                "height": "60px",
                "lineHeight": "60px",
                "borderWidth": "1px",
                "borderStyle": "dashed",
                "borderRadius": "5px",
                "textAlign": "center",
                "margin": "10px",
                "margin-left": "30%",
            },
            multiple=False,
        ),
    ])
Esempio n. 7
0
File: app.py Progetto: schlich/gram
             "margin-left": "auto",
             "margin-right": "auto",
         },
     ),
     href="https://jointhegram.org",
 ),
 html.Br(),
 html.H2("Saint Louis Metropolitan Police Department (SLMPD)"),
 html.H3("Employee Misconduct Report (EMR) - Allegations"),
 html.P(
     "EMRs obtained via Missouri Open Records Requests from 2010-2019"),
 html.H5("Select an officer to see misconduct reports:"),
 html.Datalist(
     id="officers",
     children=[
         html.Option(value=i)
         for i in officers["Officer Name"].to_list()
     ],
 ),
 dcc.Input(id="officer_input", list="officers"),
 dbc.Button("Search", id="submit"),
 html.Div(
     [
         html.Br(),
         html.Br(),
         html.H3("Officer Name", id="officer_name"),
         html.Div(id="officer-info", ),
         html.Div([
             html.Br(),
             html.H4("EMR Complaint Summary"),
             html.
Esempio n. 8
0
def data_list_children(l):
    return [html.Option(value=word) for word in l]
Esempio n. 9
0
						),
						# List of availabel neighbourhood groups to slice our data.
						dcc.Markdown('''
							Available Neighbourhood Groups to Select
							* Brooklyn
							* Queens
							* Staten Island
							* Manhattan
							* Bronx
						''',
						style={'backgroundColor': colors['background'], 'color': colors['text']}
						),
						html.Datalist(
							id='n_list', 
							children=[
								html.Option(value='Manhattan'),
								html.Option(value='Brooklyn'),
								html.Option(value='Queens'),
								html.Option(value='Bronx'),
								html.Option(value='Staten Island')
								],
							style={'backgroundColor': colors['background'], 'color': colors['text']}
						),
						# Our main Input that will control all of our visuals.
						dcc.Input(
							id='Neighbourhoods',
							type= 'text',
							required='required',
							autoComplete='on',
							value='Bronx',
							# placeholder='',
Esempio n. 10
0
            {'label': '60 Minutes', 'value': '60m'},
            {'label': '90 Minutes', 'value': '90m'},
            {'label': '1 Day', 'value': '1d'},
            {'label': '5 Days', 'value': '5d'},
            {'label': '1 Week', 'value': '1wk'},
            {'label': '1 Month', 'value': '1mo'},
            {'label': '3 Months', 'value': '3mo'}
        ],
        placeholder ='Select Interval'
        
    ),className='form-group'),

    html.Select([
            html.Option(
            children='1 Minute',
            id='option-1m',
            value ='1m'
            ),
            html.Option(
            children='5 Minutes',
            id='option-5m',
            value ='5m'
            ),
            html.Option(
            children='15 Minute',
            id='option-15m',
            value ='15m'
            ),
            html.Option(
            children='30 Minutes',
            id='option-30m',
Esempio n. 11
0
# "https://unpkg.com/spectre.css/dist/spectre.min.css",
# "https://unpkg.com/spectre.css/dist/spectre-exp.min.css",
# "https://unpkg.com/spectre.css/dist/spectre-icons.min.css",
# ]
# print(dbc.themes)
app = dash.Dash(__name__,
                external_stylesheets=external_stylesheets,
                url_base_pathname='/dashtest/')
app.config.suppress_callback_exceptions = True

df_data = pd.read_pickle("data/df_data.pkl")
df_mc = pd.read_pickle("data/df_mc.pkl")

datalist_columns = html.Datalist(
    id='datalist-columns',
    children=[html.Option(value=word) for word in df_data.columns],
)

dropdown_columns = dcc.Dropdown(
    id='dropdown-columns',
    multi=True,
    placeholder="Variable list",
    # value="",
    options=[dict(label=name, value=name) for name in df_data.columns],
    style={"margin": "10px"},
)

app.layout = html.Div([
    datalist_columns,
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-layout', style={"padding": "10px"})
Esempio n. 12
0
def auto_suggestion(search_keywords):
    print(search_keywords)
    if search_keywords:
        return [html.Option(value=sug) for sug in get_suggestion('baidu',search_keywords)]
Esempio n. 13
0
        ]
    )
]

# Put the layout together
app.layout = dbc.Container(
    [
        navbar,
        # html.P(),
        *sale_input,
        sale_output,
        dbc.Row(dbc.Col(html.Hr())),
        dbc.Row(dbc.Col(tab_grp)),
        # Data storage below here
        html.Div(
            html.Datalist([html.Option(value=usr) for usr in example_users],
                          id='existing-users'),
            style={'display': 'none'}
        )
    ],
)


@app.callback(
    [Output('username-input', 'value'),
     Output('num-tickets-input', 'value'),
     Output('prize-addition-input', 'checked'),
     Output('edit-sale-id-input', 'invalid')],
    [Input('edit-sale-id-input', 'n_submit'),
     State('edit-sale-id-input', 'value')
     ],
Esempio n. 14
0
def cargar_plantilla_formulario(mensaje_error=''):
    """
    Genera el formulario por el que se ingresan las cct de las escuelas de las que
    se quiere generar un reporte.
    
    Args :
        mensaje_error (str, opcional): mensaje de error a mostrar en el formulario en caso
            de que haya uno.
    
    Returns:
        página que contiene la pantalla previa al reporte de escuelas que contiene
            un formulario para ingresar los ccts.
    """
    form = html.Form(
        [
            # Tipo de reporte
            dcc.Input(
                name="tipo_reporte", value="reporte_region", type="hidden"),
            # Select con la clave de las regiones
            dbc.Row(
                [
                    dbc.Col(html.Select(
                        [html.Option("Selecciona una región", value="None")] +
                        [
                            html.Option(REGIONES[clave_region]['nombre'],
                                        value=clave_region)
                            for clave_region in REGIONES
                        ],
                        name='region',
                        id='select-region',
                        className='form-control',
                    ),
                            style={
                                "margin-top": "1rem",
                                "margin-bottom": "3rem"
                            },
                            className="d-flex justify-content-center",
                            md=3,
                            xs=6)
                ],
                justify="center",
            ),
            # Renglón para los botones de continuar o regresar
            dbc.Row(
                [
                    # Botón para regresarse
                    dbc.Col(html.A(dbc.Button(u"Regresar",
                                              type="button",
                                              style={
                                                  "background": "#FF0055",
                                                  "border-color": "#FF0055"
                                              }),
                                   href="/"),
                            xs=2,
                            style={
                                "margin-bottom": "3rem",
                                "margin-right": "1rem",
                                "margin-top": "1rem"
                            },
                            className="d-flex justify-content-center"),
                    # Botón para continuar
                    dbc.Col(
                        dbc.Button(u"Continuar",
                                   type="submit",
                                   style={
                                       "background": "#1199EE",
                                       "border-color": "#1199EE"
                                   }),
                        xs=2,
                        style={
                            "margin-bottom": "3rem",
                            "margin-left": "1rem",
                            "margin-top": "1rem"
                        },
                        className="d-flex justify-content-center",
                    )
                ],
                justify="center",
            )
        ],
        action="/apps/reporte",
        id="formulario-escuelas")

    layout = dbc.Container(
        [
            # Texto de encabezado
            dbc.Row(dbc.Col(
                [
                    html.
                    H1(u"Proyección de matrícula de escuelas de educación básica por región del estado de Zacatecas",
                       style={
                           "text-align": "center",
                           "margin-top": "3rem",
                           "margin-bottom": "3rem"
                       }),
                    html.H3(u"Selecciona la región que quieres consultar",
                            style={
                                "text-align": "center",
                                "margin-top": "2rem",
                                "margin-bottom": "2rem"
                            })
                ] + [
                    html.H4(mensaje_error,
                            style={
                                "text-align": "center",
                                "margin-top": "2rem",
                                "margin-bottom": "2rem"
                            }) if mensaje_error else ''
                ],
                md=6,
            ),
                    className="justify-content-center"),
            form
        ],
        fluid=True,
    )

    return layout
Esempio n. 15
0
            dcc.Markdown(
                "Mortgage years left: 📅",
                containerProps=dict(style=dict(display='inline-block'))
            ),
            dcc.Input(
                id="years-input",
                type='number',
                min=1,
                max=50,
                list='input-list',
                style=dict(width="100vw",maxWidth="200px",fontSize=25,display='inline-block')
            ),
            html.Datalist(
                id="input-list",
                children=[
                    html.Option(value=5),
                    html.Option(value=10),
                    html.Option(value=15),
                    html.Option(value=20),
                    html.Option(value=25),
                    html.Option(value=30),
                ],
            ),            
        ],style=styledict_slider),
    ],style=dict(margin='auto',paddingTop="0px")),

    # contains the output
    html.Div([
        html.Button(
            "Tell me if I should pay off my mortgage early! 💰",
            id='submit-button',
Esempio n. 16
0
def autosuggest(curr_value):
    # if not curr_value or len(curr_value) < 4:
    #     raise dash.exceptions.PreventUpdate
    filtered = [x for x in suggestions if curr_value in x]
    ordered = [html.Option(value=display_name) for display_name in sorted(filtered, key=lambda x: jaro_winkler.normalized_similarity(curr_value, x), reverse=True)][0:10]
    return ordered
Esempio n. 17
0
            html.H3(
                    children='Comparison of players stats during their careers',
                    style={
                    'textAlign': 'center'
                     },
            ),

            dcc.Markdown(children= explain_player_choice
            ),

            html.Br(),
            html.Br(),

            html.Datalist(id='list-data',
                 children=[
                     html.Option(value=name) for name in set(df["LOWER_NAME"])
                            ]),

            dcc.Input(id="input1", type="text", placeholder="Write Name", list='list-data'),
            dcc.Input(id="input2", type="text", placeholder="Write Name", list='list-data'),
            dcc.Input(id="input3", type="text", placeholder="Write Name", list='list-data'),
            dcc.Input(id="input4", type="text", placeholder="Write Name", list='list-data'),
            dcc.Input(id="input5", type="text", placeholder="Write Name", list='list-data'),

        html.Div([
            html.Div(children=[

                html.Br(),
                html.Br(),

                html.H5(
Esempio n. 18
0
prefix = "/"  #on heroku
#prefix="/tcell/"
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server, routes_pathname_prefix=prefix)
app.title = "T cell data visualizer"

#Decides the layout of web app with titles and labels
app.layout = html.Div(children=[
    html.H1(children='T cell data visualizer'),
    html.Div(children='''
        Per-gene data: Search for example the gene Gata3
    '''),
    html.Datalist(
        id='list-suggested-genes',
        children=[html.Option(value=word) for word in gene_suggestions]),
    html.Datalist(
        id='list-suggested-motifs',
        children=[html.Option(value=word) for word in motif_suggestions]),
    #############################
    dcc.Input(id='input-gene-name',
              type='text',
              list='list-suggested-genes',
              value='',
              debounce=True),
    #############################
    html.Div(children=[
        html.Div(id="tc-human-out",
                 style={
                     'width': '49%',
                     'display': 'inline-block'
Esempio n. 19
0
            ],
            className='cards_inside_row'),
        className='cards_col'),
    className='cards_row')

############################################
# tab items
dropdown_country = dbc.Card(dbc.CardBody(dbc.Row([
    dbc.Col(
        dbc.Input(placeholder="Search country...",
                  type="text",
                  list='list-data',
                  id='_cntry_name',
                  value='India')),
    html.Datalist(id='list-data',
                  children=[html.Option(value=c) for c in countries])
]),
                                         className='tab_global'),
                            className='tab_global')

dropdown_global = dbc.Card(dbc.CardBody(dbc.Row(
    dbc.Col(
        dbc.InputGroup([
            dbc.InputGroupAddon(
                "Show top", addon_type="prepend", className='addon_text'),
            dbc.Input(placeholder="10",
                      type="number",
                      min=1,
                      max=180,
                      step=1,
                      id='_no_of_cntry',
Esempio n. 20
0
         'browser',  # identifies a list of pre-defined options to suggest to the user
         n_submit=
         0,  # number of times the Enter key was pressed while the input had focus
         n_submit_timestamp=-1,  # last time that Enter was pressed
         autoFocus=
         True,  # the element should be automatically focused after the page loaded
         n_blur=0,  # number of times the input lost focus
         n_blur_timestamp=-1,  # last time the input lost focus.
         # selectionDirection='', # the direction in which selection occurred
         # selectionStart='',     # the offset into the element's text content of the first selected character
         # selectionEnd='',       # the offset into the element's text content of the last selected character
     ),
 ]),
 html.Datalist(id='browser',
               children=[
                   html.Option(value="blue"),
                   html.Option(value="yellow"),
                   html.Option(value="green")
               ]),
 html.Br(),
 html.Br(),
 html.Div(id='div_output'),
 html.P(['------------------------']),
 html.P(['Enter clicked:']),
 html.Div(id='div_enter_clicked'),
 html.P(['Enter clicked timestamp:']),
 html.Div(id='div_sub_tmstp'),
 html.P(['------------------------']),
 html.P(['Input lost focus:']),
 html.Div(id='div_lost_foc'),
 html.P(['Lost focus timestamp:']),
)
# ----------------------------------------- -------------------- ------------------------------------------


# --------------------------- layout the webpage ------------------------
app.layout = html.Div(children = 
                        [html.Div("Comorbidity Explorer", style={
                                                "color":"black",
                                                "text-align":"center",
                                                "font-family":"IntroCondBlackFree",
                                                "fontSize":"44px",
                                                "marginTop":"10px"
                                                }),
                        html.Img(id = "past-present-timeline", src = app.get_asset_url('./images/past-present-bar.png'), alt = 'past to present timeline', style={'width':'85%', 'marginTop':'20px', 'marginLeft':'100px', 'marginRight':'50px'}),
                        html.Span(["PAST", html.Div(style={"width":"80%", "height":"18px", "backgroundColor":"#fff5bf'", "display":"inline-block"}), "PRESENT"], style={"fontSize":"18px", "font-family":"IntroCondLightFree", "marginBottom":"20px", "marginLeft":"80px", "clear":"both"}),
                        html.Datalist(id='list-suggested-inputs', children=[html.Option(value=word) for word in suggestions]),
                        html.Div(dcc.Input(id='input-1',type='text',list='list-suggested-inputs',value='Viral sinusitis (disorder)', placeholder='Condition 1', debounce=True, style={'fontSize':'18px', 'width': '100%'}), style={'width': '15%', 'height':'30px', 'display': 'inline-block', 'marginTop': '-20px', 'marginLeft': '30px', 'fontSize':'18px'}),
                        html.Img(id = "time-arrow-1", src = app.get_asset_url('./images/time-arrow-1.png'), alt = 'timeline indicator 1', style={'vertical-align':'middle', 'marginLeft':'10px', 'marginRight':'10px'}),
                        html.Div(dcc.Input(id='input-2',type='text',list='list-suggested-inputs',value='', placeholder='Condition 2', debounce=True, style={'fontSize':'18px', 'width': '100%'}), style={'width': '15%', 'height':'30px', 'display': 'inline-block', 'marginTop': '-20px', 'marginLeft': '0px', 'fontSize':'18px'}),
                        html.Img(id = "time-arrow-2", src = app.get_asset_url('./images/time-arrow-2.png'), alt = 'timeline indicator 2', style={'vertical-align':'middle', 'marginLeft':'10px', 'marginRight':'10px'}),
                        html.Div(dcc.Input(id='input-3',type='text',list='list-suggested-inputs',value='', placeholder='Condition 3', debounce=True, style={'fontSize':'18px', 'width': '100%'}), style={'width': '15%', 'height':'30px', 'display': 'inline-block', 'marginTop': '-20px', 'marginLeft': '0px', 'fontSize':'18px'}),
                        html.Img(id = "time-arrow-3", src = app.get_asset_url('./images/time-arrow-3.png'), alt = 'timeline indicator 3', style={'vertical-align':'middle', 'marginLeft':'10px', 'marginRight':'10px'}),
                        html.Div(dcc.Input(id='input-4',type='text',list='list-suggested-inputs',value='', placeholder='Condition 4', debounce=True, style={'fontSize':'18px', 'width': '100%'}), style={'width': '15%', 'height':'30px', 'display': 'inline-block', 'marginTop': '-20px', 'marginLeft': '0px', 'fontSize':'18px'}),
                        html.Img(id = "time-arrow-4", src = app.get_asset_url('./images/time-arrow-4.png'), alt = 'timeline indicator 4', style={'vertical-align':'middle', 'marginLeft':'10px', 'marginRight':'10px'}),
                        html.Div(dcc.Input(id='input-5',type='text',list='list-suggested-inputs',value='', placeholder='Condition 5', debounce=True, style={'fontSize':'18px', 'width': '100%'}), style={'width': '15%', 'height':'30px', 'display': 'inline-block', 'marginTop': '-20px', 'marginLeft': '0px', 'fontSize':'18px'}),
                        html.Div(html.Button("Search", id = "searchButton")),
                        html.Div(id='predictedText', children = pageLoadingText, style={"font-family":"Arial Black",
                                                                            "fontSize":"22px",
                                                                            "width":"auto",
                                                                            "max-width":"500px",
                                                                            "float": "left",
Esempio n. 22
0
from scripts.visual import *

FONT_AWESOME = "https://use.fontawesome.com/releases/v5.14.0/css/all.css"

app = dash.Dash(__name__,
                external_stylesheets=[dbc.themes.DARKLY, FONT_AWESOME],
                suppress_callback_exceptions=True)
# Data

path = Path(__file__).parent
name_db = pd.read_csv((path / "data/urls/name_url.tsv"),
                      sep='\t',
                      header=None,
                      names=['name', 'link'])

name_list = list(name_db['name'].map(lambda x: html.Option(value=x)))
"""-----------------------------------------------
Helpers for Updating stats and visuals


-----------------------------------------------"""


def fighter_data(db, f_name):
    link = name_to_url(db, f_name)
    header = get_header_img(link)
    records = scrape_ratio(link)
    stats = scrape_stats(link)

    return header, records, stats
Esempio n. 23
0
File: app.py Progetto: schlich/mpap2
officers = data['Officer Name'].unique()
display_data = data[[
    'Officer Name', 'DSN #', 'Rank', 'Assignment', 'Date of Incident',
    'Location of Incident', 'Nature of Complaint', "Complainant's Statement",
    'Age', "Race of Complainant", "Complainant Gender"
]]
column_names = [
    'Date of Incident', 'Nature of Complaint', 'Age', 'Race of Complainant',
    'Complainant Gender'
]

app.layout = html.Div([
    html.H2('St Louis Police Complaints'),
    html.H5('Search for/select an officer'),
    html.Datalist(id='officers',
                  children=[html.Option(value=i) for i in officers]),
    dcc.Input(id='officer_input', list='officers'),
    html.Button('Search', id='submit'),
    html.Div(
        [
            html.Div([
                html.H3('Officer Name', id='officer_name'),
                html.H5('DSN: ', id='dsn'),
                html.P('Rank: ', id='rank'),
                html.P('Assignment: ', id='assignment'),
            ]),
            html.Div([
                dash_table.DataTable(
                    id='complaints',
                    columns=[{
                        "name": i,
Esempio n. 24
0
def wrap_runde_anlegen_layout():
    current = pathlib.Path(__file__).name.split('.')[0]
    namen = get_runden(
        dataframe=True).sort_values("name")["name"].unique().tolist()
    orte = get_runden(
        dataframe=True).sort_values("ort")["ort"].unique().tolist()
    return html.Div([
        dcc.Store(id='create_runde_modal_open_n_clicks', data={'n_clicks': 0}),
        dcc.Store(id='create_runde_modal_close_n_clicks', data={'n_clicks':
                                                                0}),
        dbc.Modal([
            dbc.ModalHeader(id='create_runde_modal_header'),
            dbc.ModalBody(html.Div(id='create_runde_modal_body')),
            dbc.ModalFooter([
                dbc.Button('Schließen',
                           id='create_runde_modal_close',
                           color='primary',
                           block=True),
                dbc.Button('Schließen',
                           id='create_runde_modal_close_reload',
                           color='primary',
                           block=True,
                           href=f'/{current}',
                           external_link=True)
            ]),
        ],
                  id='create_runde_modal',
                  size='xl',
                  scrollable=True),
        dbc.Container([
            wrap_empty_dbc_row(),
            dbc.Row([dbc.Col([html.Div(html.H5('Runde anlegen'))])],
                    justify='start'),
            html.Datalist(id='name_list',
                          children=[html.Option(value=name)
                                    for name in namen]),
            dbc.Row([
                dbc.Col([
                    dbc.FormGroup([
                        dbc.FormText('Name der neuen Runde'),
                        dbc.Input(id='runde_new_name',
                                  placeholder='',
                                  maxLength=40,
                                  list='name_list'),
                    ])
                ],
                        xl=6,
                        xs=12),
            ]),
            html.Datalist(id='ort_list',
                          children=[html.Option(value=ort) for ort in orte]),
            dbc.Row([
                dbc.Col([
                    dbc.FormGroup([
                        dbc.FormText('Ort der neuen Runde'),
                        dbc.Input(id='runde_new_ort',
                                  placeholder='',
                                  maxLength=20,
                                  list='ort_list'),
                    ])
                ],
                        xl=6,
                        xs=12),
            ]),
            dbc.Row([
                dbc.Col([
                    dbc.FormGroup([
                        dbc.FormText('Datum der neuen Runde'),
                        dbc.Input(id='runde_new_date',
                                  type='Date',
                                  value=dt.date.today()),
                    ])
                ],
                        xl=6,
                        xs=12),
            ]),
            dbc.Row([
                dbc.Col([
                    dbc.FormGroup([
                        dbc.Button('Neue Runde erstellen',
                                   id='create_runde_modal_open',
                                   color='primary',
                                   block=True),
                    ])
                ],
                        xl=6,
                        xs=12)
            ]),
            wrap_footer_row()
        ]),
    ])
Esempio n. 25
0
def layout_table(cls, subcls, type, subtype, tags, substructure, message=""):
    tags_coll = db_connect('tags')
    mols_coll = db_connect('molecules')
    '''
    filter = {}
    if cls is not None:
        filter['metadata.class'] = cls
    if subcls is not None:
        filter['metadata.subclass'] = subcls
    if type is not None:
        filter['metadata.type'] = type
    if subtype is not None:
        filter['metadata.subtype'] = subtype

    if filter:
        mols_ids = mols_coll.distinct('_id', filter)
        available_tags = tags_coll.distinct('tag', {'molecule_id': {"$in": mols_ids}})
    else:
        available_tags = tags_coll.distinct('tag')
    '''

    return html.Div(children=[
        dcc.Link(html.H3('Auto-QChem DB'), href="/"),
        html.Datalist(id='conf_options',
                      children=[
                          html.Option(label=desc, value=tag)
                          for desc, tag in zip(conf_options_long, conf_options)
                      ]),
        html.Form(
            id='query-form',
            children=[
                dcc.Dropdown(id="cls_dropdown",
                             options=[
                                 dict(label=cls, value=cls) for cls in list(
                                     mols_coll.distinct('metadata.class'))
                             ],
                             placeholder="Select Class",
                             persistence=False),
                dcc.Dropdown(id="subcls_dropdown",
                             options=[
                                 dict(label=subcls, value=subcls)
                                 for subcls in list(
                                     mols_coll.distinct('metadata.subclass'))
                             ],
                             placeholder="Select SubClass",
                             persistence=False),
                dcc.Dropdown(id="type_dropdown",
                             options=[
                                 dict(label=type, value=type) for type in list(
                                     mols_coll.distinct('metadata.type'))
                             ],
                             placeholder="Select Type",
                             persistence=False),
                dcc.Dropdown(id="subtype_dropdown",
                             options=[
                                 dict(label=subtype, value=subtype)
                                 for subtype in list(
                                     mols_coll.distinct('metadata.subtype'))
                             ],
                             placeholder="Select SubType",
                             persistence=False),
                dcc.Dropdown(
                    id='tags_dropdown',
                    options=[
                        dict(
                            label=
                            f'''{tag} ({len(tags_coll.distinct("molecule_id", {"tag": tag}))} molecules)''',
                            value=tag) for tag in tags_coll.distinct('tag')
                    ],
                    multi=True,
                    placeholder="Select Tags",
                    persistence=False,
                ),
                dcc.Input(name="cls", id="cls", style={'display': 'none'}),
                dcc.Input(
                    name="subcls", id="subcls", style={'display': 'none'}),
                dcc.Input(name="type", id="type", style={'display': 'none'}),
                dcc.Input(
                    name="subtype", id="subtype", style={'display': 'none'}),
                dcc.Input(name="tags", id="tags", style={'display': 'none'}),
                dcc.Input(name="substructure",
                          id="substructure",
                          placeholder="Filter w/ SMARTS Substructure",
                          style={"width": "100%"},
                          persistence=False,
                          value=substructure),
                html.Button('Query',
                            id='submit_query-form',
                            style={
                                "width": "50%",
                                "background": "#F0F8FF"
                            }),
            ],
        ),
        html.P(message) if message else html.Div(),
        html.Div(children=[
            html.Details(children=[
                html.Summary("Export Molecule List"),
                html.Form(id='export-summary-form',
                          method='post',
                          children=[
                              dcc.Input(name="export",
                                        id='export',
                                        style={'display': 'none'}),
                              html.Button('Export List',
                                          id='submit_export-summary-form',
                                          style={
                                              "width": "50%",
                                              "background": "#F0F8FF"
                                          })
                          ]),
            ]),
            html.Details(children=[
                html.Summary("Download descriptors"),
                html.Form(
                    id='export-form',
                    children=[
                        dcc.Dropdown(
                            id='dropdownPresetOptions',
                            options=[
                                dict(label=lab, value=val) for lab, val in zip(
                                    desc_presets_long, desc_presets)
                            ],
                            multi=True,
                            placeholder="Select descriptor presets...",
                        ),
                        dcc.Input(name="PresetOptions",
                                  id="inputPresetOptions",
                                  style={'display': 'none'}),
                        dcc.Input(name="ConformerOptions",
                                  id="conformerOptions",
                                  list='conf_options',
                                  style={"width": "100%"},
                                  placeholder="Select conformer option..."),
                        html.Br(),
                        html.Button('Download',
                                    id='submit_export-form',
                                    style={
                                        "width": "50%",
                                        "background": "#F0F8FF"
                                    })
                    ],
                    method='post',
                )
            ]),
            dt.DataTable(
                id='table',
                data=get_table(cls, subcls, type, subtype, tags, substructure).
                to_dict('records'),
                columns=[
                    dict(name=c,
                         id=c,
                         hideable=False,
                         presentation="markdown" if c in
                         ['image', 'descriptors'] else "input")
                    for c in [
                        'image', 'can', 'name', 'class', 'subclass', 'type',
                        'subtype', 'tags', 'theory', 'light_basis_set',
                        'heavy_basis_set', 'generic_basis_set',
                        'max_light_atomic_number', 'num_conformers',
                        'max_num_conformers', 'descriptors'
                    ]
                ],
                editable=False,
                page_size=20,
                page_action="native",
                sort_action="native",
                sort_mode="multi",
                filter_action="native",
            ),
        ]) if any(filter is not None for filter in (cls, subcls, type, subtype,
                                                    tags)) else html.Div(),
    ])
Esempio n. 26
0
def Set_Suggest(string):
    if len(string) == 0:
        return list()
    stocks = JsonStockData.GetStockInfo(string=string, Single=False)
    return [html.Option(value=word) for word in stocks]
Esempio n. 27
0
def player_suggestions():
    return html.Datalist(
        id="player-list",
        children=[html.Option(value=word) for word in playerlist]
    )
Esempio n. 28
0
        sym = i.get('value')
        try:
            sec = spy_info[spy_info['Symbol'] == sym]['Security'].values[0]
        except:
            print(sym)
        search_list.append(f'{sym} - {sec}')
    return search_list


suggestions = search_list()

search_bar = dbc.Row(
    [
        html.Datalist(
            id='list-suggested-inputs',
            children=[html.Option(value=word) for word in suggestions]),
        dbc.Col(dcc.Input(
            id='0stock_picker',
            list='list-suggested-inputs',
            placeholder='Search for stock',
            value='',
            type='text',
            size='50',
            className=
            'bg-dark border-light text-light w-100 rounded br-3 pl-2 pr-2 pt-1 pb-1'
        ),
                className='border-light'),
        # dbc.Col(
        #     dbc.Button("Search", color="primary", className="ml-2"),
        #     width="auto",
        # ),
Esempio n. 29
0
app.layout = html.Div([
    # row 1 - linha 1
    html.Div([
        html.H1('DASHBOARD - VENDAS - 2019')
    ], className='col-xs-12'),

    # row 2 - linha 2 - creating filter
    html.Div([
        html.Nav([
            html.Div([
                html.P('Filtro: ', className='navbar-brand')
            ], className='navbar-header'),
            html.Div([
                html.Label('Produto'),
                html.Select([
                    html.Option('A', value='A'),
                    html.Option('B', value='B')
                ], className='form-control')
            ], className='col-xs-2'),
            html.Div([
                html.Label('Cat. Produto'),
                html.Select([
                    html.Option('A', value='A'),
                    html.Option('B', value='B', selected='selected')
                ], className='form-control')
            ], className='col-xs-2'),
            html.Div([
                html.Label('Vendedor'),
                html.Select([
                    html.Option('Ana', value='A'),
                    html.Option('Beatriz', value='B', selected='selected'),
Esempio n. 30
0
def layout_table(tags, substructure, message=""):
    tags_coll = db_connect('tags')

    return html.Div(children=[
        html.H3('Auto-QChem DB'),
        html.Datalist(id='conf_options',
                      children=[
                          html.Option(label=desc, value=tag)
                          for desc, tag in zip(conf_options_long, conf_options)
                      ]),
        html.Form(
            id='query-form',
            style={'display': 'inline-block'},
            children=[
                dcc.Dropdown(
                    id='tags_dropdown',
                    options=[
                        dict(
                            label=
                            f"{tag} ({len(tags_coll.distinct('molecule_id', {'tag': tag}))} molecules)",
                            value=tag)
                        for tag in list(tags_coll.distinct('tag'))
                    ],
                    multi=True,
                    style={
                        "width": "300px",
                        'display': 'inline-block',
                        'verticalAlign': 'top'
                    },
                    placeholder="Select tags...",
                    persistence=True,
                ),
                dcc.Input(name="tags", id="tags", style={'display': 'none'}),
                dcc.Input(name="substructure",
                          id="substructure",
                          placeholder="Filter on SMARTS substructure...",
                          style={
                              "width": "300px",
                              'verticalAlign': 'top',
                              'display': 'inline-block'
                          },
                          persistence=False,
                          value=substructure),
                html.Button('Query',
                            id='submit_query-form',
                            style={
                                "width": "150px",
                                'display': 'inline-block',
                                "background": "#F0F8FF"
                            }),
            ],
        ),
        html.Form(id='export-summary-form',
                  style={'display': 'inline-block'},
                  method='post',
                  children=[
                      dcc.Input(name="export",
                                id='export',
                                style={'display': 'none'}),
                      html.Button('Export',
                                  id='submit_export-summary-form',
                                  style={
                                      "width": "150px",
                                      "background": "#F0F8FF"
                                  })
                  ]),
        html.P(message) if message else html.Div(),
        html.Div(children=[
            html.Details(children=[
                html.Summary("Download descriptors"),
                html.Form(
                    id='export-form',
                    children=[
                        dcc.Dropdown(
                            id='dropdownPresetOptions',
                            options=[
                                dict(label=lab, value=val) for lab, val in zip(
                                    desc_presets_long, desc_presets)
                            ],
                            multi=True,
                            style={
                                "width": "300px",
                                'verticalAlign': 'top',
                            },
                            placeholder="Select descriptor presets...",
                        ),
                        dcc.Input(name="PresetOptions",
                                  id="inputPresetOptions",
                                  style={'display': 'none'}),
                        dcc.Input(name="ConformerOptions",
                                  id="conformerOptions",
                                  list='conf_options',
                                  style={
                                      "width": "300px",
                                      'verticalAlign': 'top'
                                  },
                                  placeholder="Select conformer option..."),
                        html.Br(),
                        html.Button('Download',
                                    id='submit_export-form',
                                    style={
                                        "width": "150px",
                                        "background": "#F0F8FF"
                                    })
                    ],
                    method='post',
                )
            ]),
            dt.DataTable(
                id='table',
                data=get_table(tags, substructure).to_dict('records'),
                columns=[
                    dict(name=c,
                         id=c,
                         hideable=False,
                         presentation="markdown" if c in
                         ['image', 'descriptors'] else "input")
                    for c in [
                        'image', 'can', 'name', 'tags', 'theory',
                        'light_basis_set', 'heavy_basis_set',
                        'generic_basis_set', 'max_light_atomic_number',
                        'num_conformers', 'max_num_conformers', 'descriptors'
                    ]
                ],
                editable=False,
                page_size=20,
                page_action="native",
                sort_action="native",
                sort_mode="multi",
                filter_action="native",
            ),
        ]) if tags is not None else html.Div(),
    ])