Results of OpenElis test in Bahmni

Hi everyone, I customized my bahmni 0.80 installation with patient attributes and some other stuff. My problem is on the workflow that stopped working between Bahmni-OpenELIS.

On any patient I can make an Order and I can see it in OpenELIS, I can “collect the sample”, I can input the results and validate it. Before, the results would show up in Bahmni correctly.

Now after customizing bahmni, the Orders results are showing empty.

What could be the problem here? Can someone tell me how Bahmni gets this results for displaying, is it by Atom Feed or direct connection to PostgreSQL?

Hi. What kind of customisation did you do ? Bahmni uses Atom Feed for data sync…

Can you also check your OpenMRS database to see if it shows any failed events (failed_events table)?

I’ve found out when this exact problem happened to me: It happens imediatelly after using these scripts to clean the demo data from Bahmni/OpenELIS: https://github.com/Bahmni/bahmni-environment/tree/master/scripts/deletePatientData The scripts and the usage are mentioned here: https://talk.openmrs.org/t/how-to-start-with-a-fresh-clean-database-for-bahmni/

Can anyone replicate? Try to make an Order for any patient, go to OpenELIS, collect, give results & validate it, and then see if those results show in the patient dashboard.

Can you please show the contents of the failed_events table in OpenMRS Database?

It has the same events that came with the database, there aren’t any new failed events (from 2016). I can show a screenshot tomorrow if you want.

Hi, I recreated everything. You can see the results in Lab Results Display control in Patient Dashboard. You can also see them inside the Visits tab under Lab Investigation and Investigation Chart sections . Below is the screenshot showing the lab results in the patient dashboard.

I’ve tried again to debug the issue and it seems that it happened even before applying the scripts to remove demo data.

New things I found:

A) I seem to have the problem in my fresh installations of CentOS (with selinux and iptables disabled, following the guide “Install on CentOS”, and without using the script to remove demo data.

B) It seems to work on the vagrant box provided, but using the script to remove demo data made it stop working.


As asked about my tables. — in openmrs sql db ----

  • “failed_events” have 11 rows with data (from 2015-07-03), “failed_event_retry_log” has 55 rows with data (from 2015-06-26) - installation A) (My CentOS).

  • I’ll check on my installation B) (Vagrant Box). Update: Exactly the same as A)


— in openelis sql db ----

  • “failed_events” have 38 rows with data (all from 2016-05-03), “failed_event_retry_log” has 3896 rows with data (from 2015 and latest are from 2016-05-03) - installation A) (My CentOS).

  • I’ll check on my installation B) (Vagrant Box). Update: Exactly the same as A)

How it shows (e.g. Patient “Test Radiology”):

Just took entire evening to reproduce this again: On the vagrant box, with it working, after running the script to remove the demo data it stops working, as I reported before - reproduced 3 times.

binduak, maybe the script didn’t ran correctly, check the output for errors… I managed to confirm it to stop working exactly after the scripts were run and the demo data was removed. Some table must have crucial data for the Bahmni->Openelis connection to work.

Update: Can anyone tell me what the “markers” table in both databases do? I believe this is the one responsible for the problems.

Update2: Narrowed it down to the problem: it’s on the query that changes the table “event_records” on both databases. If I use the provided .sql files only, and don’t touch “event_records”, it works! Any ideas why?

Hi,

Event_records has the entries which are published by the publisher for the events created.
Markers table has the entries which are read by the consumers. It has the last feed that is read by the consumer.
For more information refer to https://bahmni.atlassian.net/wiki/display/BAH/Atom+Feed+Based+Synchronization+in+Bahmni

Below are the links to see the latest feeds published by MRS, ELIS and ERP

MRS: 
Encounters - view-source:http://dockerhost:8080/openmrs/ws/atomfeed/encounter/recent (Consumed by Elis,ERP)
     - ERP creates a Sale Order
Patient- view-source:http://dockerhost:8080/openmrs/ws/atomfeed/patient/recent (Consumed by Elis, ERP)
     - ERP creates a customer.
Lab Feed - view-source:http://dockerhost:8080/openmrs/ws/atomfeed/lab/recent (Consumed by Elis)
Drug Feed - view-source:http://dockerhost:8080/openmrs/ws/atomfeed/drug/recent (Consumed by ERP)
Reference Data Feed - http://dockerhost:8080/reference-data/ws/feed/recent - Not available

Elis:
Patient Feed - view-source:http://dockerhost:8080/openelis/ws/feed/patient/recent (Consumed by MRS,ERP)
     - ERP Creates a sale order.
Result Feed - view-source:http://dockerhost:8080/openelis/ws/feed/result/recent (Consumed by MRS)

ERP:
Product - http://dockerhost:8080/openerp-atomfeed-service/feed/product/recent (Consumed by Elis)
Sale Order - http://dockerhost:8080/openerp-atomfeed-service/feed/sale_order/recent (Consumed by MRS)

binduak, thanks for explaining. So, to resume, I got it working on the vagrant box by not running the sql that deletes “event_records” and the one that changes “markers” for both databases.

Can anyone tell me why it works only if these two tables are not modified, keeping the demo data?

“Atom feed” architecture has both client and server… Server keeps publishing the events and clients will read required events… Atom feed is an xml based sync… which means each page termed as feed will have set of events… event_records is a table in the server side with the entries of all the events generated. In this approach it is the client’s responsibility to keep track of the last read event which is usually recorded in markers table at client side.

Now lets take an example:

EMR to ELIS Patient sync (EMR is Server and ELIS as Client) In the EMR, a patient is created which will generate an entry in event_records table. Now Elis should read the event_record’s table of EMR and match the event_id with the id in markers table to find out the latest events generated after it has last read.

Please refer this link for more information

sravanthi17, thanks for explaining.

The workaround I did is not perfect - It worked on the Vagrant Box, but it didn’t work on my CentOS machine that I installed following the “Installed using CentOS” guide.

Even copied the databases from the now working vagrant box to my server, but it doesn’t work there. I can’t comprehend why.

Is there any place where I can see the problems with the Atom feed? (btw, the table “failed_events” / “failed_event_retry_log” are empty on openmrs and clinlims).

Which sync is not working for you ? Is it ElIS to EMR ? EMR to ELIS or both ?

ELIS to EMR sync issue

Step 1: sudo service bahmni-lab stop

Step 2: Reset markers by executing delete * from markers; (clinlims database)

Step 3: sudo service bahmni-lab start

EMR to ELIS sync issue

Step 1: sudo service openmrs stop

Step 2: Reset markers by executing delete * from markers; (openmrs database)

Step 3: sudo service openmrs start

Both Sync issues

Follow both EMR to ELIS sync issue and ELIS to EMR sync issue

You can find the issues in failed_events table or log files

The problem is from ELIS to EMR (can’t view the results of a test on the EMR patient dashboard). I did your Elis to EMR, and noticed that after starting bahmni-lab, after some minutes the markers were updated, but the EMR still can’t access the Elis results.

Then, I did your EMR to ELIS, and after starting openmrs, the markers were never inserted again on the table of openmrs database.

There are many failed events on clinlims (Elis database): http://localhost:8080/openmrs/ws/atomfeed/lab/recent http://localhost:8080/openmrs/ws/atomfeed/encounter/recent http://localhost:8080/openmrs/ws/atomfeed/patient/recent

There are NO failed events on openmrs database (it also don’t have markers).

I can always send the orders to OpenElis and I can see them there and collect sample and put results & validate, but they never travel back for the dashboard.

I found out the problem in “openmrs.log”, it shows up when I start openmrs:

I installed Bahmni 0.80 following “Install Bahmni on CentOS”, and everything works but this! I believe the module responsible has some problem in the initialization and can never update or get things from the feed - that’s why in openmrs database the “markers” table never updates itself again, or why I don’t even see a single “failed_event” on it either.

What can happen for the module org.bahmni.module.elisatomfeedclient to be failing these tasks?

1 Like

I found the problem!

Bahmni installer for CentOS has an issue - in my CentOS I noticed I was missing the openelis-atomfeed-client-0.80-SNAPSHOT.omod, so I went to check how is it on the Vagrant Box and I learned the .omod is present in /opt/openmrs/modules but as a sym link, because in reality it resides in /opt/bahmni-lab-connect/modules/openelis-atomfeed-client-0.80-SNAPSHOT.omod.

Someone forgot to program the installer to make this sym link… So the feature was broken all the time…

1 Like

Hi,

We have to re-install bahmni-lab-connect whenever you re-install openmrs. Because bahmni-lab-connect is the one creating the sym link to openelis-atomfeed-client-0.80-SNAPSHOT.omod after /opt/openmrs/modules created.

  1. openmrs creates /opt/openmrs/modules folder.

  2. bahmni-emr is the one copying all the relevant omods required by Bahmni into /opt/openmrs/modules.

  3. bahmni-lab-connect creates the link to openelis-atomfeed-client-<bahmni.version>-SNAPSHOT.omod.

Below are the commands to re-install bahmni-lab-connect

yum remove bahmni-lab-connect
yum install bahmni-lab-connect
2 Likes

hi @sravanthi17

i have an issue i can order lab and i can receive lab order in openls however after collecting sample and validating lab result, i cant see anything bahmni Dashboard. i check clinlinms database i found some error

 |                 |                      |         |
     |                                                      |         at us.mn.state.health.lims.panel.daoimpl.PanelDAOImpl.duplicatePanelExists(PanelDAOImpl.java:386)
                                                                                                                                                      +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         ... 11 more
                                                                                                                                                      +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      | Caused by: java.sql.BatchUpdateException: Batch entry 0 update clinlims.PANEL set LASTUPDATED='2017-06-19
00:09:25.191000 +05:45:00' where ID='114' and LASTUPDATED='2017-06-19 00:08:14.886000 +05:45:00' was aborted.  Call getNextException to see the cause.+|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Stateme
nt.java:2598)                                                                                                                                         +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorIm
                                                                                                                                                       |
                                             |                                                                                              |
 |                 |                      |         |
 287 | http://localhost:8050/openmrs/ws/atomfeed/lab/recent | Failed processing event in feed [http://localhost:8050/openmrs/ws/atomfeed/lab/194]
                                                                                                                                                      +| tag:atomfeed.ic
t4h.org:d862fdd2-054b-430a-92b6-2b6794fad6c3 | /openmrs/ws/rest/v1/reference-data/all-tests-and-panels/a3a4db93-ba92-492d-aa3a-f19476bd1d73 | 2017-06-18 18:24:26.313+00
 |     -1809667336 | all-tests-and-panels |       4 | lab
     |                                                      | us.mn.state.health.lims.common.exception.LIMSRuntimeException: Error while saving panel - Anaemia Paneljav
a.lang.RuntimeException: us.mn.state.health.lims.common.exception.LIMSRuntimeException: Error while saving panel - Anaemia Panel                      +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWi
thTransaction(AtomFeedHibernateTransactionManager.java:51)                                                                                            +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         at org.ict4h.atomfeed.client.service.AtomFeedClient.processEvents(AtomFeedClient.java:68)
                                                                                                                                                      +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         at org.bahmni.feed.openelis.feed.job.OpenELISFeedReaderJob.processEvents(OpenELISFeedReaderJob.jav
a: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 panel - Anaem
ia Panel                                                                                                                                              +|
                                             |                                                                                              |
 |                 |                      |         |
     |                                                      |         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(AFTransactionWorkWithoutR
esult.java:6)                                                                                                                                         +|
                                             |                                                                                              |
 |                 |                      |         |

Hi guys,

I am having same issue here: test results are not being displayed in patient dashboard. Bahmni version: 0.89 Tried reinstalling lab connector module and “delete from markers” in OpenELIS DB. It didn’t work.

I get the following exception in openmrs log: 31-07-2017 17:39:16 [ERROR] OpenElisPatientFailedEventsFeedClientImpl - openelisatomfeedclient:failed feed execution while running failed eventsjava.lang.NullPointerException java.lang.NullPointerException 31-07-2017 17:39:16 [ERROR] TimerSchedulerTask - FATAL ERROR: Task [class org.openmrs.scheduler.tasks.TaskThreadedInitializationWrapper] failed due to exception [java.lang.RuntimeException] java.lang.RuntimeException: java.lang.NullPointerException at org.bahmni.module.elisatomfeedclient.api.client.impl.OpenElisPatientFailedEventsFeedClientImpl.processFailedEvents(OpenElisPatientFailedEventsFeedClientImpl.java:75) at sun.reflect.GeneratedMethodAccessor1098.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy280.processFailedEvents(Unknown Source) at org.bahmni.module.elisatomfeedclient.api.task.OpenElisPatientFeedFailedEventsTask.execute(OpenElisPatientFeedFailedEventsTask.java:13) at org.openmrs.scheduler.tasks.TaskThreadedInitializationWrapper.execute(TaskThreadedInitializationWrapper.java:67) at org.openmrs.scheduler.timer.TimerSchedulerTask.execute(TimerSchedulerTask.java:94) at org.openmrs.api.context.Daemon$2.run(Daemon.java:135) Caused by: java.lang.NullPointerException

There´s an event failing in OpenELIS Atomfeed: { “categories”: [ { “label”: null, “schemeResolved”: null, “term”: “lab”, “scheme”: null } ], “id”: “tag:atomfeed.ict4h.org:31101a8a-1dbc-4361-906b-343035ff80cf”, “content”: “/openmrs/ws/rest/v1/reference-data/panel/552b32c8-13fa-459e-8757-992935ccde93”, “feedUri”: null, “updatedDate”: null, “title”: “panel”, “dateCreated”: null }

I have confirmed that samples were collected, entered all results and validated all of them in OpenELIS. Still I can’t see the results in the patient summary. Thanks in advance