Community Health Toolkit

OpenMRS integration capabilities

Hi there! We’re chatting with a partner who has asked about Medic Mobile and OpenMRS integration capabilities. I found this page that indicates it will be possible to exchange patient-level data, but I’m struggling to find additional documentation. Questions:

  1. What MedicMobile-to-OpenMRS integration is available out-of-box? How does it work?
  2. Does the integration only support writing of OpenMRS patient data? Will it allow for reading and writing of OpenMRS resources? And can it access other OpenMRS resources beyond patients (i.e., encounters, people).

Thanks for the info and apologies if this documentation does already exist somewhere!

2 Likes

Hi and welcome @aleksa-krolls!

Integrations with the CHT are generally achieved by pushing data to other systems using the Outbound Push feature. It’s not OpenMRS specific, rather you configure the destination to be OpenMRS, map CHT fields to OpenMRS fields, and configure the path to the appropriate OpenMRS endpoint (ie, you are not limited to specific OpenMRS resources).

The Outbound feature is pretty flexible and, as far as I’m aware, has already been used to integrate with OpenMRS, RapidPro, DHIS2, and some bespoke systems.

For receiving data from OpenMRS, you can utilize the CHT API.

@derick @kitsao have some hands-on experience and can probably provide further details on some of the projects with live OpenMRS integrations.

6 Likes

Welcome to the forum @aleksa-krolls

On the OpenMRS side, you’d need to define and endpoint that maps the JSON pushed from CHT to concept questions and concepts. Here’s an example of what was done by our friends at Palladium when we collaborated on a CHT-OpenMRS solution for our Covid response for the Kenya MoH https://github.com/palladiumkenya/openmrs-module-kenyaemrhivtesting/tree/covid-19-response

If the patient identifiers are not the same across both systems, you’d need a bridge between OpenMRS and CHT for lookup/matching and the push the data using the CHT API. Something like OpenHIM would be useful there. We haven’t explored this yet but looking to do that down the road.

4 Likes

Thanks @derick and @michael for the quick replies and helpful examples! Great to hear this Outbound Push functionality exists out-of-box. We’ve just linked to this CHT page on our OpenFn docs page for our partners: https://docs.openfn.org/source-apps.html#community-health-toolkit

For our partners, it’s sounding like OpenFn/another middleware tool could be a good fit for any advanced integration mapping requirements involving (i) data cleaning or transformations, or (ii) looking up/matching records based on an external Id.

If interested, here’s an example of a custom “upsert” pattern we implemented on OpenFn to automate (1) searching for OpenMRS patients using a CommCare external Id before (2) creating an OpenMRS Encounter based on the incoming CommCare data. We could leverage the same pattern to integrate forwarded CHT data with OpenMRS.

//**USE CASE**Integrate CommCare with OpenMRS for real-time patient record exchange, duplicate-checking & automated data cleaning //
// 1. Search for OpenMRS existing patients using EMRID
getPatients(
  {
    identifier: state => state.data.emrId, //external Id from CommCare form
    v: 'full',
  },
  {
    exactlyOne: true,
  }
);

// 2. If found, use `uuid` to create new lab encounter
createEncounter({
  encounterDatetime: state => state.references[0].visitDate, 
  patient: dataValue('uuid'), //dynamically fill with CommCare data
  encounterType: 'f01c54cb-2225-471a-9cd5-d348552c337c',
  location: dataValue('identifiers[0].location.uuid'),
  encounterProviders: [
    {
      provider: dataValue('form.provider_name'),
      encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f',
    },
  ],
}); 
4 Likes

Thanks so much for sharing, @aleksa-krolls!