Lending paths

Whilst working on Pewbot, I wondered if you could really predict the future borrowing pattern of a user based on a specific book — in other words, if they borrow book X will they then go on to borrow book Y and then book Z?

Anyway, I’ve knocked together a basic script that will extrapolate the most likely lending path (both past and future) for a specific book.

For example, here’s the lending path for “Learning SQL: a step by step guide using Oracle”:


The book in question is displayed in bold. The title directly before it (“Java: the first semester”) is the title that is most frequently borrowed prior to “Learning SQL”, and the one directly after (“Database systems: a practical approach to design…”) is the most likely to be borrowed subsequently.

In turn, I then continue to extrapolate the paths in either direction until I run out of data or a title gets duplicated.

What we end up with is a hypothetical path showing what someone is most likely to have borrowed previously, and will then go on to borrow in the future.

What’s interesting is the flow of subjects along the path — the books before are all IT books, but the future path flows into HCI, IT management, and then into corporate strategy and business titles.

If you click on a book title, then it’ll take you though to the OPAC. If you click on the “path” link, then you’ll see the lending path for that particular title.

Once you’re in the OPAC, there’s a link to the lending path at the foot of every full bib page (although the path can only be generated if there’s enough raw circulation data).

If nothing else, it proves that our students are sensible enough to borrow the Harry Potter books in the correct order! 😀

  1. If you change the “bib.pl” to “bib2.pl”, then you’ll get an extended wider lending path – e.g.


    Usually, a title gets duplicated in one of the paths and that causes the path to end (otherwise it would loop).

    In this version of the script, when it hits a duplicate title it opts for the next most likely title instead and this allows the path to continue until it runs out of usable data.

  2. Pingback: panlibus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: