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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -34
app.py CHANGED
@@ -239,49 +239,30 @@ 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 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:
 
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; margin-bottom: 1rem;'>πŸ“Š Quick Stats</h4>
258
+ </div>
 
 
 
259
  """, unsafe_allow_html=True)
260
 
261
+ quick_stats_df_reset = quick_stats_df.reset_index(drop=True)
 
 
 
 
 
 
262
 
263
+ styled_stats = quick_stats_df_reset.style.background_gradient(cmap="Oranges", subset=["Value"]).format({"Value": "{:.1f}"})
264
+ st.sidebar.table(styled_stats)
265
+
266
 
267
  # Calculate Top 10 Subjects
268
  if 'subject' in metadata_df.columns: