@@ -25,6 +25,7 @@ import warnings
2525
2626import numpy as np
2727import matplotlib.pyplot as plt
28+ import pandas as pd
2829from myst_nb import glue
2930
3031glue = 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+ ```
0 commit comments