Delete CollObject in Batch in Sp7

Hello,

What is the most efficient method to delete multiple specimens in a Specify 7 collection? Is there a way to batch delete several specimens at once (e.g., using a workbench or SP-6) instead of deleting them individually?

Additionally, is it safe to delete selected specimens directly from the collectionobject table, and will foreign keys be properly maintained?

Thanks

Hi Amelie,

This is a complex question, and why I think it has been left hanging for a bit while people ponder. I’ll outline my understanding of the options available, but would qualify it with saying that an operation such as batch deleting should be done with great care and planning, and that any specific plan is best run by the Specify team. Also, as a disclaimer that is particularly important on this post, I am not a member of the Specify team.

Q1: Is there a way to batch delete several specimens at once?

Short answer, yes. Bulk editing/deleting anything is possible through SQL, this is just not the most accessible way to do it and doesn’t have business rules applied. Another option is to repeat an operation via the API (i.e provide a list of collection object ids that you would like to delete and then run the DELETE operation against the CO table for each id via a loop).

SP7

Batch editing in general is not available through the Specify 7 workbench (though it is on the way), and thus bulk deletions through the Specify 7 workbench are not possible at this time. I am not sure if bulk deletion would be possible even after the functionality is implemented (based on its current feature scope), though this will depend on developments on the feature set by the time of release.

SP6

Batch editing is available for a subset of tables. However, I do not believe that the delete operation is possible for a CO. There doesn’t seem to be any button in the interface that would allow for a deletion to occur. You could remove the relationship from a CO to, say, an Agent through this tool.

Q2: Is it safe to delete selected specimens directly from the collectionobject table?

Individual Collection Objects can be deleted through the delete button on either the SP7 or SP6 form (delete button should be in the bottom left of the form). Whether this is safe or not to do depends on specifics of the individual CO (has a plan been made for the data, etc). The system shouldn’t give you any problems for any Collection Object provided you have the necessary permissions to delete.

I am unclear what you mean when you say “and will foreign keys be maintained?”. When you delete a Collection Object, that CO will be removed, however data in other tables will continue to exist. This doesn’t apply uniformly for all tables and is based on dependency (someone correct me if I am wrong in that). To see which tables are dependent, you can access the data model at https://<your-domain>/specify/data-model/#collectionobject. For example, Preparations for that CollectionObject will be deleted, whereas an Accession (if one had been created) would not be. For example, if I create a CO with cataloger “John Doe”, then delete the CO, “John Doe” will still exist in the system, they will just no longer be related to the now non-existent CO. This is different than the “Roll back” mechanism in the workbench, that will remove the data in the related tables.

4 Likes