Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

feat: prepare data script + pull data into google spreadsheet #7

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b5ce629
define helper methods
Mar 11, 2021
f5032c9
update gitignore
Mar 11, 2021
04282b1
update gitignore
Mar 11, 2021
4eb1dc6
update gitignore
Mar 11, 2021
93968cf
update gitignore
Mar 11, 2021
6f3ba46
sort dates by ascending order
Mar 11, 2021
64edf65
save data locally
Mar 11, 2021
f2f06db
gitignore
Mar 11, 2021
519c3d2
make fetchData an async function
Mar 30, 2021
22936dc
use fix versions of dependencies
Mar 30, 2021
b042af3
aggregate data per repo and owner
Mar 30, 2021
5260eb4
make aggregate a new script in package.json
Mar 30, 2021
80abc9c
apply suggestions from code review
Apr 7, 2021
cb00ff0
update dependency
Apr 16, 2021
02de622
feat: get count for open PRs and issues
Apr 16, 2021
c515070
try google cloud function
May 15, 2021
3b656ce
other tentative
May 15, 2021
b92583a
other tentative with gcp
May 17, 2021
64f1129
fix paths
May 17, 2021
6ba31af
add cloudbuild file to fetch data
May 19, 2021
ca191af
Merge remote-tracking branch 'origin/prepare-data-script' into prepar…
May 19, 2021
fce286a
add require definition
May 19, 2021
b9d7e88
modify config file to run task fetch
May 19, 2021
83d38bf
modify config file to run task fetch
May 19, 2021
3b04297
try including env variable
May 19, 2021
3fd45f8
raw data in single json file
May 19, 2021
0e75a69
adjust json field names
May 19, 2021
19ce23e
get results as valid json files
May 19, 2021
2577c91
add aggregate as step to cloudbuild config file
May 19, 2021
4b2fcb1
get all metrics in single json file
May 20, 2021
2978fa4
- script to update google sheet
May 25, 2021
f5fcb1a
separate constants
May 25, 2021
bf05a48
npm install before node .
May 25, 2021
e3f25d4
remove google build
May 25, 2021
e6464e0
Revert "remove google build"
May 26, 2021
63f9d81
use secrets for authentication
May 26, 2021
fa9eaee
try other structure for creds
May 26, 2021
2f7c0d0
fix removal of non-existing folder
May 26, 2021
b688d3a
try with brackets
May 26, 2021
0fd072d
log
May 26, 2021
3eef14b
load env
May 26, 2021
9618efb
try env export
May 26, 2021
909eea1
try something else
May 26, 2021
f358fb6
try something else
May 26, 2021
ac99d7b
.installed
May 26, 2021
f96cc4a
log
May 26, 2021
d856415
log
May 26, 2021
ad1fbc2
use SPREADSHEET_ID
May 26, 2021
b19fce3
remove console outputs
May 26, 2021
87452f0
apply standard js style
May 26, 2021
2a8bf26
add format
May 26, 2021
13cec85
docs: add README.md
May 26, 2021
0085cee
use fix versions of dependencies
May 26, 2021
0313298
only include year if first quarter while updating spreadsheet
Jun 1, 2021
052eb6b
update docs and add temporal metrics
Jun 9, 2021
978badf
authenticated request to list users' orgs
Jun 9, 2021
490a781
uncomment code
Jun 15, 2021
0212e01
add external comments to google spreadsheet
Jun 15, 2021
1d1544f
set timeout to 20 mins
Jun 15, 2021
88bfe1a
cache external contributors
Jun 15, 2021
dd1ee61
add dash indicator
Jun 15, 2021
415d571
remove dash indicator
Jun 15, 2021
c3f45ee
put timeout on different steps
Jun 15, 2021
6221d08
add "-" indicator
Jun 15, 2021
1731a41
remove "-"
Jun 15, 2021
8cf3f78
timeout next to args
Jun 15, 2021
6fa9e39
timeout to 20 mins
Jun 15, 2021
797269a
timeout to 20 mins
Jun 15, 2021
96c12b9
timeout to 20 mins
Jun 15, 2021
7f39a7c
debug: do not count prs twice
Oct 25, 2021
0e3d2cc
additional documentation
Feb 4, 2022
6765244
additional indicators
Feb 4, 2022
6a57677
additional documentation
Feb 4, 2022
55638dc
byQuarterYear -> byMonthYear
Feb 8, 2022
5f8797d
enlarge grid
Feb 8, 2022
24457ae
do not update google sheet
Feb 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
*.backup
*.backup
/.env
# Dependency directories
node_modules/
/.idea/
/data/
/credentials.json
/token.json
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
Metrics
=======
# MobilityData metrics
[Click here to view metrics dashboard](https://docs.google.com/spreadsheets/d/e/2PACX-1vRsOds1l3nNCntabcxqOdvTrVmK1nWjKAsrEoN5gCxB4rqDwrG3j2dDeWgx5pI6m24UGoiG1631fajI/pubhtml)

The metrics project to monitor KPIs on repos
## Repositories
This dashboard gives information regarding the following repositories:
* [MobilityData/gtfs-validator](https://www.github.com/MobilityData/gtfs-valdiator)
* [MobilityData/gbfs](https://www.github.com/MobilityData/gbfs)
* [MobilityData/transit](https://www.github.com/MobilityData/transit)
* [NABSA/gbfs](https://www.github.com/NABSA/gbfs)
* [google/transit](https://www.github.com/google/transit)

![image](https://user-images.githubusercontent.com/55884852/101205625-e3ef1900-363b-11eb-9adf-125910ee1263.png)
## Implementation
Different scripts are implemented in this repository. Their execution in the following order enables rendering of the metrics dashboard.
* [FetchRawData.js](/src/scripts/FetchRawData.js) fetches raw data from the Github repositories;
* [AggregateData.js](/src/scripts/AggregateData.js) aggregates the data previously retrieved for future rendering;

### About
## Automation
This dashboard is updated on a daily basis at 10AM (GMT-4) via a Google Cloud Build that is triggered by a pub/sub message.

This is your project's README.md file. It helps users understand what your
project does, how to use it and anything else they may need to know.
Note that the update of the dashboard will fail it all operations are not completed within 1200s (20 mins).

## Indicators

- comment's dates by months and quarter of the year
- issue creation date by months and quarter of the year
- pull request merge date by months and quarter of the year
- pull request creation date by months and quarter of the year
- external comments dates by months and quarter of the year
- forks creation dates by months and quarter of the year
- repository starring dates by months and quarter of the year
- repository commit dates by months and quarter of the year
- number of new issue authors by months and quarter of the year
- number of new pull request authors by months and quarter of the year
- number of new commit authors by months and quarter of the year
- number of open issues
- number of open pull requests

## Run

### Locally

- Make sure that `GH_TOKEN` is defined at in a file named `.env` located at the root of the project
- run `node src/scripts/FetchRawData.js`: this script will fetch raw data from Github and save it under `data/raw_data.json`
- run `node src/scripts/AggregateData.js`: this script will aggregate data from the previous script and save all metrics by month under `data/metrics.json`
23 changes: 23 additions & 0 deletions cloudbuild_refresh_data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
steps:
- name: node
entrypoint: npm
args: ['install']
- name: node
entrypoint: npm
args: ['run', 'fetch']
timeout: 1200s
env:
- 'GH_TOKEN=$_GH_TOKEN'
- name: node
entrypoint: npm
args: ['run', 'aggregate']
- name: node
entrypoint: npm
args: ['run', 'refresh']
timeout: 1200s
env:
- 'SPREADSHEET_ID=$_SPREADSHEET_ID'
- 'CREDENTIALS=$_CREDENTIALS'
- 'TOKEN=$_TOKEN'
timeout: 1200s

Loading