-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenMRS sync creates duplicate resources. #141
Comments
The So the idea was to add a window where a resource in one system that is not in the other is not created. It's not a good solution because creation times for corresponding resources in both systems can be different by much more than |
One fix for this could be to make sure that the FHIR server doesn't allow duplicate resources, based on id or any of the other So if a resource appeared in the comparison list for OpenMRS but not FHIR, but was actually in the FHIR server, the sync would still send a creation request. But it wouldn't matter, it would get a 40X error and not do anything. |
@witash While working on the I manually created the
I will pick this up from the bug and fix the actual issue with the duplicates once I am back on Monday (28th of this month) and have the defaultChannelConfig automatic setup be a separate issue. |
setting up the defaultChannelConfig is in this branch #139 Hopefully by the time you're back we'll have these merged to openmrs_mediator |
@witash I added a duplicate GET results from FHIR
|
I was able to reproduce part of the issue, although not the whole thing.
What I think may have happened in the gandaki dev instance instead is that then, duplicate CHT patients were created, which then created new patients on the FHIR Server. |
I have a PR that addresses this issue by adding a check by an identifier for patient records. I'll handle the same problem for encounters in this issue.
The same PR changes when we create the patient in the CHT to only when a new resource is created in FHIR by checking for only the 201 status code. |
OpenMRS sync currently subtracts the
2 * SYNC_INTERVAL
from theSYNC_PERIOD
to decide how long ago to sync. So if it's syncing 1 hour ago every minute, it only syncs resources which were updated in the last 58 minutes.This works around an issue where it was creating duplicate resources based on resources it had already created, but it does not really fix the core issues and is very confusing.
This workaround should be removed, and duplicate resources should be prevented by fixing the bug in the code that is supposed to be checking unique keys.
The text was updated successfully, but these errors were encountered: