Skip to main content

Need Help Using Spok Knowledge?

Internet Explorer is not supported. Please reload in Chrome, Edge, Firefox, or Safari.

Spok Messenger Patient Repository Scrub Tool

Scrub Tool

The Patient Repository Scrub Tool is used to anonymize protected health information (PHI) in a Patient Repository Service database. Once the content of the database has been anonymized, a copy of the database can be sent to Spok support for assistance without violating HIPAA guidelines.

Since there is no way of recovering the anonymized data after the Scrub Tool has been run, it is highly recommended that the scrub tool is run on a copy of the PatientRepository database. Please make sure a backup of the PatientRepository database is made before running the Scrub Tool as well.



This Scrub tool is deployed with the Patient Repository Service during the installation of Spok Messenger. For more information, please refer to Installing the Patient Repository Service section in Implementing Spok Messenger.

After installing the patient repository service, the tool appears under {installation path}\Services\ScrubTool.

There are two files in this folder:

  • RunScrubTool.bat: This is a batch file that is used to anonymize the patient identity data in the copied patient repository service database.
  • ScrubPatientInfo.sql: This is the SQL script that performs the business logic for anonymizing the PII within the patient repository service database.


Using the Scrub Tool

The tool must be ran as a user with Administrator privileges. Please note: if your database name does not match the default or the file path does not exist, running this batch file will give an error. Default parameters are pre-configured. 

The batch file should be launched through the Windows Command shell. You need to set 3 arguments as input into the script. The parameters appear in the following order:

  • Dbname: This is the database name of the Patient Repository Database you want to scrub.  The default is “PatientRepository_Copy”.
  • Directory: This is the file location for the temporary files which hold random shuffle patient identity data. There are a total six files that are created under this directory. The default file location is: C:\Program Files (x86)\Spok\Spok Messenger\Services\ScrubTool\”. If you want to customize the file path, please make sure the file path exists on the same server as the database. You will need to create the file path before executing the scrub tool in order for it to work properly.
     Make sure your file path is an absolute file path and that it has a backslash at the end of the file path.
  • Dbinstance:  This is the database instance you want to point to. The default is “.\”.


After running the tool, the Patient identity data will be anonymized. This means the data in the "copied" Patient Repository database will be transformed so it no longer contains actual PHI data. The data within the database is transformed to maintain its readability. Some data such as names are scrambled and re-used in a way that no longer identifies real people. Identifiers like medical record numbers and account numbers are substituted with random data.

  • First Name
  • Last Name
  • Middle Name
  • Gender
  • Birth
  • MedicalRecordNumber
  • AccountNumber
  • AdmitReason.