Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -223,21 +223,25 @@ if fetch_data:
|
|
223 |
return pd.isna(value) or value in ["", "N/A", "null", None]
|
224 |
|
225 |
if not metadata_df.empty:
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
# Field-by-field completeness
|
236 |
-
completeness = metadata_df.map(lambda x: not is_incomplete(x)).mean() * 100
|
237 |
-
completeness_table = completeness.round(1).to_frame(name="Completeness (%)")
|
238 |
-
|
239 |
-
# Render stats summary in sidebar
|
240 |
stats_placeholder.markdown(stats_html, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
# Render collapsible green completeness table in sidebar
|
243 |
with st.sidebar.expander("π Field Completeness Breakdown", expanded=True):
|
|
|
223 |
return pd.isna(value) or value in ["", "N/A", "null", None]
|
224 |
|
225 |
if not metadata_df.empty:
|
226 |
+
...
|
227 |
+
stats_html = f"""
|
228 |
+
<div class="sidebar-stats">
|
229 |
+
<h3 style="color: lightgray;">π Quick Stats</h3>
|
230 |
+
<p style="color:lightgray;">Total Records: <b>{len(metadata_df)}</b></p>
|
231 |
+
<p style="color:lightgray;">Incomplete Records: <b>{incomplete_count}</b></p>
|
232 |
+
<p style="color:lightgray;">Overall Metadata Completeness: <b>{overall_percent:.1f}%</b></p>
|
233 |
+
</div>
|
234 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
235 |
stats_placeholder.markdown(stats_html, unsafe_allow_html=True)
|
236 |
+
|
237 |
+
# β
Then show this right after
|
238 |
+
with st.sidebar.expander("π Field Completeness Breakdown", expanded=True):
|
239 |
+
st.dataframe(
|
240 |
+
completeness_table.style.background_gradient(cmap="Greens").format("{:.1f}%"),
|
241 |
+
use_container_width=True,
|
242 |
+
height=240
|
243 |
+
)
|
244 |
+
|
245 |
|
246 |
# Render collapsible green completeness table in sidebar
|
247 |
with st.sidebar.expander("π Field Completeness Breakdown", expanded=True):
|