{"id":13672603,"url":"https://github.com/vdaubry/github-awards","last_synced_at":"2025-05-15T22:06:06.084Z","repository":{"id":26360890,"uuid":"29809978","full_name":"vdaubry/github-awards","owner":"vdaubry","description":"Discover your ranking on github :","archived":false,"fork":false,"pushed_at":"2023-01-03T14:13:59.000Z","size":2874,"stargazers_count":1581,"open_issues_count":102,"forks_count":121,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-08T08:16:49.378Z","etag":null,"topics":["github","language","rankings","star"],"latest_commit_sha":null,"homepage":"http://git-awards.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdaubry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-25T10:08:58.000Z","updated_at":"2025-03-21T14:39:16.000Z","dependencies_parsed_at":"2023-01-14T04:29:26.182Z","dependency_job_id":null,"html_url":"https://github.com/vdaubry/github-awards","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaubry%2Fgithub-awards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaubry%2Fgithub-awards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaubry%2Fgithub-awards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaubry%2Fgithub-awards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdaubry","download_url":"https://codeload.github.com/vdaubry/github-awards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254430326,"owners_count":22069908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","language","rankings","star"],"created_at":"2024-08-02T09:01:41.213Z","updated_at":"2025-05-15T22:06:06.024Z","avatar_url":"https://github.com/vdaubry.png","language":"Ruby","readme":"[![Build Status](https://semaphoreci.com/api/v1/projects/aa2cd6ce-b19d-43bc-9db1-f1c3c2756be9/389922/badge.svg)](https://semaphoreci.com/vdaubry/github-awards)\n[![Help Contribute to Open Source](https://www.codetriage.com/vdaubry/github-awards/badges/users.svg)](https://www.codetriage.com/vdaubry/github-awards)\n\n# Important notice : Github Awards becomes Git Awards !\n\n# Git Awards\n\nGit Awards gives your ranking on GitHub by language and by location (city, country and worldwide) based on the number of stars on your repos.\n\n\n## How does it work ?\n\nIn order to calculate your ranking on GitHub we:\n- Get all GitHub users with their location\n- Geocode their location\n- Get all GitHub repositories with language and number of stars\n\nWith this information we are able to compute your ranking for a given language in a given city.\n\n## Step 1 : Get all users and repositories\n\nThere are over 10 Millions users and 15 Millions repositories on GitHub, we cannot just call the GitHub API for each user and his repos.\n\nHowever the GitHub list API returns 100 results at a time with basic information :\n- [get-all-users](https://developer.github.com/v3/users/#get-all-users)\n- [list-all-public-repositories](https://developer.github.com/v3/repos/#list-all-public-repositories)\n\nWith this one can get up to 500k user / repo per hour : this is enough to get the entire list of users and repositories with basic informations (username, repo name, etc).\n\nRake tasks are :\n\n    rake user:crawl\n    rake repo:crawl\n\nNow we need to get detailed informations such as location, language, number of stars.\n\n\n## Step 2 : Use Google Big Query to get details about active users and repositories\n\n\u003e GitHub Archive is a project to record the public GitHub timeline, archive it, and make it easily accessible for further analysis.\n\nThe GitHub Archive dataset is public, with Google Big Query we can filter the dataset to get only the latest event for each repo and users. Unfortunatly the GitHub Archives events starts from 2011, so we won't get ranking informations for users and repos that have been inactive since 2011.\n\n- Request for users :\n\n[users.sql](https://github.com/vdaubry/github-awards-api/blob/master/sql/GoogleBigQuery/users.sql)\n\n- Request for repositories :\n\n[repos.sql](https://github.com/vdaubry/github-awards-api/blob/master/sql/GoogleBigQuery/repos.sql)\n\nWe can then download the results as JSON, parse the result, and fill missing information about users and repos.\n\nRake tasks are :\n\n    rake user:parse_users\n    rake repo:parse_repos\n\nWe now have the users location, and repositories language and number of stars. In order to get country and world rank we need to geocode user locations\n\n\n## Step 3 : Geocoding user locations\n\nLocation on GitHub is a plain text field, there are about 1 million profiles with location on GitHub. Free geocoding APIs usually have a hard rate limiting. First step is to geocode only distinct location, which leaves about 100k locations to geocode.\nA solution to speed up the geocoding is to use a combination of :\n\n- [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)\n- [Open Street Map API](http://wiki.openstreetmap.org/wiki/Nominatim)\n\nRake task is :\n\n    rake user:geocode_locations\n\nWe now have all the information we need to compute ranking.\n\n## Step 4 : Compute rankings by language and by location (city/country/world)\n\nTo get rankings we first calculate a score for each user in each language using this formula :\n\n    sum(stars) + (1.0 - 1.0/count(repositories))\n\nThen we use Postgres [ROW_NUMBER()](http://www.postgresql.org/docs/9.4/static/functions-window.html) function to get ranks compared to other developers with repositories in the same languages, in the same location (by city, by country or worldwide).\n\nOk, now we have all GitHub users' ranking :)\n\nIn order to speed up queries based on user ranks, we create a table with all rankings information. Once we have all rankings informations on a single table we can properly index it, we get acceptable response time when we query it from a web application.\n\nThe query to create the language_rankings table can be found here :\n\n[rank.sql](https://github.com/vdaubry/github-awards-api/blob/master/sql/rank.sql)\n\n\n## Step 5 : VOILA ! Look for your ranking and have fun :)\n\n\nNext steps :\n\n- Github connect\n- Manually refresh your informations\n- Automating data update\n- Improve UI\n\n\n## Contributing :\n\n* Fork it `https://github.com/vdaubry/github-awards/fork`\n* Create your feature branch `git checkout -b my-new-feature`\n* Commit your changes `git commit -am 'Add some feature'`\n* Push to the branch `git push origin my-new-feature`\n* Create a new Pull Request\n\n## License\n\nThis project is available under the MIT license. [See the license file](LICENSE.md) for more details.\n","funding_links":[],"categories":["Happy Exploring 🤘","Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaubry%2Fgithub-awards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdaubry%2Fgithub-awards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaubry%2Fgithub-awards/lists"}