Skip to content

Commit c8f24e0

Browse files
committed
github reporting updates
1 parent 747fa09 commit c8f24e0

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ services:
1414
STACKQL_GITHUB_USERNAME: ${STACKQL_GITHUB_USERNAME}
1515
STACKQL_GITHUB_PASSWORD: ${STACKQL_GITHUB_PASSWORD}
1616
GOOGLE_CREDENTIALS: ${GOOGLE_CREDENTIALS}
17+
dns:
18+
- 8.8.8.8
1719
command:
1820
- /bin/sh
1921
- -c

notebooks/github/sprint_reporting/includes/includes.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"from IPython.display import display, Markdown, HTML, clear_output\n",
1111
"import plotly.express as px\n",
1212
"import pandas as pd\n",
13-
"import sys, datetime, base64, time, psycopg2\n",
13+
"from datetime import datetime, timedelta, timezone\n",
14+
"import sys, base64, time, psycopg2\n",
1415
"sys.path.append('/jupyter/ext')\n",
1516
"import stackql\n",
1617
"from psycopg2.extras import RealDictCursor\n",

notebooks/github/sprint_reporting/sprint_reporting.ipynb

+28-12
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@
2020
"# show header\n",
2121
"owner = owner.value\n",
2222
"repo = repo.value\n",
23+
"sprint_number = sprint_number.value\n",
2324
"start_date = start_date.value.strftime('%Y-%m-%d')\n",
2425
"end_date = end_date.value.strftime('%Y-%m-%d')\n",
25-
"header_text = f\"# Sprint {sprint_number.value}\\n\"\n",
26-
"header_text += f\"#### {start_date} to {end_date}\\n\"\n",
26+
"aest = timezone(timedelta(hours=10))\n",
27+
"start_date_aest = datetime.fromisoformat(f\"{start_date}T00:00:00\").replace(tzinfo=aest)\n",
28+
"end_date_aest = datetime.fromisoformat(f\"{end_date}T00:00:00\").replace(tzinfo=aest)\n",
29+
"start_date_utc = start_date_aest.astimezone(timezone.utc)\n",
30+
"end_date_utc = end_date_aest.astimezone(timezone.utc)\n",
31+
"start_date_iso_utc = start_date_utc.isoformat()\n",
32+
"end_date_iso_utc = end_date_utc.isoformat()\n",
33+
"header_text = f\"# Sprint {sprint_number}\\n\"\n",
34+
"header_text += f\"#### {start_date} to {end_date} (AEST)\\n\"\n",
2735
"display(Markdown(header_text))"
2836
]
2937
},
@@ -50,8 +58,10 @@
5058
" JSON_EXTRACT(commit, '$$.author.name') as author,\n",
5159
" DATE(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as date\n",
5260
" FROM github.repos.commits\n",
53-
" WHERE owner = '$owner' AND repo = '$repo' AND\n",
54-
" date > '$start_date' AND date <= '$end_date') c\n",
61+
" WHERE until = '$end_date_iso_utc' \n",
62+
" AND since = '$start_date_iso_utc'\n",
63+
" AND owner = '$owner' \n",
64+
" AND repo = '$repo') c\n",
5565
"GROUP BY c.author"
5666
]
5767
},
@@ -87,8 +97,10 @@
8797
"DATE(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as date,\n",
8898
"TIME(DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+10 hours')) as time\n",
8999
"FROM github.repos.commits\n",
90-
"WHERE owner = '$owner' AND repo = '$repo' AND\n",
91-
"date > '$start_date' AND date <= '$end_date'"
100+
"WHERE until = '$end_date_iso_utc' \n",
101+
"AND since = '$start_date_iso_utc'\n",
102+
"AND owner = '$owner' \n",
103+
"AND repo = '$repo'"
92104
]
93105
},
94106
{
@@ -102,7 +114,7 @@
102114
"commits_df = stackql_df\n",
103115
"commit_shas = commits_df['sha'].tolist()\n",
104116
"display(commits_df)\n",
105-
"display(create_download_link(commits_df))"
117+
"display(create_download_link(commits_df, filename=f\"{sprint_number}_commits.csv\"))"
106118
]
107119
},
108120
{
@@ -128,9 +140,12 @@
128140
"FROM\n",
129141
"github.repos.activities\n",
130142
"WHERE \n",
131-
" owner = '$owner' AND \n",
132-
" repo = '$repo' AND\n",
133-
" date > '$start_date' AND date <= '$end_date'"
143+
"owner = '$owner' \n",
144+
"AND repo = '$repo'\n",
145+
"AND date > '$start_date' \n",
146+
"AND date <= '$end_date'\n",
147+
"AND direction = 'desc'\n",
148+
"AND time_period = 'month'"
134149
]
135150
},
136151
{
@@ -142,7 +157,7 @@
142157
"\n",
143158
"# display activity and download link\n",
144159
"display(stackql_df)\n",
145-
"display(create_download_link(stackql_df))"
160+
"display(create_download_link(stackql_df, filename=f\"{sprint_number}_activity.csv\"))"
146161
]
147162
},
148163
{
@@ -200,6 +215,7 @@
200215
"WHERE \n",
201216
" owner = '$owner' AND \n",
202217
" repo = '$repo' AND\n",
218+
" since = '$start_date_iso_utc' AND\n",
203219
" updated_at > '$start_date' AND updated_at <= '$end_date'"
204220
]
205221
},
@@ -302,7 +318,7 @@
302318
"\n",
303319
"# display files with download link\n",
304320
"display(files_df)\n",
305-
"display(create_download_link(files_df))"
321+
"display(create_download_link(files_df, filename=f\"{sprint_number}_files.csv\"))"
306322
]
307323
}
308324
],

scripts/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
/srv/stackql/stackql --version
33
echo "starting stackql server..."
4-
nohup /srv/stackql/stackql --http.response.pageLimit=1 --pgsrv.port=5444 srv &
4+
nohup /srv/stackql/stackql --http.response.pageLimit=-1 --pgsrv.port=5444 srv &
55
echo "stackql server started"
66
start-notebook.sh --NotebookApp.token=''

0 commit comments

Comments
 (0)