Tuesday, April 27, 2010

Solving design issue

SO far the code worked really well as expected, then we created patches and submitted them. (by the way he create patches option is pretty cool, it helps to see the changes you made, and you may not even remember). Ben Wolfe suggested that we move the javascript that control the pop-up preview from the "encounterDisplay.jsp" file so that PreviewComplexObstag class would have its own built-in js; which would make the take more reusable. We solved this by correcting the css class, instead. Also we move the resize method from PreviewComplexObstag class to ImageHandler, which made more sense in the design prospective.

Thursday, April 15, 2010

thumbnail creation

we are getting closer and closer to the end of our ticket. Since we were avoiding loading the entire image when the user only need to preview the image (memory issue), we had to resize the image to make a thumbnail instead. We resized the image by redrawing the original image and assigning new dimensions.

In our new previewComplexObsTag method, we resize the image and save the its thumbnail, with "thumb_" prefix added on the original title of the image. Because they use the Obs Id to get the link to the complex obs image, we added the view to get the thumbnail; so on the normal hyper link of the complex obs image we added "&view=thumbnail" to return the reference of its thumbnail.
Another issue in resizing was keeping the ratio of the image, but Tyler fixed it too.

Thursday, April 1, 2010

Addition isImageHandler() method

When we started this project the main key was to figure out if a complex observation is an image or not, so that we could provide a preview for it. We tried different ways that ended up working, but we were told they were not the best ways to test a complexObs. This week we added an isImageHandler() method in the Obs class (it returns true if the ComplexObs is an instance of ImageHanlder) and we were still trying to save the thumbnail for an image (which we haven't finished yet).


Once we finish saving the thumbnail, we will probably achieve the end of the task required on the ticket.

Sunday, March 21, 2010

Presentation week

last week was the week before Spring break and it was the presentation week. We didn't do much on our ticket other than preparing and present our progress to the audience. It seems like we are pretty close(hopefully) to finish our project. After the break, we will work on creating and saving thumbnails of a complex obs. Dr. Matocha was able to trace down the location where the complex obs (images and texts) are stored, i think that will help us to save the thumbnails.

Dr. Matocha: "It looks like I have found the images and where they are identified in the database. First, when the initial run wizard creates a folder in my home directory named Application Data\OpenMRS\ On my XP machine, Application Data is hidden and is located at C:\Documents and Settings\matochaj\Application Data\ In this folder, there is a file named openmrs-runtime.properties. More important to you is that after adding a ComplexObs, there should be a complex_obs folder in there that contains the image files that have been submitted with their original names (I believe).

In the openmrs database, look in the obs table. In phpmyadmin, be sure to scroll to the right to see the value_complex field. I have a single observation record whose value_complex field is "jpg image |Water lilies.jpg". I guess that some method in the API tears this back apart into the type, filename, and extension.
"

Tuesday, March 16, 2010

switching to the use of tags

As i mentioned last week that we had two options to view the complex obs, first we tried to pass the view generated in the controller but it didn't work properly. The is a method called getHyperlink() which is supposed to return the link that shows the entire complex observation. But when we called it in jsp page, it returned the link to the encounter.

Since we had a second option of using a custom tag, we tried created a PreviewComplexObs tag in the openmrs.tld file and PreviewComplexObsTag,a taglib class that relates to the tag. Tyler did a fantastic job on this, so that we can call now css classes in java.Now, you can get the link of the observation.

Future work: Creating a thumbnail of the image and store it.
Find a better to test an observation

Thursday, March 11, 2010

JSTL expression language, what in the world?

This past week was full of confusions about the how to access Java methods in JSP; however it seems like this week it's still the same. I changed the returning string (in Java) that indicates the label of the complex obs display, but I did it in the way i can't even explain i wrote -fieldHolder.label- even thoough I thought it would be fieldHolder.getLabel(). We thought there is something else going behind the scene, so that Tyler asked this issue at the mailing list.

Here is the answer from Darius
"The idea behind MVC is that the JSP page is purely for view, and therefore you never really call any methods there. So we use JSTL-EL, which lets you access objects and their properties in the model, e.g. ${patient.gender}, but you cannot do ${patient.setGender(...)}.

Anyway I'm not exactly sure what the code you're working with looks like, but your options are probably:
1. write a custom tag, like
2. generate the preview in the controller and pass it to the view precomputed.
"

He cites these two options, so we are trying to figure out which one we can be able to build.

Monday, March 1, 2010

Is there always a second way in jsp?

After Tyler sent a question on the OpenMRS developpers' mailing list, we found out that we have to handle the complex obs in a different way from how we approached it. It seems like we need to define a java function then call it in jsp. We can use servlets but none of the openMRS structures contain these.

However, since Josh and JK ended up using jsp as well, they may help us discover the syntax. I will definitely have more time to work on our project, because now, i have everything installed on my PC using Xampp.

Let's see if there is a another way to do this