Administering FormEntry
Overview
The OpenMRS FormEntry module uses Microsoft® InfoPath™ to gather data for the repository.
- You must have dictionary concepts defined for each question and answer on your form.
- The form definition is created by defining a hierarchy of fields that will be used on the form.
- The layout of the form hierarchy currently has some restrictions imposed by how the forms are eventually translated into the database
- Form hierarchies should have the following sections (in order)
- *PATIENT — as a section field
- *ENCOUNTER — as a section field
- *OBS — as a concept field with the concept MEDICAL OBSERVATIONS
- *ORDERS — as a section field
- There are certain fields that are required for an encounter and these must be present within the form hierarchy under the appropriate section.
- We have created the "Basic Form" as a starting point. The basic form contains all of the required fields to get a form working. You should always start a new form by making a copy of the Basic Form and giving your copy a new name.
- The layout of the form hierarchy currently has some restrictions imposed by how the forms are eventually translated into the database
Design Form
- If you have not just finished designing the schema...
- Log into OpenMRS as an administrator
- Navigate to Administration ? Forms
- Click on the <u>Edit Metadata</u> link next to your form name
- Click on the <u>Download XSN</u> link
- Do not open the file with InfoPath (the default action); rather, save the file to disk
- Right mouse click the saved XSN file and click 'Design' to open it in Microsoft Infopath in design view
To add form controls:
- Select Data Source from the right navigation menu.
- Right-click a form element from the Data Source menu.
- Drag-and-drop the form element into the main content section.
- : NOTE: for typical observations, you may want to drag the child "value" element instead of the entire observation element
- : NOTE: For nicely-formatted form elements such as selection boxes and check boxes, use a coded item from your schema, and make sure that it is not set to Multi. Drag the value over to where you want. Afterwards, you can use the Properties dialog to give the form display values of your choosing.
- Select a form control from the context menu that is displayed.
To add layout elements:
- Move the blinking cursor to the content area where you would like to add a new layout element
- Select Layout from the right navigation menu.
- Select a layout option from the Layout menu.
To get just the concept name displayed you need to use some xpath scripting:
- Right click on the input box in design mode and select "Expression Box Properties"
On the "General" tab, in the "Data Source" section, in the "XPath:" textbox, paste:
substring-before(substring-after(., "^"), "^")
Publish Form
To publish your form to the web (general instructions):
- Save XSN to filesystem (assuming you are still working within InfoPath).
- Close InfoPath.
- Log into OpenMRS as an administrator and go to Administration ? Forms
- Click on the <u>Upload XSN</u> link
- Browse to your XSN and upload it
Editing a Form
DO NOT design the XSN that the server uses. The folder specified in the runtime properties for OpenMRS (via the formentry.infopath.output_dir property) is for use ONLY by OpenMRS. You should never manipulate these files directly. In order to get files into that folder, use the "Upload XSN" function. In order to get files out of that folder, use the "Download XSN" function.
Duplicating a Form
Duplication of form is now easily accomplished using the Manage Forms page. Simply select the form you wish to duplicate using the drop down box and then press duplicate. You will be taken to the meta data screen to allow you to change the name and the version. Of note, you have to change the build number in the database directly if you require (form table). It is important to note that XSNs have database form IDs incorporated, so one form cannot be used on another system unless you use the new Import/Export module (which requires identical Concept dictionaries). Occasionally it is necessary to change the ID of an XSN after it has been exported. This can be done using the old method of duplicating form (adapated from Andy's message):
- Open the XSN of the form in Design mode (right mouse click the file and choose design) and select File ? Extract form files from the menu to save the form as separate files. Then close infopath.
- You will now see a folder with the name of your duplicate form. Inside this folder you will see some files. Edit the FormEntry.xsd file with a text editor (wordpad or notepad) and find the line:
:
<xs:attribute name="id" type="xs:positiveInteger" fixed="n" use="required" />
- : where n is the id of the form.
- Change the n within <tt>fixed="n"</tt> to the form id of the form in the databas