gvlktejaswi commited on
Commit
93282af
·
verified ·
1 Parent(s): 80f0ebf

Update page_files/Categorized_Search.py

Browse files
Files changed (1) hide show
  1. page_files/Categorized_Search.py +14 -2
page_files/Categorized_Search.py CHANGED
@@ -1139,7 +1139,7 @@ with right_col:
1139
  # st.session_state._scroll_to_results = True
1140
  properties_df = (
1141
  material_df[material_df["section"] == section_choice][
1142
- ["property_name", "section"]
1143
  ]
1144
  .drop_duplicates()
1145
  .reset_index(drop=True)
@@ -1155,14 +1155,19 @@ with right_col:
1155
  key="inspect_properties_table",
1156
  column_config={
1157
  "property_name": st.column_config.TextColumn("PROPERTY NAME"),
 
 
 
1158
  "section": st.column_config.TextColumn("SECTION"),
1159
  },
1160
  )
1161
 
1162
  selected_indices = property_event.selection.rows if property_event and property_event.selection else []
1163
 
 
1164
  if selected_indices:
1165
- property_choice = properties_df.iloc[selected_indices[0]]["property_name"]
 
1166
  st.session_state.inspect_property = property_choice
1167
  elif st.session_state.inspect_property in properties_df["property_name"].tolist():
1168
  property_choice = st.session_state.inspect_property
@@ -1178,6 +1183,13 @@ with right_col:
1178
  & (all_data["property_name"] == property_choice)
1179
  & (all_data["value"].notna())
1180
  ]
 
 
 
 
 
 
 
1181
 
1182
  if result.empty:
1183
  st.warning("No data found for this material-property combination")
 
1139
  # st.session_state._scroll_to_results = True
1140
  properties_df = (
1141
  material_df[material_df["section"] == section_choice][
1142
+ ["property_name", "value", "unit", "test_condition", "section"]
1143
  ]
1144
  .drop_duplicates()
1145
  .reset_index(drop=True)
 
1155
  key="inspect_properties_table",
1156
  column_config={
1157
  "property_name": st.column_config.TextColumn("PROPERTY NAME"),
1158
+ "value": st.column_config.TextColumn("VALUE"),
1159
+ "unit": st.column_config.TextColumn("UNIT"),
1160
+ "test_condition": st.column_config.TextColumn("TEST CONDITION"),
1161
  "section": st.column_config.TextColumn("SECTION"),
1162
  },
1163
  )
1164
 
1165
  selected_indices = property_event.selection.rows if property_event and property_event.selection else []
1166
 
1167
+ selected_prop_row = None
1168
  if selected_indices:
1169
+ selected_prop_row = properties_df.iloc[selected_indices[0]]
1170
+ property_choice = selected_prop_row["property_name"]
1171
  st.session_state.inspect_property = property_choice
1172
  elif st.session_state.inspect_property in properties_df["property_name"].tolist():
1173
  property_choice = st.session_state.inspect_property
 
1183
  & (all_data["property_name"] == property_choice)
1184
  & (all_data["value"].notna())
1185
  ]
1186
+ # if a specific experiment row was picked, narrow to it
1187
+ # (value + test_condition) so the exact measurement shows
1188
+ if selected_prop_row is not None:
1189
+ result = result[
1190
+ (result["value"].astype(str) == str(selected_prop_row["value"]))
1191
+ & (result["test_condition"].astype(str) == str(selected_prop_row["test_condition"]))
1192
+ ]
1193
 
1194
  if result.empty:
1195
  st.warning("No data found for this material-property combination")