Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,38 +15,48 @@ st.set_page_config(
|
|
| 15 |
st.title("π Catalog Data Dashboard")
|
| 16 |
st.markdown(
|
| 17 |
"""
|
| 18 |
-
This dashboard combines live Google Sheets data for:
|
| 19 |
- catalog onboarding
|
| 20 |
-
- metadata completeness
|
| 21 |
-
- mapping/scraping status
|
| 22 |
"""
|
| 23 |
)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
cat_onboarding_df, cat_metadata_df, cat_status_df = get_data()
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# =========================================================================================================================
|
| 30 |
# Tab 0 - Overview
|
| 31 |
# =========================================================================================================================
|
| 32 |
|
| 33 |
-
with tab0:
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
# =========================================================================================================================
|
| 52 |
# Tab 0 - Static stuff
|
|
@@ -338,69 +348,69 @@ with tab3:
|
|
| 338 |
|
| 339 |
st.plotly_chart(fig_field_coverage, use_container_width=True)
|
| 340 |
|
| 341 |
-
# heatmap 1
|
| 342 |
-
|
| 343 |
-
z = cat_df_numeric[meta_cols].astype(float).to_numpy()
|
| 344 |
-
x = list(meta_cols)
|
| 345 |
-
y = list(cat_df_numeric["Catalog name"].astype(str))
|
| 346 |
-
|
| 347 |
-
# Build the heatmap (no annotation_text)
|
| 348 |
-
fig_heatmap = ff.create_annotated_heatmap(
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
)
|
| 360 |
-
|
| 361 |
-
# Layout adjustments
|
| 362 |
-
fig_heatmap.update_layout(
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
)
|
| 370 |
-
|
| 371 |
-
# Tweak label angles for readability
|
| 372 |
-
fig_heatmap.update_xaxes(tickangle=-45)
|
| 373 |
-
fig_heatmap.update_yaxes(automargin=True)
|
| 374 |
-
|
| 375 |
-
st.plotly_chart(fig_heatmap, use_container_width=True)
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
# heatmap 2
|
| 379 |
-
|
| 380 |
-
fig_heatmap1 = px.imshow(
|
| 381 |
-
cat_df_numeric[meta_cols],
|
| 382 |
-
labels=dict(x="Metadata Field", y="Catalog Name", color="Completeness"),
|
| 383 |
-
x=meta_cols,
|
| 384 |
-
y=cat_df_numeric["Catalog name"],
|
| 385 |
-
color_continuous_scale=[
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
],
|
| 390 |
-
)
|
| 391 |
-
|
| 392 |
-
fig_heatmap1.update_layout(
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
)
|
| 398 |
-
fig_heatmap1.update_xaxes(tickangle=-45)
|
| 399 |
-
|
| 400 |
-
st.plotly_chart(fig_heatmap1, use_container_width=True)
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
with tab4:
|
| 405 |
-
|
| 406 |
|
|
|
|
| 15 |
st.title("π Catalog Data Dashboard")
|
| 16 |
st.markdown(
|
| 17 |
"""
|
| 18 |
+
This dashboard combines Static Data with live Google Sheets data for:
|
| 19 |
- catalog onboarding
|
| 20 |
+
- metadata completeness
|
|
|
|
| 21 |
"""
|
| 22 |
)
|
| 23 |
|
| 24 |
+
if st.button("π Refresh Data"):
|
| 25 |
+
st.cache_data.clear()
|
| 26 |
+
st.toast("Refreshing data...", icon="π")
|
| 27 |
+
st.rerun()
|
| 28 |
+
|
| 29 |
cat_onboarding_df, cat_metadata_df, cat_status_df = get_data()
|
| 30 |
|
| 31 |
+
tab1, tab2, tab3 = st.tabs([
|
| 32 |
+
# "Overview",
|
| 33 |
+
"Static Data",
|
| 34 |
+
"Onboarding Status",
|
| 35 |
+
"Metadata Completeness",
|
| 36 |
+
# "Mapping Status"
|
| 37 |
+
])
|
| 38 |
|
| 39 |
# =========================================================================================================================
|
| 40 |
# Tab 0 - Overview
|
| 41 |
# =========================================================================================================================
|
| 42 |
|
| 43 |
+
# with tab0:
|
| 44 |
+
# st.header("Overiew")
|
| 45 |
+
# if st.button("π Refresh Data"):
|
| 46 |
+
# st.cache_data.clear()
|
| 47 |
+
# st.toast("Refreshing data...", icon="π")
|
| 48 |
+
# st.rerun()
|
| 49 |
|
| 50 |
+
# st.markdown("---")
|
| 51 |
+
# st.subheader("Quick Data Preview")
|
| 52 |
|
| 53 |
+
# col1, col2, col3 = st.columns(3)
|
| 54 |
+
# with col1:
|
| 55 |
+
# st.dataframe(cat_onboarding_df.head(5))
|
| 56 |
+
# with col2:
|
| 57 |
+
# st.dataframe(cat_metadata_df.head(5))
|
| 58 |
+
# with col3:
|
| 59 |
+
# st.dataframe(cat_status_df.head(5))
|
| 60 |
|
| 61 |
# =========================================================================================================================
|
| 62 |
# Tab 0 - Static stuff
|
|
|
|
| 348 |
|
| 349 |
st.plotly_chart(fig_field_coverage, use_container_width=True)
|
| 350 |
|
| 351 |
+
# # heatmap 1
|
| 352 |
+
# # Prepare data
|
| 353 |
+
# z = cat_df_numeric[meta_cols].astype(float).to_numpy()
|
| 354 |
+
# x = list(meta_cols)
|
| 355 |
+
# y = list(cat_df_numeric["Catalog name"].astype(str))
|
| 356 |
+
|
| 357 |
+
# # Build the heatmap (no annotation_text)
|
| 358 |
+
# fig_heatmap = ff.create_annotated_heatmap(
|
| 359 |
+
# z=z,
|
| 360 |
+
# x=x,
|
| 361 |
+
# y=y,
|
| 362 |
+
# showscale=True,
|
| 363 |
+
# colorscale=[
|
| 364 |
+
# [0.0, "rgb(255,77,77)"], # red for 0 (No)
|
| 365 |
+
# [0.5, "rgb(255,204,0)"], # yellow for 0.5 (Some)
|
| 366 |
+
# [1.0, "rgb(0,204,102)"] # green for 1 (Yes)
|
| 367 |
+
# ],
|
| 368 |
+
# annotation_text=None # removes numbers
|
| 369 |
+
# )
|
| 370 |
+
|
| 371 |
+
# # Layout adjustments
|
| 372 |
+
# fig_heatmap.update_layout(
|
| 373 |
+
# title="Metadata Completeness Heatmap (Catalog vs Field)",
|
| 374 |
+
# xaxis_title="Metadata Field",
|
| 375 |
+
# yaxis_title="Catalog Name",
|
| 376 |
+
# width=1600, # make it wide
|
| 377 |
+
# height=1000, # make it tall so names fit
|
| 378 |
+
# margin=dict(l=200, r=50, t=80, b=150), # spacing for labels
|
| 379 |
+
# )
|
| 380 |
+
|
| 381 |
+
# # Tweak label angles for readability
|
| 382 |
+
# fig_heatmap.update_xaxes(tickangle=-45)
|
| 383 |
+
# fig_heatmap.update_yaxes(automargin=True)
|
| 384 |
+
|
| 385 |
+
# st.plotly_chart(fig_heatmap, use_container_width=True)
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
# # heatmap 2
|
| 389 |
+
|
| 390 |
+
# fig_heatmap1 = px.imshow(
|
| 391 |
+
# cat_df_numeric[meta_cols],
|
| 392 |
+
# labels=dict(x="Metadata Field", y="Catalog Name", color="Completeness"),
|
| 393 |
+
# x=meta_cols,
|
| 394 |
+
# y=cat_df_numeric["Catalog name"],
|
| 395 |
+
# color_continuous_scale=[
|
| 396 |
+
# [0.0, "rgb(255,77,77)"],
|
| 397 |
+
# [0.5, "rgb(255,204,0)"],
|
| 398 |
+
# [1.0, "rgb(0,204,102)"]
|
| 399 |
+
# ],
|
| 400 |
+
# )
|
| 401 |
+
|
| 402 |
+
# fig_heatmap1.update_layout(
|
| 403 |
+
# title="Metadata Completeness Heatmap (Catalog vs Field)",
|
| 404 |
+
# width=1600,
|
| 405 |
+
# height=1000,
|
| 406 |
+
# margin=dict(l=200, r=50, t=80, b=150),
|
| 407 |
+
# )
|
| 408 |
+
# fig_heatmap1.update_xaxes(tickangle=-45)
|
| 409 |
+
|
| 410 |
+
# st.plotly_chart(fig_heatmap1, use_container_width=True)
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
# with tab4:
|
| 415 |
+
# st.header("Catalog Mapping status")
|
| 416 |
|