Skip to toolbar

Community & Business Groups

Health hacks and XForms

I thought you might be interested in an XForms based web application – the foundation for which was created at a 2-day health hack known as NHS hack-day (NHS is the National Health Service in the UK).

At the hack I proposed an electronic forms based application specifically for pre-operative assessments (essentially a set of questions designed to ascertain the background health and associated anaesthetic risk for patient scheduled for surgery). As I had previous experience of XForms I wanted to use XForms to create the front end of the application. The main requirements I had were a good fit for XForms – see below:

  • The form should be as intuitive as possible for the patients:
    • This meant that the form should be based upon clearly laid out sections – in this case I used the <xf:switch/> statement to present different sections.
    • Questions posed to the patient depend on their previous answers – here I used a mixture of <xf:group ref=”.[conditional statement]”> and <xf:bind id=”SomeId” relevant=”conditional statement”/> <xf:select1 bind=”SomeId”/>
    • Errors on the form needed to be clearly highlighted to the user with associated help/hint text – a feature directly supported by XForms
    • The form needed to be “pretty” – Not being a UI expert I used Twitter’s bootstrap to help style the form. This is still work in progress and I did need to figure out a few things but the integration so far with XSLTForms has not too been too painful.
  • Options for select controls need to be sourced externally.
    • In the current version of forms4health I have used a simple XML data models.
    • In a full blown application these may be more complex in be sourced from an standalone terminology server.
    • Either way the use of <xf:model/> and the <xf:itemset/> allows this information to be losley coupled to the form.
  • The results of the form need to be sent/saved as XML
    • The healthcare administrator “booking” the assessment has a choice of PDF or XML as the output of the form submission – here I used XForms to send the XML to a background Java servlet that either forwarded the XML directly or created a PDF via XSL:FO / FOP.
    • Where XML is requested this is typically for integration with the healthcare institution’s own systems, however the specific XML may vary depending on healthcare facility. This implies the need for lose coupling between the UI and the data – The MVC architecture of XForms allows this coupling to be defined declaratively.
  • The form needs to be available on a variety of platforms
    • In theory this is well aligned with XForms however (and I may be wrong) for now I think the majority of XForms applications are still being developed as web-sites/embeded in HTML.  I used XSTLForms as this supports a large number of web browsers, however I have pre-processed (transformed) the xml files to html to ensure as wide a compatibility as possible (you will be able to see the difference between and if you do “view source”)
  • The form and associated functionality needed to be developed quickly
    • The declarative nature of XForms allowed us to build upon the excellent foundation provided by XForms to rapidly generate working applications

Overall XForms was great for being able to quickly create a very usable application with relatively simple/lightweight backend logic to produce a workable application. I am hoping the demo site will provide enough inspiration for an NHS (or other healthcare provider) organisation to sponsor the development of a fully functioning service.

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you comment here, note that this forum is moderated and your IP address is sent to Akismet, the plugin we use to mitigate spam comments.