*See the bottom of this page for links to the author’s related research and/or publications.
The bookshift.py script provides data that allows library staff to complete predictable library book shifts. It can do that only when someone creates appropriate data files for the script to read. The following instructions how to create usable data.
Predictable books shifts require planning and data collection ahead of time. Library staff must collect measurements of books as they currently sit on the shelves. They must also collect measurements of shelves in the future location. Optionally, library staff may specify imposed fill ratios for collections of books that will be shifted.
This script requires specific input to work. It requires two comma separated files with the option of using a third. File requirements are below. It is easiest to make these files in a spreadsheet and then to export them to CSV. The files must be named the same as the sample files provided with the script.
bookshift.py will create new csv files that include the data you input, plus additional columns of programmatically created data. Following is a sample, and the goal, of two columns from one of the exported files.
| shelf_num | pretty_waypoint |
|---|---|
| 1 | The last book from this shelf goes 24.0 in/cm into shelf 1 |
| 2 | The last book from this shelf goes 18.9 in/cm into shelf 2 |
| 3 | The last book from this shelf goes 17.9 in/cm into shelf 3 |
Method 1: Simply copy the bookshift.py file to a location where you can execute a python script. Create a subdirectory named “files-to-import” and place the three relevant data CSV files in that directory: current.csv, future.csv, and collections.csv. If you do not want to use imposed fill ratios, then rather than using the collections.csv file download the “no_collections.csv” file from the code repository to your “files-to-import” directory.
Method 2: As an alternative to copying the one file, clone the bookshift GitHub repository and work within the resulting directory. The resulting directory will already contain the “files-to-import” directory with five test files. Execute bookshipt.py and it should create a “export-data” directory with the resulting files. That will confirm the script works and now you can create your own csv files from shelving data and replace the files as stated in method 1.
This file describes your current arrangement of shelves and books. The following example shows required column names. For a longer example using actual data, see the sample current.csv file. The data below is shown in in a table format but the file must be csv.
- measure: The units of books measured on the shelf. Examples are in inches.
- sctn_increment: place an x here if this is the first shelf of a section.
- call_num: The call number of the first book on that shelf.
- This field must only have a call number in it for the first book on the first section of the first shelf of the range. The field doubles as a range_increment field. If there is not a book on this shelf, write “No book” or “N/A”.
- col_num: Collection number of the books on that shelf. Unless you plan to use imposed fill ratios, all rows should be “1”.
| measure | sctn_increment | call_num | col_num |
|---|---|---|---|
| 35 | x | A 1.3: M35 | 1 |
| 28 | 1 | ||
| 15 | 1 | ||
| 35 | 1 |
This file describes the future arrangement of shelves. See the example future.csv file provided with the script for a real world example.
- shelf_measure: measurement of the shelf space that could be occupied by books.
- sctn_increment: place an x here if this is the first shelf of a section.
- range_increment: place an x here if this is the first shelf of a range.
| shelf_measure | sctn_increment | range_increment |
|---|---|---|
| 35.5 | x | c |
| 35.5 | ||
| 35.5 | ||
| 35.5 |
This file describes one or more sets of books and whether you want to impose fill ratios on that set.
- set_num: set number; They should be listed starting with 1 and ending with your last set number. These must be consecutive integers.
- imposed_fill_ratio: The fill ratio you will impose on a set. You can define as many sets as you want, but the script works best if you leave a generous percentage of the books in “unimposed” sets.
| set_num | imposed_fill_ratio |
|---|---|
| 1 | |
| 2 | 0.65 |
| 3 | 0.7 |
| 4 |
- shelf: the horizontal structure that books sit on
- section: a vertical group of shelves of similar size stacked above each other with space between them for books.
- range: a group of sections, attached to each other, forming a line on the floor. Ranges are arranged in parallel with aisles between them for people to walk down and look at the books.
- fill ratio: the measure of books on a shelf divided by the measure of books that could be on the shelf if it were full.
- imposed fill ratio: a fill ratio defined not by a calculation but by a person’s judgment, irregardless of what the fill ratios are for other collections
- collection: a contiguous set of books that have the same future fill ratio.
Below, you can find similar research by the author, Joshua Lambert.
- Lambert, J. (2022). Predictable book shifting. The Code4Lib Journal, 54. https://journal.code4lib.org/articles/16577
- Lambert, J. (2022). Evidence-based library book shifting. Journal of Access Services, 19(4), 167–178. https://doi.org/10.1080/15367967.2023.2172416
- Research data - https://osf.io/8m3cu/
- Research data DOI - https://doi.org/10.17605/OSF.IO/8M3CU
- For librarians not comfortable using Python, the linked spreadsheet at OSF can provide similar results using a different tool.