Yey! Google Summer of Code 2012, I'm IN !! :) :) :)

As April 23 approaches, the heart-beat level rises in every students’ body for a one reason - its Google Summer of Code a.k.a GSoC. 

Google Summer of Code is a global program that offers post-secondary student developers ages 18 and older stipends to write code for various open source software projects. They have to work with open source, free software, and open technology-related groups over a three month period. Google Summer of Code is a highly competitive program with a limited number of spots. I am proud to be part of it this year.

My name is Harsha Sanjeewa Siriwardena, 3rd Year, IT Undergraduate who studies in SLIIT and lives in Colombo, SriLanka. I am a Simple, Cool guy enjoy Coding, Android development, Open source and learning new Technological stuff.

I am planning to implement Project idea called Better Error Submission Process - Feedback Module for OpenMRS as a part of GSoC 2012. This post will give a short description of the process I went through to make it to coding for OpenMRS project through GSoC 2012.

I chose OpenMRS as my organization. Why? After taking a look at Gsoc list, Among all these projects, organizations the relatively coolest Project is called "OpenMRS" which is my favorite. I loved their idea. "Write Codes, Save Lives!" As it sounds, its a Medical Record Management System, which is widely used in many countries globally as a Free and Open source software product. And that’s totally awesome! I really wanted to be part of this wonderful project. No matter even after the end of Gsoc 2012, for sure I will remain with this marvelous Open Source Community. So, when did I start to get involved? It was year 2012, January. Yeah I started bit early cause I had a serious intension to get through gsoc this year.  

Before started contributing OpenMRS, I have completed a 6 months Internship at hSenid Mobile where I gained lots of experience in Industrial Software Engineering. Those experience at office was really helpful for me to work in OpenMRS project as both Organizations were using almost the same technologies for developing stuff. I am pretty much familiar with J2EE and related its Technologies as OpenMRS uses J2EE at its core too. I still remember the great supervision I got  from Mr. Jason, Mr. Romith and Mr. Thilina at hSenid Mobile. In this occasion I should advert them too.

In the pre-gsoc period I was gathering information about Gsoc. These days Pradeeban Ayya, Nirmal Ayya, Suhothayan Ayya helped me a lot to get a quick jump start. (Sorry! "Ayya" means brother in my mother lang :) Specially Pradeeban Ayya did a excellent job from his Blog Articles to teach us the Basics of Gsoc, IRC/Mailing list Ethics and other random facts of a Open Source Communities. I attend to Apache BarCamp (Thanks to WSO2) held at University of Colombo, SriLanka which I have learnt lots of Gsoc related stuff (How, why, what?) and how self motivation affects to get through gsoc.  

And finally, I worked with Gaurav Paliwal, Suranga Kasthurirathne, who are Senior Developers and Mentors of OpenMRS. They were really, really helpful. Guided me right from basics of OpenMRS and helped me out at every difficult stage of the project. And whole OpenMRS Developers Community was wonderful. Whenever I got problems regarding developments, fixing bug ticketsreplied as soon as they got time to answer via IRC and Mailing lists. That’s totally cool!

I hacked a bit of OpenMRS Core modules and Patched few tickets. I almost spent my time Coding OpenMRS for more than 9 hours a day in those previous months since Feb 2012. Earlier January of 2012, I have done an interesting OpenMRS English to Sinhala Localization contribution with the help of several people. That was a significant milestone of my OpenMRS related work, which really grew-up my love towards OpenMRS.

Then came the news of GSoC 2012. And OpenMRS made its way to the selected organizations list this time too! So It was a great pleasure for me knowing that I had the chance to work on my favorite project as part of Google Summer of Code 2012.

I started preparing the Proposal for Better Error Submission Process for FDBK Module which is an extension of the project General Feedback Mechanism in OpenMRS. The main objective of the Feedback module is to provide a mechanism for users to communicate with system supporters/admins with system-related (not patient-specific) messages, refactoring the error submission process and make it more easy and effective preferably a wizard driven one. Finally I thought only to stick with this project idea as my main Gsoc Proposal and tried to make it more effective and a Strong one.

And after all the discussions, I was able to fine tune my Project proposal and submitted. The list of accepted proposals were out by GMT 1900 hours (00.30 AM in here) on April 23rd, 2012 on the Google melange site and I was glad to see my name on the List and on the OpenMRS 2012 GSoccers Landing page

So now (as soon as my Final exam finishes in May 4th) I am going to work in one of the coolest projects in the open source world as part of the Google Summer of Code. I am really proud and happy to be at this place!

Thanks for Reading my Gsoc-Story this far! :)


Other related Links.
  1. GSoc 2012 - Accepted Students From Sri Lanka
  2. OpenMRS - GSoC 2012 Landing Page
  3. List of all projects accepted into GSoC 2012
  4. Project Proposal - Better Error Submission Process for FDBK Module

Better Error Submission Process for FDBK Module - Gsoc-Proposal

GSoC 2012 - OpenMRS - Project Proposal

Better Error Submission Process for FDBK Module




Better Error Submission Process for FDBK Module is an extension of the project General Feedback Mechanism. The main objective of the Feedback module is to provide a mechanism for users to communicate with system supporters/admins with system-related (not patient-specific) messages, refactoring the error submission process and make it more easy and effective preferably a wizard driven one.


1. User friendly wizard to be developed that should take information from the user in step by step procedure.
2. Screenshot of the browser should be automatically attached when selected by the user instead of the manually attaching it.
3. Other important info, like current page should also be automatically added to the feedback.
4. Users should be able to communicate with other users. (Communicate means the users can submit their feedbacks to a specific user within System rather only sending it to Admin.)


1. As the Screenshot is taking automatically and it can be edited by using several markers within the System. So there won’t be need of manually hiding patient data anymore. (The Screenshot capturing, Editing(hiding the sensitive data) using a Image Edit software, finally uploading it, all these annoying steps are skipped in the new system and user will able to simply submit their feedbacks in couple of minutes time.)
2. Screenshots can be taken faster, hiding confidential information. So the Admin/Staff user does not need to think twice before forwarding the problem as it will not be containing any sensitive data.
3. Faster problem solving process as previous conversation can be referred by other user when given permission by reporter or administrator.


For Capturing the screenshots and editing them inside the Web Browser, I have researched about how Google Feedback mechanism works and got to know they were using a Javascript approach to handle the process within Client Side.
JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I found a working script called html2canvas which converts html into a canvas image. So hope this to be implemented in the OpenMRS Feedback module.
For making the interactions with other users (which is not available in the current system) I will implement and expand the functionality of prevailing classes/forms used in Feedback module. 

Goals and Deliverables
  •  Design the additional tables of FDBK module Schema after the improvements.
  •  Finalize the design of User Feedback form wizard.
  •  Fixing the issues exist in the Current Feedback System.
  • Finalizing of taking current page info and other important feedback information features. 
  •  Finalize the communication among users feature within Feedback module.
  •  Integrating the special feature of Capturing the screen-shots and editing them inside the Web Browser.
  •  Source code with technical wiki
  •  User guide with wiki

    Draft Timeline
  • April 24­ - May 7: Discussion with the mentors about the final project descriptions, list of tasks, deliverables and time­line; learning OpenMRS framework and Module implementations.
  •  May 8- May 20: Finalizing the user interface mockups, finalizing the Table Schema, and learning necessary technologies if anything new and needed, Research more about Google Feedback Mechanism and how it has to be implemented in OpenMRS Feedback module.
  •  May 21- July 8: First Phase of Development
SMART Goal #01
* Goal : Adding the new features which are not exist in the Current Feedback System.   
* Relevance :
 > Fix the known issues exist in the current Feedback system. [May 21 - May 25 ]
 > Build the User communication feature within the Feedback System. New Classes may added as needed to build the communication among users.  [May 26 - June 10]
 > Take the current page info and other important feedback information. The existing classes will be modified and will added by new Attributes as necessary. [June 11 - June 25]
 > Development of the User friendly Wizard Driven Feedback Form. [June 26 - July 08]
* Time-bound : May 21- July 8
* Measure: Fully Tested and working Feedback Form Wizard with the feedback communication feature among users, without Automated Screen-shot capturing mechanism.

  • July 9- July 13: Mid­term evaluations and work on feedback received
  • July 14- August 10: Second Phase of Development
SMART Goal #02
* Goal : Implement the Automatic Screen-shot capturing mechanism within Browser.
* Relevance :
> Processing the Browser Screen-shot to an Image (DOM to Image)> Implement the Blackout/Highlight tools. (using Javascript + DOM)
> This Goal involves in very interesting feature of the upcoming Feedback Form and holds bit of complexity in the development process as well. So I hope this might take some considerable time in developments.
* Time-bound : July 14 - August 5
* Measure: Fully Tested and working Feedback Form Wizard with Automatic Screen-shot capturing mechanismAs in [Figure 1.4] user will able to Blackout and Highlight appropriate important stuff on the Screen-shot image.

  • August 6 - August 13: Finalization, Testing and other final improvements.
Better Error Submission Process for FDBK Module
[Related Diagrams]

- Related Diagrams are shown below.
        1. UI-Mockups (Collecting information step by step as a Wizard)
        2. Use-Case-Diagram
        3. Flow-Charts (for Feedback Sender, Feedback Receiver, Administrator)

1. User-Interface-Mockups

Figure 1.1

Figure 1.2

Figure 1.3

 Figure 1.4

Figure 1.5

Figure 1.6

Figure 1.7

 Figure 1.8

2. Use-Case-Diagram

 Figure 2.1

3. Flow-Charts

 Figure 3.1

  Figure 3.2

Figure 3.3

#GoogleCodeJam my Answer Algorithm for Problem A. Speaking in Tongues

Took around 1.5 hours to write this Algorithm.
When the submission to #gcj I have been tried total 3 times.
After 2 tries I figured out z =q and q=z :D
Totally I went 3 tries but last one is a loss, I thought it will automatically submitted after the count down though it didnt. :/

I got Full marks for this Algorithm.. hahahahha.. how cool it was..... :)

  Problem A. Speaking in Tongues


We have come up with the best possible language here at Google, called Googlerese. To translate text into Googlerese, we take any message and replace each English letter with another English letter. This mapping is one-to-one and onto, which means that the same input letter always gets replaced with the same output letter, and different input letters always get replaced with different output letters. A letter may be replaced by itself. Spaces are left as-is.
For example (and here is a hint!), our awesome translation algorithm includes the following three mappings: 'a' -> 'y', 'o' -> 'e', and 'z' -> 'q'. This means that "a zoo" will become "y qee".
Googlerese is based on the best possible replacement mapping, and we will never change it. It will always be the same. In every test case. We will not tell you the rest of our mapping because that would make the problem too easy, but there are a few examples below that may help.
Given some text in Googlerese, can you translate it to back to normal text?

Solving this problem

Usually, Google Code Jam problems have 1 Small input and 1 Large input. This problem has only 1 Small input. Once you have solved the Small input, you have finished solving this problem.


The first line of the input gives the number of test cases, T. T test cases follow, one per line.
Each line consists of a string G in Googlerese, made up of one or more words containing the letters 'a' - 'z'. There will be exactly one space (' ') character between consecutive words and no spaces at the beginning or at the end of any line.


For each test case, output one line containing "Case #X: S" where X is the case number and S is the string that becomes G in Googlerese.


1 ≤ T ≤ 30.
G contains at most 100 characters.
None of the text is guaranteed to be valid English.


ejp mysljylc kd kxveddknmc re jsicpdrysi
rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
de kr kd eoya kw aej tysr re ujdr lkgc jv

Case #1: our language is impossible to understand
Case #2: there are twenty six factorial possibilities
Case #3: so it is okay if you want to just give up

My Answer!


 * Google Code Jam - Qualification Round 2012
 * Problem A. Speaking in Tongues
 * Author :
 * @harshadura


public class Main {

    private static String[] EncryptedLines;
    private static String[] DecryptedLines;

    public static void main(String[] args) {

        int i = 0;
        int j = 0;
        int count = 0;

        try {
            FileInputStream fstream = new FileInputStream("C:\\Users\\Harsha\\Documents\\NetBeansProjects\\GoogleCodeJamA\\");
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;

            EncryptedLines = new String[100];

            while ((strLine = br.readLine()) != null) {
                EncryptedLines[i++] = strLine;
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());

        DecryptedLines = new String[count - 1];
        int numTests = Integer.valueOf(EncryptedLines[0]);

        if (numTests < 1 || numTests > 30){
            System.out.println("Invalid Input!!!!!!!!");

        for (i = 1; i <= numTests; i++) {
            DecryptedLines[j++] = "Case #" + i + ": " + ConvertLine(EncryptedLines[i]);

        String writableString = "";

        for (int k = 0; k < DecryptedLines.length; k++) {
            if (k + 1 == DecryptedLines.length) {
                writableString = writableString + DecryptedLines[k];
            writableString = writableString + DecryptedLines[k] + "\n";


    public static String ConvertLine(String plainText) {
        int size = plainText.length();
        String decripted = "";
        if (size > 100) { 
            System.out.println("More than 100 Characters exceeded for a Single Case and Thats Invalid!!!!!!!!");

        for (int i = 0; i < size; i++) {
            decripted = decripted + charMap(plainText.charAt(i));
        return decripted;

    public static void writeToFile(String WrittenText) {
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(;
            String file_name = "A-small-attempt3.out";
            FileWriter fstream = new FileWriter(file_name);
            BufferedWriter out = new BufferedWriter(fstream);
            System.out.println("File created successfully.");
        } catch (Exception e) {

    public static char charMap(char x) {
        switch (x) {
            case 'a':
                return 'y';
            case 'b':
                return 'h';
            case 'c':
                return 'e';
            case 'd':
                return 's';
            case 'e':
                return 'o';
            case 'f':
                return 'c';
            case 'g':
                return 'v';
            case 'h':
                return 'x';
            case 'i':
                return 'd';
            case 'j':
                return 'u';
            case 'k':
                return 'i';
            case 'l':
                return 'g';
            case 'm':
                return 'l';
            case 'n':
                return 'b';
            case 'o':
                return 'k';
            case 'p':
                return 'r';
            case 'q':
                return 'z';
            case 'r':
                return 't';
            case 's':
                return 'n';
            case 't':
                return 'w';
            case 'u':
                return 'j';
            case 'v':
                return 'p';
            case 'w':
                return 'f';
            case 'x':
                return 'm';
            case 'y':
                return 'a';
            case 'z':
                return 'q';
        return x;