cncf / devstats.archive

📈CNCF-created tool for analyzing and graphing developer contributions
https://devstats.cncf.io/
Apache License 2.0
444 stars 147 forks source link

Feature Request: Add country option to the developer activity dashboard #146

Closed nikhita closed 6 years ago

nikhita commented 6 years ago

Currently, the developer activity count dashboard has the following drop down options:

It would be nice to have a fourth option for "Country" so that we can toggle the developer activity count per country.

For example, if I select "China" from the drop down list, I can see all contributors from China listed as per their contributions, etc.

I think this will be a useful feature to understand how Kubernetes contributors are distributed across the world and also help us connect with other local developers (among many other benefits).

Thanks to @dims for starting a discussion about this.

/cc @dims @spiffxp @lukaszgryglicki

nikhita commented 6 years ago

@dims also shared this link on Slack about raw data about contributors: https://raw.githubusercontent.com/cncf/gitdm/master/github_users.json

lukaszgryglicki commented 6 years ago

Will work on this.

lukaszgryglicki commented 6 years ago

Working on this.

lukaszgryglicki commented 6 years ago

Done:

nikhita commented 6 years ago

@lukaszgryglicki thanks for getting this done so quick!

Quick question: where does this get the data from? I am from India and have that on my github profile (since forever) but it doesn't show my name in the list for India.

lukaszgryglicki commented 6 years ago

It comes from geonames.org, some algorithms try to parse GitHub location, I'll check yours and let You know.

lukaszgryglicki commented 6 years ago

github_users.son says:

  {
    "login": "nikhita",
    "email": "nikitaraghunath!gmail.com",
    "affiliation": "Red Hat",
    "name": "Nikhita Raghunath",
    "commits": 395,
    "location": "Mumbai, India",
    "country_id": "in",
    "sex": null,
    "sex_prob": null,
    "tz": "Asia/Kolkata"
  },

GHA database says:

gha=# select * from gha_actors where login = 'nikhita';
          id          |  login  |       name        | country_id | sex | sex_prob |      tz      | tz_offset | country_name 
----------------------+---------+-------------------+------------+-----+----------+--------------+-----------+--------------
 -4174142372497897645 | nikhita | Nikhita Raghunath | in         |     |          | Asia/Kolkata |       330 | India

So everything looks good. How many contributions do you have? Maybe try to search on next pages?

EDIT: I took a look and sorry, no more pages, I would have to investigate this.

nikhita commented 6 years ago

@lukaszgryglicki I have 4115 contributions, checking it from this list for all countries.

lukaszgryglicki commented 6 years ago

Got you. You have an old username and then moved to GH with new user id:

gha=# select * from gha_events where dup_actor_login = 'nikhita' limit 1;
     id     |       type        | actor_id | repo_id  | public |     created_at      |  org_id  | forkee_id | dup_actor_login |     dup_repo_name     
------------+-------------------+----------+----------+--------+---------------------+----------+-----------+-----------------+-----------------------
 8447614173 | IssueCommentEvent | 16105680 | 20580498 | t      | 2018-10-19 08:39:15 | 13629408 |           | nikhita         | kubernetes/kubernetes
(1 row)

gha=# select * from gha_actors where id = 16105680;
    id    |  login   |             name              | country_id | sex | sex_prob | tz | tz_offset | country_name 
----------+----------+-------------------------------+------------+-----+----------+----+-----------+--------------
 16105680 | nikinath | (Moved to github.com/nikhita) |            | m   |     0.71 |    |           | 
(1 row)

gha=# 

I need to handle this, thanks.

nikhita commented 6 years ago

You have an old username and then moved to GH with new user id:

Oh yeah! Sorry for making it more complicated for you. :grimacing:

lukaszgryglicki commented 6 years ago

Ohh you new GitHub id doesn't have location info:

  {
    "login": "nikinath",
    "email": "nikinath!users.noreply.github.com",
    "affiliation": "?",
    "name": "(Moved to github.com/nikhita)",
    "commits": 0,
    "location": null,
    "country_id": null,
    "sex": "m",
    "sex_prob": 0.71,
    "tz": null
  },

So it is not assigned to a given country. But anyway, it should find you own (legacy) id and count them, digging... changing few SQL conditions.

nikhita commented 6 years ago

@nikhita is my new github id. @nikinath was my super old one :)

Or not...depends on the way you see it. I changed my username from nikinath to nikhita and then created another account with the username nikinath (to help with redirections, etc).

lukaszgryglicki commented 6 years ago

Here you go: https://k8s.devstats.cncf.io/d/13/developer-activity-counts-by-repository-group?orgId=1&var-period_name=Last%20decade&var-metric=contributions&var-repogroup_name=All&var-country_name=India

nikhita commented 6 years ago

@lukaszgryglicki Yay, thanks for the quick fix! :rocket: