OpenClinica User Manual/RenamingDatasets

From Wikibooks, open books for an open world
Jump to: navigation, search

Renaming datasets[edit]

Cluttered lists[edit]

After you've been conducting your study for some time, you might find your list with datasets cluttered. Especially with names like "temp" or "temp2", etc. You can not rename these datasets and when you "delete" them, only the status changes. You may want to delete these sets or rename them.

In general it is a better approach to rename your datasets, because of regulations and because of complexity.

Renaming[edit]

You could add a "z_" as prefix, so all your existing datasets go to the end of your list and new ones will be on top. If you look at the tables involved you'll see archived_dataset_file, dataset_crf_version_map, dataset_filter_map, dataset_item_status, dataset_study_group_class_map.

To see a list of all tables: login to your server; sudo as user postgres; start psql; connect to openclinica, describe all tables.

cd /usr/bin

sudo -u postgres ./psql

(in psql)

\c openclinica

\dt

The one you're aiming at is dataset, of course. To see the structure of the table, type "\d dataset" List your datasets with "select dataset_id, study_id, name from dataset;"

Find in this output the study_id of the study for which you want to rename your datasets, for example study_id=7. Your update statement will be "update dataset set name='z_'||name where study_id=7;"

Deleting[edit]

If you really want to delete the datasets, you would have to issue a series of sql-statements like: "delete from archived_dataset_file where dataset_id in (select dataset_id from dataset where study_id=7);" And you would have to do this for all related tables and finally delete the records from table dataset.

And whatever you choose: before you do anything, make a backup.