Bahmni-OpenELIS integration

Currently I’m getting a few errors (stacktraces) regarding the communication between OpenMRS and OpenELIS. But I have to admit that I ‘played around’ with the software components quite a bit (to increase my technical understanding), so it might well be that I messed something up. However I think I saw similar errors when I was starting up my initial vagrant box.

I think on a 10000 ft level I understand how the two talk to each other (bidirectional Atom feeds). Is there any way (or need) to configure this communication (e.g. by specifying URLs)?

And from OpenMRS perspective:

  1. Does the EMR-API offer the feed so that OpenELIS then can consume it?
  2. Do the scheduled task in OpenMRS then look for updates on the OpenELIS side?

Currently I’m seeing the error below in the Tomcat/OpenMRS logs.

2015-11-27 11:04:54,440 [http-nio-8080-exec-4] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/openelis].[action]- Servlet.service() for servlet [action] in context with path [/openelis] threw exception [java.lang.RuntimeException: org.ict4h.atomfeed.server.exceptions.AtomFeedRuntimeException: feed does not exist] with root cause
org.ict4h.atomfeed.server.exceptions.AtomFeedRuntimeException: feed does not exist
	at org.ict4h.atomfeed.server.service.feedgenerator.NumberFeedGenerator.validateFeedId(NumberFeedGenerator.java:92)
	at org.ict4h.atomfeed.server.service.feedgenerator.NumberFeedGenerator.getFeedForId(NumberFeedGenerator.java:34)
	at org.ict4h.atomfeed.server.service.EventFeedServiceImpl.getEventFeed(EventFeedServiceImpl.java:55)
	at org.ict4h.atomfeed.server.service.helper.EventFeedServiceHelper$2.execute(EventFeedServiceHelper.java:49)
	at org.ict4h.atomfeed.server.service.helper.EventFeedServiceHelper$2.execute(EventFeedServiceHelper.java:46)
	at org.bahmni.feed.openelis.feed.transaction.support.AtomFeedHibernateTransactionManager.executeWithTransaction(AtomFeedHibernateTransactionManager.java:42)


ERROR - BaseRestController.handleException(106) |2015-11-27 11:09:01,192| null
java.lang.NullPointerException
	at org.openmrs.module.emrapi.encounter.EncounterTransactionMapper.map(EncounterTransactionMapper.java:46)
	at org.openmrs.module.emrapi.encounter.EmrEncounterServiceImpl.getEncounterTransaction(EmrEncounterServiceImpl.java:160)

All configuration necessary for atomfeed communications are in atomfeed.properties file e.g. “~/apache-tomcat-8.0.12/webapps/openelis/WEB-INF/classes/atomfeed.properties”.

It offers the feed so that any system interested in events can subscribe and consume.

Yes, openmrs also listens for new events in OpenELIS atomfeed.

As far as error message, I think it is trying to listen on a feed which does not have any events. Should not cause much of an issue as such.

OK. This helps.

Is the reference-data webapp also involved in this data exchange? (I couldn’t find much information about it at all.)

Also: Is the webapp openerp-atomfeed-service required for OpenMRS <–> OpenELIS communication or only needed for the Pharmacy component?

This is required only for Openmrs --> openERP connection.

Actually reference-data webapp is deprecated. We had built it to create reference-data(drugs, tests, panel, concepts etc), and other three systems (MRS, ELIS, ERP) listened for events to sync these data. But now all reference data are directly created in OpenMRS and synced to ELIS & ERP.

Great. Is it then safe for me to remove both webapps from Tomcat (as long as I don’t need the ERP component)?

Yes, it will be safe to remove these webapps.

Thanks for the explanations. Now that I understand the technical foundation better, I would like to get a better sense of the ‘logical coupling’.

I still get the same error as indicated by the stacktrace above. In the access log I see this request: “GET /openelis/ws/feed/patient/18 HTTP/1.1” 500 5859 25

So indeed a resources does not exists. This stacktrace appears every 15 seconds (as currently configured), so it makes it almost impossible to detect other problems/stacktraces in the log.

The URL for this patient with ID 18 does not exist, but none of the parent pathes for the URL do either; like /openelis/es, /openelis/ws/feed/, … (but htis might be ok).

Now for tests I’ve played around with my installation quite a bit. Started and stopped OpenELIS and OpenMRS independent from each other. Exexcuted SQL statements (e.g. deletes to get rid of my temporary test data) in the OpenMRS DB. Could this be the reason for this 'instability’?

Can you recommend a way how I could ‘clear’ the backlog for these feeds to get rid of these messages/errors?

This should not cause any issue.

This can cause issue.

So just to debug more, can you try to see “/openelis/ws/feed/patient/recent” returns.

Also, maybe you can just delete all atomfeed related data and start afresh -

Stop tomcat & openerp(if installed) service Login to openmrs database and run following statements.

mysql -uroot -p openmrs
delete from failed_events;
delete from event_records;
delete from markers;
delete from event_records_offset_marker;
delete from event_records_queue;

Similarly login to openerp & openelis DB and run same statements.

 psql -Uclinlims clinlims
 psql -Uopenerp openerp

Start tomcat and openerp (if installed)

Yep. That worked.

But table event_records_queue doesn’t exist in my DBs. Do I have an outdated schema?

And I’m getting one initial stack trace. But it seems as a 'self-organising’ activity and it doesn’t occur afterwards. So I’m simply ignoring it:

132763 [Thread-201] INFO org.quartz.core.QuartzScheduler - Scheduler OpenELIS-Scheduler_$_NON_CLUSTERED started.
2015-11-29 12:46:47,736 [http-nio-8080-exec-2] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/openmrs].[openmrs]- Servlet.service() for servlet [openmrs] in context with path [/openmrs] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Unexpected error] with root cause
java.lang.NullPointerException
	at org.ict4h.atomfeed.Configuration.getSchema(Configuration.java:61)
	at org.ict4h.atomfeed.server.repository.jdbc.AllEventRecordsOffsetMarkersJdbcImpl.getAll(AllEventRecordsOffsetMarkersJdbcImpl.java:70)
	at org.ict4h.atomfeed.server.service.feedgenerator.NumberFeedGenerator.findMarker(NumberFeedGenerator.java:57)
	at org.ict4h.atomfeed.server.service.feedgenerator.NumberFeedGenerator.getRecentFeed(NumberFeedGenerator.java:40)
	at org.ict4h.atomfeed.server.service.EventFeedServiceImpl.getRecentFeed(EventFeedServiceImpl.java:37)
	at org.ict4h.atomfeed.server.service.helper.EventFeedServiceHelper$1.execute(EventFeedServiceHelper.java:24)
	at org.ict4h.atomfeed.server.service.helper.EventFeedServiceHelper$1.execute(EventFeedServiceHelper.java:21)
	at org.openmrs.module.atomfeed.transaction.support.AtomFeedSpringTransactionManager$1.doInTransaction(AtomFeedSpringTransactionManager.java:40)

Thanks a lot, christian

And as another maybe unrelated question: Is the OpenMRS AtomFeed module used behind the scenes? It is available in my installation, but the OpenMRS System Admin page (http://localhost:8080/openmrs/module/atomfeed/manage.form) for it is broken and gives the stacktrace below:

2015-11-29 12:48:14,991 [http-nio-8080-exec-5] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/openmrs].[openmrs]- Servlet.service() for servlet openmrs threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [180] in the generated java file: [/home/bahmni/apache-tomcat-8.0.12/work/Catalina/localhost/openmrs/org/apache/jsp/errorhandler_jsp.java]
Syntax error, insert "}" to complete Block

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)

Hi,

Yes OpenMRS Atomfeed module is being used behind the scenes. It publishes “Patient” & “Encounter” events whenever they are saved.

Looks like its admin page is broken.

Thanks,

Yes, but in normal dev environment should not be much of an issue. Installing latest bahmni should resolve this.

>> Also: Is the webapp openerp-atomfeed-service required for OpenMRS <–> OpenELIS communication or only needed for the Pharmacy component? Yes

OpenElis page was blank ( http:///openelis). I checked the log file and saw the following . “clinlims” does not exist. Using my psql , i checked that clinlims actually existed but was empty, so i downloaded the openElis dump file and put it in the clinlims database using " psql -Uclinlims clinlims < ~/Downloads/base.backup". Now when i try open OpenElis page, it still comes blank, but the log shows the following …

Caused by: org.postgresql.util.PSQLException: ERROR: relation “clinlims.quartz_cron_scheduler” does not exist

Can anyone help me with this? My aim is to get OpenElis to working.

Please try the following. I am assuming you are workign with V0.80 of Bahmni:

  1. Stop OpenELIS

service bahmni-lab stop

  1. Execute the commands in the method: restore_pgsql_db( ). This will download a database, and restore databases for OpenELIS, and OpenERP (since both systems use postgresql). https://github.com/Bahmni/bahmni-vagrant/blob/master/packer/scripts/base-v80.sh#L59

  2. Once DB has been restored, start OpenELIS again.

service bahmni-lab start

  1. Check the logs in /var/log/bahmni-lab for any errors.

Yes I am working with Bahmni 0.80 version. I followed the above steps and my OpenELIS is working now, thank you Gurpreet. As of now i am able to log into the http:///openelis using admin\adminADMIN!.. I am getting the OpenELIS dashboard with most funcionality working, except the PANELS when Adding a SAMPLE of a SAMPLETYPE, there is no panel generation, like for “BLOOD”. For this I assume we need to configure openmrs modules first.

The only error in OpenElis is the following. A few sub-pages in the OpenElis for example "Admin -> Test " show

I then decided to integrate OpenElis with OpenMRS using the following standard link A>>>>https://bahmni.atlassian.net/wiki/display/BAH/OpenELIS+Basic+Configurations AND B>>>>https://bahmni.atlassian.net/wiki/display/BAH/Laboratory+Management+System

THE BAHMNI-LAB LOG SHOWS THIS (still not able to see the panels on the OpenElis).

7079874 [OpenELIS-Scheduler_Worker-2] ERROR org.quartz.core.ErrorLogger - Job (atom-feed-openmrs-encounter-failed.atom-feed-openmrs-encounter-failedJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.ict4h.atomfeed.client.exceptions.AtomFeedClientException: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: column “tags” does not exist Position: 89] at org.quartz.core.JobRunShell.run(JobRunShell.java:218) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560) Caused by: org.ict4h.atomfeed.client.exceptions.AtomFeedClientException: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: column “tags” does not exist

CURRENT STATUS

The “http://192.168.1.26:8080/openmrs/module/atomfeed/manage.form” shows blank. The “https://192.168.1.26/openelis/PanelMenu.do” has 27 pages FILLED

I’m not really sure what is the error or how it was caused.

With this as reference, Is it true that OpenERP should work to set up panels in OpenElis?

@deepakrv: The documentation URL you have pasted is of SEARCH hospital. There we had deployed EMR, OpenELIS, and OpenERP. So, for them, the documentation for more assertive on the process to follow, since they would charge customers for lab tests done, and billing for done in OpenERP. For OpenELIS and OpenERP to sync, the data should be the same in both.

Please see this discussion: (Default) workflow between OpenMRS and OpenELIS

If you don’t want to use OpenERP, you don’t need to worry. You can use just EMR, and OpenELIS.