December Days 19 - The Algorithm
Dec. 20th, 2016 10:14 am[It's December Days time! There's no overarching theme this year, so if you have ideas of things to write about, I'm more than happy to hear them.]
collection_name = gets.chomp
books = Array.new
Book.where(collection: collection_name).find_each do |book|
books.push
end
weed_candidates = Array.new
books.each do |book|
if book.type == fiction && book.publication_date <= 2.years_ago && (book.circ_ytd < 4 || book.circ_lastyear < 4), weed_candidates.push
end
if book.type == nonfiction && book.publication_date <= 5.years_ago && (book.circ_ytd < 4 || book.circ_lastyear < 4 || (book.circ_lifetime / (Time.now.year - book.publication_date.year)) < 4),
weed_candidates.push
end
end
After that, it requires a certain amount of human intervention, looking at condition of the material, whether it has friends in a series that are going well, whether it's an award-winner (which doesn't necessarily save it from its fate) and so forth. There's also some looking on things that escape this algorithm to catch the things that are circulating but in bad condition or that have circulated sufficiently that they may need replacement copies. But that's the basic way that I handle making decisions about which books are to be considered for dismissal based on their circulation. Other material types have different baselines, but the idea is the same.
A thing we always have to remember is that the computer can make suggestions, but the humans always have the final day on whether something stays or goes. Always.
collection_name = gets.chomp
books = Array.new
Book.where(collection: collection_name).find_each do |book|
books.push
end
weed_candidates = Array.new
books.each do |book|
if book.type == fiction && book.publication_date <= 2.years_ago && (book.circ_ytd < 4 || book.circ_lastyear < 4), weed_candidates.push
end
if book.type == nonfiction && book.publication_date <= 5.years_ago && (book.circ_ytd < 4 || book.circ_lastyear < 4 || (book.circ_lifetime / (Time.now.year - book.publication_date.year)) < 4),
weed_candidates.push
end
end
After that, it requires a certain amount of human intervention, looking at condition of the material, whether it has friends in a series that are going well, whether it's an award-winner (which doesn't necessarily save it from its fate) and so forth. There's also some looking on things that escape this algorithm to catch the things that are circulating but in bad condition or that have circulated sufficiently that they may need replacement copies. But that's the basic way that I handle making decisions about which books are to be considered for dismissal based on their circulation. Other material types have different baselines, but the idea is the same.
A thing we always have to remember is that the computer can make suggestions, but the humans always have the final day on whether something stays or goes. Always.