Reports are not working as expected

Tags: #<Tag:0x00007fe6dc3b0cc0>

I have run and used the bahmni application for several patients. However the report module does not seem to work. I tried to run Visit Report but it shows empty record. From its name I can guess this report should show any visits done by the patients. But on my case I already have many patient visits however the report is not showing only recorded visit (only showing report headers)

My first inital test

  • Visit Report : empty

  • Patient Information Report : empty

  • Smoking History Report : has some records

I am using the latest version of Bahmni

bahmni-installer-0.88-101.noarch bahmni-emr-0.88-241.noarch bahmni-lab-connect-0.88-241.noarch bahmni-web-0.88-241.noarch bahmni-erp-0.88-32.noarch bahmni-reports-0.88-10.noarch bahmni-erp-connect-0.88-32.noarch bahmni-openmrs-0.88-60.noarch bahmni-lab-0.88-32.noarch

Why the records are not showing in all reports ? What am I missing here ?

Can you please share logs after

  1. restart these two services - openmrs & bahmni-reports.
  2. run reports - Visit Report/Patient Information Report/Smoking History Report

( openmrs log file - /var/log/openmrs/openmrs.log reporting log file - /var/log/bahmni-reports/bahmni-reports.log )

I run the above reports in the following order

  1. Visit Report. The bahmni-reports.log gives

    context [anonymous] 9:23 attribute sortByColumns isn't defined

  2. Then I run Patient Information Report. The bahmni-reports.log gives

     com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'openmrs.concept_view' doesn't exist
             at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
             at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
             at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
             at java.lang.reflect.Constructor.newInstance(Unknown Source)
             at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
             at com.mysql.jdbc.Util.getInstance(Util.java:386)
             at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
             at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
             at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
             at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927)
             at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2399)
             at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2789)
             at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2812)
             at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2761)
             at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
             at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
             at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:1006)
             at org.bahmni.reports.template.PatientReportTemplate.build(PatientReportTemplate.java:35)
             at org.bahmni.reports.util.BahmniReportUtil.build(BahmniReportUtil.java:33)
             at org.bahmni.reports.web.ReportGenerator.invoke(ReportGenerator.java:49)
             at org.bahmni.reports.web.MainReportController.getReport(MainReportController.java:53)
             at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
    
  3. The Smoking History Report (which seems to work) The bahmni-report.log gives

2017-03-10 11:57:29,916 INFO [bahmnireports][org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator] Executing request: GET http://localhost:8050/openmrs/ws/rest/v1/session HTTP/1.1 2017-03-10 11:57:30,555 INFO [bahmnireports][org.bahmni.webclients.openmrs.OpenMRSLoginAuthenticator] Authentication response: {"sessionId":"EC94B56C6370CB73EFFE67B238D5FD3C","authenticated":true,"user":{"uuid":"78999fca-12b1-11e6-827a-080027d2adbd","display":"reports-user","username":"reports-user","systemId":"Reports User","userProperties":{},"person":{"uuid":"7897cb04-12b1-11e6-827a-080027d2adbd","display":"Reports User","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/person/7897cb04-12b1-11e6-827a-080027d2adbd"}]},"privileges":[{"uuid":"d05118c6-2490-4d78-a41a-390e3596a215","display":"Get Visit Types","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/privilege/d05118c6-2490-4d78-a41a-390e3596a215"}]},{"uuid":"d05118c6-2490-4d78-a41a-390e3596a249","display":"Get Users","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/privilege/d05118c6-2490-4d78-a41a-390e3596a249"}]},{"uuid":"d05118c6-2490-4d78-a41a-390e3596a211","display":"Get Providers","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/privilege/d05118c6-2490-4d78-a41a-390e3596a211"}]},{"uuid":"d05118c6-2490-4d78-a41a-390e3596a231","display":"Get Concept Sources","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/privilege/d05118c6-2490-4d78-a41a-390e3596a231"}]},{"uuid":"d05118c6-2490-4d78-a41a-390e3596a251","display":"Get Concepts","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/privilege/d05118c6-2490-4d78-a41a-390e3596a251"}]}],"roles":[{"uuid":"e49ac8b6-d490-11e5-b193-0800270d80ce","display":"Emr-Reports","links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/role/e49ac8b6-d490-11e5-b193-0800270d80ce"}]}],"retired":false,"links":[{"rel":"self","uri":"http://192.168.33.10/openmrs/ws/rest/v1/user/78999fca-12b1-11e6-827a-080027d2adbd"},{"rel":"full","uri":"http://192.168.33.10/openmrs/ws/rest/v1/user/78999fca-12b1-11e6-827a-080027d2adbd?v=full"}],"resourceVersion":"1.8"}}

Any idea why the first 2 queries reports generate the following log ?

context [anonymous] 9:23 attribute sortByColumns isn't defined and Table ‘openmrs.concept_view’ doesn’t exist`

I couldn’t find my concept_view in the mysql table. How can I restore it or recreate it ?

Hi @abiieez,

Restore Database: If you restore the database all the changes that you have done will be lost.

Recreate the concept_view: Execute this sql query from mysql prompt to create the concept_view in your openmrs database. This way you will not loose the changes you have done to openmrs database.

I followed you second suggestion to Recreate the concept_view. This solved the patient information report however the patient visit report still giving the same error in the log

context [anonymous] 9:23 attribute sortByColumns isn't defined

Where can I define this attribute ?

Hi @abiieez,

This is nothing to do with your visit report. sortByColumns is a missing configuration in json file. You can ignore that. Let me know if you can see any other errors in the log file.

I am not seeing any other errors in the bahmni-reports.log. I tried to reinstall bahmni-reports using yum but I am still getting no other errors in the log file.

Hi @abiieez,

Can you try running below sql query and let us know the count.

select count(*) from visit where date_started BETWEEN '2015-03-11 17:52:35' AND '2017-03-09 12:44:06';

If the count is zero then you will not get any records when you generate from reports module. If the count is non zero and you can’t see any records from reports module then its the issue with reports module setup in your machine.

Hi the query result is non zero as shown below

mysql> select count(*) from visit where date_started BETWEEN '2015-03-11 17:52:35' AND '2017-03-09 12:44:06';
+----------+
| count(*) |
+----------+
|       18 |
+----------+
1 row in set (0.00 sec)

Thanks for pointing me to where the problem is.

I realized I am using many different visit types thus what I did was to modify the reports.json by removing the "visitTypesToFilter portion. Now the visit report are showing all the records that I expected.

1 Like