Skip to content

vanderbilt-redcap/redcap-instrument-and-variable-sql-renamer

Repository files navigation

redcap-instrument-and-variable-sql-renamer

Description

This module allows super users to change an Instrument or Variable name preserving all information previously associated with it, modifying all data and metadata associated to the old name, includding the branching logic. *Other features such as alerts, locking, field comments, etc. will not be modified.
*Primary Key variables cannot be renamed.

Installation

When enabling the module, a new link

This picture shows the module's configuration link in the External Modules section

will show up on the External Modules section.

When clicking the link, the module's page will load:

This picture shows the module's main page

Usage

To use the tool simply follow these steps:
  1. Select which type of data you want to modify (variable or instrument).
    This picture shows the data type to modify
  2. Select the name. You can use the dropdown or type the name and find one.
    This picture shows the data dropdown
  3. Upon selecting the variable/instrument, a new input will appear. Add the new name.
    This picture shows the new input
  4. For Instruments add the Form Name as it would show on REDCap's Designer page.
    This picture shows the Instrument Names as they appear on the Designer page.
  5. If a name already exists an error message will show.
    This picture shows the error when trying to add an existing name
  6. For Instruments a warning message will alert you before continuing.
    This picture shows the popup message
  7. After Confirming the changes, a success message will appear.
    This picture shows the instrument success message
  8. You can check the changes by click on the dropdown or going to REDCap's Designer Page.
    This picture shows the instrument dropdown updated
  9. You can also check REDCap's Logging to see what user did the changes and what changes were made.
    This picture shows the logs showing the changes

Developer Section: SQL Tables Involved

All SQL queries are done with transactions, this means that, if something fails, it will revert back and no changes will be applied.
The logs show all tables involved but here's a summary:
  • Instruments
    • redcap_data: field_name
    • redcap_metadata: form_name
    • redcap_metadata: field_name
    • redcap_metadata: form_menu_description
    • redcap_surveys: form_name
    • redcap_surveys: title
    • redcap_events_forms: form_name
  • Variables
    • redcap_data: field_name
    • redcap_metadata: field_name
    • redcap_metadata: branching_logic
*There are up to 5 redcap_data tables (redcap_data1 to redcap_data5). The logs will display which table has been affected.