OpenMRS ADT generation for COVID response

Folks, Suranga K again. Its been ~3 years? Pleased to talk to you again.

We’re operationalizing OpenMRS for some high priority COVID work in the US. We need to trigger an ADT message generation from a HTML form submission. What is the best way to do this? Do we have any production ready ADT generation code? is there functionality to trigger this on form submission? I’m told that @wyclif worked on this, but was unable to find anything online. We would be happy to re-purpose anything you may have to offer.

CC’ing @paul


We did exactly that with a post-submission action that would admit or discharge the patient based on some obs logic out of the submitted form.

@ruhanga could please share a sample snippet? On my phone right now. So it’ll be the first of us two :wink:

@suranga unfortunately the module where this is done isn’t public, but it’ll be ok to share the significant snippet.

1 Like

Yay! thanks @mksd and @ruhanga, yes, please share. Did you happen to have any ADT generation code as well? we would greatly appreciate it :slight_smile:

Just a thought on this

  1. The Task Scheduler allows triggering of a task via REST
  2. After post submission - you can trigger a REST call to run a task that triggers the actions that you want
  3. The code for the actions you need are then isolated from the post-submission

If you want to this task can be scheduled to run every hour to process any actions that may be needed


@ssmusoke, thank you! would there be any example code on how to leverage this approach?

@suranga, we’ve used the post-submission action for an admission/discharge use-case. To use the same for the ADT generation, you will implement org.openmrs.module.htmlformentry.CustomFormSubmissionAction probably in a custom module then provide the full qualified class name in a postSubmissionAction tag, in the form. The FormEntrySession would provide you with all the collected and saved info on the form.

Code Snippet:

package org.openmrs.module.custom.htmlformentry.action;

import org.openmrs.module.htmlformentry.CustomFormSubmissionAction;
import org.openmrs.module.htmlformentry.FormEntrySession;

public class AdtGeneration implements CustomFormSubmissionAction {

    public void applyAction(FormEntrySession session) {
	    // ADT generation logic

HTML form entry tag snippet:

<postSubmissionAction class="org.openmrs.module.custom.htmlformentry.action.AdtGeneration"/>
1 Like

thank you @ruhanga, @ssmusoke @mksd, this is perfect, and works great!

1 Like