Encounter Synchronization Best Approach


I have been working on adding support for Encounter sync. But as I moved on, I some how became myopic. I think I’m not even sure of what am even doing.

How does sync2 handle this?

Actually am not a sync2 guru but with a quick analysis, sync2 doesn’t support the ‘Encounter’ resource but it only syncs the Visit Resource as part of the Encounter :slight_smile:

How I was planning to approach this!

I cameup with duplicate dozer friendly beans that I would use copy all required merge able data/attributes to be synced to other instances.


An Encounter has quite a complex hierarchy level. That where we have the Obs and there Obs is made up of Concepts.

Zeroing on a Concept alone, its some other wide metadata alone. As I made more research on this, I hit upon what @dkayiwa said about Concepts here

Site level users and metadata are not synced, neither are concepts and forms, as they are expected to be similar

Whats the best approach here, could I just keep track of just a Concept and User Identifier or will need to explicitly transfer a solid Encounter objects with all Concept objects in the same batch!

cc: @ssmusoke, @dkayiwa

Actually the following also needs to be addressed.

As we implement this, I’m sure that merged data(father instance) should be in a read only format. Loosely meaning it has an impaired scope. A merged Encounter shouldn’t be 100% of same utility with the original.

So what should a merged Encounter be expected of/to contain by a Provider. Technically speaking what are the crucial attributes of the Encounter Resource?

cc: @ssmusoke, @dkayiwa, @darius

@samuel34 The aim is to ensure that the complete encounter is synchronized, otherwise the merged data is not useable.

Oooohh, cool thats what I was also anticipating.

Any comment about this. Could this be the best approach?

I’m still confused with this :expressionless:

cc: @ssmusoke, @dkayiwa

@samuel34 This is why I am pushing to see how to leverage the sync 2 module otherwise you will need to build mappings for Patients, Visits, Encounters, Obs …

With obs you will need to handle concepts with values (date, numeric) then complex obs, coded concepts, grouped concepts etc which I promise you will get very hairy :wink: very fast

To be more specific, I’m confused with @dkayiwa’s dev notes

Site level users and metadata are not synced, neither are concepts and forms, as they are expected to be similar. The merged data (father instance) would be read-only, used reporting and analysis purposes.

How to address this. While syncing Obs, you mean we just need the Concept ID?

The challenge with is for sync2, it just makes use of the Openmrs REST API which make syncing its Resources easy and with less headache. But for our implementation, it just impossible to use REST Since data should be physically in a file :slight_smile:

But with your currently clarification, it can keep me moving for a while

And btw, looking at the sync2 codebase, there is no Mapping for Encounters, Visit and Obs since it doesn’t even support Encounters.

:fearful: :raised_hands: