Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Install OpenMRS
  • Install the XForms Module
  • Configure xform module
    • Login to your OpenMRS installation and select "Administration" from the menu bar
    • Select Manage Global Properties from the Maintenance section.
      • Scroll down to xforms.showModelXmlTab and type "true" in place of the "false".
      • Locate xforms.showXformsSourceTab and type "true" in place of the "false".
      • Create a new property called xforms.xsltJR and paste the following XSLT stylesheet as it's value:
        Code Block
        <?xml version='1.0' encoding='UTF-8'?>
        <xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fn='http://www.w3.org/2005/xpath-functions' xmlns:xf='http://www.w3.org/2002/xforms' >
        <xsl:output method='xml' version='1.0' encoding='UTF-8'/>
        <xsl:template match='/'>
        
        
        <html xmlns='http://www.w3.org/1999/xhtml' xmlns:xf='http://www.w3.org/2002/xforms' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xs='http://www.w3.org/2001/XMLSchema'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ev='http://www.w3.org/2001/xml-events' xmlns:jr='http://openrosa.org/javarosa'>
        <head>
        <title>
        <xsl:value-of select='/xf:xforms/xf:model/xf:instance/*/@name'/>
        </title>
        
        <xf:model>
        <xsl:copy-of select='/xf:xforms/xf:model/xf:instance' />
        
        <xsl:for-each select='/xf:xforms/xf:model/xf:bind'>
        
        <xsl:copy>
        <xsl:attribute name='id'>
        <xsl:value-of select='@id' />
        </xsl:attribute>
        
        <xsl:attribute name='nodeset'>
        <xsl:value-of select='@nodeset' />
        </xsl:attribute>
        
        <xsl:if test='string-length(normalize-space(@type)) > 0'>
        <xsl:attribute name='type'>
        <xsl:value-of select='@type' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@visible)) > 0'>
        <xsl:attribute name='visible'>
        <xsl:value-of select='@visible' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@readonly)) > 0'>
        <xsl:attribute name='readonly'>
        <xsl:value-of select='@readonly' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@required)) > 0'>
        <xsl:attribute name='required'>
        <xsl:value-of select='@required' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@locked)) > 0'>
        <xsl:attribute name='readonly'>
        <xsl:value-of select='@locked' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@calculate)) > 0'>
        <xsl:attribute name='calculate'>
        <xsl:value-of select='@calculate' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@relevant)) > 0'>
        <xsl:attribute name='relevant'>
        <xsl:value-of select='@relevant' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@constraint)) > 0'>
        <xsl:attribute name='constraint'>
        <xsl:value-of select='@constraint' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@message)) > 0'>
        <xsl:attribute name='jr:ConstraintMSG'>
        <xsl:value-of select='@message' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test="@id='patient.patient_id'">
        <xsl:attribute name="jr:preload">
        <xsl:text>context</xsl:text>
        </xsl:attribute>
        
        <xsl:attribute name="jr:preloadParams">
        <xsl:text>preloaded-patient-id</xsl:text>
        </xsl:attribute>
        </xsl:if>
        
        </xsl:copy>
        
        </xsl:for-each>
        </xf:model>
        </head>
        <body>
        <xsl:for-each select='/xf:xforms/*'>
        <xsl:if test='local-name() \!= "model"'>
        <xsl:copy-of select='.' />
        </xsl:if>
        </xsl:for-each>
        </body>
        </html>
        
        </xsl:template>
        </xsl:stylesheet>
        
        If copying and pasting doesn't work try copying and pasting from this text file from the cell-life dev server.  xforms.xsltJR.txt

Use Cases

The functionality supported by OpenMRS-JR allows the user to download a list of patients as well as a list of forms and fill out a form for a patient and then either submit it back to the server or save it for later submission. A JavaRosa-specific form allows users of OpenMRS-JR to submit patient registration information to an OpenMRS server, thus allowing patients to be created. These functions are can be broken down into these two use cases.

...

  • Failure to enter a valid base URL (for example omitting the port number), or if the server is unreachable causes  an "Unhandled exception. Close application?" error, if the user has not logged in previously.
  • The login is insecure.  The username and password are passed through a URL post to OpenMRS. On some phones, it shows the URL including the password in plain text when the user verifies that they want to connect to the server.  The username and password are also included in the PostURL in the program settings for anyone to see.
  • An "Exit" option should be added to each major section of the program, or some means of navigating to the main screen so you can exit properly.
  • Forms appear in OpenMRS-jr when downloaded even if they are not marked as published in OpenMRS.
  • Xforms are downloaded from the server, but they don't show up properly on the list of forms.  (they download and appear properly with the dev.cell-life.org server, so there is probably a server configuration step missing in the instructions) This happens on both test phones. They only appear as a cursor above the or below the two forms that are hard coded into the program. "jr-patient-single-reg" and "SMS Test (Munaf)"
  • If a bad password is entered, it stores it in the PostURL setting, and you are If a bad password is entered, it stores it in the PostURL setting, and you are unable to send forms.
  • MAJOR: Was unable to send forms because the patient_id didn't exist.  The form should accept the patient identifier, not the internal OpenMRS patient_id.  If the patient_id doesn't exist, it should be sent to a default patient, and/or the user should be notified there is a problem with the ID.

xForms Bugs (XForms 3.8.8)

  • Xforms doesn't show additional selections for providers or locations when they are added after the form is created.  This is an XForms 3.8.8 bug, as they didn't show up in the web interface until recreating the xform either.
  • The location chosen when filling out the form is not always reflected when viewing the encounter that was created.
  • The provider chosen when filling out the form is not always reflected when viewing the encounter that was created.
  • http://192.168.4.8:8080/openmrs/moduleServlet/xforms/xformDownload?target=xformslist&uname=admin&pw=test includes forms that are retired.  Security flaw: it shows the forms without a valid username and password.