Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-3647

Should allow a form schema to be shared by more than one form entry module



    • Type: New Feature
    • Status: Closed
    • Priority: TBD
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Complexity:


      During the recent AMPATH xforms training, many wanted to reuse their existing form schemas (already used for infopath formentry) to create xforms. But this was not possible because whenever they were on the patient dashboard and tried to enter a form, always infopath came up. The workaround was to create new forms as duplicates of the same schema and ensure that they saved them with xforms. Problem with this was that whenever they needed to change the form schema, they had to make the same change in two places (one for the infopath form schema and the other for the xforms form schema)

      I wished choosing a form for data entry on the patient dashboard would, if the same form is attached to more than one module, present some sort of way to choose which module. Or any other way.

      NB: I noticed that this is not a problem for htmlformentry since it does not use the form schemas.

      Because i needed to continue the training without requiring my students to duplicate their existing form schemas, i temporarily created a hack in the xforms module which overrides the PersonFormEntryPortletController and instead of populating the model with Map<Form, FormEntryHandler> entryUrlMap which is keyed by Form hence meaning that the last module to be put as handler wins, it instead populates it with Map<FormModuleKey, FormEntryHandler> entryUrlMap where FormModuleKey looks like:

      public class FormModuleKey extends Form {
      	private static final long serialVersionUID = 1L;
      	private Form form;
      	private String moduleId;
      	public FormModuleKey(Form form, String moduleId) {
      		this.form = form;
      		this.moduleId = moduleId;
      	public String getName() {
      		return form.getName() + " - (" + moduleId + ")";
      	public Integer getFormId() {
      		return form.getFormId();

      As a result when a form had more than one module handling it, it would be be listed, under the formentry tab, as many times as the number of modules with the module id suffix as the example below:
      Basic Form - (xforms)
      Basic Form - (formentry)

      So now over to you all, do you think think we should allow a form schema to be shared by more than one form entry module?

        Gliffy Diagrams




              dkayiwa Daniel Kayiwa
              dkayiwa Daniel Kayiwa
              0 Vote for this issue
              12 Start watching this issue



                  Time Tracking

                  Original Estimate - 4 hours
                  Remaining Estimate - 4 hours
                  Time Spent - Not Specified
                  Not Specified