This is truly an outstanding discussion!
My impression is that although convenient, the openmrs events module suffers from two challenges. First, via a customized approach, it’s taking on the complicated task of event tracking. Second, it is home-grown and therefore depends on our community’s ability to keep maintained.
I believe that we would be better off delegating this responsibility of change detection to a third party library, like Debezium, which is dedicated to solving this problem and robustly maintained by a large community.
Integrating a debezium workflow poses (at least) two challenges. First, many OpenMRS implementations depend on the war based deployment strategy rather than a stack/microservice/container based approach. This provides simplicity but lacks flexibility. Second, even if one were to use debezium, we lack an existing tool to convert the debezium data stream of table based changes into domain objects (e.g. a patient or an encounter), something the openmrs events module makes easy. Given how data is distributed across tables in OpenMRS, though solvable, this is not as simple as, changed detected → create new fhir object.
I applaud the effort made by @mseaton to create an openmrs module with debezium. This may solve problem 1 above for many implementations. For those like ampath which use a container based deployment strategy, we could simultaneously pursue that option for deploying Debezium.
Now, if we could solve problem 2, this may make it much easier to, as a community, embrace the debezium approach. I think we could begin solving this problem independent of which software is chosen to receive the debezium messages (Apache Camel Vs OpenHIM vs ??) as all these libraries seem to allow you to write the transformer layer in whatever code you want.
I’ve discussed with @ibacher and he is interested in spiking on this in the coming weeks. Our initial use case is essentially receiving debezium messages and converting to FHIR objects via the FHIR2 module. Perhaps others have code already achieving this? Please do share if that’s the case. @bashir, thanks for providing this link . Could you speak a bit more about your approach to taking a table name then determining which object needs to be created?
Again thanks to all for this great discussion.