Skip to content

hackjutsu/Github-Ranking-Crawler

 
 

Repository files navigation

This repository is for the crawler app. Click here to see the front-end app.

太阁极客榜 (BitTiger Geeks Ranking)

太阁极客榜(or BitTiger Geeks Ranking)is a real-time ranking board for BitTiger's Github members. Its results are based on members' Github activities in the past seven days with daily updates at 06:30 PDT.

Demo: https://bittiger-ranking.firebaseapp.com

Screenshots

Motivation

By showing the Github members' activities in a game-style ranking board, we can finally help the github members grow their interests and get more engaged in coding.

We intentionally introduce some top coders in our ranking board just to have more fun;)

Components

This project consists of three components:

  1. A crawler to dig the members' public data and calculates their rankings.
  2. A Firebase-powered persistence layer for the results from the crawler.
  3. A front-end single-page app to show the members' rankings from the persistence layer.

Usage

To start the application:

npm install
node launcher.js

To crawl the github data and update the ranking history(user_ranking_info) to database(Firebase):

localhost:port/crawl

To crawl the github data but NOT update the ranking history(user_ranking_info) to database(Firebase). We only update the ranking history in production scenario.

localhost:port/test

Note You have to configure your own github account and firebase secret in ./configs/account.js

Firebase Date Structure

Firebase URL: https://bittiger-ranking.firebaseio.com

bittiger-ranking
 |__ + user_events
 |__ + user_ranking_info

user_events is the data displayed on the ranking board. The data is set by the crawler app and retrieved by the front-end web app.

  • created_time: the most recent update time
  • events: a sorted array of the latest user data
  • event - <number> - ranking_history: the user's most recent 10 rankings
user_events
 |__ created_time: "2016-05-09T18:37:44-07:00"
 |__ + events
       |__ + 0
       |__ + 1
       		 |__ CreateEvent: 11
       		 |__ ForkEvent: 4
       		 |__ PullRequestEvent: 6
       		 |__ PushEvent: 23
       		 |__ Total: 44
       		 |__ avatar_url: "https://avatars.githubusercontent.com/u/7756581?v=3"
       		 |__ html_url: "https://github.com/hackjustu"
       		 |__ login: "hackjustu"
       		 |__ organization: "bittiger"
       		 |__ ranking_change: 0
       		 |__ + ranking_history
       		 		    |__ + 0	  
       		 		    |__ + 1
       		 		          |__ ranking: 3
       		 		          |__ timestamp: "2016-05-09T06:30:03-07:00"
       		 			    

user_ranking_info helps store users' most recent 100 ranking history. As now, this data is only used by the crawler app.

  • <user1's login>: Usually we call it the username for the Github member. It is the same value as shown in the previous user-events - events - <number> - login
user_ranking_info
     |__ + <user1's login>
     |__ + <user2's login> 
     |__ + hackjustu
     			|__ + 0
     			|__ + 1
       		 		  |__ ranking: 3
       		 		  |__ timestamp: "2016-05-08T06:30:03-07:00"

Ranking Algorithm

We compare Total, PushEvent, PullRequestEvent, CreateEvent and ForkEvent in sequence and stop at the first available result.

Total = PushEvent + PullRequestEvent + CreateEvent + ForkEvent

Note: If you have multiple commits in one push event, we still count it one score. People have suggested using the number of commit instead of push. We could probably adopt this some time, but at this moment, we still count push.

Users can sort the members by other order such as just PushEvent or ForkEvent, but we use the ranking of Total for our medal system in the next section.

Medal System

We adopt Clash of Clans's medal system for fun, beacasue we love the game~~

Medal Icon Scores (Total)
Champion > 100
Gold 50 - 100
Silver 20 - 50
Bronze < 20

Note: If you are Super Cell and feel unhappy about how your lovely medal icons are used here, please just let me know. I'm more than happy to change them.

Team Members

Cosmo
Cosmo

Acknowledgment

  • Project Wukong contributes the prototype for the backend github crawler.
  • Freepik contributes several cool free images.

License

MIT ©Cosmo

Repository information

  • category: full stack
  • team: Fighting Falcon
  • description: A real-time ranking board for BitTiger's Github members.
  • stack: nodejs, firebase

About

🏆 Realtime ranking board for BitTiger Github members. (太阁极客榜 Crawler)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%