Work thread for creating /dev/1 badge

Based on the ideas of @burke and @sunbiz I am proposing that the /dev/1 badge be granted automatically upon a user receiving the following badge titles:

  1. /dev/null (bronze badge level, already exists)
  2. Smart Developer (bronze badge level)
  3. Contributor (bronze badge level, partially existsl)

/dev/null

This is automatically granted daily when a user has received the GitHub User badge (added a GitHub profile and the Friendly User badge (introduced themself).

Smart Developer

Similar to the github_badges plugin below, we need to create a Discourse plugin that will:

  1. Run periodically (daily?) like the GitHub badge query does.
  2. Somehow query Moodle (API?) to return OpenMRS ID’s that have passed the exam.
  3. Match those ID’s against active Discourse accounts.
  4. Grant badge.

Contributor

  1. Fork and expand the github_badges Discourse plugin (and then PR the changes back) to do the following: a. Expand the current github badges repo Discourse site setting to use more than one GitHub repository. b. Match users not only on their Discourse email address (current) but also a custom user field that admins can define. (In our case, the “GitHub ID” custom field.)
  2. For /dev/1 we are looking for the initial bronze badge for 1 accepted PR.

The /dev/1 badge

This will auto-grant when the 3 badges (we’ll need their badge ID numbers in the DB) above exist for any given user. We already know how to do this, i.e.:

SELECT user_id, CURRENT_TIMESTAMP granted_at, NULL post_id
FROM user_badges pb
WHERE badge_id = 106
AND EXISTS (
  SELECT 1 FROM user_badges ib
  WHERE pb.user_id = ib.user_id
  AND ib.badge_id = 107
)
AND EXISTS (
  SELECT 1 FROM user_badges ib
  WHERE pb.user_id = ib.user_id
  AND ib.badge_id = 108
)
;

That’s it!

  1. What do folks think?
  2. Who can volunteer to do some Ruby hacking to get these plugins done?
5 Likes

Badges created so far:

@michael “OpenMRS basics quiz” or “Intro quiz”?

Let’s call it “OpenMRS Dev Basics Quiz”.

So we have some work to do on Moodle, but ready for an eager volunteer to take on the Ruby work for forking the GitHub plugin as described above. Fame and fortune (well, fame anyway!) await! :wink:

Where is this quiz…I want /dev/1

@sunbiz is working on the quiz development now. We are hoping (but becoming decreasingly less hopeful) to have the /dev/1 badge ready by GSoC application time. Need some ruby hackers to help.

Down to help if you need it! <3 Ruby!

Check the github badges repo in the posts above as well as our initial spec … questions welcome here :smile:

Alrighty time to have some fun :smiley:

@sunbiz ping… :smile:

1 Like

Thanks for the ping @michael. I shared the quiz questions privately in a Google doc, so that the answers are not leaked. I changed the quiz setup a bit on the moodle instance.

I’m also avoiding complicated Spring, Hibernate questions. Very basic questions may be. Moderate maven and core Java questions. The quiz will be 20 questions in 20 minutes because we don’t want people to do web searches and fill in the answers. Whatever this is worth, we can make the passing grade to a lowly 50% (or 40%), but at least makes a newcomer know what they need to learn to make dev contributions to OpenMRS. Any suggestions from past GSoC students or mentors?

1 Like

We can add few basic questions on Git, OpenMRS Data model and Terminologies used in OpenMRS Community.It may help newcomers to know the things needed to make dev contributions. :smiley:

1 Like

I was trying to get this done, but it seems to me the github_badges plugin is inefficient. It does a git clone and uses the git command-line to check email. Many people have multiple email accounts in their github account from which they commit and so git’s author email won’t be accurate. I then tried writing another discourse plugin that will work against the github API, but it seems that I have to write a lot of Ruby REST client code. In my quick attempt, I cant get the GitHub API octokit.rb to work in a discourse plugin.

@michael, do you want this to be a discourse plugin only? Why not an external script that calls Github and Discourse API that can be run through a cron scheduler??

  1. The user list from discourse (…/admin/users.json - needs permission)
  2. Iternate through the list and get the github ID field from each user (custom field value for id=2)
  3. get all repos under openmrs github org (…/users/openmrs/repos)
  4. Iterate through the list and get commits of authors (from 2) from github (…/repos/openmrs/:reponame>/commits?author=:githubid>)
  5. count the number of commits and add it up
  6. check the total commit count if > 1, then POST to give discourse badge (…/badges?id=…)

The problem is likely the github rate limit of 5000 calls per hour, but we can use the Etag for later times to deal with the limit. We can use a small database with two tables: ratelimit(URL,Etag) and commit(user,count) to send the If-Not-Modified header with the github request

I think I can write this in the next few hours, if this is acceptable as a standalone script? Since no one’s taken up the mantle for the plugin, I can think of this if we still make it before we need to evaluate the GSoC application? This script can also be evolved to check the moodle quiz and give a discourse badge for people who score above 50%? Any one have opinions??

I’ve written a Java SE REST client for Discourse-Github integration - https://github.com/sunbiz/openmrs-contrib-discohub Here is what I’ve come up with in a couple of hours. Works to get commit count. Need to deal with rate-limit. @michael, need admin permissions to get user list from discourse.

Agreed, what’s there now is very simple.

I think this is the correct path, unfortunately as you say it’s more involved. We now have a custom field that is a user-provided GitHub ID, so that we won’t have to rely on email address. It’d be safe to assume that people have to fill this field in order to get the badge.

This would increase the complexity. It’d be much preferable if we could keep everything self-contained. We are also not the only ones who would benefit from this, so I’d prefer to build upon the existing effort if we can at all do it.

I like the logic and we can certainly try this as an interim measure, but I’d still like to get the plugin working. :slight_smile: @sunbiz contact me on IRC to work through the permissions real-time. Thanks for your efforts on this!! :star2:

Hi you guys @michael and i were working this weekend on a few different things. I wanted to express my opinions about the concept of a dev badge. I love it and i think that it will help support the community. However, at the current time, 74 /dev/null people are in the queue ( and there are 15 people who are grandfathered into the upper stages).

Getting the quiz live and the integration work for the other requirements seem to be a boulder in the way of success. I would like to suggest an interim solution to move those developers along. it would be very simple ( since i did see a copy of the quiz and it looks like it is very near to completion–and great BTW). Can we directly contact the 74 people ( including someone that looks great and signed up today) and include a list of the requirements ( as well as a link to the quiz ) and a form for them to send back? They could /would send back their pull request documentation /JIRA issue as well as the quiz. We ( i know, the royal we) would then review this documentation and respond to them.

Obviously, this isn’t the ultimate long term solution but it will move people along the path. In the meantime, the programming for the long term solution would need to be finished–but we could keep a dB of the results/ people until that is done.

low hanging fruit. not perfect but i think that it will do. thanks for considering. terry

2 Likes

Apologies for the delay in not responding to this thread. I think it is a good idea to contact them individually and get this started, till we think of what can be a more longer term solution, like partnering with a MooC or hosting a LMS platform on our own. I really appreciate the work that @michael has got done in a survey on surveymonkey. I think thats a great start to have them started with the quiz.

1 Like