Versions Compared

Key

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

Background

Originally, the only way to create data entry forms in OpenMRS was using Microsoft Infopath. Now there are alternatives--one that has several advantages is the HTML Form Entry module. It would ease migration to this module if there were an automatic utility to convert an Infopath form to an HTML Form. The point of this project is to write that utility.

[edit]

What's in an Infopath form? An HTML Form?

An Infopath form is an XSN file. (This is actually just a CAB archive with an XSN file extension. Windows can handle these natively, while on linux you'd use the 'cabextract' utility.) Among other files, the archive contains:

...

An OpenMRS HTML Form is an xml document that contains mostly HTML, but also some special tags, in particular <obs/> which puts an observation widget on the form. See [[Html_Form_Entry_Module#Example_HTML|archive:an example] ?HTML Form Entry Module for an example and all available tags.

[edit]

Examples

Attached here is an example of an Infopath XSN file that represents PIH's Cardiology Consultation form. We will use this as an example. To see what this looks like you would need to download the file, and (in Windows) right click on it and say Design.

[edit]

What you need to do

You need to merge the xsl files in the infopath XSN, along with supporting information from the xsd file in the XSN, and create an HTML Form Entry xml document from it. Using XSLT might be the way to go, or else doing some brute-force java code with regex searches.

...

Element

Infopath representation

HTML Form Representation

Pages

File names page1.xsl

Code Block

<htmlform>


    <page title="Page 1">


    ...


    </page>


    ...


</htmlform>

Sections

???

Code Block

<section headerLabel="section 1">


   content here


</section>

Patient Name

(other things besides given_name work similarly)< span hideFocus="1" ... xd:binding="patient/patient.given_name" ... >
<xsl:value-of select="patient/patient.given_name"/>
</ span>

Code Block
<lookup expression="patient.personName.givenName"/>

Encounter location

the whole radio button section with Rusumo, Mulindi, etc.

Code Block
<encounterLocation order="30,27,etc"/>

Encounter date

Date picker widget bound to encounter/encounter.encounter_datetime

Code Block
<encounterDate/>

Encounter provider

Widget bound to encounter/encounter.provider_id (after "Form completed today by:")

Code Block
<encounterProvider/>

Checkbox for coded observation

the checkbox before "patient est hospitalisé"

warning that this cannot be handled correctly (because of the value-when-unchecked<obs unchecked)

Code Block
<obs conceptId="3389" answerConceptId="1065"/>

Checkbox group for multi-select coded observation

The checkboxes in 3. like "bonne apparence" and "cachectique"

Needs multiple widgets:

Code Block
<obs conceptId="2419" answerConceptId="3227"/>


<obs conceptId="2419" answerConceptId="5622"/>

Radio button group for coded observation

the radio button group including "NYHA classe I"

Collapse to a single element. If you change the layout, give a warning.

Code Block
<obs conceptId="3139" style="radio" answerConceptIds="3135,3114,..."/>

Select list for coded observation

no examples in this form

archive:HTML_Form_Entry_Module_HTML_Reference#Boolean

Checkbox for boolean observation

the checkbox before "La même que DDB" in 1.C.

Code Block
<obs conceptId="6208" style="checkbox"/>

Other booleans

no examples in this form

Code Block
<obs conceptId="a" style="checkbox"/>

Textarea for text observation

text box under "La même que DDB" in 1.C.

Code Block
<obs conceptId="3221" style="textarea"/>

Text field for text observation

text field in first row under "4. Labos préalables"

Code Block
<obs conceptId="2216"/>

Text field for numeric observation

the text box after Poids

Code Block
<obs conceptId="5089"/>

Date observations

The column under "4. Labos préalables"

Code Block
<obs conceptId="3267"/>

Submit button

 

Code Block
<submit/>

Other HTML Markup

< table > < div > ...

Pass this straight through

...

Obs Groups

  • If an obs field is not directly in the <obs> section of the xsd, but it's inside a grouping concept, it needs to result in an <obsgroup groupingConceptId="567">...</obsgroup>
    • Note that obs groups in HTML forms need to have all their widgets next to each other, whereas this isn't required in infopath. If you find something that can't be represented, then throw an error.