How to dynamically add support for my encounter type

I am developing a custom openmrs module [Reference App]. Within the module, I created new encounter types using the encounter service class. I added these new encounter to the patient visit actions.

For the form, i did not use the htmlform entry - this was because of my custom requirement. Certain details for the forms (some of which were autocomplete) were not implemented as concepts, instead, they were gotten from a custom database. With what I have when i save, needed details show up in observation, and when I check visit history, I can see them as part of past observation.

But with these came two issues:

  1. Edit - unlike the default encounter types (like Visit Note), the edit icon does not show up when checking the encounter types (past visit history). So, after doing a little research i discovered that in the reference app module,in the encounterDisplay_extension.json file, there’are default supported encounter types, which the editable properties are set to true. But since my encounter types are created dynamically, i may not be able to know their uuid (since i may install the module in more than one openmrs installation).

  2. My encounters still show as part of action for past visit, even when the record is already there. Any suggestions on resolving the above issue would be appreciated. @darius, @dkayiwa, @wyclif … Thanks.

@osagie.ehigiato I am following the PIH way of loading Encounter Types metadata via the Metadata sharing module ( like below:

  1. Define Encounter Types in a class like

  2. Define a bundle to install the Encounter Types like here

  3. In my module activator I do the following in the started Method: MetadataDeployService deployService = Context.getService(MetadataDeployService.class); deployService.installBundle(Context.getRegisteredComponents(EncounterTypeMetadataBundle.class).get(0));

  4. Since the UUIDs are available then you can extend them in a way similar the EncounterDisplay_extension.json file

PS: I generate random UUIDs from

1 Like

Thanks. I got it working. But when you click on the edit icon in the past vist, it takes you to a url like this: htmlformentryui/htmlform/

Is there a way I can change this default behaviour? Maybe in some configuration?


I have successfully resolved the first issue (with the custom edit link). This how my json app extension in my module now looks like…

[ `{ “id”: “referenceapplication.otherEncounterTemplate”, “extensionPointId”: “org.openmrs.referenceapplication.encounterTemplate”, “type”: “fragment”, “extensionParams”: { “templateId”: “defaultEncounterTemplate”, “templateFragmentProviderName”: “coreapps”, “templateFragmentId”: “patientdashboard/encountertemplate/defaultEncounterTemplate”, “supportedEncounterTypes”: { “78b53d2d-143d-4c44-b54e-dbc2e48672f8”: { // Presenting Complaint “icon”: “icon-question-sign”, “editUrl”: “consulttionnotes/complaints/{{patient.uuid}}&encounterId={{}}”, “editable”: true }, “9e6a8d37-4b11-4589-be71-ab9ef6287bd4”: { // Prescriptions “icon”: “icon-tablet”, “editUrl”: “consulttionnotes/prescriptions/{{patient.uuid}}&encounterId={{}}”, “editable”: true }, ``

But the second issue remains: when I enter my custom encounter types, it still shows as part of action for past visit.

Hello All, I am developing a drug order module where I have a form in a fragment displaying when the user clicks on a link/button named “Add”; In other words, when the user clicks on the “Add” link on the dashboard, a drug order (prescription) form appears on the side with fields to enter the drug composition details. When I am looking for is something similar to Visits page (snapshots posted above) When we click on the “show details” link, a fragment appears beneath the box… Could anyone please give me the link to this code. I have spent quite sometime trying to figure this out…

This is what I am looking for - Link

Sorry, please ignore the last line…there is no link

This is part of the Core Apps Underscore.js templating filling the dashboard’s encounter templates details upon clicking: