Uploaded image for project: 'OpenMRS 3.x Frontend'
  1. OpenMRS 3.x Frontend
  2. O3-1041

Refactor patient-forms-app to use a configurable list of HFE forms

    XMLWordPrintable

Details

    • Enhancement
    • Status: Done
    • Must
    • Resolution: Fixed
    • None
    • None
    • None
    • Undetermined

    Description

      Currently, the patient-forms-app has a mechanism for distinguishing between HTMLFormEntry forms and non-HTMLFormEntry forms. HTMLFormEntry forms are launched in a new page while other forms are launched in the workspace.

      The problem is that the list of HTMLFormEntry forms is hard-coded. This should be refactored so that the list of HTMLFormEntry forms can be configured by an implementation.

      This can be done by defining a proper configuration schema for the form app. For now, the idea is just to externalise what's already hard-coded, e.g., something like:

      import { Type } from '@openmrs/esm-framework';
      
      export const configSchema = {
        htmlFormEntryForms: {
          _type: Type.Array,
          _elements: {
            formUuid: {
              _type: Type.UUID,
            },
            formName: {
               _type: Type.String,
               _description: 'The name of the form'
            },
            formXmlFileName: {
               _type: Type.String,
               _description: 'The name of the XML file that defines the form'
            },
            formUiPage: {
              _type: Type.String,
              _description: 'The HTMLFormEntry page to use to show this form. Should be one of "enterHtmlFormWithStandardUi" or "enterHtmlFormWithSimpleUi"',
              _validators: [validator(p => p === 'enterHtmlFormWithStandardUi' || p === 'enterHtmlFormWithSimpleUi', 'Must be one of "enterHtmlFormWithStandardUi" or "enterHtmlFormWithSimpleUi"')]
            }
          }
        }
      }
      

      The existing hard-coded values should then be converted as the default value for this schema. This will allow implementers to define what forms should be registered as HFE forms, at least until a better mechanism comes along.

      Gliffy Diagrams

        Attachments

          Activity

            People

              icrc.psousa Pedro Sousa
              ibacher Ian Bacher
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: