TIL: PIH has an open tool for migrating patients between OpenMRS instances

Today I learned on today’s O3 design call: PIH has a public tool for moving patient records from one OpenMRS server to another.

It exports each patient’s full record as JSON through the REST API, then imports it into the target server. PIH used it to merge two instances in Malawi and is using it now to bring their Haiti servers into one.

Any implementer could run into a migration like this at some point, so I’m sharing it here in case it’s useful or gives you ideas for your own.

@cioan @fanderson, thanks for sharing this! Anything more you’d add?

or @mogoodrich ^^

Yes, feel free to take look. I’ll note that in the process of building it I have been focused on PIH use cases and not thought about general ones, but most of the code should be fairly generic.

Recently I had Claude develop a bunch of scripts (also included in the repo) to run through the entire process. The new scripts have only been tested once, but hopefully they will tested again and used for real next week.