Bahmni OpenElis LabTest Sync

I recently upgraded my Bahmni from 0.89 to 0.91. Now I am facing two issues

  1. Lab orders are not synching.

  2. Uploading lab test concepts not updating openelis. I am suspecting during upgrade some credentials were being reset to defaults. But I looked at /opt/bahmni-lab/bahmni-lab/WEB-INF/classes/atomfeed.properties everything seems to be okay.

    java.lang.RuntimeException: us.mn.state.health.lims.common.exception.LIMSRuntimeException: Error while saving test - Biakan Aerob Pus - ICU at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWithTransaction(AtomFeedHibernateTransactionManager.java:51) at org.ict4h.atomfeed.client.service.AtomFeedClient.processEvents(AtomFeedClient.java:68) at org.bahmni.feed.openelis.feed.job.OpenELISFeedReaderJob.processEvents(OpenELISFeedReaderJob.java:73) at org.bahmni.feed.openelis.feed.job.OpenELISFeedReaderJob.execute(OpenELISFeedReaderJob.java:57) at org.quartz.core.JobRunShell.run(JobRunShell.java:207) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560) Caused by: us.mn.state.health.lims.common.exception.LIMSRuntimeException: Error while saving test - Biakan Aerob Pus - ICU at org.bahmni.feed.openelis.feed.event.LabFeedEventWorker.process(LabFeedEventWorker.java:95) at org.ict4h.atomfeed.client.service.AtomFeedClient$EventProcessor.doInTransaction(AtomFeedClient.java:168) at org.ict4h.atomfeed.transaction.AFTransactionWorkWithoutResult.execute(AFTransactionWorkWithoutResult.java:6) at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWithTransaction(AtomFeedHibernateTransactionManager.java:42) … 5 more Caused by: us.mn.state.health.lims.common.exception.LIMSException: Error while saving test - Biakan Aerob Pus - ICU at org.bahmni.feed.openelis.feed.service.impl.TestService.createOrUpdate(TestService.java:146) at org.bahmni.feed.openelis.feed.event.LabFeedEventWorker.process(LabFeedEventWorker.java:72) … 8 more Caused by: java.lang.NullPointerException at org.bahmni.feed.openelis.feed.service.impl.TestService.createOrUpdate(TestService.java:107) … 9 more ^C

This is not the whole log (only the last 2 lines seem to show that it tried to save the tests but failed). You can also check the errors in the “failed_events” table.

Additional error form bahmni-lab.log

Failed processing event in feed [http://localhost:8050/openmrs/ws/atomfeed/encounter/1] java.lang.NullPointerExceptionjava.lang.RuntimeException: java.lang.NullPointerException at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWithTransaction(AtomFeedHibernateTransactionManager.java:51) at org.ict4h.atomfeed.client.service.AtomFeedClient.processEvents(AtomFeedClient.java:68) at org.bahmni.feed.openelis.feed.job.OpenELISFeedReaderJob.processEvents(OpenELISFeedReaderJob.java:73) at org.bahmni.feed.openelis.feed.job.OpenELISFeedReaderJob.execute(OpenELISFeedReaderJob.java:57) at org.quartz.core.JobRunShell.run(JobRunShell.java:207) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560) Caused by: java.lang.NullPointerException at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker$SampleItemTestCache.findOrCreateSampleItemFromCache(EncounterFeedWorker.java:562) at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker$SampleItemTestCache.add(EncounterFeedWorker.java:543) at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker.getSampleTestCollections(EncounterFeedWorker.java:393) at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker.createSample(EncounterFeedWorker.java:238) at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker.process(EncounterFeedWorker.java:181) at org.bahmni.feed.openelis.feed.event.EncounterFeedWorker.process(EncounterFeedWorker.java:163) at org.ict4h.atomfeed.client.service.AtomFeedClient$EventProcessor.doInTransaction(AtomFeedClient.java:168) at org.ict4h.atomfeed.transaction.AFTransactionWorkWithoutResult.execute(AFTransactionWorkWithoutResult.java:6) at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWithTransaction(AtomFeedHibernateTransactionManager.java:42) ... 5 more

Not entire sure, because this is still not the complete log (check the failed_events table too, as I mentioned above), but this is my hypothesis

  1. You have not defined a sample type for this test in OpenMRS.

  2. Or that for the test, there is no “sample” type association in ELIS. (however that happened)

So, try to find out more

  • Check in OpenELIS, whether the test and the sample types are defined. If both are defined, then chances are they are not associated.
  • Check in OpenELIS => Adminstration => left menu (Type of sample with Test/Panel association) - Check whether you can find an association of sample type and test/panel.

For 2, to investigate, try out

  • In postgres Clinlims database, check the “external_reference” table and with the test UUID (OpenMRS concept UUID) identify the “item_id” – in the “SAMPLETYPE_TEST” table, check if there is any record for the “test_id” (identified above by the “item_id” from the external reference table).

For resolution, you can try

  • In OpenMRS concept dictionary, try to re-associate the test/panel to the sample type.

It can also happen that the sync for that sample and lab association failed and was not retried after 5 attempts. Try resetting the “failed_events.retries” value to zero!

  • Connect to Postgres Clinlims database

update failed_events set retries = 0;

@angshuonline my issue also same, can you please suggest me something on this https://pastebin.com/k7AxZJRT

Please check the marker table content and the failed_events table content [both mysql and postgres]. These will let you know whether the sync happened or in case of failure, the reason why it failed can be analysed

@buvaneswariarun how can I uninstall the bahmni and reinstall it, I have followed the

yum -y remove bahmni*

But it is not removing the entire bahmni software. When I execute this command and trying to reinstall with

Bahmni install

it is giving the error like

please try yum remove bahmni and then give a bahmni install

Follow this wiki in case, you need to reinstall or upgrade your bahmni installation.

https://bahmni.atlassian.net/wiki/spaces/BAH/pages/103350284/Upgrade+to+Latest+Bahmni+Release