Spaces:
Sleeping
Sleeping
mihaeladuta commited on
Commit ·
98dd01b
1
Parent(s): b01cd5a
Added ability to select records based on a search term in the title.
Browse files- src/pages/2_Outputs.py +31 -0
src/pages/2_Outputs.py
CHANGED
|
@@ -26,6 +26,8 @@ dset_to_print.columns = ["count"]
|
|
| 26 |
pd.set_option("display.max_colwidth", None)
|
| 27 |
st.dataframe(dset_to_print)
|
| 28 |
|
|
|
|
|
|
|
| 29 |
st.markdown("Select from the charts below to view the "
|
| 30 |
"distributions for the number of outputs records by ...")
|
| 31 |
|
|
@@ -39,3 +41,32 @@ for column in [cb.COL_PANEL_NAME,
|
|
| 39 |
sort=False)
|
| 40 |
vis.draw_counts_percent_chart(dset_stats,
|
| 41 |
column)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
pd.set_option("display.max_colwidth", None)
|
| 27 |
st.dataframe(dset_to_print)
|
| 28 |
|
| 29 |
+
st.markdown("## All outputs")
|
| 30 |
+
|
| 31 |
st.markdown("Select from the charts below to view the "
|
| 32 |
"distributions for the number of outputs records by ...")
|
| 33 |
|
|
|
|
| 41 |
sort=False)
|
| 42 |
vis.draw_counts_percent_chart(dset_stats,
|
| 43 |
column)
|
| 44 |
+
|
| 45 |
+
st.markdown(f"## Outputs with a specified term in the '{cb.COL_OUTPUT_TITLE}'")
|
| 46 |
+
search_word = st.text_input(f"Enter a term to search the '{cb.COL_OUTPUT_TITLE}'"
|
| 47 |
+
" of the outputs records,"
|
| 48 |
+
" for example software, computation, database, machine learning etc.",
|
| 49 |
+
max_chars=40,
|
| 50 |
+
value="",
|
| 51 |
+
help="Enter a term to search for."
|
| 52 |
+
)
|
| 53 |
+
search_column = cb.COL_OUTPUT_TITLE
|
| 54 |
+
if search_word:
|
| 55 |
+
dset_selected = dset[dset[search_column].str.contains(search_word,
|
| 56 |
+
case=False,
|
| 57 |
+
na=False)]
|
| 58 |
+
st.markdown(f"Number of outputs records with '{search_word}' in '{search_column}': "
|
| 59 |
+
f"{dset_selected.shape[0]}")
|
| 60 |
+
st.markdown("Select from the charts below to view the "
|
| 61 |
+
"distributions for the number of selected outputs records by ...")
|
| 62 |
+
|
| 63 |
+
for column in [cb.COL_PANEL_NAME,
|
| 64 |
+
cb.COL_UOA_NAME,
|
| 65 |
+
cb.COL_OUTPUT_TYPE_NAME,
|
| 66 |
+
cb.COL_OPEN_ACCESS]:
|
| 67 |
+
with st.expander(column):
|
| 68 |
+
dset_stats = proc.calculate_counts(dset_selected,
|
| 69 |
+
column,
|
| 70 |
+
sort=False)
|
| 71 |
+
vis.draw_counts_percent_chart(dset_stats,
|
| 72 |
+
column)
|