Sync 2.0 - Manual synchronization of selected records

Dear community,

We’re currently working on a feature in Sync 2.0 module that allows executing manual synchronization of selected records. It’s going to be an API that exposes method, that could be easily used in a custom widget in other modules - for example from the patient page.

From my research follows that when we’re retrieving any feeds from AtomFeed - each found one is immediately being processed. We can specify the category - so for example, only patients would be synchronized, but there will be a problem with synchronizing single entity.

I’m wondering if that’s even possible use case, that someone would want to synchronize a single object if probably there will be a scheduled task to synchronize all of them anyway. I wasn’t able to find any reasonable solutions to synchronize a single object with AtomFeed - we could, for example, save objects that were found by AtomFeed but wasn’t synchronized, and synchronize them later, in scheduler execution - but I’m not sure it’s worth it, as this might not be even used in the future.

Do you think we should cover the case when only one specific object is being synchronized? If so, do you have any better ideas on how to achieve this?

1 Like

If you do not see an immediate need for it, to the point of saying that it might not even be used in the future, then i would say, do not implement it.

Thanks for your response, I’ll leave this use case then. At least untill it’ll be needed.

I think this would be very helpful in troubleshooting/fixing sync errors. Here is one example (…though this is between OpenMRS and OpenELIS). There are for example cases you can have an obs failing to sync because it can’t find the corresponding patient/person on the destination server and you need to find a way to trigger sync for that patient record only.

Thanks for your response. I believe the best way for troubleshooting/fixing sync errors will be using the Sync 2 Audit Log (https://wiki.openmrs.org/display/projects/Auditing+and+error+handling). There you can find information about failed transactions and you can retry the transaction. I think it should be more convenient because you will have information about all the errors in one place.

I was talking more about what to do once you have identified the issue. In the example I gave (…of an Obs failing to sync because it can’t find the corresponding Patient/Person), Audit Log will show me the reason why the record is failing to sync but it won’t help me to fix the issue. -Clicking on retry will just still fail with the same error as it will not send the missing patient/person record. The solution is to find a way to synchronize that patient/person record first and once it has successfully synced, you can then click retry on the obs record.

Now I see your point of view. Thanks a lot for your clarification.

In that case we’ll try to provide some functionality which will let us synchronize a single object. Using the AtomFeed to synchronizing single entity will be problematic, so I would suggest using the SyncClient to update this entity. I’m not a hundred percent sure but update method should create the object if not exist.

FYI: @ohinc