Data Integrity Module Check Repair

This page only applies to versions of Data Integrity Module up to 1.1.3. This feature is no longer included in versions 2.0+.

Introduction

The Check Repair feature is another cool feature of the Data Integrity Module. This feature enables the user to repair the data records in the database that constituted a failed check. Once a check is run, the results are displayed in the Results page and in that page a link is given through which the user can repair the failed records of a check.

Providing Proper Repair Directives

It is very important to provide a proper and accurate repair directive when adding integrity checks via the web interface or via the XML file upload feature. A check can have one of four valid repair types:

  • None
  • Script
  • Instructions
  • Link

None

If the user sets the repair type to None, a repair directive is not needed to be provided.

Script

If the repair type is set to Script, the user has to enter a valid SQL query which will repair the failed records in the database. For example say the check code is like "SELECT * FROM patient_name WHERE first_name IS NULL", which will return database records that has NULL for the first name and these records will cause a failed test. So if the user wants to repair the check via a script, he/she can enter a repair directive like "UPDATE patient_name SET first_name = 'test' WHERE first_name IS NULL".

Instructions

If the repair type is set to Instructions, the user has to provide a set of instructions in the repair directive. The provided set of instructions can be in simple plain text or even in HTML syntax. For example if the user wants to see a list of instructions each having some formatting, the user can enter instructions like the ones that can be found here

The user can also provide a link to a location from where the failed records can be repaired. If the link should change depending on the returned result and if it is a page within the OpenMRS app, the link should be in the format "module/patient/patientDashboard?patientId={result}". The link should be relative and should omit the "http"//servername:port/webappname" part. (e.g. http://localhost:8080/openmrs). Furthermore the check code should return the value which needs to be substitued for the {result} in the link, in the first column.

e.g:
The code: SELECT patient_id, name FROM patient WHERE time(date_created) > time('2005-09-20') AND time(date_created) < time('2006-09-20')
The repair directive: module/patient/patientDashboard?patient_id={result}

If the link is static and doesn't depend on the query results you have to enter the full link like "http://www.openmrs.org" in the repair directive

Repairing the Check

The link to repair the check can be found in the results page. Once that link is clicked, the check will be repaired in accordance with the repair type and the repair directive that was specified when the check was created. If a repair type of "None" is specified, a link is given to the page where the user can add a repair directive to the respective check.

Back to Main Page