nataliaElv commited on
Commit
b410ebc
β€’
1 Parent(s): b7f42ff

Bugs table

Browse files
Files changed (1) hide show
  1. app.py +56 -30
app.py CHANGED
@@ -16,8 +16,7 @@ def fetch_data():
16
  for issue in issues:
17
  issues_data.append(
18
  {
19
- 'Number': issue.number,
20
- 'Title': issue.title,
21
  'State': issue.state,
22
  'Created at': issue.created_at,
23
  'Closed at': issue.closed_at,
@@ -34,8 +33,7 @@ def save_data(df):
34
 
35
 
36
  st.title(f"GitHub Issues Dashboard for {repo.name}")
37
-
38
- fetching_data = st.empty()
39
 
40
  try:
41
  df = pd.read_json("issues.json")
@@ -43,8 +41,6 @@ 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")
50
 
@@ -65,47 +61,77 @@ with col2:
65
  # # TODO Dataframe: Unresolved conversations
66
  # ## Issues with new comments. Sorted by number of new comments (based on timeframe above) and/or date of last comment.
67
 
68
- # Section 2: Issue classification
69
- st.header("Issue classification")
70
-
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="πŸ”—")
 
16
  for issue in issues:
17
  issues_data.append(
18
  {
19
+ 'Issue': f"{issue.number} - {issue.title}",
 
20
  'State': issue.state,
21
  'Created at': issue.created_at,
22
  'Closed at': issue.closed_at,
 
33
 
34
 
35
  st.title(f"GitHub Issues Dashboard for {repo.name}")
36
+ status = st.status(label="Loading data...", state="running")
 
37
 
38
  try:
39
  df = pd.read_json("issues.json")
 
41
  df = fetch_data()
42
  save_data(df)
43
 
 
 
44
  # Section 1: Issue activity metrics
45
  st.header("Issue activity metrics")
46
 
 
61
  # # TODO Dataframe: Unresolved conversations
62
  # ## Issues with new comments. Sorted by number of new comments (based on timeframe above) and/or date of last comment.
63
 
64
+ st.subheader("Latest bugs 🐞")
65
+ bug_issues = open_issues[open_issues["Labels"].apply(lambda labels: "type: bug" in labels)]
66
+ bug_issues = bug_issues[["Issue","Labels","Created at","URL"]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  st.dataframe(
68
+ bug_issues.sort_values(by="Created at", ascending=False),
69
+ hide_index=True,
70
  column_config={
71
+ "Issue": st.column_config.TextColumn("Issue", width=400),
72
+ "Labels": st.column_config.TextColumn("Labels"),
73
+ "Created at": st.column_config.DatetimeColumn("Created at"),
74
+ "URL": st.column_config.LinkColumn("πŸ”—", display_text="πŸ”—")
75
  }
76
  )
77
 
78
+ # Section 2: Issue classification
79
+ st.header("Issue classification")
80
+ col1, col2 = st.columns(2)
81
 
82
+ ## Dataframe: Number of open issues by label.
83
+ with col1:
84
+ st.subheader("Top ten labels πŸ”–")
85
+ open_issues_exploded = open_issues.explode("Labels")
86
+ label_counts = open_issues_exploded.value_counts("Labels").to_frame()
87
+
88
+ def generate_labels_link(labels):
89
+ links = []
90
+ for label in labels:
91
+ label = label.replace(" ", "+")
92
+ links.append(f"https://github.com/argilla-io/argilla/issues?q=is:open+is:issue+label:%22{label}%22")
93
+ return links
94
+
95
+ def generate_label_categories(labels):
96
+ categories = []
97
+ sub_categories = []
98
+ for label in labels:
99
+ cats = label.split(": ")
100
+ categories.append(cats[0])
101
+ try:
102
+ sub_categories.append(cats[1])
103
+ except:
104
+ sub_categories.append(None)
105
+ return categories,sub_categories
106
+
107
+ label_counts['Link'] = generate_labels_link(label_counts.index)
108
+ # label_counts['Category'], label_counts['Subcategory'] = generate_label_categories(label_counts.index)
109
+
110
+ st.dataframe(
111
+ label_counts.head(10),
112
+ column_config={
113
+ "Labels": st.column_config.TextColumn("Labels"),
114
+ "count": st.column_config.NumberColumn("Count"),
115
+ "Link": st.column_config.LinkColumn("Link", display_text="πŸ”—")
116
+ }
117
+ )
118
+
119
+ ## Dataframe: Number of open bugs ordered by date
120
+
121
  # ## Cloud of words: Issue titles and description
122
 
123
  # # Community engagement
124
  st.header("Community engagement")
125
  # ## Dataframe: Latest issues open by the community
126
  # ## Dataframe: issues sorted by number of comments
127
+ st.subheader("Top engaging issues πŸ’¬")
128
+ engagement_df = open_issues[["Issue","Reactions","Comments","URL"]].sort_values(by=["Reactions", "Comments"], ascending=False).head(10)
129
  st.dataframe(
130
  engagement_df,
131
  hide_index=True,
132
  use_container_width=True,
133
  column_config={
134
+ "Issue": st.column_config.TextColumn("Issue", width=400),
 
135
  "Reactions": st.column_config.NumberColumn("Reactions", format="%d πŸ‘"),
136
  "Comments": st.column_config.NumberColumn("Comments", format="%d πŸ’¬"),
137
  "URL": st.column_config.LinkColumn("πŸ”—", display_text="πŸ”—")