Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: reoganized the page and updated it to reflect the latest version of OpenMRS-JR

...

OpenMRS-jr (pronounced OpenMRS junior) is a mobile application developed using the JavaRosa platform. In this the latest version the user can:

  • Specify a base URL for a working OpenMRS installation
  • Login to the app with a valid OpenMRS username and password
  • Download the list of available cohorts of patients
  • Select a cohort of patients to download, and download the patients onto the mobile device
  • Download XForms onto the mobile device from OpenMRS
  • Select a patient, and fill out one or more XForms for that patient
  • Fill out a form for a patient not currently on the phone using their patient identifier
  • Register new patients

The application uses the Xforms module and is built on top of JavaRosa. The application hasn't been tested extensive on different phones but in theory it should work on most J2ME compatible phones.

...

  • 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".
      • Locate xforms.xformSerializer and set it to "org.openmrs.module.xforms.serialization.DefaultXformSerializer".
      • 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 <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>
         >
        <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 
                        <xsl:if test="@id='patient.patientmedical_record_idnumber'">
                                                 <xsl:attribute name="jr:preload">
                                                   <xsl:text>context</xsl:text>
                                                 </xsl:attribute>
        
                                                 <xsl:attribute name="jr:preloadParams">
                                                     <xsl:text>preloaded-patient-id<identifier</xsl:text>
                                                 </xsl:attribute>
                                        </xsl:if>
        
           
                   </xsl:copy>
                
                </xsl:for-each>
        
               </xf:model>
             < 
         </head>
         
         <body>
        <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.  projects: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.

Download Forms and Cohorts, and Fill out a form for a patient

  • Download a list of patients based on an existing OpenMRS cohort.
  • Be able to select a patient on the mobile and fill out a downloaded form.
  • Be able to download an existing form, or load a form from memory.
  • Submit back to the xforms module and have it appear in OpenMRS as if you entered it using infopath.

Image Removed

Creating new OpenMRS Patients

  • Load JR
  • Create a new patient registration
  • Submit Registration to Server

Image Removed

Installing the mobile application

The application can be installed on your mobile phone by visiting this link in your phone's browser: http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jad If your phone gives problems downloading the application via the JAD, access the JAR directly at: http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jar.  These links are for the initial version.  (Links for the latest version are currently at the bottom of this page.)

Developer Guide

OpenMRS-JR requires a JavaROSA build. JavaROSA is hosted at bitbucket.org and can be downloaded using the instructions on their wiki: http://bitbucket.org/javarosa/javarosa/wiki/Home It is highly recommended that the Demo project in JavaROSA be compiling and running as a precursor to OpenMRS-JR.

OpenMRS-JR is also hosted at bitbucket.org and the process of checking out the source is exactly the same as that of JavaROSA:

The bitbucket repository is: http://bitbucket.org/cell_life/openmrs-jr

Once the Eclipse project has been checked out and imported into Eclipse, locate the build.properties and local.properties files and update the following parameters as required:

  • wtk.home=<path-to-sun-wireless-tool-kit-folder>
  • polish.home=<path-to-polish-home-(uses-Polish-2.1)>
  • dir.root=<root-of-openmrs-jr-folder>

Development/testing of OpenMRS-jr was done with the following server configuration...

  • Server: Last Build: Mar 10 2010 03:59 PM  Version: 1.6.0 dev Build 11699 (Also confirmed working with Version: 1.6.0 Build 12644 and Version: 1.7.0 RC Build 15604)
  • Form Import Export 1.6.0
  • HTML Form Entry 1.6.1
  • XForms 3.8.8 (Also confirmed working with 3.9.2)
  • Reporting Compatibility 1.5.0.2

Video demo

A video showing the application at work can be seen here: http://screenr.com/WEA

Feature List

Properties

  • Enter the base URL for the OpenMRS server.  This should include the http://, and a the server port, and implementation directory, such as http://192.168.4.7:8080/openmrs
  • All other URLs are generated off this base URL. If this URL is incorrect, none of the form download, patient download, cohort download, patient creation, user authentication, or form submission features will work.

Image Removed

Login

  • Enter the username and password.
  • If the user has not logged in using the phone before, authenticate the user by contacting the server and saving the user profile.
    • otherwise simply verify the password using the local user profile.

Image Removed

Cohorts

Shows a list of cohorts. Selecting a cohort causes the list of patients to be downloaded. Once the patients are downloaded, proceed to Patient List screen.  Note: you must have a saved cohort (a saved patient search is not adequate).  If you don't have a saved cohort, you cannot proceed to the forms.

Image Removed

Patient Select

This is the central screen of the app. It shows a list of patients. If there are no patients, load the Cohorts screen and download a list of available cohorts from the server. From this screen, it is possible to download more patients (via the cohort screen), view and download forms, create new OpenMRS patients, or view any unsent forms. Selecting a patient moves focus to the Patient Details screen, and then to the Form List screen.

Image Removed

Patient Details

This screen shows the patients= basic demographic details.

Image Removed

Downloading Forms

Show a list of forms already on the phone, and presents the option to download more forms or update the existing forms with newer versions of the forms. Newly downloaded forms overwrite existing forms with the same name. Selecting a form opens the form for filling.

Image Removed

Filling a Form

This screen navigates the user through each question in the form prompting the user for answers. The user can move forwards or backwards through questions, or exit the form.

Image Removed

Saving A Form For Later Sending

When the compulsory questions in a form are filled out, the form becomes able to be saved. Saved forms can be sent at a later stage either individually or as a group of forms.

Image Removed

Viewing Unsent Forms

When the compulsory questions in a form are filled out, the form becomes able to be saved. Saved forms can be sent at a later stage either individually or as a group of forms.

Image Removed

Creating A New Patient

It is possible to create OpenMRS patients. When this feature is selected, a form loads and the user is prompted to fill data for the minimum fields that OpenMRS requires for a patient creation. Once the form is filled out, and the form submitted, the newly created patient should be visible in the patient list in OpenMRS. Note that for the phone to download the new patient, there has to be a cohort that includes this patient, and the user needs to re-download that cohort.

Image Removed

Creating A Compatible XForm

The simplest form acceptable consists of 3 sections: Patient information, Encounter information and Observation information. The following fields MUST be present: PATIENT.PATIENT_ID, ENCOUNTER.ENCOUNTER_DATETIME, ENCOUNTER.LOCATION_ID and ENCOUNTER.PROVIDER_ID.

Designing the XForm

The simplest method of creating a form is to go Administration in your OpenMRS instance and select "Manage Forms"

  • Duplicate the Basic Form
  • Scroll down to "Schema design" and delete all extra fields so that it looks like this:

Image Removed

  • Then Save the form.
  • Click on "Design XForm"

Image Removed

  • Then go to File and click Save (this must be done to ensure the XFORM is created from the form).
  • Once saved, your XForm should be downloaded on the "Download Forms" option in the Form List on the device.
      • . (Note: this is an updated format which will allow you to enter forms based on the patient identifier rather them already being synchronized to the phone.)

Creating A Compatible XForm

The simplest form acceptable consists of three sections: Patient information, Encounter information and Observation information. The following fields MUST be present: PATIENT.PATIENT_ID, ENCOUNTER.ENCOUNTER_DATETIME, ENCOUNTER.LOCATION_ID and ENCOUNTER.PROVIDER_ID.  If entering patients by patient identifier you must also include PATIENT.PATIENT_MEDICAL_RECORD_NUMBER.

Designing the XForm

The simplest method of creating a form is to go Administration in your OpenMRS instance and select "Manage Forms"

  • Duplicate the Basic Form
  • Scroll down to "Schema design" and delete all extra fields so that it looks like this: Image Added
  • Then Save the form.
  • Click on "Design XForm" Image Added
  • Click on PATIENT ID on the left Form Fields.
  • Uncheck Visible and Required on the properties tab.
  • Then go to File and click Save (this must be done to ensure the XFORM is created from the form).
  • Once saved, your XForm should be downloaded to the phone with the "Download Forms" option in the Form List on the device.

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 can be broken down into these two use cases.

Download Forms and Cohorts, and Fill out a form for a patient

  • Download a list of patients based on an existing OpenMRS cohort.
  • Select a patient from the cohort on the mobile or to enter the patient identifier of a patient that is not already on the phone.
  • Download forms from OpenMRS or select one that was previously downloaded and stored on the phone.
  • Fill out the selected form.
  • Submit back to the xforms module and have it appear in OpenMRS like any other encounter.

Image Added

Creating new OpenMRS Patients

  • Load JR
  • Create a new patient registration
  • Submit Registration to Server

Image Added

Installing the mobile application

The application can be installed on your mobile phone by visiting this link in your phone's browser: 
https://wiki.openmrs.org/download/attachments/4489666/OpenMRS-JR.jad

If your phone gives problems downloading the application via the JAD, access the JAR directly at:
https://wiki.openmrs.org/download/attachments/4489666/OpenMRS-JR.jar

Get the initial OpenMRS-JR release at:
[http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jad

http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jad]http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jar[

http://bitbucket.org/cell_life/openmrs-jr/downloads/OpenMRS-JR.jad]

Developer Guide

OpenMRS-JR requires a JavaROSA build. JavaROSA is hosted at bitbucket.org and can be downloaded using the instructions on their wiki: http://bitbucket.org/javarosa/javarosa/wiki/Home It is highly recommended that the Demo project in JavaROSA be compiling and running as a precursor to OpenMRS-JR.

OpenMRS-JR is also hosted at bitbucket.org and the process of checking out the source is exactly the same as that of JavaROSA:

The bitbucket repository is: http://bitbucket.org/cell_life/openmrs-jr

Once the Eclipse project has been checked out and imported into Eclipse, locate the build.properties and local.properties files and update the following parameters as required:

  • wtk.home=<path-to-sun-wireless-tool-kit-folder>
  • polish.home=<path-to-polish-home-(uses-Polish-2.1)>
  • dir.root=<root-of-openmrs-jr-folder>

Development/testing of OpenMRS-jr was done with the following server configuration...

  • Server: Last Build: Mar 10 2010 03:59 PM  Version: 1.6.0 dev Build 11699 (Also confirmed working with Version: 1.6.0 Build 12644 and Version: 1.7.0 RC Build 15604)
  • Form Import Export 1.6.0
  • HTML Form Entry 1.6.1
  • XForms 3.8.8 (Also confirmed working with 3.9.2)
  • Reporting Compatibility 1.5.0.2

Video demo

A video showing the application at work can be seen here: http://screenr.com/WEA

Feature List

Properties

  • Enter the base URL for the OpenMRS server.  This should include the http://, and a the server port, and implementation directory, such as http://192.168.4.7:8080/openmrs
  • All other URLs are generated off this base URL. If this URL is incorrect, none of the form download, patient download, cohort download, patient creation, user authentication, or form submission features will work.

Image Added

Login

  • Enter the username and password.
  • If the user has not logged in using the phone before, authenticate the user by contacting the server and saving the user profile.
    • otherwise simply verify the password using the local user profile.

Image Added

Cohorts

Shows a list of cohorts. Selecting a cohort causes the list of patients to be downloaded. Once the patients are downloaded, proceed to Patient List screen.  Note: you must have a saved cohort (a saved patient search is not adequate).  If you don't have a saved cohort, you cannot proceed to the forms.

Image Added

Patient Select

This is the central screen of the app. It shows a list of patients. If there are no patients, load the Cohorts screen and download a list of available cohorts from the server. From this screen, it is possible to download more patients (via the cohort screen), view and download forms, create new OpenMRS patients, or view any unsent forms. Selecting a patient moves focus to the Patient Details screen, and then to the Form List screen.

Image Added

Patient Details

This screen shows the patients= basic demographic details.

Image Added

Downloading Forms

Show a list of forms already on the phone, and presents the option to download more forms or update the existing forms with newer versions of the forms. Newly downloaded forms overwrite existing forms with the same name. Selecting a form opens the form for filling.

Image Added

Filling a Form

This screen navigates the user through each question in the form prompting the user for answers. The user can move forwards or backwards through questions, or exit the form.

Image Added

Saving A Form For Later Sending

When the compulsory questions in a form are filled out, the form becomes able to be saved. Saved forms can be sent at a later stage either individually or as a group of forms.

Image Added

Viewing Unsent Forms

When the compulsory questions in a form are filled out, the form becomes able to be saved. Saved forms can be sent at a later stage either individually or as a group of forms.

Image Added

Creating A New Patient

It is possible to create OpenMRS patients. When this feature is selected, a form loads and the user is prompted to fill data for the minimum fields that OpenMRS requires for a patient creation. Once the form is filled out, and the form submitted, the newly created patient should be visible in the patient list in OpenMRS. Note that for the phone to download the new patient, there has to be a cohort that includes this patient, and the user needs to re-download that cohort.

Image Added

Feedback from Initial Testing (using Nokia N80 and MFU W71)

...