FormEntry Technical Overview
The OpenMRS FormEntry module uses Microsoft® InfoPath™ to gather data for the repository.
[edit]
Designing Forms
- The form hierarchy (or schema) created within the OpenMRS web application defines an XML Schema for data collection. Essentially, the form hierarchy defines all of the data points that will be (or could be) gathered on any particular form.
- When you download a form for the first time, the schema your have defined along with an XML template that follows the schema are injected into a starter form that contains the basic layout and plumbing for InfoPath. A downloaded XSN should be saved to disk and opened with InfoPath in design mode — e.g., right-click the XSN file and select "Design" from the context menu.
- During the design process, forms that are saved to disk are automatically altered internally by InfoPath. The URLs in the form are changed to point to the local file system.
- When you upload a form through the OpenMRS web application, the internal URLs are converted to the appropriate value based on the server's URL and the file's location on the server.
[edit]
Submitting Forms
- When an InfoPath form is submitted to the server, an XML file containing the form data is actually posted to the server (via HTTP POST protocol, just as you were submitting a web-based form)
- The server places the XML file (unchanged) into the
formentry_queue code> table - A scheduled FormEntry queue processing task scans the
formentry_queue code> table every 30 seconds and, when records are found, process queue entries. The XML is translated using the form's XSLT template to create an HL7 message to be placed in thehl7_in_queue code> (HL7 inbound message queue)- If errors occur, the record is transferred to the
formentry_error code> table and processing stops - If no errors occur, the record is transferred to the
formentry_archive code> table and an entry is made into thehl7_in_queue code> (HL7 inbound message queue)
- If errors occur, the record is transferred to the
- An HL7 processor task scans the
hl7_in_queue code> table every 30 seconds and processes any entries that are found.- The open source HL7API engine is used to parse the HL7 message and create the appropriate
encounter code> andobs code> records. - If any errors occur, they are logged in the
hl7_in_error code> table; otherwise, the entry is moved to thehl7_in_archive code> table when processing is completed successfully.
- The open source HL7API engine is used to parse the HL7 message and create the appropriate
In summary, form data are initially placed in the FormEntry queue, translated into HL7 messages in the HL7 inbound queue, and then parsed into the individual encounter and observational data points. Subsequently, all data operations (other than auditing FormEntry submissions) are performed on data from the encounter code> and obs code> tables.
By FormEntry 1.2, we should be translating order data into appropriate HL7 messages to follow the same general flow and generate data within the order code> tables.
[edit]
Deployment Notes
- Be sure to set the formentry.infopath_server_url property at openmrs/admin/maintenance/globalProps.form
- As of Formentry version 2.6, the formentry_queue table is not used anymore, the default queue is done on the filesystem at $user/OpenMRS/formentry/queue
