Using HtmlFormFlowsheet Module in KenyaEMR

Hello team,

I am struggling to incorporate HtmlFormFlowsheet in htmlformentry module. I keep getting the error: “java.lang.IllegalArgumentException: You must specify either an htmlFormId or a formId for a valid html form org.openmrs.module.htmlformentry.web.controller.HtmlFormEntryController.getFormEntrySession(”.

In KenyaEMR we use form uuids and am wondering if it is the way the forms are stored. I would really appreciate your feedback on this. @darius, @mseaton, @dkayiwa

Regards, Antony

Can you give more details on what you are exactly doing and the full stack trace?

@dkayiwa thanks for this. We are building htmlforms in KenyaEMR and these are rendered using htmlformentry module on the UI framework platform. We have a current need to nest forms within a form and htmlflowsheet module came in handly.

I started testing the incorporation of htmlflowsheet module like shown below: >

            <section headerLabel="Testing Flow Sheet Module">
                <htmlformflowsheet showHtmlForm="true" formId="59ed8e62-7f1f-40ae-a2e3-eabe350277ce" />

This renders the form

On clickicking the Add New button, I get an error indicating need for formID. The error is

Also attached is the error log: error.log.txt (10.7 KB)

We are running the following versions of modules: HTML Form Entry v2.4 htmlformflowsheet v1.4.1 OpenMRS platform v1.9.9

Please let me know if I need to provide additional information.


@dkayiwa was the explanation adequate? Please also note that the forms are defined in htmlforms directory are required by UI framework and are not saved in the database. I am curious to see where the htmlflowsheet module has been used in conjuction with UI framwork.



Have you guys installed this

since you are running openmrs-platform 1.9 ?

have you seen this

the instructions seem to suggest you must also have htmlformentry19ext module installed if you are running platform 1.9

Thanks @tendomart. I will verify and rever. Thanks for the direction so far.

@aojwang am humbled to serve you sir.

@aojwang, I do not believe the htmlformflowsheet module was written to support these use cases. As far as I recall, it requires a form to actually be saved to the database, and it requires configuration by form id, not uuid. These are things that could be changed, but I do not believe this module gets a lot of current support. Are you interested and able in making the necessary updates to the module?


@mseaton I also thought the module requires access to htmlforms stored in the database. I am really interested to do a fix for this and the earliest chance I have is from mid Sep. I will pick it up if none will have picked it by then.

Thanks so much for the help.

@mseaton I am revisiting this with intention to make this module handle the use cases I had earlier on indicated. In your view, do you think it is still a valid project with regard to possible benefits to the community?

@aojwang, I’m not sure - I don’t hear much clamoring for it, and I personally ended up writing an alternative in Malawi when we needed better flowsheet functionality. I’d be more inclined to take that code and pull in into a more generic format than to invest in the older htmlformflowsheet code, if I were working on it. But really up to you and what you feel you need.

Best, MIke

Thanks so much Mike. I will look at the alternative and get back with to you. In the meantime, would you mind sharing with me any documentation on the module and possibly just a few screenshots?


@aojwang it isn’t really documented particularly well - the best documentation is really just looking at the code.

The basic principle is that there is a single page (controller + gsp) that renders a “mastercard”. A mastercard contains 2 basic constructs:

  1. A single header (represented by an htmlform) that can be filled out exactly once (it may be edited, but not repeated) and is on the top of the page. This generally contains demographic details and information collected at enrollment into a program.

  2. One or more flowsheets, each represented by an htmlform that renders a header row and a data row for each encounter associated with that form. Typically these forms are configured with both a “view” and an “entry” section, so that it is optimized for entry/edit and view differently as needed.

A specific flowsheet is simply an instance of the “mastercard” page with parameters passed in to specific what the header form, mastercard forms, and specified patient are.

Most of the code is in single jQuery-based javascript file that is responsible for loading, rendering, and submitting the htmlforms asynchronously, as well as doing some built-in validation. The lions share of all of this is generic, though there will be a few things in the code that is specific to our Malawi implementation, that would need to be extracted.

A few screenshots:

Entering the initial header encounter

Viewing the initial header encounter, link available to enter flowsheet encounters

Entering a flowsheet encounter

Viewing a mastercard after 2 flowsheet encounters entered

I’ve had on my wish list for a while to try to port this over to a more generic module - like htmlformentryui perhaps. It really wouldn’t be a lot of work - there are only a handful of classes and they are mostly already generic. But I just never found the time to prioritize it. Let me know if you are interested in giving it a shot! :slight_smile:

Best, Mike

Thanks for the elaborate explanation. I am considering to prioritize this work in the next few weeks and I will surely reach out to you for further direction. @mogoodrich has also explained to me the PIH “Visit Note” functionality which seem to do something similar.

This feature can as well be a good topic for this year’s hackathon just in case it is not finished before the conference. what do you think?


@aojwang, yes I had that thought too - could be the right size and scope for a hackathon project. Let’s consider it.


Thanks so much.

@aojwang - good working with you and the rest of the KenyaEMR team this year in Nairobi. Following up from our sessions, I have made some follow-up commits to address the issues we were facing. I have also made some additional changes to fit this properly into the reference application or another patient ui. Have a look at the updated README and install the latest htmlformentryui and flowsheetexample modules, and let me know how you get on with things.

Best, Mike

1 Like

Thanks so much for getting the solution Mike. Our team will test this and revert to you. Regards, Antony

@mseaton - We were really glad to work with you on this item and thanks so much for everything. We tested the changes and all worked as expected. For our use, we may need to test the module against lower versions of reporting, serialization-xstream and uiframework modules. We shall provide feedback once the testing is done. Thanks so much.