Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a project deletion/undeletion function(ality) #78

Closed
pbchase opened this issue Sep 9, 2022 · 7 comments
Closed

Add a project deletion/undeletion function(ality) #78

pbchase opened this issue Sep 9, 2022 · 7 comments

Comments

@pbchase
Copy link
Contributor

pbchase commented Sep 9, 2022

We need a project deletion function that implements REDCap's normal "soft deletion" as implemented in REDCap's ProjectGeneral/delete_project.php. That process makes three changes:

$sql = "update redcap_projects set date_deleted = '".NOW."'
	     where project_id = $project_id and date_deleted is null";
...
ToDoList::updateTodoStatus($project_id, 'delete project','completed');
...
Logging::logEvent($sql,"redcap_projects","MANAGE",PROJECT_ID,"project_id = ".PROJECT_ID,"Delete project");

It's not clear to me what the best approach would be. We could write an R function that makes the database changes above. We could write an external module that adds an API method to delete projects with a super token. We could include a portion of REDCap code and call that using and external call to command line PHP.

What do you think we should do?

@pbchase pbchase added this to the Sequester orphaned projects milestone Sep 9, 2022
@ChemiKyle
Copy link
Contributor

I think an R function is easiest. IIRC the project deletion process in REDCap backend is just setting that date_deleted column so until they add something fancier we should take the KISS option of just doing the same thing.

@pbchase
Copy link
Contributor Author

pbchase commented Sep 9, 2022

... IIRC the project deletion process in REDCap backend is just setting that date_deleted column so until they add something fancier we should take the KISS option of just doing the same thing.

The backend also calls ToDoList::updateTodoStatus and Logging::logEvent

@pbchase
Copy link
Contributor Author

pbchase commented Sep 9, 2022

I asked the community if they wrote us an API extension: https://community.projectredcap.org/questions/133969/is-there-a-project-deletion-api-extension.html

@pbchase
Copy link
Contributor Author

pbchase commented Sep 9, 2022

We probably wouldn't need to call or emulate ToDoList::updateTodoStatus as this is outside the ToDoList

@pbchase pbchase changed the title Add a project deletion function(ality) Add a project deletion/undeletion function(ality) Sep 12, 2022
@ChemiKyle
Copy link
Contributor

I'm also going to add an un-delete function. These might end up as a PR to redcapcustodian since they're generically useful.

@pbchase
Copy link
Contributor Author

pbchase commented Nov 1, 2022

Putting the delete/undelete functionality in REDCapCustodian makes lots of sense.

@pbchase
Copy link
Contributor Author

pbchase commented Oct 5, 2023

@pbchase moved this to a REDCap custodian issue. As such, this issue can be closed

@pbchase pbchase closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants