CCockrum commited on
Commit
c0c4a21
Β·
verified Β·
1 Parent(s): 79d8dc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -208,12 +208,24 @@ if fetch_data:
208
 
209
  metadata_df = pd.DataFrame(items)
210
 
211
- # Show summary statistics in sidebar
212
- # βœ… Quick Stats (after metadata_df is created and populated)
 
 
 
 
 
 
 
213
  if not metadata_df.empty:
214
- stats_placeholder.markdown("<h3 class='sidebar-stats'>πŸ“Š Quick Stats</h3>", unsafe_allow_html=True)
215
- stats_placeholder.markdown(f"<p style='color:lightgray;'>Total Records: <b>{len(metadata_df)}</b></p>", unsafe_allow_html=True)
216
- stats_placeholder.markdown(f"<p style='color:lightgray;'>Incomplete Records: <b>{len(metadata_df[metadata_df.isnull().any(axis=1)])}</b></p>", unsafe_allow_html=True)
 
 
 
 
 
217
 
218
 
219
  st.sidebar.write(f"Incomplete Records: {len(metadata_df[metadata_df.isnull().any(axis=1)])}")
 
208
 
209
  metadata_df = pd.DataFrame(items)
210
 
211
+ # Define custom completeness check
212
+ def is_incomplete(value):
213
+ return pd.isna(value) or value in ["", "N/A", "null", None]
214
+
215
+ # Create mask for incomplete rows
216
+ incomplete_mask = metadata_df.applymap(is_incomplete).any(axis=1)
217
+ incomplete_count = incomplete_mask.sum()
218
+
219
+ # βœ… Fill in the Quick Stats placeholder
220
  if not metadata_df.empty:
221
+ stats_html = f"""
222
+ <div class="sidebar-stats">
223
+ <h3 style="color: lightgray;">πŸ“Š Quick Stats</h3>
224
+ <p style="color:lightgray;">Total Records: <b>{len(metadata_df)}</b></p>
225
+ <p style="color:lightgray;">Incomplete Records: <b>{incomplete_count}</b></p>
226
+ </div>
227
+ """
228
+ stats_placeholder.markdown(stats_html, unsafe_allow_html=True)
229
 
230
 
231
  st.sidebar.write(f"Incomplete Records: {len(metadata_df[metadata_df.isnull().any(axis=1)])}")