Versions Compared

Key

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

Table of Contents

Custom Sections and Fields on the Registration App

...

  1. Navigate to System Administration-->Manage Apps
  2. Click the square disable button beside "referenceapplication.registrationapp.registerPatient" to disable the integrated Registration App configuration.
  3. Add a new App Definition by clicking "Add App Definition".
  4. Give your new App a name, perhaps "referenceapplication.registrationapp.myRegisterPat".
  5. Copy the latest template for the registration App, found here (note that the square brackets before and after should not be used). 
  6. Paste this into the Definition (required) field.
  7. Modify the ID to represent the ID you specified in step 4 above.  For example, change "id": "referenceapplication.registrationapp.registerPatient", to "id": "referenceapplication.registrationapp.myRegisterPat",
  8. Modify the URL line to represent the ID you specified in step 4 above.  For example, change "url": "registrationapp/registerPatient.page?appId=referenceapplication.registrationapp.registerPatient", to "url": "registrationapp/registerPatient.page?appId=referenceapplication.registrationapp.myRegisterPat",
  9. If you prefer, you can change the "description" and "label" fields to your liking, for example, name them in your language.  You can also change the icon and order to your liking.
  10. Save the new App configuration.

Info
titleNotes:
  • If you have a syntax error, it will give you an error "Invalid Json", and not let you save it until fixed.
  • If you didn't change the App ID in the Json, it will give you an error "The App ID should match the one in the definition" when you try to save it.
  • If the App name is too long, it will give you an error like, "Failed to save referenceapplication.registrationapp.myRegisterPatient", and not let you save it.

...

  1. Find the UUID of the Person Attribute Type (s) that you want to add to the Registration App. 
    1. Go to System Administration --> Advanced Administration --> Manage Person Attribute Types
    2. Click on the name of the Person Attribute, for example "Mother's Name".
    3. You will find the UUID listed in grey, for example... 8d871d18-c2cc-11de-8d13-0010c6dffd0f
    Note: If the person attribute you want to add doesn't yet exist, you can create it here.
  2. Open the App you created in the Initial Steps above.
  3. In the list of sections you can add a new section, or you can simply add the person attribute to an existing section.  Sections and fields are separated with a comma.  The code to add a question of Mother's Name is...

    Code Block
    languagejava
    titleMother Name Person Attribute Field
          {
           "type": "personAttribute",
           "label": "Mother's Name",
           "formFieldName": "mothersName",
           "uuid": "8d871d18-c2cc-11de-8d13-0010c6dffd0f",
           "widget": {
                      "providerName": "uicommons",
                      "fragmentId": "field/text"
                     }
           }

    If you want to add the question in a section of it's own, you would use something like this, placed in the list of sections...

    Code Block
    languagejava
    titlePerson Attribute in own section
    {
        "legend": "My Person Attribute",
        "id": "myPersonAttributeLabel",
        "fields": [
          {
           "type": "personAttribute",
           "label": "Mother's Name",
           "formFieldName": "mothersName",
           "uuid": "8d871d18-c2cc-11de-8d13-0010c6dffd0f",
           "widget": {
                      "providerName": "uicommons",
                      "fragmentId": "field/text"
                     }
           }
          ]
    }


  4. Change the "uuid": value to the UUID of the Person Attribute that you want to appear in the Registration App.
  5. Save your App and enjoy!

...

Here's where it's exposed in the UI where users can click on the identifier to edit it.

Configuring a dropdown widget that consumes a concept-set in the Registration App

A drop-down widget to capture Concept formatted person attributes types can be defined/configured as follows below. One can provide the options as a map of 'options', 'conceptSet' or both as seen in the below example.

Code Block
languagejs
titleDropdown widget that consumes a concept-set
{
    "id": "nationality",
    "legend": "Country of Origin",
    "fields": [{
        "label": "Country of Origin",
        "type": "personAttribute",
        "formFieldName": "nationality",
        "uuid": "9895c7d0-f4eb-4f0b-8413-86f293700f5c",
        "widget": {
            "providerName": "registrationapp",
            "fragmentId": "field/dropDown",
            "config": {
                "formFieldName": "nationality",
                "conceptSet": "165657AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "options": [{
                    "label": "",
                    "value": ""
                }],
                "initialValue": "",
                "hideEmptyLabel": true,
                "expanded": false
            }
        }
    }]
}


Integrating with a Master Patient Index

...

Note: The app needs to have an address field. If it does not, such as in the "registrationapp.basicRegisterPatient" (defined in openmrs-module-registrationapp/omod/src/main/resources/apps/registrationapp_app.json) you will receive the following errors:


ERROR - PixPatientExporter.exportPatient(47) |2018-06-25 15:07:18,328| java.util.NoSuchElementException

...

Thus, if you use a registration app that has all the required fields, such as the referenceapplication.registrationapp.registerPatient that comes with the reference application, it will not produce that error.

------------------------------------------------------------------------------------------------------------------------

...