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.
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
Changes in code/config causing this error in sql query (which wasn’t done), so to the next option
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.
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
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.
Run the below command to see if there are any orphaned observations
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.
Suggested Wasim to check if the form is by mistake edited or it is intended to be removed.
If the form is not needed then the orphaned obs can be voided through DB.
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.