Using Chart Search module with DB other than "openmrs"

Tags: #<Tag:0x00007f1f7455c540>

Hello all–

After playing around with the chart search module on the opemrs demo server and being impressed, I attempted to install it on my local instance of the PIH system and ran into an issue because (I believe) my local instance uses a non-standard database name (ie, openmrs_haiti instead of openmrs).

The module is not working for me, and I see the following in the logs:

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user ‘openmrs_hai_user’@‘localhost’ for table ‘obs’

I confirmed that the module is loading my DB connection properties properly from my runtime properties (including the url referencing the DB “openmrs_haiti”), but elsewhere in the error message I see queries that are referencing the DB name directly using “openmrs”:

Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT o.uuid as id, obs_id, person_id, obs_datetime, obs_group_id, as concept_name, as coded, value_boolean, value_datetime, value_numeric, value_text, cc.concept_class_name, AS concept_synonym FROM openmrs.obs o INNER JOIN (SELECT * FROM openmrs.concept_name c WHERE c.locale = ‘en’ AND concept_name_type = ‘FULLY_SPECIFIED’) AS cn1 ON cn1.concept_id = o.concept_id LEFT JOIN (SELECT * FROM openmrs.concept_name c WHERE c.locale = ‘en’ AND concept_name_type = ‘FULLY_SPECIFIED’) AS cn2 ON cn2.concept_id = o.value_coded LEFT JOIN (SELECT * FROM openmrs.concept_name c WHERE c.locale = ‘en’ AND concept_name_type IS NULL) AS cn3 ON cn3.concept_id = o.concept_id LEFT JOIN (SELECT DISTINCT o.concept_id, AS concept_class_name FROM concept_class class JOIN concept c ON c.class_id = class.concept_class_id JOIN obs o ON o.concept_id = c.concept_id) AS cc ON cc.concept_id = o.concept_id WHERE person_id=‘8’ AND o.voided=0 AND cn1.voided=0 Processing Document # 1

I’m assuming this is why I’m getting the access issues.

Thoughts? Thanks!

1 Like

Thanks @mogoodrich for noticing and reporting this issue, i have created which is soon going to fix this issue, for a better chartsearch overview upto somehow current stuff, i recommend testing using

Thanks, I look forward to exploring further!

Now pulling from master and testing with 1.4-SNAPSHOT should clear this issue

1 Like

Great Joseph, I will test!

@k_joseph I had add in one other small fix (to escape the json) but now this works great!

I created a ticket about the additional change I made to escape the json:

One other question–I’m not sure how the module and solr works, but is there any automated or behind-the-scenes processing that happens, or does the processing just happen when you actual access the chart search section? I was wondering if I could roll the module out on the production server but only allow a few select users to user it (while we are testing) without having to worry about an overall performance impact.