Best way for Migrating Patients Between OpenMRS Instances

Hello,

As part of our project, we are facing the task of migrating a comprehensive set of patient data (such as patient information, visits, encounters, and related records) from one OpenMRS instance to another.

Could anyone advise if there exists a recommended approach or specific tools for migrating patient data between OpenMRS instances? Any insights or experiences shared would be greatly appreciated.

Thank you.

1 Like

Why not dbsync? You guys are already using it no?

Hello @mksd,

Is a different case, dbsync does the synchronization from the OpenMRS Field → OpenMRS HQ. And we want to migrate some patients from OpenMRS HQ → OpenMRS Field.

The ideal solution is having the dbsync working both ways. But for now, the goal is to migrate the patients to start with the box in the field.

Hi @luis.oliveira , a few years ago we had a similar need here at PIH. We had to selectively migrate the patient records from one OpenMRS instance to another. We just a wrote a couple simple pages that allow us to export the patient’s visits/ecounters/obs to a JSON file and then import that exported JSON file on a different server:

Here are the two export/import pages:

The main code is in these javascript files:

5 Likes

@luis.oliveira what I’m suggesting is to leverage the capabilities of dbsync to perform a one-off patients data migration (operating from a copy of your origin database not necessarily running it from the actual production HQ, if need be). You could tweak it for the sake of the one-off exercise to operate the selection of the subset of patients that you are interested in.

The reason why I mention that is because we have used dbsync that way in the past in one of our projects.

1 Like

Thanks @cioan,

Seems to be in line with what we need.

This development is part of your distro right? Not a stand-alone module? Is it possible to select the patients based on a filter or must be one by one?

Any possibility there could be similar patients in both instances? if those are separately unique and you would want just to merge them and NOT caring of duplications, you could write a routine through the API to read csv relations and add those records on top of the others(though slow), it has worked for me.

1 Like

You could select and export all patients on the list, or one by one. I think it would be easy enough to implement any filter you like. This code is in the pihcore module which is part of the PIH distro. But I think that it could be easily migrated to the coreapps, or re-written using the O3 framework?

1 Like

Could this process be reverse engineered to import patients not already in an OpenMRS instance? Or would that just be too much trouble? I am still looking for a way to “preload” OpenMRS with patient data exported from a non-OpenMRS EMR or other database that would include not just demographics but also things like diagnosis list, medication list, lab observations, etc.

1 Like

@akanter that’s what we did actually in the context of a particular project, we tweaked dbsync to import patients from a legacy system into OpenMRS. As usual with such patients migration, it’s all a bit of a one-off exercise.

1 Like