Thursday, September 18, 2008

Today, I completed the development of the Patient Portrait Module according to the proposal I have submitted and gotten approved by OpenMRS. The Patient Portrait Module comprises an image viewer that provides features for uploading an image, removing an image, and displaying the most recent image of a person in the patient dashboard. With the instruction of my mentor, ended up not including zooming-in and –out an image, and display all available images for a given person.

Before completing the project, I had to overcome recently the following two issues:

- For uploading an image, I wanted to use jQuery Form Plugin. The jQuery Form Plugin allows you to upgrade HTML forms to use AJAX, which is very simple. After adding the necessary code to the jsp file for uploading the image, everything seemed working fine. The image was being uploaded and saved in the database. However, after the upload process, a blank page was being displayed, which is not normal. After a lot of debugging and with the help of my mentor, I discovered that I did not handled properly the callback method showResponse(), which is responsible for displaying the image after uploading it. I needed to get back the obsId of the image and use it to display the image.

- In order to save the image in the database, I needed to create a Concept Complex for it. The Concept Complex is created in two parts. The first part is to add a global property in the confing.xml file of the module and give it a name. The second part is to use OpenMRS application to manually add the Concept Complex to the dictionary of concepts. Now, when I first created the Concept Complex called PERSONPORTRAIT, I did not add a handler for it. Later on, when I wanted to modify this concept to associate it with the handler, OpenMRS was throwing an exception saying that the concept already exists. Unsuccessful associating the concept with the handler, I created a second concept for the dictionary and associated it with the handler successful. I changed the name of global property in the config.xml file to the second name. After this changes, the upload picture stopped working. After hours of debugging I was not able to fix the problem and I asked my mentor for assistance. It turned out that, if you change the name of the global property in the code, it will not be automatically changed in OpenMRS. You need to manually change the name through the Global Properties Manager found in the Administrator page. This issue needs to be addressed by OpenMRS.

No comments: