DEV Community

Cover image for The Github Contribution Stats
Dash Reyes
Dash Reyes

Posted on • Edited on

The Github Contribution Stats

Hello, World!

I just want to share this project about how you can dynamically generate a template of your Github contribution stats based on the Commits, Pull Requests, Issues and Code Reviews.

The ratings scale are based on this Academic Grading In Japan I was fascinated with that ("S" rarely given ๐Ÿ˜‚) and also we used some of the common formula in Statistic like (Mean, SD, Z-Score, etc.) to get the final scores based on the 4 data sets (Commits, Pull Requests, Issues and Code Reviews). If you want check the technical details of it you can visit this file ContributionRatings.js

Usage

Just copy paste this into your markdown content and replace the value of the ?username= URL parameter based on your Github Username.

[![Contribution Stats](https://github-contribution-stats.vercel.app/api/?username=lorddashme)](https://github.com/LordDashMe/github-contribution-stats/)
Enter fullscreen mode Exit fullscreen mode

Probably you will notice that the generated template has a message below the stats, we added this feature in order to preserve the origin of the project. If you want to remove this just make sure you give a star in the project and after a couple of minutes this will disappear, we need this minutes because we implemented a caching for each generated template.

Purpose

Actually if you don't know Github released a feature Github README profile (they say a Secret Repository ๐Ÿ˜„). You can check this article on how it works How to add GitHub Profile README (new feature). And I think this project will give you additional content to include or show for your Github README Profile.

Contribute

Yes! the project is open for any idea or suggestion just visit the repository Github Contribution Stats and don't forget to star the repository ๐Ÿ˜Š that will help a lot!

Edited July 21, 2020

Appreciated all the comments and suggestions โค๏ธ. I never thought that this post will be active like this and all of you supported this.

There's still so much room for improvement since then many changes applied to enhance it further! thank you so much for the support! ๐ŸŽ‰

Top comments (13)

Collapse
 
benwtrent profile image
Benjamin Trent

It's disappointing to see that only commits are taken into account.

PR reviews and creating issues are vital contributions to projects.

I wouldn't know how to weigh them all together though.

Collapse
 
lorddashme profile image
Dash Reyes • Edited

Hello! thanks for the comment, really appreciated ๐Ÿ˜Š. Actually yes, right now commits are only counted for the ratings and the other 3 vitals for contribution are not yet included (Issues, Code Review, Pull Requests). But yes I will include all of them now ๐Ÿ˜Š

Collapse
 
benwtrent profile image
Benjamin Trent

I am glad the score exists :). It would be an interesting statistical analysis on how to weight each of them differently.

Thread Thread
 
lorddashme profile image
Dash Reyes

Here's the interesting part if we just use the following common statistic formula (I also explained it here in another comment: dev.to/lorddashme/comment/129i9) then we can get the ratings for the 4 vital metrics for the contribution (Commits, Code Review, PR, Issues) and give each metrics a ratings multiplier for example for the Commits it's pretty common so I will give it a 0.8 and then the Code Review with a 2 so this mean the Code Review is much higher weight compare to Commits ๐Ÿ˜„

Collapse
 
hamzaanis profile image
Info Comment hidden by post author - thread only accessible via permalink
Hamza Anis

For the badge which includes PR and issues like this

alt

You can do something like this.

<img src=https://github-readme-stats.vercel.app/api?username={username}&show_icons=true alt={username} />
Collapse
 
anuraghazra profile image
Anurag Hazra • Edited

This one is my project, github-readme-stats btw :)

GitHub logo anuraghazra / github-readme-stats

Dynamically generated stats for your github readmes

Github Readme Stats

GitHub Readme Stats

Get dynamically generated GitHub stats on your readmes!

Tests Passing Issues GitHub pull requests

View Demo ยท Report Bug ยท Request Feature

็ฎ€ไฝ“ไธญๆ–‡ ยท Espaรฑol

Loved the project? Please consider donating to help it improve!

Features

GitHub Stats Card

Copy paste this into your markdown content, and that's it. Simple!

Change the ?username= value to your GitHub's username.

[![Anurag's github stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)

Note: Ranks are calculated based on user's stats, see src/calculateRank.js

Hiding individual stats

To hide any specific stats, you can pass a query parameter ?hide= with an array of items you wanna hide.

Options: &hide=["stars","commits","prs","issues","contribs"]

![Anurag's github stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&hide=["contribs","prs"])

Showing icons

To enable icons, you can pass show_icons=true in the query param, like so:

![Anurag's github stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true)

Themes

With inbuilt themes you can customize the look of the cardโ€ฆ




People don't usually know the origin because lot of people do not attribute the project.

Collapse
 
mzaini30 profile image
Zen

My Github stats

Wew ๐Ÿ˜…

Collapse
 
lorddashme profile image
Dash Reyes

Ohh my! Congrats you got the S score! ๐ŸŽ‰ ๐Ÿ˜„ HAHAHAHAHAHAHA

Collapse
 
mzaini30 profile image
Zen

Hahahaha.... ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚

Collapse
 
hamzaanis profile image
Info Comment hidden by post author - thread only accessible via permalink
Hamza Anis

In addition to this I would like to add the reference for Github README Profile generator which also includes this post.

Collapse
 
____marcell profile image
Marcell Cruz

Nice project, but I think the contribution results are not making much sense right now, I think it should be more focused on the overall contribution, how is the calculation done ?

Collapse
 
lorddashme profile image
Dash Reyes • Edited

Hello! thanks for the comment, appreciated ๐Ÿ˜„. For the ratings calculation we've used some of the common statistic formula to get the final result, for example getting the Mean of the 3 data sets (which in our case the This Year, This Month, and This Week), when you have the Mean you can use it together with the Standard Deviation (Basically I considered this as the threshold for the score) to calculate the Z-Score which will be the basis for the ratings ๐Ÿ˜„. For more technical details you can also check the ContributionRatings.js which holds all the information for the calculation ๐Ÿ˜„.

Some comments have been hidden by the post's author - find out more