Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -239,12 +239,13 @@ 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
|
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 |
st.sidebar.markdown("""
|
249 |
<div style='
|
250 |
background-color: #2b2b2b;
|
@@ -253,11 +254,26 @@ if fetch_data:
|
|
253 |
margin-bottom: 1.5rem;
|
254 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
255 |
'>
|
256 |
-
<h4 style='color: #FFA500; margin-bottom: 1rem;'
|
257 |
</div>
|
258 |
""", unsafe_allow_html=True)
|
259 |
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
st.sidebar.table(styled_stats)
|
262 |
|
263 |
|
|
|
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;
|
|
|
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)
|
278 |
|
279 |
|