Tuesday, July 3, 2012

OpenMRS GSoC Project Introduction - my first online presentation

Just after the coding period began in GSoC, we in OpenMRS had our introduction presentations where each of the GSoC participant had to give a brief 10 minute introduction regarding our projects at the weekly OpenMRS Developers Forum. Since this was my first time, doing such kind of online presentation for an audience i was bit uncomfortable regarding this as well as excited too. However my mentor Mark was very helpful and he helped me to correct the content i am going to present, the things i am going to say etc.

There are few ways to connect to the Developers forum as Skype, Adobe Connect etc. and i was using Adobe Connect. Therefore it was not very hard to configure the settings where i did prechecking of my microphone,speakers etc. before the meeting and also before the meeting starts, some of us did test our microphones with voice. My slot was the last presentation of the schedule so by that time my fears were all gone and i was well relaxed. :D That is one remarkable experience in my GSoC memories and presenting my project into a new audience was really a great experience, as well as the support and help we got from the fellow OpenMRS community members!

I have also attached the slide i used to do the presentation, as there was specific information which needed to be mentioned there. Perhaps a future OpenMRS GSoC student may find it useful :)


Down the lane with OpenMRS in GSoC 2012-Part II

The next task i was assigned is,

2. Creating a new tag to restrict all (or part of) an HTML Form by role 


The <restrictByRole> tag is the next newcomer to the HTML tag base of Form Entry Module. This feature is concerned to be implemented in a way that, some user with a particular role can be restricted from either viewing a certain HTML form (or a section in the form) by using the <restrictByRole> tag. The tag comes with two attributes as "include" and "exclude" where you can mention the names of the roles for whom you want to include or exclude the form restriction.

As an example if you don't need to make a certain table in your HTML form to be viewable to a Person which has "Data Manager" role assigned to him/her, you form description would be as follows,

<restrictByRole include="Data Manager">                   
  <table>

   <tr>
       <obs conceptId="6100" labelText="Restricted for Data Manager"/>
   </tr>

  </table>
</restrictByRole>


So this table would not be shown to any person with the 'Data Manager' role but only to the users who belongs to that role.
In the same way this can be used with "exclude" attribute, in where the corresponding section would only be not restricted to the mentioned role.

An example form would be like,

1.0 These rows in the table are not restricted for the user Admin, who has "System Developer" role
2.0 If a user who is not a "System Developer" opens the form, if would look like this
That is where we are heading towards at the moment. There are two more tasks to do during the summer so i look forward for those also very enthusiastically!

Down the lane with OpenMRS in GSoC 2012 ..............

Time flows lot faster and i can't believe that it has almost come up the time for GSoC mid evaluations too.  I did have a quite busy but amazing time of two months so far with GSoC where it helped me to learn about many new things and technologies. So thought to have a little flashback on the things done so far.

The following are the tasks which i have already finished by the time of mid evaluation for this GSoC with HTML Form Entry module in OpenMRS.
1. Add autocomplete search functionality to encounter provider and encounter location widgets in HTML Form Entry
There are a lot of names as locations and encounter provider persons  in the system where it is displayed in a drop down list of options at the current module, but due to the long list of options it will be time taking to load and submit the location and provider values with the HTML form. 
At present, HFE module provides auto complete functionality with the <obs> tag, (stands for observation entries), where it does follows the JQuery AJAX calls to populate the source for the auto complete. However this feature is tightly coupled for Concept classes and ids, therefore it is not reusable for the Locations and Providers. The intention of my task is providing a generalized auto complete mechanism through out the module, which uses a pre-populated list of options as the source and which can be used with any other field (as DrugOrder etc.) in the future too. 
Encounter location and provider have been implemented by having two dedicated widgets for each such as, LocationWidget (for <encounterLocation>) and PersonStubWidget (for <encounterProvider>) tags. In addtion to that there is another encounter provider is introduced with htmlformentry 1.9 onwards which too uses a dedicated widget named ProviderWidget with <encounterProviderAndRole> tag. The intention of the task is replace the dedicated  widgets for location, provider etc. and implement a common auto complete mechanism over the Html Form Entry module by just using AutoCompleteWidget and the DropDownWidget for the fields. In that case when a user needs to add auto complete functionality into any other field, it can be easily done by using the new, generalized AutoCompleteWidget.
Here are few of the snapshots from new functionality!



 
 
 

 
 
 
 
And also it works with Options which has special characters like ã,é etc. and which have double quotes,single quotes in middle too :) Auto complete functionality is added into <encounterLocation>, <encounterProvider> and <encounterProviderAndRole> usingthe new AutocompleteWidget and LocationWidget and ProviderWidget in the module is replaced with the new AutocompleteWidget or a default DropDownWidget, hence they have been deprecated for future occurrences. 
The following is the link for the demonstration video i did regarding this new functionality at the second GSoC progress presentation at OpenMRS on 21st June 2012. The next post will explain the second task i have completed. I am eagerly waiting to see my changes have been integrated into HFE module soon :)
GSoC 2012 Autocomplete Demo
The presentation slides can be found Here!

Friday, May 11, 2012

Working with databases in mysql

The following is a brief tutorial on how to login to mysql shell from Linux (Ubuntu 11.10).

First of all mysql-server must be installed in your system. To enter the mysql commands from the shell we need to first change into mysql shell from the default unix shell window. To do this,

  • Find the mysql directory in your local computer. (by default this is /usr/bin if you installed mysql from the terminal via apt-get install). Now we need to get into mysql shell.
  • Enter the following command in a terminal window.
         $ [mysql-directory]/bin/mysql host -u root -p
  •  In my system this is,
          $ /usr/bin/mysql mydb_1 -u root -p where host is replaced by the corresponding database name i need to connect. This tells the system to connect the database as root by demanding the password (-p). Once you get connected the following text would appear and mysql shell would be opened.

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 151
Server version: 5.1.62-0ubuntu0.11.10.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


Now we can enter any valid mysql command and proceed with database queries. Following are some of the common and important commands. Always keep in mind that each command must be finished with ; or \g

1. To view the 'help' entries
mysql> help;


2. To view the list of existing databases
mysql> show databases;

The output will be something like,
mysql> show databases \g
+------------------------------------+
 | Database                    |
+----------------------------------+
 | information_schema |
| mysql                        |
+-------------------------------+
2 rows in set (0.00 sec)
 


3. To create a new database
mysql> create database mynew_db;

4. To drop a database
mysql> drop database mynew_db;
The output will be like,
Query OK, 102 rows affected (23.71 sec)
 

5. To quit or exit from connection
mysql> exit; or  mysql> quit;






Monday, April 23, 2012

GSoC 2012, this summer with OpenMRS!

WoW after all the hard effort I got selected into Google Summer of Code 2012 to work with OpenMRS today. OpenMRS was the only organization i tried in this summer GSoC as i was so interested in the project as well as the support got from the community during the time of GSoC was awesome.



It was a bit struggling experience at the beginning as i had never worked with OpenMRS before so i was trying very hard in getting familiar with the project and catch up the speed. There were sometimes where i really felt to give up and pack off when i started fixing the first  ticket of the project. But anyway i never stopped trying and with a few days of killing myself (and also with great guidance got from community experts through IRC), i finally managed to understand the code a bit and could work in some introductory bugs. Life was much easier after that and it became more and more fun with the time going :) 

When going through the list my first interest was project HTML Form Entry Module Enhancements (to which i got selected at last, Yeppi :)). I felt a natural interest for that as i had formally worked with HTml,JSP etc. during my internship at WSO2 so immediately decided to begin OpenMRS with it :D. After contacting my mentor i could get some more information about the project and Mark, my mentor gave me some good  advice on how to begin and getting familiar with code. I first worked on an intro ticket with his guidance and when it was done moved onto other etc. It is really appreciated the guidance and support i got from my mentor Mark Goodrich, as he was very helpful towards me since from the beginning.

I applied for two projects in OpenMRS this summer "HTML Form Entry Module Enhancements" and "Personal Health Record Module Enhancements". I was looking forward to work in any of the two if i get selected but was extremely happy to know that i got my first choice project to work. 

"OpenMRS is a software platform and a reference application which enables design of a customized medical records system with no programming knowledge (although medical and systems analysis knowledge is required). It is a common platform upon which medical informatics efforts in developing countries can be built. The system is based on a conceptual database structure which is not dependent on the actual types of medical information required to be collected or on particular data collection forms and so can be customized for different uses." 

The HTML Form Entry module in OpenMRS allows one to create forms to enter and edit patient data within the system. The approach is very simple since user needs to know a little HTML and also about the basics of OpenMRS system. It allow users to write forms using standard HTML tags combined with a set of special tags that reference different aspects of the OpenMRS data model. The module has been improved a lot throughout the past, and my project is also to enhance the performance and feature support for the HTML Form Entry module.


Some tips for the future GSoCers  of OpenMRS from me.

  • It is never too late to start if you can commit hard and make a change. The main thing is trying your maximum and get something done, which will show the community that you are talented and committed too.
  • Join into mailing lists and IRC and discuss if you have trouble in proceeding with some point. From my experience i could solve in many issues after discussing it in IRC. Don't be hesitate to call for help :)
  • Read the documentation lot, it has almost everything regarding system and modules.
  • Try to fix at least few introductory bugs, it is the best way to get to know the code.
  • Contact your mentor, other community experts etc. in the need of a help.

That's all for now. But looking for more excitement to come in the next few days.

Happy GSoC to all my fellow OpenMRS interns as well as to others too!

Monday, March 26, 2012

Remote debugging maven jetty with IntelliJ Idea in Ubuntu 11.10

Jetty web server is an open source http server/client container which can be used to run and test webapps.  Jetty server provides a plugin to integrate with apache maven and it can be used to run a webapp in a maven project. To do this we need to add jetty-maven-plugin into our <plugins> section by adding it into webapp pom.xml file.

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.10</version>
            <configuration>
               <webXml>${project.build.directory}/jetty/WEB-INF/web.xml</webXml>
               <webAppConfig>
                  <contextPath>/${webapp.name}</contextPath>
                  <!--enable reloading static resources -->
                  <overrideDescriptor>src/test/resources/override-web.xml</overrideDescriptor>
               </webAppConfig>
               <scanIntervalSeconds>10</scanIntervalSeconds>
            </configuration>
         </plugin>


Now add the following Maven Options line into your .bashrc file.

For JDK 1.3 or above :
export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"

For below JDK 1.3:
export MAVEN_OPTS="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"

Goto the webapp folder from terminal and enter,
 mvn jetty:run
Jetty server will start on debug mode and will listen on port 8000 now. The following info will be appeared in terminal.




Goto IntelliJ Idea project and create a remote debug confiruation giving following parameters. (to do this follow the path Run --> Edit Configurations. Click on the + button followed by Remote and you will see remote configuration window appears)


Host = localhost
Port = 8000

Run the remote debug and it will also listen on port 8000 now.

Tuesday, March 6, 2012

Configuring proxy settings for Apache Maven

Ever wondered how to build your project with Apache Maven via a proxy server? This is a brief tutorial on how to do so.

Environment : Ubuntu 11.10 Oneiric
                        Apache maven 2.2.1

Apache maven holds all the configuration data in a single file called settings.xml file inside the 'conf' directory in the main directory of maven. The file includes configuration details regarding the proxies therefore we need to edit that section in order to enable the proxy server for a maven build.

This is how to do it.
  • Download the maven binary distribution from Apache Maven downloads page. The newest version is 3.0.4 however the stable version is 2.2.1 for the existing projects which are not upgraded into maven 3.
  • Extract the binary distribution into somewhere in your hard disk. apache-maven-2.2.1 directory will be visible now. Browse to the 'conf' directory inside 'apache-maven-2.2.1' main directory.
  • The 'settings.xml' file is inside the 'conf' directory. Open the file with a text editor and uncomment the section between <proxy> </proxy> tags. Edit the <proxy> entry as follows.
<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     | -->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>MYHOST.LK</host>
      <port>3200</port>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
   
  </proxies>
  • Replace the MYHOST.LK address with the host address of your proxy server and replace the port number with relevant proxy port too. Save and close the file, now and you are ready to build via a proxy :)