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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -14
app.py CHANGED
@@ -239,33 +239,49 @@ if fetch_data:
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)
268
-
269
 
270
  # Calculate Top 10 Subjects
271
  if 'subject' in metadata_df.columns:
 
239
  completeness_df = pd.DataFrame({"Field": completeness.index, "Completeness (%)": completeness.values})
240
  completeness_table = completeness_df.set_index("Field")
241
 
242
+ # Prepare Quick Stats
243
+ quick_stats_df_reset = quick_stats_df.reset_index(drop=True)
244
 
245
+ # Apply background gradient to values
246
  styled_stats = (
247
  quick_stats_df_reset.style
248
+ .background_gradient(cmap="Reds", subset=["Value"]) # πŸ”₯ red theme
249
  .format({"Value": "{:.1f}"})
250
  .set_properties(**{
251
  "text-align": "center",
252
+ "color": "lightgray",
253
+ "font-size": "1rem",
254
+ "font-weight": "bold",
255
+ "border-color": "#2b2b2b",
256
  })
257
  )
258
 
259
+ # Custom CSS Card Wrapper
260
+ st.sidebar.markdown("""
261
+ <div style='
262
+ background-color: #2e2e2e;
263
+ padding: 1.5rem;
264
+ border-radius: 12px;
265
+ margin-bottom: 1.5rem;
266
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
267
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
268
+ '
269
+ onmouseover="this.style.transform='scale(1.02)'; this.style.boxShadow='0 12px 24px rgba(0,0,0,0.4)';"
270
+ onmouseout="this.style.transform='scale(1)'; this.style.boxShadow='0 8px 16px rgba(0,0,0,0.3)';"
271
+ >
272
+ <h4 style='color: #ff7f7f; margin-bottom: 1rem;'>πŸ“Š Quick Stats</h4>
273
+ """, unsafe_allow_html=True)
274
+
275
+ # Render styled table inside the "card"
276
  st.sidebar.dataframe(
277
  styled_stats,
278
  use_container_width=True,
279
+ height=250,
280
+ hide_index=True
281
  )
282
+
283
+ # Close the div
284
+ st.sidebar.markdown("</div>", unsafe_allow_html=True)
 
 
285
 
286
  # Calculate Top 10 Subjects
287
  if 'subject' in metadata_df.columns: