Chunks of code used during the implementations at Huddersfield and Northumbria will be released here in the hope that they’ll be of use to others.
Unless noted otherwise, the scripts have a CC0 licence. They are released “as is” and, whilst we can offer general help and advice to help you get them up & running, you should regard them as unsupported.
Horizon: Export Deleted MARC Records (19th/Aug/2010)
Code: deletedbibs.pl (Perl script)
When a bib record is deleted via the staff client, Horizon flags the record for deletion by changing the LDR 6 position to “d”. In the bib table in the Horizon database, the LDR is denoted by tag 000. The following SQL can be used to locate these records:
select bib# from bib where tag="000" and text like "_____d%"
The Day End process carries out the actual physical removal of the bib record. So, it is important to ensure that you export any flagged bibs after the library has closed (so that no further records will be deleted by staff) but before Day End runs.
The deletedbibs.pl script can be set to run automatically — we run it as a Scheduled Task on a Windows PC at 10pm every day.
You will need to tweak the script before you can use (see the inline comments for more info) and you’ll need to set up the following:
- configure an ODBC connection (or similar) to your Horizon server so that the script can run the SQL query)
- place a copy of the Horizon marcout.exe tool in the same directory as the script (or somewhere within the path)
- configure the marcout switches so that the bib# is added to the relevant MARC tag
- configure the FTP details of the server you are uploading the MARC .mrc files to
Although we’re using the script to export deleted MARC records to Summon, you could easily use it for any other product, e.g. VuFind, AquaBrowser, etc.
Horizon: Simple DLF Item Availability (19th/Aug/2010)
When we initially got Summon, one of the things we noticed was that it was scraping the OPAC pages to get the live item availability data for books, etc. Because of the poor way in which HIP handles sessions, this has the potential to adversely affect OPAC performance. In the past, libraries who’ve allowed search engines (e.g. Google) to index their HIP have reported server slow down and even crashes.
So, to try and pre-empt any problems before we went fully live with Summon, we liaised with Serials Solutions and implemented a very basic item availability web service based on the DLF spec. You can see some sample output from the web service here.
In our particular case, the dlf.pl script is proxying the output from a mod_perl server running on our intranet. We chose to write the web service using a mod_perl handler (instead of a bog standard Perl CGI script) for several reasons:
- mod_perl handlers are considerably faster than standard CGI scripts
- we can use Apache::DBI to provide a persistent database connection to Horizon
- a handler can cache data (in our case, a list of item collections and status codes) in memory
- mod_perl is just so cool 😉
As long as you’ve got a bit of experience with Perl, you could easily rehack the code to turn it into a basic CGI script, but you’ll loose some of the above benefits.
Apart from the handler, you’ll also need to set up a text file with status codes and availability messages — here’s a chunk from our file. For each of your Horizon item status codes, you can decide whether or not that means the item is “available” (dlf:availabilitystatus) and what the relevant display message (dlf:availabilitymsg) should be. Note that the file is tab separated.