Anonymise script for endTB

How to run it?

  1. Download the endtb-config using below wget command

    Download endtb-config
    wget https://github.com/Bahmni/endtb-config/archive/release-0.82.zip


  2.  uncompress downloaded file using below command

    unzip file
    unzip release-0.82.zip


  3. Go to anonymise folder

    Navigate to anonymise folder
     cd endtb-config-release-0.82/scripts/anonymise
  4. Run the script as below which internally executes the “deidentify_openmrs.sql” on “openmrs” database. 

     

    Navigate to anonymise folder
     ./anonymise.sh
    Running script will prompt for mysql root password, please provide the valid passsword.

What is incorporated in it?

The sql script is self-intuitive as each and every sql statement has the comment for what it does. However, here are the list of things that are incorporated as part of anonymisation script

  • Person name is anonymised to have eight random alpha numeric upper case characters.

  • Birth date is anonymised in such a way that the script will add or reduce 0-6months / 0-3months / 0-30days to the birth date if the person is more than 15years / between 5 and 15years / less than 5years old respectively. Estimated DoB will be toggled randomly to have either true or false (1 or 0).

  • Person attributes of type text will be anonymised to have eight random alpha numeric upper case characters.

  • Person attributes of type numeric (which are having form validation as numbers) will be anonymised to have random numbers with 10 digits.

  • If the patient identifier prefix (eg. ARM for Armenia)  exists in the system, EMR IDs are anonymised with a combination of random patient identifier prefix (from the list of prefixes available) and a random number (a unique autoincrement id which is given in patient table in openmrs) attached to it (eg. ARM123). If not, it will use ‘ETB’ as the prefix while generating the EMR ID (eg: ETB123).

  • Treatment IDs are anonymised to have eight random alpha numeric upper case characters.

The observations anonymisation has been commented out in the script. Once that is uncommented, it will be anonymised as follows.

  • Text fields will be anonymised to have eight random alpha numeric upper case characters.

  • Numeric fields will be anonymised to have random numbers of 8 digits.

 

How to customize it?

For person attributes:


Anonymising any TEXT Person Attributes

To anonymise any text person attributes (like patient address), please add those person attribute types to the array at line #31

https://github.com/Bahmni/endtb-config/blob/release-0.82/scripts/anonymise/deidentify_openmrs.sql#L31

Anonymising any NUMERIC Person Attributes

To anonymise any numeric person attributes (like telephone number), please add those person attributes to the array at Line #38

https://github.com/Bahmni/endtb-config/blob/release-0.82/scripts/anonymise/deidentify_openmrs.sql#L38

 

 For observations captured on forms:

Make sure to uncomment lines from 53 to 65 to have the observations anonymised by the script.

Anonymising any TEXT Fields

To anonymise any text fields, add the fully specified name of those fields (concepts) to the array at Line #57 (in place of or right after ‘Specimen Id’ having comma separated)

https://github.com/Bahmni/endtb-config/blob/release-0.82/scripts/anonymise/deidentify_openmrs.sql#L57

Anonymising any NUMERIC Fields

To anonymise any numeric fields, add the fully specified name of those fields (concepts) to the array at Line #64 (in place of or right after ‘Lab, Sample ID’ having comma separated)

https://github.com/Bahmni/endtb-config/blob/release-0.82/scripts/anonymise/deidentify_openmrs.sql#L64

 

 

On this page

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)