CCockrum commited on
Commit
dc8ba9e
Β·
verified Β·
1 Parent(s): d469516

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -27
app.py CHANGED
@@ -239,39 +239,29 @@ if fetch_data:
239
  completeness_df = pd.DataFrame({"Field": completeness.index, "Completeness (%)": completeness.values})
240
  completeness_table = completeness_df.set_index("Field")
241
 
242
- # Sidebar Quick Stats (fancy card version)
243
- quick_stats_df = pd.DataFrame({
244
- "Metric": ["Total Records", "Incomplete Records", "Overall Completeness (%)"],
245
- "Value": [len(metadata_df), incomplete_count, round(overall_percent, 1)]
246
- })
247
 
248
- # Card-like background container
249
- st.sidebar.markdown("""
250
- <div style='
251
- background-color: #2b2b2b;
252
- padding: 1.5rem;
253
- border-radius: 12px;
254
- margin-bottom: 1.5rem;
255
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
256
- '>
257
- <h4 style='color: #FFA500; text-align: center; margin-bottom: 1rem;'>Quick Stats</h4>
258
- </div>
259
- """, unsafe_allow_html=True)
260
-
261
- #Reset index to fully remove the index
262
- quick_stats_df_reset = quick_stats_df.reset_index(drop=True)
263
-
264
- #Style: orange gradient + center text inside the cells
265
  styled_stats = (
266
  quick_stats_df_reset.style
267
- .background_gradient(cmap="Reds", subset=["Value"])
268
  .format({"Value": "{:.1f}"})
269
  .set_properties(**{
270
- "text-align": "center", # center the text
271
- "color": "lightgray", # light gray text
272
- "font-size": "0.95rem", # slightly larger text
 
273
  })
274
- )
 
 
 
 
 
 
 
 
 
275
 
276
  # Display using st.table for clean appearance
277
  st.sidebar.table(styled_stats)
 
239
  completeness_df = pd.DataFrame({"Field": completeness.index, "Completeness (%)": completeness.values})
240
  completeness_table = completeness_df.set_index("Field")
241
 
242
+ # Prepare styled quick stats
243
+ quick_stats_df_reset = quick_stats_df.reset_index(drop=True) # πŸ‘ˆ resets and drops the index completely
 
 
 
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  styled_stats = (
246
  quick_stats_df_reset.style
247
+ .background_gradient(cmap="Orangess", subset=["Value"]) # πŸ”₯ your red gradient
248
  .format({"Value": "{:.1f}"})
249
  .set_properties(**{
250
+ "text-align": "center",
251
+ "color": "#1A1A1A",
252
+ "font-size": "0.95rem",
253
+ "font-weight": "bold"
254
  })
255
+ )
256
+
257
+ # Render without showing index
258
+ st.sidebar.dataframe(
259
+ styled_stats,
260
+ use_container_width=True,
261
+ height=240,
262
+ hide_index=True # πŸ‘ˆ this hides any leftover index
263
+ )
264
+
265
 
266
  # Display using st.table for clean appearance
267
  st.sidebar.table(styled_stats)