nataliaElv commited on
Commit
cc871a7
β€’
1 Parent(s): b1dec7c

Links to label searches

Browse files
Files changed (1) hide show
  1. app.py +32 -12
app.py CHANGED
@@ -37,9 +37,13 @@ st.title(f"GitHub Issues Dashboard for {repo.name}")
37
 
38
  fetching_data = st.empty()
39
 
40
- df = pd.read_json("issues.json")
 
 
 
 
41
 
42
- status = st.status("Loading data...", status="running")
43
 
44
  # Section 1: Issue activity metrics
45
  st.header("Issue activity metrics")
@@ -67,24 +71,41 @@ st.header("Issue classification")
67
  ## Dataframe: Number of open issues by label.
68
  st.subheader("Top ten labels by number of open issues:")
69
  open_issues_exploded = open_issues.explode("Labels")
70
- label_counts = open_issues_exploded.value_counts("Labels")
71
- st.dataframe(label_counts.head(10))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  # ## Dataframe: Number of open bugs by severity level. Critical, major, minor
 
74
  # ## Cloud of words: Issue titles and description
75
 
76
  # # Community engagement
77
  st.header("Community engagement")
78
  # ## Dataframe: Latest issues open by the community
79
  # ## Dataframe: issues sorted by number of comments
80
- engagement_df = df[["Number","Title","Reactions","Comments","URL"]].sort_values(by=["Reactions", "Comments"], ascending=False).head(10)
81
  st.dataframe(
82
  engagement_df,
83
  hide_index=True,
84
  use_container_width=True,
85
  column_config={
86
  "Number": st.column_config.NumberColumn("No."),
87
- "Title": st.column_config.TextColumn("Title"),
88
  "Reactions": st.column_config.NumberColumn("Reactions", format="%d πŸ‘"),
89
  "Comments": st.column_config.NumberColumn("Comments", format="%d πŸ’¬"),
90
  "URL": st.column_config.LinkColumn("πŸ”—", display_text="πŸ”—")
@@ -92,17 +113,16 @@ st.dataframe(
92
  )
93
 
94
  # ## Cloud of words: Comments??
95
- # ## Dataframe: issues sorted by number of reactions.
96
  # ## Dataframe: Contributor leaderboard.
97
 
98
  # # Issue dependencies
99
  # st.header("Issue dependencies")
100
  # ## Map: dependencies between issues. Network of issue mentions.x
101
 
102
- status.update(label="Checking for updated data...", status="running")
103
  updated_data = fetch_data()
104
- if not df.equals(updated_data):
105
- save_data(updated_data)
106
- status.update(label="Refresh for updated data!", status="complete")
107
  else:
108
- status.update(label="Data is up to date!", status="complete")
 
 
37
 
38
  fetching_data = st.empty()
39
 
40
+ try:
41
+ df = pd.read_json("issues.json")
42
+ except:
43
+ df = fetch_data()
44
+ save_data(df)
45
 
46
+ status = st.status(label="Loading data...", state="running")
47
 
48
  # Section 1: Issue activity metrics
49
  st.header("Issue activity metrics")
 
71
  ## Dataframe: Number of open issues by label.
72
  st.subheader("Top ten labels by number of open issues:")
73
  open_issues_exploded = open_issues.explode("Labels")
74
+ label_counts = open_issues_exploded.value_counts("Labels").to_frame()
75
+
76
+ def generate_labels_link(labels):
77
+ links = []
78
+ for label in labels:
79
+ label = label.replace(" ", "+")
80
+ links.append(f"https://github.com/argilla-io/argilla/issues?q=is:open+is:issue+label:%22{label}%22")
81
+ return links
82
+
83
+ label_counts['Link'] = generate_labels_link(label_counts.index)
84
+
85
+ st.dataframe(
86
+ label_counts.head(10),
87
+ column_config={
88
+ "count": st.column_config.NumberColumn("Count"),
89
+ "Link": st.column_config.LinkColumn("Link", display_text="πŸ”—")
90
+ }
91
+ )
92
 
93
  # ## Dataframe: Number of open bugs by severity level. Critical, major, minor
94
+
95
  # ## Cloud of words: Issue titles and description
96
 
97
  # # Community engagement
98
  st.header("Community engagement")
99
  # ## Dataframe: Latest issues open by the community
100
  # ## Dataframe: issues sorted by number of comments
101
+ engagement_df = open_issues[["Number","Title","Reactions","Comments","URL"]].sort_values(by=["Reactions", "Comments"], ascending=False).head(10)
102
  st.dataframe(
103
  engagement_df,
104
  hide_index=True,
105
  use_container_width=True,
106
  column_config={
107
  "Number": st.column_config.NumberColumn("No."),
108
+ "Title": st.column_config.TextColumn("Title", width=400),
109
  "Reactions": st.column_config.NumberColumn("Reactions", format="%d πŸ‘"),
110
  "Comments": st.column_config.NumberColumn("Comments", format="%d πŸ’¬"),
111
  "URL": st.column_config.LinkColumn("πŸ”—", display_text="πŸ”—")
 
113
  )
114
 
115
  # ## Cloud of words: Comments??
 
116
  # ## Dataframe: Contributor leaderboard.
117
 
118
  # # Issue dependencies
119
  # st.header("Issue dependencies")
120
  # ## Map: dependencies between issues. Network of issue mentions.x
121
 
122
+ status.update(label="Checking for updated data...", state="running")
123
  updated_data = fetch_data()
124
+ if df.equals(updated_data):
125
+ status.update(label="Data is up to date!", state="complete")
 
126
  else:
127
+ save_data(updated_data)
128
+ status.update(label="Refresh for updated data!", state="complete")