Bug 32487 - Cronjob to delete records with no items
Summary: Cronjob to delete records with no items
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-19 03:50 UTC by Aleisha Amohia
Modified: 2023-12-28 20:42 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Crowdfunding committed: 0
Crowdfunding contact:
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2022-12-19 03:50:59 UTC
We've been requested to develop a cronjob to clear out bibliographic records with no items. This could be useful if there's a duplicate record where items are being attached, so the other record is empty and not being used in Koha, just crowding search results.
Comment 1 Andrew Fuerste-Henry 2022-12-19 17:18:10 UTC
It'd be great if this included some way to exclude some itemless bibs, for libraries that include bibs for ebooks without attached item records. Maybe an option to exclude certain biblio-itemtypes from the deletion? Or to exclude bibs with something in the 856?
Comment 2 Katrin Fischer 2022-12-19 17:32:02 UTC
There are actually quite a lot of cases that come to mind, where a record has no items but is still wanted/needed:

* Set type records for multi-volumes
* Series type records for traced series
* Records where the item is linked using EasyAnalytics
* Analytical records using 773 standard linking
* Serials where the library has subscriptions and issues, but doesn't create items
* Acquisition records where the library doesn't attach items or new standing order records
* Electronic resources - 856 might not be best, as it could also be some other type of content enrichment like a scanned TOC. Maybe 007, Pos. 0? https://www.loc.gov/marc/bibliographic/bd007.html

Maybe an option: add a --WHERE SQL condition option to the existing batchdeletebiblios.pl. 

This way it would allow libraries to easily specifiy "has no items", without going into the rabbit hole of discussing all the above cases. Keeping it simple.
Comment 3 David Cook 2022-12-19 22:15:51 UTC
Locally we handle this scenario using a custom report page where librarians can review bib records with no items attached. 

They'll often exclude electronic resources by item type. 

It's a more manual process than a cronjob, but it's less error prone I think.
Comment 4 Aleisha Amohia 2023-01-10 04:04:37 UTC
Thanks all for your discussion.

I ended up using cronjobs/runreport.pl to run a report fetching the biblionumbers of biblios with no items, piping those results into a file, then giving that file to batchdeletebiblios.pl.

I'll close this bug report now.