GSOC Week1: Getting familiar with the Sync Code

3 06 2008

My first week of gsoc went without writing a lot of code for the Openmrs Data Synchronization. At least I tried to get familiar with the code in the branch there, there is a big work already done on the project , so I have to design the user interface in order to setup , control and monitor the Synchronization process between two OpenMRS server installations : PARENT and CHILD.

A parent should have many CHILD(s) The actual synchronization process goes bi-directional means that any new , update or delete transaction made on the Child model is handled as a Sync Item hold in the Sync Journal waiting for transmission to the PARENT Server . When the PARENT receives the Sync record (made of Sync Items) from the Child , It get updated and then deliver a Sync report to the Child and then the Child get updated and before Synchronization PARENT and CHILD should have an identical Database Model. The Synchronization process involves many tricks as Sync Data Structures , Model Changes tracking within SynchronizationHibernateInterceptor algorithms , Data Serialization (Xml), Transmission , Deserialization and Updates .The main difference between the Openmrs trunk data model and the Sync data model was the addition of guid unique keys to every table (i.e. Synchonizable object/class) being synchronized .This enable Server to handle records from different Openmrs systems even having the same id (PK). An other trick to be done by Sync developers is to design algorithms for Conflict resolution within Sync updates and an adaptive data transmission algorithm (I think there are tickets for that).

In order to test Synchronization, I’ve made two OpenMRS installations at my work office .There is a desktop installation working as PARENT server and my laptop is set as the Child server. At the beginning I got some problems with the Sync branch deployment as I checked it out from the repository . I couldn’t even get the welcome page , there was a runtime error about the Anonymous Role login ,so I tried to change some login settings at org.openmrs.api.contect.UserContext.getAnonymousRole() and I was logged with a SUPERUSER_ROLE (“System Developer”). After I found the Synchronization was Disabled then I set a runtime property synchronization.sync_status to =enabled but the bug still there (Error to parse the runtime property synchronization.sync_status),after I decided to change the default return value at org.openmrs.synchronization.SyncUtil.getSyncStatus() to ENABLED_CONTINUE_ON_ERROR, but right now I found the I left the default return value as it was DISABLED_SYNC , then I set the runtime property synchronization.sync_status with an enum value in the org.openmrs.synchronization.SyncStatusState (ENABLED_CONTINUE_ON_ERROR) and there was no more parsing error .An other issue was with the guid field in the database .The addition of guid column in the Sync database was so crucial for Items exchange between different servers DB but in the openmrs_1.1.0-add-guids.sql script set guid as a Not Null value which result in JDBCException (guid field doesn’t have a default value) when creating new Items or Updating others in the DB without setting the guid. That exception prevented me neigther to create new data in the DB nor to update(edit) present ones. I was even unable to create a new Child Server @PARENT because the Child account is like adding a new User to the System .I think the solution for this is to create guid field with a Not Null default value like “emremremremremremremremremremremremr” . For my testing I decided to remove the script setting guid as not null value.Then It works fine for adding users, but it doesn’t for adding Patients. I still have problems with Sync Web transmission because after setting a Child the History page throws an Error , I still have more to track on those errors,(it’s even helpful to know more crucial lines in the code ) , while implementing my design plans.

I think my project is not too challenging and I hope I should be done early , but my testing will be always depending on the sync engines build by my mentors Maros and Christian during the in Data Synchronization project .I ‘ve read things about the Spring MVC framework used there and I already have my own JSP-JSLT page for testing and accessing Sync data in the DB via controllers . I will of course build more Controllers and Viewers , and more still to come …

*Ibyiza biri Imbere !*(Better Tomorrow)


Actions

Information

Leave a comment