Friday, November 11, 2011

My work with AMPATH - Part two

                     
It's been some time since I published part 1 of my AMPATH story. I couldn't follow up with part two because the project is still very much ongoing, and I've only just committed the latest changes....


But let me try to pick up this story where I left off, and write at least a chapter or so on our progress.


Well, (resuming our narrative...) Ada tried out my new omod on an openmrs server, and sure enough it worked.
So she went ahead and uploaded the new module to the AMPATH research server, and suddenly it did not work.


The error was as follows,




Error Starting Module – Patient Matching
Error while trying to start module
Error while running sql: DROP TABLE IF EXISTS `openmrs`.`persistreportdata` . Message: DROP command denied to user 'amrs_user'@'localhost' for table 'persistreportdata'

I has just started digging into this problem when I got a mail from Win (Nyoman Ribeka) a Regenstrief developer and one of the fist contributors (well, actually THE first contributor) to the patientmatching module.

Apparently Ada had forwarded him the stack trace, and it had taken Win all of five minutes to come up with the solution.

The problem was that we had tested out the fixes using an 'openmrs' database, while the  AMPATH database was named 'amrs' ! . The issue was being caused by a database dependent code snippet that had somehow by-passed our vigorous code review process.

So naturally our fixes worked on the openmrs test environment, and crashed on the AMPATH environment.

But anyway, it was quite easy to fix once we understood the cause. we traced the faulty code to the sqldiff file ( an SQL inset into statement had the database name 'openmrs' prepended to the end. This was unnecessary, and was causing our problems. )

So I fixed it, tested it out and sent Ada the latest omod...

And was that the end of our problems ? not quite, 

But that is for later. Do stay tuned for part -3 !

No comments:

Post a Comment