Cleans up Box folders for completed Jira cases:
Scans the Box root folder for case folders (
aearep-XXXX).Checks whether each case is ready for purging via its Jira status.
For ready cases: deletes data files (CSV, DTA, ZIP, …), keeps documents (PDF, DOCX, TXT, …), and moves the folder into the
1Completedsubfolder.
aea-box-clean-folders --test # dry run
aea-box-clean-folders # process all ready cases
aea-box-clean-folders --case 1234 # process one case
aea-box-clean-folders --list # list cases and their status
aea-box-clean-folders --all --email # also send restricted-data deletion noticesRestricted-data deletion notice (--email / -e)¶
For a cleaned-up case whose Jira issue (or, if revised, the last issue in its
“is revised by” chain) has a Request confidential data subtask, the script
can additionally:
Post an internal comment on both that issue and the subtask, confirming the Box deletion, reminding the reader to also delete any offline copies, and giving the
aea-box-recover-files --case <N> --days 30command to undo it.Set the issue’s
Was data deleted?field toYes.Send an author-facing deletion-confirmation email (based on the restricted-data request template) to
dataeditor@aeapubs.org, with the subtask key and manuscript number in the subject line. The email includes an editor’s note asking the recipient to fill in the author’s name and the manuscript title and forward it — the author’s own address isn’t available in Jira, so this can’t be sent directly. If sending fails (e.g. no mailbox password available), the email’s To/Subject/body are printed to the console instead, to copy into a mail client by hand.
Cases with no such subtask are skipped silently — there’s nothing to notify.
This is off by default. Without --email, you’re prompted interactively
(default No) once before processing starts. Pass --email/-e to enable it
unconditionally, including under --test (which only previews the notice).
Environment¶
Box:
BOX_FOLDER_PRIVATE,BOX_PRIVATE_KEY_ID,BOX_ENTERPRISE_ID, andBOX_CONFIG_PATH(orBOX_PRIVATE_JSON)Jira:
JIRA_USERNAME,JIRA_API_KEY, optionallyJIRA_SERVERFor
--email:DATAEDITOR_EMAIL_PASSWORD(fallback if the 1Password CLIophas no session, e.g. when running remotely; otherwise read from the 1Password item “Email for AEA Dataeditor”), optionallyDATAEDITOR_SMTP_HOST(defaultmail.aeapubs.org) andDATAEDITOR_SMTP_PORT(default587)
Deleted files can be restored with aea-box-recover-files.