endTB exports failing

Hi,

I have had endTB exports running successfully until 12th May and after that somehow it starts failing. I checked the bahmni batch logs and found following mysql query failing. https://pastebin.com/CwJnSRGq I was thinking that may be records entered in followup template after 12th May (perhaps hyphen in any text) may have caused this, however, I was not able to get to bottom of it.

endTB release version is 1.5.1

Any help is appreciated.

Thanks, Wasim

Moved to the #software:bahmni category

@wasim, in your stack trace, I see the following:

where o.obs_id in ()

This appears to be the likely source of your problem.

Mike

1 Like

hmm, what’s surprising to me is I have not modified any code or even the config, it was running fine and then it starts failing, looking at the stack trace, It can be two things in my opinion causing exports to fail.

corresponds to your MySQL server version for the right syntax to use near ') and obs_con.concept_id in (661, 166, 665, 1596, 1840, 1199, 1200, 1201, 638' at line 17
  1. Changes in code/config causing this error in sql query (which wasn’t done), so to the next option
  2. Some data is entered in followup template (that’s where it is failing), that is messing with the query.

I have tried looking at the data closely, so far haven’t found anything, will continue.

This is just a general troubleshooting option from back in the days - do a full server reboot

Hi, I tried looking at the code but can’t trace a code path which would cause the sql to have “o.obs_id in ()”. The childObsIds on this line is going empty. May be you can just checkout the code and run it against your database. That way you can debug quickly. It’s a spring boot+spring batch application and fairly simple to run. I recently started to work on it for another usecase and below are the steps i followed to have it running

  1. clone the code from here
  2. Import the gradle project in IntelliJ (or Eclipse)
  3. Update the application-dev.properties file with datasource details
  4. Run Application.java with VM option -Dspring.profiles.active=dev to run it in dev mode.

Hope this helps.

Connected with Wasim offline. Update : Exports will not work when there are orphaned observations We had seen an issue like this earlier exports failure issue in endtb. The approach we have taken to identify the issue was as below to check if there are any orphaned obs.

  1. Run the below command to see if there are any orphaned observations
  1. There was an orphaned obs found when we opened the respective for in Application, it didn’t have any data. We are not sure about how this happened but the issue is clear that there is Form Group Obs with all the voided children.
  2. Suggested Wasim to check if the form is by mistake edited or it is intended to be removed.
  3. If the form is not needed then the orphaned obs can be voided through DB.
  4. If the form was by mistake removed then to un-voided the child obs making the obs tree complete.

Note : Going forward we might not find this orphaned obs issue because with OpenMRS 2.0 upgrade such orphaned obs can’t saved so there will be no way to end up in this situation.

1 Like