mbecchis commited on
Commit
9a7d0a6
Β·
verified Β·
1 Parent(s): 93fc514

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +94 -84
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
- tab0, tab1, tab2, tab3, tab4 = st.tabs(["Overview", "Static Data", "Onboarding Status", "Metadata Completeness", "Mapping Status"])
 
 
 
 
 
 
28
 
29
  # =========================================================================================================================
30
  # Tab 0 - Overview
31
  # =========================================================================================================================
32
 
33
- with tab0:
34
- st.header("Overiew")
35
- if st.button("πŸ”„ Refresh Data"):
36
- st.cache_data.clear()
37
- st.toast("Refreshing data...", icon="πŸ”„")
38
- st.rerun()
39
 
40
- st.markdown("---")
41
- st.subheader("Quick Data Preview")
42
 
43
- col1, col2, col3 = st.columns(3)
44
- with col1:
45
- st.dataframe(cat_onboarding_df.head(5))
46
- with col2:
47
- st.dataframe(cat_metadata_df.head(5))
48
- with col3:
49
- st.dataframe(cat_status_df.head(5))
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
- # Prepare data
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
- z=z,
350
- x=x,
351
- y=y,
352
- showscale=True,
353
- colorscale=[
354
- [0.0, "rgb(255,77,77)"], # red for 0 (No)
355
- [0.5, "rgb(255,204,0)"], # yellow for 0.5 (Some)
356
- [1.0, "rgb(0,204,102)"] # green for 1 (Yes)
357
- ],
358
- annotation_text=None # removes numbers
359
- )
360
-
361
- # Layout adjustments
362
- fig_heatmap.update_layout(
363
- title="Metadata Completeness Heatmap (Catalog vs Field)",
364
- xaxis_title="Metadata Field",
365
- yaxis_title="Catalog Name",
366
- width=1600, # make it wide
367
- height=1000, # make it tall so names fit
368
- margin=dict(l=200, r=50, t=80, b=150), # spacing for labels
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
- [0.0, "rgb(255,77,77)"],
387
- [0.5, "rgb(255,204,0)"],
388
- [1.0, "rgb(0,204,102)"]
389
- ],
390
- )
391
-
392
- fig_heatmap1.update_layout(
393
- title="Metadata Completeness Heatmap (Catalog vs Field)",
394
- width=1600,
395
- height=1000,
396
- margin=dict(l=200, r=50, t=80, b=150),
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
- st.header("Catalog Mapping status")
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