Monday, March 15, 2010

Custom Tag

We decided the best (easiest?) way to handle our problem is to create a custom tag and add it to the openmrs tag library. With a custom tag, you can have a parameter that the corresponding class can access. So for our tag, we pass in the observation and in the PreviewComplexObsTag class we take that observation and determine what needs to be returned. For ComplexObs that have image handlers, we return a link to the full size image and an icon that when moused over pops up a preview of the image. The popup is accomplished using the jQuery code I found earlier in the semester. If the Complex Ob has a text handler, it simply returns a link to the text document.

We are planning on generating a thumbnail version of a given image on the fly in this tag's class. Getting the image data from the obs and generating a thumbnail isn't actually that hard, but the issue we are having is how to save it to the file system and how to access it later. We figured out that the thumbnail should be able to be accessed using the obsId parameter and the view parameter when calling the get obs method in the servlet.

Sunday, March 7, 2010

The MVC Architecture Confuses Me.

While I do believe that we have been learning some things about OpenMRS and their architecture, Elisee and I are still having some trouble completely understanding the system. I feel like we are missing some fundamental pieces of how this type of project works; one thing that I know I need to get a better understanding of is JSTL. JSTL (JavaServer Pages Standard Library) is how methods are accessed from JSP pages.

Elisee was able to edit some Java code and it changed what was displayed on the webpage when that method was called. We still aren't sure how to apply that to what we need.

I found the controller that handles the requests for an image in a complex observation. It is the WebImageHandler class (extends ImageHandler). When getObs() is called it sets a new instance of ComplexData to the name of the obs passed in and gives it a String value of either the HTML view (an img tag) or the Hyperlink view. The view returned is decided by a parameter passed into the method. This seems like it would be the spot we would want to place a third htmlpreview option, but I'm not sure. It seems like this would make sense for images, but does not help us for complex obs that aren't images. I'm still not sure exactly how to access this. In the obsForm.jsp page they use ${htmlView} or ${hyperlinkView} to get the view that they need. This same thing cannot be used on the encounterDisplay.jsp page because ${htmlView} returns the html view for that encounter page. I don't know how to tell it we are wanting the html view of the current observation.

After what we thought was a lot of progress, these past 2 weeks have been spent digging through code and reading tons. We are still trying to determine the right way to complete this "introductory" project.