Skip to content

Commit 6f4a582

Browse files
committed
Add rudimentary analysis about first-responders to issues.
1 parent 19182b8 commit 6f4a582

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

site/numpy_issues.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import warnings
2525
2626
import numpy as np
2727
import matplotlib.pyplot as plt
28+
import pandas as pd
2829
from myst_nb import glue
2930
3031
glue = functools.partial(glue, display=False)
@@ -111,3 +112,58 @@ ax.set_ylabel(r"$\frac{issues}{day}$", fontsize=20);
111112
% TODO: add distribution of labels
112113

113114
### First responders
115+
116+
```{code-cell} ipython3
117+
---
118+
tags: [hide-input]
119+
---
120+
# Remove issues that are less than a day old for the following analysis
121+
newly_created_day_old = [
122+
iss for iss in newly_created
123+
if np.datetime64(datetime.datetime.now()) - np.datetime64(iss["createdAt"])
124+
> np.timedelta64(1, "D")
125+
]
126+
127+
# TODO: really need pandas here
128+
first_commenters = []
129+
for iss in newly_created_day_old:
130+
for e in iss["timelineItems"]["edges"]:
131+
if e["node"]["__typename"] == "IssueComment":
132+
first_commenters.append(e["node"]["author"]["login"])
133+
break # Only want the first commenter
134+
135+
# TODO: Update IssueComment query to include:
136+
# - whether the commenter is a maintainer
137+
# - datetime of comment
138+
# This will allow analysis of what fraction of issues are addressed by
139+
# maintainers vs. non-maintainer, and the distribution of how long an issue
140+
# usually sits before it's at least commented on
141+
142+
glue("new_issues_at_least_1_day_old", len(newly_created_day_old))
143+
glue(
144+
"num_new_issues_responded",
145+
f"{len(first_commenters)} ({100 * len(first_commenters) / len(newly_created_day_old)}%)"
146+
)
147+
```
148+
149+
Of the {glue:text}`new_issues_at_least_1_day_old` issues that are at least 24
150+
hours old, {glue:text}`num_new_issues_responded` of them have been commented
151+
on.
152+
153+
```{code-cell} ipython3
154+
---
155+
tags: [hide-input]
156+
---
157+
first_commenter_tab = pd.DataFrame(
158+
{
159+
k: v
160+
for k, v in zip(
161+
("Contributor", "# of times commented first"),
162+
np.unique(first_commenters, return_counts=True),
163+
)
164+
}
165+
)
166+
first_commenter_tab.sort_values(
167+
"# of times commented first", ascending=False
168+
).head(10)
169+
```

site/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# For analysis
2+
numpy
23
matplotlib
4+
pandas
35
# For the site
46
sphinx
57
myst-nb

0 commit comments

Comments
 (0)