GSoC 2015 Week3

Another week of exam…

I’ve mainly done two things this week, finishing ID-89 and ID-102.

There is not much to talk about ID-102, just deleting and replacing… For ID-89, refactoring ldap.js, It’s been a long time that I noticed that operations related with ldap.js would be much slower than the ordinary. After checking the search operations, I found that the old one will use search which has baseDN of ou=users,dc=openmrs,dc=org and a filter of uid=USERNAME. Then inspired by intuition, I realized that LDAP server may highly possible first fetch all entries under baseDN and then use that filter to select the items. This would be intolerant in production, as we can directly find the entry via DN of uid=USERNAME,ou=users,dc=openmrs,dc=org.

After performing a little experimentation on my machine and proving that search with direct DN would be 1 times more faster than with filter. I rewrote all the operations in the new ldap.js. Hence, this time, the refactor doesn’t only focus on logic flow and readabilities, but also efficiency.

TODO for Next Week

  • ES6 investigation
  • Something else interesting

GSoC 2015 Week2

Well… Exam period is coming… For the sake of GPA, I have to spend lots of time on reviewing. Hence, commits were getting less.

However, goodnews is that the midterm goals are kind of easier compared to those final, and I’ve finished a lot. Currently I’m working on managing front-end dependencies by Bower, which is a npm-like package management tools. Though the task itself is rather easy, all I need to do is find the referrence and replace it, some parts of codebase of Dashboard are kind of aged with lots of deprecated code and dependencies that sometimes will confuse developer, namely me for now. So besides adorpting Bower, I’m also reviewing our code-base to filter out-dated parts which would make things easier in the future. That’s work related with ID-102

Also, I’ve been working on ID-89 as well which aims to refactor ldap.js and add tests.

To summarize:


  • Reviewed some parts of Dashboard front-end thing.
  • Refactored ldap.js and added some tests for it.


  • Finish these tasks: ID-102 and ID-89.
  • See what I can achieve with ES6.

GSoC 2015: Week1

The first week has passed with not too many troubles, and I hope that this could last for the whole summer. :)

Though having pressure to deal with school works as well, I still managed to deliver some simple work. It’s ID-105 that concerns about creating and synchronizing the OpenMRS-ID with Talk’s account system.

Well, originally I thought this would be a simple task that only costs a few hours. However, it’s not that easy. From my work log, I can recall that I’ve spent one and a half day to get the testing environment set up. The Discourse has a paucity of documentation, like many start-up opensource projects, and it’s also a Ruby on Rails project, which is a technique I’m totally unfamiliar with. And after setting up the environment, I then used a day to mess around with its API, which turns out to be inappropriate. :/ So exhausted I am, I decided to use the brutal-force way, which is to imitate user’s login behaviour as SSO will handle the sync automatically.

Right before I deliver my PR, Robby notified me about the newly added PR convention of OpenMRS listed here. The guide suggests us to use git rebase to squash all commits into one and then make the PR. That’s indeed very thoughtful idea. It’s a pity that I only know this now. And then I wrote another script for syncing current accounts.

Anyway to sum up briefly:

What I Have Done

  • Added an auto-sync hook for TALK.
  • Wrote a script to import current accouts.

Actually…… It’s not so much that I have done. Sorry, used a few days to get familiar to development again.

The Last Weekly-post for GSoC

Wow, time flies. It’s already my final weekly blog post for GSoC 2014. So much fun I’ve had, Great journey indeed.

I had uploaded my final presentation this week, here. And eared a few “likes”, hoho. However, except for that, I didn’t do much work this week. Well… if you listen carefully in my presentation, you may find out that I had some issue with my throat. It’s inflammation, and it got worse after the day I uploaded the post. So anyway, I took a week-off resting.

Well, actually not just resting… my ubuntu was broken, again. So I took this chance upgraded all my stuff, including the tools that supports this blog.

However, it’s already in “documentation period”, and my project has less stress on that. The works will be done soon hopefully.

So, all in all, I had a sick week :/ , but the work will be done pretty.

Bon voyage!

About to End

Well the title should be “The 12th Week of GSoC”, if I went the usual way. Hahhhh, well, tomorrow will be the official soft pencil down date. It means, I need to stop coding, and working on perfecting documentations.

It’s really been a great unforgettable experience, It’s my first time working on a real-life project, and first time to work for a open-source community, specifically such a great community that with such a noble objective. “Write codes, save lives”!

Originally, I want to publish this blog later after I have done my final presentation. However it’s not done yet, and it’s close to the end of this week. I have to publish my weekly-blog.

Anyway, the presentation will be done in tomorrow for sure.

Well, summarize as usual.


  1. Fixed few issues, ID-48, ID-51, and working on ID-52, ID-55 now.
  2. Done the specification work for the RESTful APIs with Elliott(Well, most works is done by him, I’m not experienced…)
  3. Working on the final presentation.

The 11th Week of GSoC

Wow it’s almost close to the end of this years GSoC. So many exciting experiences, and new knowledge learnt.

The OAuth

Anyway, I’ve been working on the OAuth and the RESTful APIs this week. Yes, we used the OAuth 2.0 to achieve SSO service. As it is a widely-used protocol, it will be more easy for us to implement authorization logic for other OpenMRS apps.

And also we plan to build a OAuth based RESTful API system. So we can open the access to the OpenMRS ID, however, we have very very very little information to share. But maybe in the future the Dashboard will have more information, and become a central data storage system. Apps can store the user related information in Dashboard, and let others to access.

Well, that’s only my own vision about the far future.

So, summarize briefly as usual!

What I Have Done

  1. Perfected the patch for ID-48, and learnt something new about the Mongoose.
  2. Learnt the OAuth 2.0 a bit, and began to refactor the OAuth module with Mongoose.
  3. Built the very prototype of the REST module.


  1. Complete the refactoring work of OAuth.
  2. Record my final presentation.

The 10th Week of GSoC

Announcement for Dashboard 2.0

Exciting week!!!

After lots of testing and fixing, I’m proudly annoucing that the new Dashboard has been released. Check it out https://id.openmrs.org

Well, the new Newdashboard hasn’t changed so much on the outside, so you may find no much differences. Except for the email selecting part of profile page. Most the chagnges have happened in the backend. We’ve replaced the data storage to Mongo, for more possibility in the future.

However, I can’t say this upgrading is smooth. We’ve used lots of time on adapting to legacy datas. The new data model is somehow relatively easy to design and implement. But I have to change a lot for backward compatibility, and this process had spent lots of our time, about weeks.

Anyway, briefly summarize.


  1. Collaborate with Elliott to deploy the 2.0.
  2. Fix some bugs of it.
  3. Checked and discussed the RESTful APIs with Elliott.


  1. RESTful APIs

The 9th Week of GSoC


Oh, another week of delay… Deployment is somehow exciting and painful.

In this week Elliott and I have tried to do a trial deployment on the staging server. However, we encountered lots of problems that delayed our schedule. Like duplicate emails we found earlier, and also updating other functional modules to adapt the new Dashboard.

I updated the Migrator, and added a verifier for verifing the correctness of the migration, then made PRs for globalnavbar and sso module. And left oauth and groups module for Elliott to work on, sorry for that, but I really don’t know how to test these two…

And after we tested the migrator separately on our own machine. Things should be fine now, we think… However, you know, another issue poped out. Last time, due to the famous heartbleed bug of OpenSSL, our people made a global password reset for all acount. Specifically, setting all accounts password as empty, as OpenLDAP won’t authenticate a user with empty password. And that is definitely a thing that I have never thought about :/

Not only this, when I was checking this issue, I found that I used wrong password hashing algo, SHA rather than SSHA. And this is because of the different slapd.conf between production server and dev machine.

So we created ID-45 and ID-46.

Anyhow, Summarize!!

What I Have Done

  1. Updated Migrator.
  2. Collaborated with Elliott to do a trial deployment of Dashboard 2.0 and solved lots of problems.

What I Will Do

  1. Finish the deployment.
  2. Learn RESTful APIs

That’s it!

The 8th Week of GSoC


What I Have Done

  1. Updated lots of dependecies, mainly about our main frame express. Now it’s using 3.0.
  2. Adopted formage as our admin panel for data.
  3. Tested 2-way sync via Syncrepl.
  4. Discussed about duplications with old accounts.

The 7th Week of GSoC

Summarizing!!! So, keep it brief.

What I Have Done

  1. Finished the sync work with OpenLDAP.
  2. Built a dynamic migrating solution for temparay usage.
  3. Built a simple migration script for migrating data from OpenLDAP to Mongo*, Here is the repo

What I Will Do

Deploy the Dashboard 2.0!.

That’s it.