DEV Community

Cover image for How to find developer locations by Git commits
Responsive Crocodile
Responsive Crocodile

Posted on

How to find developer locations by Git commits

Screenshot tool for commit analytics

Parameters:

  • scale: +/- country;
  • margin of error: up to a thousand km;
  • error probability, by my estimation, is currently around 20%;

Facts:

  • commit time is saved with the user's timezone;
  • we can extract the commit history by calling git log;

Current algorithm:

  • we look at the timezone in the commit timestamp;
  • in some timezones, there is only one major city (for example: +4:30 Kabul, +5:45 Kathmandu, +10:30 Adelaide);
  • in some timezones, there is only one country (for example: +05:30 India, +12:00/+13:00 New Zealand);
  • having a zone with N countries, we only consider those with a higher probability of IT presence (for example: in the Burkina Faso / UK zone, we exclude Burkina Faso);
  • we check the top-level domain of the email address (for example: .mil is mostly used by the US military);
  • we check the mail server (for example: Chinese users prefer qq.com);
  • we check for unique characters in commit messages (for example: ł for Poland, ß for Germany, ñ for Spain);
  • we check for popular surnames (for example: Kim and Park account for ~15 million Koreans in the Korea/Japan zone, while Suzuki and Sato account for ~4 million Japanese).

What else can be done:

  • save the TOP 100 IT companies and their addresses. Determine the company from the email (for example: for mike@luxoft.com, it is most likely Luxoft). Correlate the email, offices, and the current range of countries.
  • if a person has been committing frequently and for a long time, you can create a histogram and correlate the gaps in it with public holidays (for example: Christmas for Catholics, fiesta and siesta for Spaniards, Independence Day in Papua New Guinea).
  • correlate the location with other metrics and highlight on the map those who are working and those who have been fired (or the core team). Then, adjust the location of individual people based on the position of the majority.

Cons:

  • there are many "ifs", so there will be errors. My goal is not to guess 100% of the cases, but to correctly assume "for the majority".
  • the algorithm is easy to fool, but for "the majority" this is a pointless task.

Yes, the method is not the most accurate. But the current implementation (with bugs) already guesses quite well, and if proper daylight saving time transitions are added, and metrics are expanded, it will become even better. The source code is here, the online demo is here.


// NodeJS
npx assayo

// Python
pipx install assayo
assayo

// Ruby
gem install assayo
assayo

// Docker
docker pull bakhirev/assayo

// Online
https://bakhirev.github.io/demo/
Enter fullscreen mode Exit fullscreen mode

Top comments (0)