From b84688a95eeaf6f271f48d6c26ae8cf083022047 Mon Sep 17 00:00:00 2001 From: ardunn Date: Thu, 20 Feb 2020 14:18:19 -0800 Subject: [PATCH 1/4] update dash-esauto --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5c731bb..e0c6d84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,13 +3,14 @@ dash-core-components==1.5.1 dash-html-components==1.0.2 dash-renderer==1.2.1 dash-table==4.5.1 -dash-auth==1.3.2 -dash-elasticsearch-autosuggest==1.1.0 +dash-auth==1.3. pymatgen==2019.9.8 flask==1.1.1 Flask-Caching==1.7.2 gunicorn==19.9.0 pandas==0.25.1 +dash-elasticsearch-autosuggest==2.2.0 + -e git+https://github.com/materialsintelligence/matscholar.git#egg=matscholar From 8296ef5c7d9820c48ddf62125b157754ce70ade8 Mon Sep 17 00:00:00 2001 From: ardunn Date: Thu, 20 Feb 2020 14:22:29 -0800 Subject: [PATCH 2/4] derp, dash auth fixed --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e0c6d84..93c8916 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ dash-core-components==1.5.1 dash-html-components==1.0.2 dash-renderer==1.2.1 dash-table==4.5.1 -dash-auth==1.3. +dash-auth==1.3.2 pymatgen==2019.9.8 flask==1.1.1 Flask-Caching==1.7.2 From 8f119d833ecbc88647178e8e75db1e14b931321a Mon Sep 17 00:00:00 2001 From: ardunn Date: Thu, 20 Feb 2020 17:36:59 -0800 Subject: [PATCH 3/4] draft 1 --- matscholar_web/assets/msweb.css | 12 +- matscholar_web/constants.py | 2 - matscholar_web/search/view.py | 340 +++++++++++++++++--------------- 3 files changed, 192 insertions(+), 162 deletions(-) diff --git a/matscholar_web/assets/msweb.css b/matscholar_web/assets/msweb.css index d54aaed..fa530f1 100644 --- a/matscholar_web/assets/msweb.css +++ b/matscholar_web/assets/msweb.css @@ -8,12 +8,12 @@ } .react-autosuggest__input { - width: 240px; - height: 30px; + width: 100%; + height: 60px; padding: 10px 20px; font-family: Helvetica, sans-serif; font-weight: 300; - font-size: 16px; + font-size: 32px; border: 1px solid #aaa; border-radius: 4px; } @@ -35,7 +35,7 @@ display: block; position: absolute; top: 51px; - width: 280px; + width: 100%; border: 1px solid #aaa; background-color: #fff; font-family: Helvetica, sans-serif; @@ -47,8 +47,8 @@ } .react-autosuggest__suggestions-list { - margin: 0; - padding: 0; + margin: 5; + padding: 5; list-style-type: none; } diff --git a/matscholar_web/constants.py b/matscholar_web/constants.py index bafaf37..3f7cebf 100644 --- a/matscholar_web/constants.py +++ b/matscholar_web/constants.py @@ -16,7 +16,6 @@ example_searches = load_static_data_file("example_searches.json") sample_abstracts = load_static_data_file("sample_abstracts.json") - # Artifacts for making tests run easier fake_endpoint = "not_a_real_endpoint" fake_api_key = "not_a_real_api_key" @@ -26,7 +25,6 @@ api_key = os.environ.get("MATERIALS_SCHOLAR_API_KEY", fake_api_key) rester = Rester(endpoint=endpoint, api_key=api_key) - # Artifacts for elastic testing fake_elastic_credential = "not_a_real_elastic_credential" diff --git a/matscholar_web/search/view.py b/matscholar_web/search/view.py index 2c05026..168a2b5 100644 --- a/matscholar_web/search/view.py +++ b/matscholar_web/search/view.py @@ -40,7 +40,7 @@ def app_view_html(): [ logo_html(), search_bar_and_buttons_html(), - guided_search_boxes_html(), + # guided_search_boxes_html(), subview_results_container_html(), ] ) @@ -133,12 +133,44 @@ def search_bar_and_buttons_html(): ) label_container = html.Div(label, className="has-text-centered") - search_bar = dcc.Input( - placeholder=example_searches[-1], - id="search-main-bar-input", - className="input is-info is-medium", - autoFocus=True, - ) + # search_bar = dcc.Input( + # placeholder=example_searches[-1], + # id="search-main-bar-input", + # className="input is-info is-medium", + # autoFocus=True, + # ) + + index_name_map = { + "properties": "Properties", + "applications": "Applications", + "characterization_methods": "Characterization Methods", + "synthesis_methods": "Synthesis Methods", + "structure_phase_labels": "Structure/Phase", + "materials": "Materials", + "descriptors": "Sample Descriptor" + } + + esdb_name_query = ','.join(index_name_map.keys()) + endpoint_multi = elastic_host + "/" + esdb_name_query + "/_search?search_type=dfs_query_then_fetch" + + search_bar = ESAutosuggest( + id='input', + value='', + endpoint=endpoint_multi, + fields=["original", "normalized"], + defaultField="original", + additionalField="normalized", + sectionMap=index_name_map, + numSuggestions=20, + sort=["_score"], + placeholder='', + suggestions=[], + authUser=elastic_user, + authPass=elastic_pass, + searchField="original.edgengram", + autoFocus=True, + spellCheck=False + ) sized = "is-size-7" tooltip_spans = [html.Span("Keywords: ", className=sized)] @@ -224,150 +256,150 @@ def hidden_ref_example_searches_html(): return examples_hidden_ref -def guided_search_boxes_html(): - """ - Get the html block for hidden guided search fields. - - Returns: - (dash_html_components.Div): The html block for the hidden search fields. - """ - hr = divider_html() - dropdown = dcc.Dropdown( - id="search-type-dropdown", - options=[ - { - "label": "Search for: Statistics (on named entities/words)", - "value": "entities", - }, - {"label": "Search for: Relevant Papers", "value": "abstracts"}, - { - "label": "Search for: Summary of Materials", - "value": "materials", - }, - {"label": "Search for: Everything", "value": "everything"}, - ], - value="everything", - ) - dropdown_column = html.Div(dropdown, className="column is-fullwidth") - dropdown_columns = html.Div( - [dropdown_column], className="columns is-centered" - ) - dropdown_container = html.Div( - dropdown_columns, className="container has-margin-5" - ) - - entity_filters_html = [ - guided_search_box_elastic_html(f) for f in valid_search_filters - ] - - entity_filter_row_1 = html.Div( - entity_filters_html[0:3], className="columns is-centered" - ) - entity_filter_row_2 = html.Div( - entity_filters_html[3:6], className="columns is-centered" - ) - entity_filter_row_3 = html.Div( - entity_filters_html[6:9], className="columns is-centered" - ) - entity_filter_rows = [ - entity_filter_row_1, - entity_filter_row_2, - entity_filter_row_3, - ] - - advanced_search_boxes = html.Div( - entity_filter_rows, - id="advanced_search_boxes", - className="container has-margin-top-10", - ) - - summary_txt = "Guided search fields" - summary = html.Summary( - summary_txt, className="has-text-centered is-size-6" - ) - hidden_column = html.Details( - [hr, dropdown_container, summary, advanced_search_boxes], - className="column is-half", - ) - - hidden_columns = html.Div(hidden_column, className="columns is-centered") - hidden_container = html.Div([hidden_columns], className="container") - - return hidden_container - - -def guided_search_box_elastic_html(field): - """ - Get the html block for a single filter boxes with ESAutosuggest. - - Args: - field (str): The field type. Either a lowercase entity or "text". - """ - placeholders = { - "material": "PbTe, graphite,...", - "property": "dielectric constant, melting point,...", - "application": "cathode, catalyst,...", - "descriptor": "thin film, nanoparticle,...", - "characterization": "x-ray diffraction, EDS...", - "synthesis": "sol - gel, firing,...", - "phase": "perovskite, wurtzite,...", - "text": "nanoparticle synthesis...", - } - - ES_field_dict = { - "material": "materials", - "property": "properties", - "application": "applications", - "descriptor": "descriptors", - "characterization": "characterization_methods", - "synthesis": "synthesis_methods", - "phase": "structure_phase_labels", - "text": "matscholar_production.entries", - } - - tooltip_texts = { - "material": "Material stoichiometries and common names.", - "property": "Names of measurable materials phenomena.", - "application": "Commercial and research uses for materials.", - "descriptor": "Ways to describe bulk materials.", - "characterization": "Methods for characterizing materials.", - "synthesis": "Names of procedures for synthesizing materials.", - "phase": "Proper and common names of phases (nanoscale).", - "text": "Raw text search to supplement the entity search.", - } - - color = search_filter_color_map[field] - common_entity_style = ( - f"msweb-is-{color}-txt is-size-5 has-text-weight-semibold" - ) - entity_txt = "{}:".format(field.capitalize()) - entity_name = html.Div(entity_txt, className=f"{common_entity_style}") - - tooltip_txt = tooltip_texts[field] - entity_label_tooltip = html.Div( - tooltip_txt, className=f"tooltip-text is-size-7 has-margin-5" - ) - - # Autosuggest is styled by CSS react classnames ONLY! - esas = ESAutosuggest( - id="search-" + field + "-filters-input", - fields=["original", "normalized"], - endpoint=elastic_host + "/" + ES_field_dict[field] + "/_search", - defaultField="original", - additionalField="normalized", - placeholder=placeholders[field], - authUser=elastic_user, - authPass=elastic_pass, - searchField="original.edgengram", - sort=["_score"], - suggestions=[], - autoFocus=True, - spellCheck=False, - ) - # esas = dcc.Input(id="search_" + field + "_filters_input") - - textbox = html.Div( - [entity_name, esas, entity_label_tooltip], - className="has-margin-right-10 has-margin-left-10 tooltip", - ) - return textbox +# def guided_search_boxes_html(): +# """ +# Get the html block for hidden guided search fields. +# +# Returns: +# (dash_html_components.Div): The html block for the hidden search fields. +# """ +# hr = divider_html() +# dropdown = dcc.Dropdown( +# id="search-type-dropdown", +# options=[ +# { +# "label": "Search for: Statistics (on named entities/words)", +# "value": "entities", +# }, +# {"label": "Search for: Relevant Papers", "value": "abstracts"}, +# { +# "label": "Search for: Summary of Materials", +# "value": "materials", +# }, +# {"label": "Search for: Everything", "value": "everything"}, +# ], +# value="everything", +# ) +# dropdown_column = html.Div(dropdown, className="column is-fullwidth") +# dropdown_columns = html.Div( +# [dropdown_column], className="columns is-centered" +# ) +# dropdown_container = html.Div( +# dropdown_columns, className="container has-margin-5" +# ) +# +# entity_filters_html = [ +# guided_search_box_elastic_html(f) for f in valid_search_filters +# ] +# +# entity_filter_row_1 = html.Div( +# entity_filters_html[0:3], className="columns is-centered" +# ) +# entity_filter_row_2 = html.Div( +# entity_filters_html[3:6], className="columns is-centered" +# ) +# entity_filter_row_3 = html.Div( +# entity_filters_html[6:9], className="columns is-centered" +# ) +# entity_filter_rows = [ +# entity_filter_row_1, +# entity_filter_row_2, +# entity_filter_row_3, +# ] +# +# advanced_search_boxes = html.Div( +# entity_filter_rows, +# id="advanced_search_boxes", +# className="container has-margin-top-10", +# ) +# +# summary_txt = "Guided search fields" +# summary = html.Summary( +# summary_txt, className="has-text-centered is-size-6" +# ) +# hidden_column = html.Details( +# [hr, dropdown_container, summary, advanced_search_boxes], +# className="column is-half", +# ) +# +# hidden_columns = html.Div(hidden_column, className="columns is-centered") +# hidden_container = html.Div([hidden_columns], className="container") +# +# return hidden_container + + +# def guided_search_box_elastic_html(field): +# """ +# Get the html block for a single filter boxes with ESAutosuggest. +# +# Args: +# field (str): The field type. Either a lowercase entity or "text". +# """ +# placeholders = { +# "material": "PbTe, graphite,...", +# "property": "dielectric constant, melting point,...", +# "application": "cathode, catalyst,...", +# "descriptor": "thin film, nanoparticle,...", +# "characterization": "x-ray diffraction, EDS...", +# "synthesis": "sol - gel, firing,...", +# "phase": "perovskite, wurtzite,...", +# "text": "nanoparticle synthesis...", +# } +# +# ES_field_dict = { +# "material": "materials", +# "property": "properties", +# "application": "applications", +# "descriptor": "descriptors", +# "characterization": "characterization_methods", +# "synthesis": "synthesis_methods", +# "phase": "structure_phase_labels", +# "text": "matscholar_production.entries", +# } +# +# tooltip_texts = { +# "material": "Material stoichiometries and common names.", +# "property": "Names of measurable materials phenomena.", +# "application": "Commercial and research uses for materials.", +# "descriptor": "Ways to describe bulk materials.", +# "characterization": "Methods for characterizing materials.", +# "synthesis": "Names of procedures for synthesizing materials.", +# "phase": "Proper and common names of phases (nanoscale).", +# "text": "Raw text search to supplement the entity search.", +# } +# +# color = search_filter_color_map[field] +# common_entity_style = ( +# f"msweb-is-{color}-txt is-size-5 has-text-weight-semibold" +# ) +# entity_txt = "{}:".format(field.capitalize()) +# entity_name = html.Div(entity_txt, className=f"{common_entity_style}") +# +# tooltip_txt = tooltip_texts[field] +# entity_label_tooltip = html.Div( +# tooltip_txt, className=f"tooltip-text is-size-7 has-margin-5" +# ) +# +# # Autosuggest is styled by CSS react classnames ONLY! +# esas = ESAutosuggest( +# id="search-" + field + "-filters-input", +# fields=["original", "normalized"], +# endpoint=elastic_host + "/" + ES_field_dict[field] + "/_search", +# defaultField="original", +# additionalField="normalized", +# placeholder=placeholders[field], +# authUser=elastic_user, +# authPass=elastic_pass, +# searchField="original.edgengram", +# sort=["_score"], +# suggestions=[], +# autoFocus=True, +# spellCheck=False, +# ) +# +# +# textbox = html.Div( +# [entity_name, esas, entity_label_tooltip], +# className="has-margin-right-10 has-margin-left-10 tooltip", +# ) +# return textbox From de3a501d2738c0a53950ca3dae6b6a994058ff0b Mon Sep 17 00:00:00 2001 From: ardunn Date: Thu, 5 Mar 2020 22:17:25 -0800 Subject: [PATCH 4/4] wip update --- matscholar_web/app.py | 171 ++++++++++++++++++--------------- matscholar_web/common.py | 11 +++ matscholar_web/search/logic.py | 12 ++- matscholar_web/search/view.py | 63 ++++++++---- 4 files changed, 161 insertions(+), 96 deletions(-) diff --git a/matscholar_web/app.py b/matscholar_web/app.py index 820ecb0..2854c1a 100644 --- a/matscholar_web/app.py +++ b/matscholar_web/app.py @@ -118,75 +118,92 @@ def update_nav_bar_highlight(path): ################################################################################ -@app.callback( - Output("search-main-bar-input", "value"), - [Input("search-example-button", "n_clicks")] - + get_search_field_callback_args( - as_type="input", return_component="value" - ), -) -def search_bar_live_display(example_search_n_clicks, *ent_txts): - """ - Update the main search bar text live from the example search button and the - entity fields being typed in. - - Args: - example_search_n_clicks (int): The number of times the example search - button was clicked. - *ent_txts (strs): The strings for each guided search field. - - Returns: - (str): The text to be shown in the search bar via live update. - - """ - return sl.search_bar_live_display(example_search_n_clicks, *ent_txts) +# @app.callback( +# Output("search-main-bar-input", "value"), +# [Input("search-example-button", "n_clicks")] +# + get_search_field_callback_args( +# as_type="input", return_component="value" +# ), +# ) +# def search_bar_live_display(example_search_n_clicks, *ent_txts): +# """ +# Update the main search bar text live from the example search button and the +# entity fields being typed in. +# +# Args: +# example_search_n_clicks (int): The number of times the example search +# button was clicked. +# *ent_txts (strs): The strings for each guided search field. +# +# Returns: +# (str): The text to be shown in the search bar via live update. +# +# """ +# return sl.search_bar_live_display(example_search_n_clicks, *ent_txts) @app.callback( - Output("search-example-button", "n_clicks"), - get_search_field_callback_args(as_type="input"), + Output("search-query-display", "children"), + [Input("search-input-unibox", "n_submit")], + [State("search-input-unibox", "input"), + State("search-current-query-hidden", "value")] ) -def void_example_search_n_clicks_on_live_search(*ent_txts): - """ - Reset the number of example search button clicks when any search is changed - via the guided search fields. - - Args: - *ent_txts: The entity texts, though it does not matter what they - actually are. - Returns: - (int): The number of clicks to set the example search button n_clicks - to. - """ - return 0 - - -@app.callback( - Output("search-go-button", "n_clicks"), - [Input("search-main-bar-input", "n_submit")] - + get_search_field_callback_args( - as_type="input", return_component="n_submit" - ), - [State("search-go-button", "n_clicks")], -) -def sum_all_fields_and_buttons_n_submits(*all_n_clicks): - """ - Sum the guided search fields and main search field and "Go" button n_submits - and n_clicks to a single n_clicks number for the Go button. Thus the user - can hit enter on any guided search field or the main box and the app will - act like you are hitting the go button. - - Args: - *all_n_clicks (ints): Integers representing the number of times each - guided search field or main search bar or Go button was - clicked/entered. - - Returns: - n_times_searched (int): The total number of times a search was executed. - If this is voided correctly in another callback, it will be either - 0 or 1. - """ - return sl.sum_all_fields_and_buttons_n_submits(*all_n_clicks) +def update_query_display(unibox_n_submit, unibox_input, current_query): + print("triggered in app.py") + return sl.update_query_display(unibox_input, unibox_n_submit, current_query) + + +# @app.callback( +# Output("search-current-query-hidden", "value"), +# [Input("")] +# ) + + +# @app.callback( +# Output("search-example-button", "n_clicks"), +# get_search_field_callback_args(as_type="input"), +# ) +# def void_example_search_n_clicks_on_live_search(*ent_txts): +# """ +# Reset the number of example search button clicks when any search is changed +# via the guided search fields. +# +# Args: +# *ent_txts: The entity texts, though it does not matter what they +# actually are. +# Returns: +# (int): The number of clicks to set the example search button n_clicks +# to. +# """ +# return 0 + + +# @app.callback( +# Output("search-go-button", "n_clicks"), +# [Input("search-main-bar-input", "n_submit")] +# + get_search_field_callback_args( +# as_type="input", return_component="n_submit" +# ), +# [State("search-go-button", "n_clicks")], +# ) +# def sum_all_fields_and_buttons_n_submits(*all_n_clicks): +# """ +# Sum the guided search fields and main search field and "Go" button n_submits +# and n_clicks to a single n_clicks number for the Go button. Thus the user +# can hit enter on any guided search field or the main box and the app will +# act like you are hitting the go button. +# +# Args: +# *all_n_clicks (ints): Integers representing the number of times each +# guided search field or main search bar or Go button was +# clicked/entered. +# +# Returns: +# n_times_searched (int): The total number of times a search was executed. +# If this is voided correctly in another callback, it will be either +# 0 or 1. +# """ +# return sl.sum_all_fields_and_buttons_n_submits(*all_n_clicks) @app.callback( @@ -242,18 +259,18 @@ def memoize_wrapper(dropdown_value, search_text): # Rotates example searches through the search bar # See example_searches.js and clientside.js for more details -app.clientside_callback( - ClientsideFunction( - namespace="clientside", - function_name="cycleExampleSearchesClientsideFunction", - ), - Output("search-main-bar-input", "children"), - [ - Input("core-url", "pathname"), - Input("search-main-bar-input", "id"), - Input("search-examples-hidden-ref-cs", "id"), - ], -) +# app.clientside_callback( +# ClientsideFunction( +# namespace="clientside", +# function_name="cycleExampleSearchesClientsideFunction", +# ), +# Output("search-main-bar-input", "children"), +# [ +# Input("core-url", "pathname"), +# Input("search-main-bar-input", "id"), +# Input("search-examples-hidden-ref-cs", "id"), +# ], +# ) ################################################################################ diff --git a/matscholar_web/common.py b/matscholar_web/common.py index 576577f..c51e30b 100644 --- a/matscholar_web/common.py +++ b/matscholar_web/common.py @@ -156,6 +156,17 @@ def common_404_html(): return html.Div("404", className="has-text-centered") +def empty_div_html(): + """ + Return an empty div with no id. + + Returns: + (dash_html_components.Div): The empty div. + + """ + return html.Div("") + + def common_stat_style(): """ The common style for info statistics. diff --git a/matscholar_web/search/logic.py b/matscholar_web/search/logic.py index e2b33e7..1500652 100644 --- a/matscholar_web/search/logic.py +++ b/matscholar_web/search/logic.py @@ -2,7 +2,7 @@ import re from matscholar.rest import MatScholarRestError -from matscholar_web.common import common_rester_error_html +from matscholar_web.common import common_rester_error_html, empty_div_html from matscholar_web.constants import example_searches, valid_search_filters from matscholar_web.search.common import cobalt_warning_html from matscholar_web.search.subviews.abstracts import abstracts_results_html @@ -16,6 +16,7 @@ from matscholar_web.search.view import ( malformed_query_warning_html, no_query_warning_html, + query_display_html ) @@ -73,6 +74,15 @@ def show_search_results(go_button_n_clicks, dropdown_value, search_text): return common_rester_error_html(rester_error) +def update_query_display(unibox_input, unibox_n_submit, current_query): + print("triggered in logic") + + if unibox_n_submit in [None, 0]: + return empty_div_html() + else: + return query_display_html("nothing...") + + def sum_all_fields_and_buttons_n_submits(*all_n_clicks): """ Sum the guided search fields and main search field and "Go" button n_submits diff --git a/matscholar_web/search/view.py b/matscholar_web/search/view.py index 168a2b5..c36f313 100644 --- a/matscholar_web/search/view.py +++ b/matscholar_web/search/view.py @@ -1,4 +1,5 @@ import os +import copy import dash_core_components as dcc import dash_html_components as html @@ -18,6 +19,7 @@ example_searches, search_filter_color_map, valid_search_filters, +entity_color_map ) @@ -154,7 +156,7 @@ def search_bar_and_buttons_html(): endpoint_multi = elastic_host + "/" + esdb_name_query + "/_search?search_type=dfs_query_then_fetch" search_bar = ESAutosuggest( - id='input', + id='search-input-unibox', value='', endpoint=endpoint_multi, fields=["original", "normalized"], @@ -163,7 +165,7 @@ def search_bar_and_buttons_html(): sectionMap=index_name_map, numSuggestions=20, sort=["_score"], - placeholder='', + placeholder="", suggestions=[], authUser=elastic_user, authPass=elastic_pass, @@ -172,24 +174,28 @@ def search_bar_and_buttons_html(): spellCheck=False ) - sized = "is-size-7" - tooltip_spans = [html.Span("Keywords: ", className=sized)] - for k in valid_search_filters: - color = search_filter_color_map[k] - tooltip_span = html.Span( - k, className=f"msweb-is-{color}-txt {sized} has-text-weight-bold" - ) - tooltip_spans.append(tooltip_span) - tooltip_spans.append(html.Span(", ")) - - tooltip_spans.pop(-1) + current_query_hidden = html.Div(id="search-current-query-hidden", children="blahblah", className="is-hidden") + + # sized = "is-size-7" + # tooltip_spans = [html.Span("Keywords: ", className=sized)] + # for k in valid_search_filters: + # color = search_filter_color_map[k] + # tooltip_span = html.Span( + # k, className=f"msweb-is-{color}-txt {sized} has-text-weight-bold" + # ) + # tooltip_spans.append(tooltip_span) + # tooltip_spans.append(html.Span(", ")) + # + # tooltip_spans.pop(-1) + + # search_bar_tooltip = html.Div( + # tooltip_spans, className=f"tooltip-text has-margin-0" + # ) - search_bar_tooltip = html.Div( - tooltip_spans, className=f"tooltip-text has-margin-0" - ) + query_display = html.Div(id="search-query-display", children="") search_bar_html = html.Div( - [label_container, search_bar, search_bar_tooltip], - className="flex-column is-narrow tooltip", + [label_container, search_bar, query_display, current_query_hidden], + className="flex-column is-narrow", ) go_button = html.Button( @@ -256,6 +262,27 @@ def hidden_ref_example_searches_html(): return examples_hidden_ref +def query_display_html(entity_query): + print("generating query display") + entity_colormap_key = copy.deepcopy(entity_color_map) + entities_keys = [] + for e, color in entity_colormap_key.items(): + # don't need the "other" label + if e == "other": + continue + entity_key = html.Div( + e, className=f"is-size-4 msweb-is-{color}-txt has-text-weight-bold" + ) + entity_key_container = html.Div( + entity_key, className="flex-column is-narrow has-margin-5 box" + ) + entities_keys.append(entity_key_container) + + entity_key_container = html.Div( + entities_keys, className="columns is-multiline has-margin-5" + ) + return entity_key_container + # def guided_search_boxes_html(): # """ # Get the html block for hidden guided search fields.