Exemple #1
0
def get_cross_validation_result(labeled_kinases, zscore_cutoff):
    """Does LOO validation and returns container with formatted results."""
    loo_experiment = cross_validation.LOOValitation(network, labeled_kinases)
    zscore_table = loo_experiment.run_validation()
    # get ROC figure
    tpr, fpr, auc = loo_experiment.get_roc()
    roc_fig = draw_roc_curve(tpr, fpr, auc)
    # define results div
    result_div = html.Div(children=[
        html.Details(children=[
            html.Summary(
                "Cross-validation AUC is %1.2f (expand for details)" % auc, ),
            dcc.Graph(id="loo-roc", figure=roc_fig),
            html.Ul(children=[
                html.Li(app_text.auc_explanation["random"]),
                html.Li(app_text.auc_explanation["moderate"]),
                html.Li(app_text.auc_explanation["high"]),
            ]),
        ], ),
        html.Details(children=[
            html.Summary("Full z-score and ranks table (expand for details)"),
            convert_to_dash_table(zscore_table),
        ]),
    ])
    # make updated graph
    graph_nodes, node_styling = create_cytoscape_div(network, labeled_kinases,
                                                     zscore_table,
                                                     zscore_cutoff)
    return result_div, graph_nodes, node_styling
Exemple #2
0
def three_row_layout(
    row1_children,
    row2_children,
    row3_children,
    row1_title="",
    row2_title="",
    id_prefix="",
):
    return html.Div(
        className="app_main_content",
        children=[
            html.Details(
                open=True,
                className="container scalable",
                children=[
                    html.Summary(row1_title, className="summary"),
                    html.Div(id="top-row",
                             className="row",
                             children=row1_children),
                ],
            ),
            html.Details(
                open=True,
                className="container scalable",
                children=[
                    html.Summary(row2_title, className="summary"),
                    html.Div(id="middle-row",
                             className="row",
                             children=row2_children),
                ],
            ),
            html.Div(id="bottom-row", className="row", children=row3_children),
        ],
    )
Exemple #3
0
def figure_header_ensemble(elements: dict) -> list:
    """Constructs children components of the figure header div.

    Paremeters
    ----------
    elements : dict
        text content of the respective components

    Returns
    -------
    components : list
        list of the html and dcc components

    """
    components = [
        html.A(id=elements["anchor_id"]),
        html.H4(elements["header_title"].upper()),
        dcc.Markdown(elements["summary"]),
        html.Details(
            children=[html.Summary("Key Insights"), dcc.Markdown(elements["insight"])]
        ),
    ]
    if "factoid" in elements:
        components.append(
            html.Details(
                children=[
                    html.Summary("Interesting Factoid"),
                    dcc.Markdown(elements["factoid"]),
                ]
            )
        )
    return components
Exemple #4
0
def recipe(val):
    time = ''
    if 'time' in val:
        time = val['time']

    return html.Div(
        className='recipe',
        children=[
            html.Img(src=val['image']),
            html.Div(className='recipe-text',
                     children=[
                         html.H5(children=val['title']),
                         html.P(className='recipe-meta',
                                children=val['portions'] + '  ' + time),
                         html.Details([
                             html.Summary(
                                 str(len(val['ingredients'])) +
                                 ' ингредиента(ов)'),
                             html.Div(children=[
                                 html.P(ingredientLine)
                                 for ingredientLine in val['ingredients']
                             ])
                         ]),
                         html.Details([
                             html.Summary(str(len(val['steps'])) + ' шаг(ов)'),
                             html.Div(children=[
                                 html.P(stepLine) for stepLine in val['steps']
                             ])
                         ])
                     ])
        ])
 def filter_layout(self) -> Optional[list]:
     """Makes dropdowns for each dataframe column used for filtering."""
     if not self.use_filter:
         return None
     df = self.data
     dropdowns = [html.H4("Set filters")]
     for col in self.filter_cols:
         if df[col].dtype == np.float64 or df[col].dtype == np.int64:
             min_val = df[col].min()
             max_val = df[col].max()
             mean_val = df[col].mean()
             dropdowns.append(
                 html.Div(children=[
                     html.Details(
                         open=True,
                         children=[
                             html.Summary(col.lower().capitalize()),
                             dcc.RangeSlider(
                                 id=self.uuid(f"filter-{col}"),
                                 min=min_val,
                                 max=max_val,
                                 step=(max_val - min_val) / 10,
                                 marks={
                                     min_val: f"{min_val:.2f}",
                                     mean_val: f"{mean_val:.2f}",
                                     max_val: f"{max_val:.2f}",
                                 },
                                 value=[min_val, max_val],
                             ),
                         ],
                     )
                 ]))
         else:
             elements = list(self.data[col].unique())
             dropdowns.append(
                 html.Div(children=[
                     html.Details(
                         open=True,
                         children=[
                             html.Summary(col.lower().capitalize()),
                             wcc.Select(
                                 id=self.uuid(f"filter-{col}"),
                                 options=[{
                                     "label": i,
                                     "value": i
                                 } for i in elements],
                                 value=elements
                                 if self.filter_defaults is None else [
                                     element for element in self.
                                     filter_defaults.get(col, elements)
                                     if element in elements
                                 ],
                                 size=min(15, len(elements)),
                             ),
                         ],
                     )
                 ]))
     return dropdowns
 def filter_layout(self):
     """Makes dropdowns for each dataframe column used for filtering."""
     if not self.use_filter:
         return None
     df = self.data
     dropdowns = [html.H4("Set filters")]
     for col in self.filter_cols:
         if df[col].dtype == np.float64 or df[col].dtype == np.int64:
             min_val = df[col].min()
             max_val = df[col].max()
             mean_val = df[col].mean()
             dropdowns.append(
                 html.Div(children=[
                     html.Details(
                         open=True,
                         children=[
                             html.Summary(col.lower().capitalize()),
                             dcc.RangeSlider(
                                 id=self.filter_ids[col],
                                 min=min_val,
                                 max=max_val,
                                 step=(max_val - min_val) / 10,
                                 marks={
                                     min_val: f"{min_val:.2f}",
                                     mean_val: f"{mean_val:.2f}",
                                     max_val: f"{max_val:.2f}",
                                 },
                                 value=[min_val, max_val],
                             ),
                         ],
                     )
                 ]))
         else:
             elements = list(self.data[col].unique())
             dropdowns.append(
                 html.Div(children=[
                     html.Details(
                         open=True,
                         children=[
                             html.Summary(col.lower().capitalize()),
                             dcc.Dropdown(
                                 id=self.filter_ids[col],
                                 options=[{
                                     "label": i,
                                     "value": i
                                 } for i in elements],
                                 value=elements,
                                 multi=True,
                             ),
                         ],
                     )
                 ]))
     return dropdowns
Exemple #7
0
def build_interface(app):
    inel_div = inelastic.build_interface(app)
    el_div = elastic.build_interface(app)
    el_div.style = inel_div.style = dict(border="1px solid lightgray", padding='1em')
    return html.Div([
        html.H1(children='CNCS resolution'),
        html.Details([
            html.Summary('Help'),
            html.Div([
                dcc.Markdown('''
##### Data
This page displays resolution data from experimental measurements and analytical models.

* The experimental data was obtained by measuring the vanadium standard sample. 
* The modeled data was obtained from a PyChop \[1\] model.
                '''),
                dcc.Markdown('''
##### Plots
The plots below are interactive plot.ly plots.

* You can drag a rectangle to zoom in
* There are several icons near the top-right corner on each plot.ly plot as you hover your mouse on top of the plot, including an icon to zoom out
* Hover the mouse over any data point to show more information related to the data point
                '''),
                html.P([
                    "[1]", " ",
                    html.A("PyChop", href="https://docs.mantidproject.org/nightly/interfaces/PyChop.html", target="_blank"),
                ]),
            ])
        ]),
        dcc.Tabs(children=[
            dcc.Tab(label='Inelastic', children=[inel_div]),
            dcc.Tab(label='Elastic', children=[el_div]),
            ])
    ])
Exemple #8
0
def generate_control_elements(parameters_table):
    master_list = []

    for group in parameters_table.group.unique():
        group_list = []
        group_list.append(html.Summary(children = group))

        param_table_selection = parameters_table[parameters_table.group == group]

        for index, row in param_table_selection.iterrows():
            slider_label = dcc.Markdown(dangerously_allow_html = True,
                                            children = row['label'])
            marks_dict = {i: str(round(i, ndigits = 4)) for i in np.linspace(row['min'], row['max'], num = 5)}
            slider = dcc.Slider(id = row['id'],
                                    min = row['min'],
                                    max = row['max'],
                                    step = row['step'],
                                    value = row['default'],
                                    marks = marks_dict)
            group_list.append(dbc.Row([dbc.Col(slider_label, width = 1), dbc.Col(slider, width = 10)]))
            

        master_list.append(html.Details(children = group_list))

    return master_list
Exemple #9
0
def define_score_instruments(midifile):
    return html.Div([
    add_instruments(midifile),
    html.Div('bars', style={'textAlign': 'center', 'color': 'grey'}),
    dcc.RangeSlider(
        id='score_range',
        min=1,
        max=len(roll.get_downbeats()),
        step=1,
        value=[1, len(roll.get_downbeats())],
        pushable=1,
        dots=True,
        updatemode='drag',
        tooltip={
            'always_visible': False,
            'placement': 'bottom'
        },
        # marks={
        #     0:'0',
        #     5:'5',
        #     10:'10'
        # }
    ),
    html.Div(id='slider_return', style={'textAlign': 'center', 'color': 'grey'}),

    html.Button(id='analyze_button', n_clicks=0, children='Push here for analysis', className='button',),

    html.Details([html.Summary('Show score', className='button'), html.Div(
        html.Div(html.Div(children=[html.Img(src='data:image/png;base64,{}'.format(encoded_image3.decode()), style={'width': '100%'})], style={'textAlign': 'center'})),
    )]),])
Exemple #10
0
def make_code(file):
    return html.Div([
        html.Details(
            [html.Summary('Code'),
             html.Div(file_iterator_to_html(file))])
    ],
                    style={'padding-bottom': '2em'})
Exemple #11
0
def make_code_box(title, id, children):
    """
    :param title: text to show when twistie box is closed
    :param id of the code box
    :param children: content to copy to the clipboard - typically a code block
    :return: a div with a twistie box
    """
    return html.Div([
        html.Details(
            open=False,
            id="open_" + id,
            children=[
                html.Summary([
                    title,
                    html.Button(
                        id="copy_" + id,
                        n_clicks=0,
                        className="fa fa-copy",
                        style={"border": "none"},
                    ),
                ]),
                dcc.Markdown(id="md_" + id, children=children,
                             className="p-2"),
            ],
            className="shadow mt-2",
        ),
    ])
Exemple #12
0
def create_filter_sidebar(columns_metadata=None):
    filter_divs = [
        html.Label('Filter Columns',
                   id='title_filterbox',
                   style={
                       'fontWeight': 'bold',
                       'fontSize': 20
                   })
    ]
    all_checklists = []
    for category, cols in columns_metadata.items():
        detail_children = []
        detail_children.append(
            html.Summary(category, style={'fontWeight': 'bold'}))
        checklist = dcc.Checklist(id='available_{}'.format(category),
                                  options=[{
                                      'label': i,
                                      'value': i
                                  } for i in cols],
                                  value=cols[:3])

        detail_children.append(checklist)
        all_checklists.append(checklist)
        filter_divs.append(html.Details(detail_children))

    filter_sidebar = html.Div(filter_divs,
                              className='w3-sidebar w3-bar-block',
                              style={'width': '25%'})

    return filter_sidebar, all_checklists
Exemple #13
0
def generate_options(plotted_axes_format, fig1, fig2):
    if plotted_axes_format == 'MAG':
        return html.Div()
    elif plotted_axes_format == 'RI':
        return html.Div()
    elif plotted_axes_format == 'TIME':
        fig1_x = fig1['data'][0]['x']
        fig2_x = fig2['data'][0]['x']
        return html.Div(
            html.Details([
                html.Summary('Timegating Options'),
                html.Button(id='timegate-button',
                            children='Time Gate Visible Traces'),
                html.H6("Frequency Gate"),
                dcc.RangeSlider(id='freq-gate-slider',
                                min=min(fig1_x),
                                max=max(fig1_x),
                                step=(max(fig1_x) - min(fig1_x)) / len(fig1_x),
                                value=[min(fig1_x), max(fig1_x)]),
                html.Div(id='freq-gate-slider-value'),
                html.Div('\n'),
                html.H6("Time Gate"),
                dcc.RangeSlider(id='time-gate-slider',
                                min=min(fig2_x),
                                max=max(fig2_x),
                                step=(max(fig2_x) - min(fig2_x)) / len(fig2_x),
                                value=[min(fig2_x), max(fig2_x)]),
                html.Div(id='time-gate-slider-value'),
                html.Div('\n'),
            ]))
    elif plotted_axes_format == 'BODE':
        return html.Div()
    else:
        return html.Div()
Exemple #14
0
def get_details(dois):
    return html.Details([
        html.Summary('Show dois?'),
        html.Span([html.A("{}; ".format(doi), href="http://www.doi.org/{}".format(doi), target="_blank")
                   for doi in dois[:20]],
                  style={"white-space": "nowrap"})
    ])
Exemple #15
0
def create_allDivs():

    style = {
        'margin': 20,
        'border': '1px solid #aaa;',
        'border-radius': 4,
        'padding': '.5em .5em 0'
    }

    setFileButton = html.Button('Set File',
                                id='setFileButton',
                                style={"margin": "20px"})
    children = [
        html.H4("IJAL Upload",
                style={'text-align': 'center'},
                id='pageTitleH4'), setFileButton,
        html.Details([
            html.Summary('Tier Guide, option 2: specify interactively'),
            html.Div(create_tierMapGui())
        ],
                     style=style)
    ]

    div = html.Div(children=children,
                   id='main-div',
                   className="twelve columns")  # , style=style)

    return div
def get_details(dois):
    dois = dois[:MAX_N_MATERIALS_IN_TABLE]

    viewable_doi_links = []
    for doi in dois:
        link = html.A(
            "{}; ".format(doi),
            href = "http://www.doi.org/{}".format(doi),
            target = "_blank"
        )
        link_div = html.Div(link)
        viewable_doi_links.append(link_div)

    viewable_doi_links = viewable_doi_links[:MAX_N_DOIS_FOR_VIEWING]

    df = pd.DataFrame({"doi": dois})
    download_link = get_csv_download_link_from_df(
        df,
        f"Download dois as csv"
    )

    summary_txt = f'Show dois?'
    summary = html.Summary([summary_txt])
    details = html.Details([summary] + viewable_doi_links)
    doi_html_link = html.Div(download_link)
    return details, doi_html_link
def make_filter(
    parent: "PropertyStatistics",
    tab: str,
    df_column: str,
    column_values: list,
    multi: bool = True,
    value: Union[str, float] = None,
    open_details: bool = False,
) -> html.Div:
    return html.Div(children=html.Details(
        open=open_details,
        children=[
            html.Summary(df_column.lower().capitalize()),
            wcc.Select(
                id={
                    "id": parent.uuid("filter-selector"),
                    "tab": tab,
                    "selector": df_column,
                },
                options=[{
                    "label": i,
                    "value": i
                } for i in column_values],
                value=[value] if value is not None else column_values,
                multi=multi,
                size=min(20, len(column_values)),
                persistence=True,
                persistence_type="session",
            ),
        ],
    ), )
Exemple #18
0
def validate_inputs(n_clicks, protein_list):
    """Validates protein list submitted by user."""
    message = []
    # diffusion switch, by default, is set to return no-update signal (ie: do nothing)
    diffusion_switch = dash.no_update
    proteins = re.findall("\w+", protein_list)
    proteins = [protein.upper() for protein in proteins]

    if len(proteins) == 0:
        message.append(
            dbc.Alert("You haven't entered anything in the textbox",
                      color="danger"))
        return message, diffusion_switch
    else:
        valid_kinases = InputValidator().validate(proteins)
        valid_kinases = [vk for vk in valid_kinases if vk in network.proteins]
        invalid_kinases = [
            kinase for kinase in proteins if kinase not in valid_kinases
        ]
        if len(valid_kinases) == 0:
            message.append(
                dbc.Alert(
                    """
                    None of the strings you entered were recognized as valid kinase ids.
                    The app expects HUGO (hgnc) symbols for human kinases.
                    See list here https://www.genenames.org/
                    """,
                    color="danger",
                ))
            return message, diffusion_switch
        if len(valid_kinases) > 0:
            message.append(
                dbc.Alert(
                    children=[
                        html.P("""
                            Diffusing kinases in the input set: {kinases}.
                            See diffusion results (graph and z-score table) below.
                            """.format(kinases=", ".join(valid_kinases))),
                        html.P("""
                            Higher z-score indicates closer connectivity of the protein
                            to the input set. Only proteins with z-score > 2 are
                            show in the graph view.
                            """),
                    ],
                    color="success",
                ))
            diffusion_switch = "valid"
        if len(invalid_kinases) > 0:
            message.append(
                dbc.Alert(
                    "These items were not found in network: {kins}".format(
                        kins=", ".join(invalid_kinases)),
                    color="dark",
                ), )
    # wrap alerts into a collapsible
    message_wrap = html.Details(children=[
        html.Summary("Experiment summary (expand for details)"),
        html.Div(children=message),
    ])
    return message_wrap, diffusion_switch
Exemple #19
0
 def __init__(self, children=None, id=None, title=None, **kwargs):
     if children is None:
         children = ["Loading..."]
     if id is None and isinstance(title, str):
         id = title
     if isinstance(title, str):
         title = H4(title,
                    style={
                        "display": "inline-block",
                        "vertical-align": "middle"
                    })
     contents_id = f"{id}_contents" if id else None
     summary_id = f"{id}_summary" if id else None
     kwargs["style"] = {"margin-bottom": "1rem"}
     super().__init__(
         [
             html.Summary(title, id=summary_id),
             html.Div(
                 children,
                 id=contents_id,
                 style={
                     "margin-top": "0.5rem",
                     "margin-left": "1.1rem"
                 },
             ),
         ],
         id=id,
         **kwargs,
     )
Exemple #20
0
def extract_layer(input_object, indents=0):
    indent_text = str(2 * indents) + "em"
    open_on_default = True

    if isinstance(input_object, list):
        # Transform to dict and then continue
        input_object = dict(enumerate(input_object))
        open_on_default = False

    if isinstance(input_object, dict):
        content_list = []
        for key, value in input_object.viewitems():
            if isinstance(value, dict) or isinstance(value, list):
                content_list.append(
                    html.Details([
                        html.Summary(Em(Strong(str(key)))),
                        extract_layer(value, indents + 1)
                    ],
                                 open=open_on_default))
            else:
                try:
                    string_value = [Strong(str(key)), ": {}".format(value)]
                except:
                    string_value = "!ERROR! - Non-dict object could not " +\
                        "become String - Type = {}".format(type(input_object))

                content_list.append(html.P(string_value))
    else:
        # ERROR: Something has gone wrong here. Only Dicts/lists should be passed
        # to this file.
        content_list = [html.P("!Error! Not list or dict: {}".format(\
            type(input_object)))]

    html_div = html.Div(content_list, style={'text-indent': indent_text})
    return html_div
Exemple #21
0
def html_qc_expert_form():
    if (config["feedback_enabled"]):
        return html.Div([
            dbc.Row([
                dbc.Col(html.H5("Submit Supplying Lab Feedback:",
                                className="nomargin"),
                        width=6),
                dbc.Col(dcc.Input(id="qc-user-1",
                                  placeholder="Your initials (e.g. MBAS)",
                                  value="",
                                  type="text"),
                        width=3),
                html.Div(id="placeholder0", style={"display": "none"}),
                dbc.Col([
                    html.Button("Submit QC values", id="feedback-button"),
                    html.Div(id="qc-feedback", className="qc-feedback")
                ],
                        width=3)
            ]),
            html.Div([
                html.Details([
                    html.Summary("How it works (click to show)"),
                    html.P("""If you want to send a sample to resequence,
                    go to the sample card and select "Resequence" in 
                    the Suplying Lab Feedback section. The admin will get
                    an email with the change. You can also "Accept" samples
                    with the "Supplying lab" warning and their data will
                    be used in the future to adjust QC thresholds.""")
                ])
            ],
                     className="mb-1")
        ])

    else:
        return None
Exemple #22
0
def get_row(idx, ticker, n_clicks=0):
    close, volume = extract_data(ticker)

    summary = html.Summary([
        html.Div([
            html.P(ticker, id=f'ticker_{idx}',className='three columns'),
            html.P(close, id=f'close_{idx}', className='three columns'),
            html.P(volume, id=f'volume_{idx}', className='three columns')
            ],
            className="row eleven columns",
            style={"height": "25","float":"right"},
        )],
        className='row',
        style={"paddingLeft":"10", 'color': 'white'}
)
    change_btn = html.Button(
                "Change",
                id=f"change_{idx}_btn",
                n_clicks=n_clicks,
                style={"margin": "0px 7px 7px 10px","textAlign": "center", "color": '#4286f4'},
                className='four columns'
            )
    chart_btn = html.Button(
                "Chart",
                id=f"chart_{idx}_btn",
                n_clicks=n_clicks,
                style={"margin": "0px 7px 7px 10px","textAlign": "center", "color": '#4286f4'},
                className='four columns'
    )
    
    btns = html.Div([change_btn, chart_btn], className='row')
    return html.Details([summary, btns], style={"textAlign": "center","paddingTop":"4"})
Exemple #23
0
def html_qc_expert_form():
    if ("REPORTER_ADMIN" in os.environ
            and os.environ["REPORTER_ADMIN"] == "True"):
        return html.Div([
            html.Div([
                html.Div(html.H5("Submit Supplying Lab Feedback:",
                                 className="nomargin"),
                         className="six columns"),
                html.Div(dcc.Input(id="qc-user-1",
                                   placeholder="Your initials (e.g. MBAS)",
                                   value="",
                                   type="text"),
                         className="three columns"),
                html.Div(html.Button("Submit QC values", id="feedback-button"),
                         className="three columns")
            ],
                     className="row"),
            html.Div([
                html.Div(html.Details([
                    html.Summary("How it works (click to show)"),
                    html.P("""If you want to send a sample to resequence,
                        go to the sample card and select "Resequence" in 
                        the Suplying Lab Feedback section. The admin will get
                        an email with the change. You can also "Accept" samples
                        with the "Supplying lab" warning and their data will
                        be used in the future to adjust QC thresholds.""")
                ]),
                         className="six columns"),
                html.Div(id="qc-feedback", className="six columns qc-feedback")
            ],
                     className="row mb-1")
        ])

    else:
        return None
Exemple #24
0
def make_filter(
    get_uuid: Callable,
    tab: str,
    vtype: str,
    column_values: list,
    multi: bool = True,
    value: Union[str, float] = None,
    open_details: bool = False,
) -> wcc.Selectors:
    return html.Details(
        open=open_details,
        children=[
            html.Summary(vtype),
            wcc.Select(
                id={
                    "id": get_uuid("vitem-filter"),
                    "tab": tab,
                    "vtype": vtype,
                },
                options=[{
                    "label": i,
                    "value": i
                } for i in column_values],
                value=[value] if value is not None else column_values,
                multi=multi,
                size=min(15, len(column_values)),
            ),
        ],
    )
Exemple #25
0
    def get_result(self, parameters):
        data_test_section = html.Details(children=[html.Summary('Test Data'),
                                                   self.data_test_table])
        evaluation_result = html.Div(children=[html.Div(self.scoreText),
                                               html.Div(self.confusionMatrixFigure),
                                               self.fairness_results])
        if self.figure is None:
            result = [html.Div(children=[html.Div(self.configText,
                                                  className='six columns',
                                                  style={'display': parameters['display_config']}),
                                         html.Div(evaluation_result, className='six columns')],
                               className='one_result')]
        else:
            result = [html.Div(children=[html.Div(self.configText,
                                                  className='five columns',
                                                  style={'display': parameters['display_config']}),
                                         html.Div(self.figure,
                                                  className='three columns',
                                                  style={'display': parameters['display_figure']}),
                                         html.Div(evaluation_result, className='four columns')],
                               className='one_result')]

        if parameters['display_data_test_table']:
            result.append(data_test_section)
        return result
 def filter_selectors(self) -> List[html.Div]:
     """Dropdowns for dataframe columns that can be filtered on (Zone, Region, etc)"""
     return [
         html.Div(
             children=[
                 html.Details(
                     open=True,
                     children=[
                         html.Summary(selector.lower().capitalize()),
                         wcc.Select(
                             id=self.selectors_id[selector],
                             options=[
                                 {"label": i, "value": i}
                                 for i in list(self.volumes[selector].unique())
                             ],
                             value=list(self.volumes[selector].unique()),
                             multi=True,
                             size=min(20, len(self.volumes[selector].unique())),
                             persistence=True,
                             persistence_type="session",
                         ),
                     ],
                 )
             ]
         )
         for selector in self.selectors
     ]
 def selector_dropdowns(self):
     """Makes dropdowns for each selector.
     Args:
         dframe - Volumetrics Dataframe
         selectors - List of selector columns
     Return:
         dcc.Dropdown objects
     """
     dropdowns = []
     for selector in self.selectors:
         elements = list(self.volumes[selector].unique())
         if selector in ["ENSEMBLE", "SOURCE"]:
             value = elements[0]
         else:
             value = elements
         dropdowns.append(
             html.Div(children=[
                 html.Details(
                     open=True,
                     children=[
                         html.Summary(selector.lower().capitalize()),
                         wcc.Select(
                             id=self.selectors_id[selector],
                             options=[{
                                 "label": i,
                                 "value": i
                             } for i in elements],
                             value=value,
                             multi=True,
                             size=min(20, len(elements)),
                         ),
                     ],
                 )
             ]))
     return dropdowns
Exemple #28
0
def make_filter(
    parent,
    tab: str,
    vtype: str,
    column_values: list,
    multi: bool = True,
    value: Union[str, float] = None,
    open_details: bool = False,
) -> html.Div:
    return html.Div(children=html.Details(
        open=open_details,
        children=[
            html.Summary(vtype),
            wcc.Select(
                id={
                    "id": parent.uuid("vitem-filter"),
                    "tab": tab,
                    "vtype": vtype,
                },
                options=[{
                    "label": i,
                    "value": i
                } for i in column_values],
                value=[value] if value is not None else column_values,
                multi=multi,
                size=min(15, len(column_values)),
                persistence=True,
                persistence_type="session",
            ),
        ],
    ), )
Exemple #29
0
def create_provider_layout(providers):
    html_out = {}
    for news_provider in providers:
        html_out[news_provider] = html.Div([html.H1(providers[news_provider]),
        html.Details([html.Summary('See all:'),
            dcc.Markdown(id=news_provider)], open = True )],
        style = article_style)
    return html_out
Exemple #30
0
def make_details(title, *contents):
	return html.Details([
		html.Summary(title),
		*contents
	],style={
		'padding': '.3em',
		'border': 'solid .5px gray'
	},open=True)