From d595567a146caf95565cc5136c0f7b5a1154353a Mon Sep 17 00:00:00 2001 From: Leah Wasser Date: Wed, 25 Sep 2024 18:35:34 -0600 Subject: [PATCH] feat(plot): add average time open plot --- .../historical-peer-review-stats.ipynb | 110 ++-- metrics/peer-review/review-timing.ipynb | 526 ++++++++++++++++++ myst.yml | 2 + 3 files changed, 583 insertions(+), 55 deletions(-) create mode 100644 metrics/peer-review/review-timing.ipynb diff --git a/metrics/peer-review/historical-peer-review-stats.ipynb b/metrics/peer-review/historical-peer-review-stats.ipynb index 5f9764f..1d15f79 100644 --- a/metrics/peer-review/historical-peer-review-stats.ipynb +++ b/metrics/peer-review/historical-peer-review-stats.ipynb @@ -165,7 +165,7 @@ "expression": "today", "result": { "data": { - "text/plain": "'24 September 2024'" + "text/plain": "'25 September 2024'" }, "metadata": {}, "status": "ok" @@ -284,7 +284,7 @@ " \n", " 0\n", " pyos-accepted\n", - " 18\n", + " 19\n", " \n", " \n", " 1\n", @@ -293,13 +293,13 @@ " \n", " \n", " 2\n", - " under-review\n", + " on hold\n", " 14\n", " \n", " \n", " 3\n", - " on hold\n", - " 14\n", + " under-review\n", + " 13\n", " \n", " \n", " 4\n", @@ -322,10 +322,10 @@ ], "text/plain": [ " status count\n", - "0 pyos-accepted 18\n", + "0 pyos-accepted 19\n", "1 joss-accepted 17\n", - "2 under-review 14\n", - "3 on hold 14\n", + "2 on hold 14\n", + "3 under-review 13\n", "4 seeking editor 2\n", "5 out of scope 2\n", "6 pre-review 1" @@ -398,23 +398,23 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -515,7 +515,7 @@ "expression": "open_count", "result": { "data": { - "text/plain": "17" + "text/plain": "16" }, "metadata": {}, "status": "ok" @@ -570,23 +570,23 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -716,23 +716,23 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -897,7 +897,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 16, "metadata": { "editable": true, "slideshow": { @@ -913,23 +913,23 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Altair doesn't support pandas periods, convert to str\n", + "summary_by_quarter['quarter'] = summary_by_quarter['quarter'].astype(str)\n", + "# Create the Altair chart using object-oriented syntax\n", + "chart = (\n", + " alt.Chart(summary_by_quarter)\n", + " .mark_line(point=alt.MarkConfig(filled=True, size=100), strokeWidth=1)\n", + " .encode(\n", + " x=alt.X('quarter:O', axis=alt.Axis(labelAngle=-45)), # Ordinal quarter on the x-axis\n", + " y=alt.Y('days_open:Q',axis=alt.Axis(format=\"d\", tickMinStep=1) ), # Quantitative days_open on the y-axis\n", + " tooltip=['days_open']\n", + " )\n", + " .properties(title=\"Mean Review Open Duration (days)\", width=\"container\")\n", + " .interactive()\n", + ")\n", + "\n", + "chart" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "remove-input" + ] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "Unnamed: 0 int64\n", + "package_name object\n", + "date_opened datetime64[ns, UTC]\n", + "labels object\n", + "status object\n", + "days_open int64\n", + "dtype: object" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Get a list of reviews submitted to us\n", + "# This potentially doesn't include issues that were deemed out of scope...\n", + "\n", + "open_reviews = reviews[reviews[\"date_closed\"].isna()]\n", + "\n", + "today = datetime.now(timezone.utc)\n", + "open_reviews[\"days_open\"] = (today - open_reviews[\"date_opened\"]).dt.days\n", + "open_reviews.drop(columns=[\"date_closed\"], inplace=True)\n", + "total_open = len(open_reviews)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "remove-input" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Unnamed: 0package_namedate_openedlabelsstatusdays_open
00FElupe2024-09-14 22:37:44+00:00['0/pre-review-checks', 'New Submission!']pre-review11
11Solar Data Tools2024-08-17 06:30:02+00:00['2/seeking-reviewers']under-review39
22THzTools2024-08-01 11:54:53+00:00['0/seeking-editor']seeking editor55
33BlackMarblePy2024-07-18 14:15:11+00:00['1/editor-assigned']under-review69
44MontePy2024-07-01 21:04:05+00:00['3/reviewers-assigned']under-review86
\n", + "
" + ], + "text/plain": [ + " Unnamed: 0 package_name date_opened \\\n", + "0 0 FElupe 2024-09-14 22:37:44+00:00 \n", + "1 1 Solar Data Tools 2024-08-17 06:30:02+00:00 \n", + "2 2 THzTools 2024-08-01 11:54:53+00:00 \n", + "3 3 BlackMarblePy 2024-07-18 14:15:11+00:00 \n", + "4 4 MontePy 2024-07-01 21:04:05+00:00 \n", + "\n", + " labels status days_open \n", + "0 ['0/pre-review-checks', 'New Submission!'] pre-review 11 \n", + "1 ['2/seeking-reviewers'] under-review 39 \n", + "2 ['0/seeking-editor'] seeking editor 55 \n", + "3 ['1/editor-assigned'] under-review 69 \n", + "4 ['3/reviewers-assigned'] under-review 86 " + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# The plot below isn't super useful .\n", + "# open_reviews.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "remove-input" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "
\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "# Create the Altair chart using object-oriented syntax\n", + "chart = (\n", + " alt.Chart(open_reviews)\n", + " .mark_line(point=alt.MarkConfig(filled=True, size=100), strokeWidth=0)\n", + " .encode(\n", + " x=alt.X('date_opened:T', axis=alt.Axis(labelAngle=-45, format='%Y-%m-%d')), # Ordinal quarter on the x-axis\n", + " y=alt.Y('days_open:Q'), # Quantitative days_open on the y-axis\n", + " tooltip=['package_name', 'status', 'days_open', 'date_opened']\n", + " )\n", + " .properties(title=\"Open Reviews - Days Open\", width=\"container\")\n", + " .interactive()\n", + ")\n", + "\n", + "chart" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + }, + "vscode": { + "interpreter": { + "hash": "d7b89e158b719c02a21186c9646700ecf5a8cc5b1b6f738df9b6ffa75e5e74e4" + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/myst.yml b/myst.yml index 4521a50..1ddc4c9 100644 --- a/myst.yml +++ b/myst.yml @@ -19,6 +19,8 @@ site: url: /peer-review-metrics/historical-peer-review-stats - title: Peer review data url: /peer-review-metrics/current-reviews-data + - title: Review Timelines + url: /peer-review-metrics/review-timing - title: Contributor data url: /peer-review-metrics/contributor-pr-issues - title: Contributing