def serve_layout(doi="none", tokens=testTokens[0]):
    return html.Div([
        dmi.AnnotationContainer(doi=doi,
                                tokens=tokens,
                                labels=testLabels,
                                passiveLabels=[],
                                className="testClass",
                                id="annotation_container",
                                selectedValue=None),
        dmi.DropdownCreatable(
            options=[{
                'value': '',
                'label': 'material:'
            }, {
                'value': '',
                'label': 'property:'
            }, {
                'value': '',
                'label': 'application:'
            }],
            multi=True,
            id="tags_selector",
            placeholder="Add filters...",
            promptText="Add filter ",
            value=None,
        ),
        html.Div("doi is " + doi, id="test_output"),
        html.Div(html.Button("Confirm", id="annotate_confirm"))
    ])
示例#2
0
def serve_layout(path=None):
    if path is not None and len(path) > len("/search"):
        path = path[len("/search") + 1::]
        path = path.replace("%20", " ")
    options = []
    value = options
    if path is not None:
        filter_value_material = path.split("/")
        if len(filter_value_material) == 3:
            options = [{
                'label': 'material:' + filter_value_material[2],
                'value': 'material:' + filter_value_material[2]
            }, {
                'label':
                filter_value_material[0] + ':' + filter_value_material[1],
                'value':
                filter_value_material[0] + ':' + filter_value_material[1]
            }]
            value = options
    return [
        search_html(),
        dmi.DropdownCreatable(options=options,
                              multi=True,
                              promptText="Add filter ",
                              className="search-filters",
                              placeholder="filter:value1,value2",
                              searchable=True,
                              value=value,
                              id='search_filters'),
        html.Div('Valid filters: ' + ', '.join(MatstractSearch.VALID_FILTERS),
                 style={
                     "color": "grey",
                     "padding": "10px 1px",
                     "fontSize": "10pt"
                 },
                 className="row"),
        html.Div("", id="search_results", className="row"),
        html.Div(
            [
                html.Span(
                    "Attribution Notice: This data was downloaded from the Scopus API between January - July 2018"
                ),
                html.Br(),
                html.Span(
                    " via https://api.elsevier.com and https://www.scopus.com."
                )
            ],
            style={
                "color": "grey",
                "textAlign": "center",
                "fontSize": "10pt",
                "marginTop": "30px"
            },
            className="row")
    ]
示例#3
0
def serve_macro_annotation(db, display):
    """Things like experimental vs theoretical, inorganic vs organic, etc."""
    tags = []
    for tag in db.abstract_tags.find({}):
        tags.append({'label': tag["tag"], 'value': tag['tag']})

    return [html.Div([html.Div("Tags: ", className="two columns"),
                     html.Div(dmi.DropdownCreatable(
                         options=tags,
                         id='abstract_tags',
                         multi=True,
                         value=''
                     ), className="ten columns")],
                     className="row", style={"display": display})]
示例#4
0
app.title = "Matstract - Rediscovering Materials"

db = AtlasConnection().db

# loading css files
css_files = [
    "dash_extra.css", "skeleton.min.css", "webstract.css",
    "googleapis.raleway.css", "googleapis.dosis.css"
]
stylesheets_links = [
    html.Link(rel='stylesheet', href='/static/css/' + css) for css in css_files
]

header = html.Div([
    dcc.Location(id="url", refresh=False),
    html.Div(dmi.DropdownCreatable(), style={"display": "none"}),
    html.Img(
        src=
        "https://s3-us-west-1.amazonaws.com/matstract/matstract_with_text.png",
        style={
            'height': '50px',
            'float': 'right',
            'max-width': "100%",
            "margin": "5px 3px 20px 5px",
            "clear": "both"
        }),
    html.H4("Rediscovering Materials",
            className="headline",
            style={
                "float": "left",
                "margin": "15px 5px 10px 1px",