Closed eddierubeiz closed 2 years ago
Summary of results:
Here's the math:
manuscripts = Work.where("json_attributes -> 'genre' ? 'Manuscripts'").where(published:true).where(parent:nil)
manuscripts = manuscripts.select { |m| m.date_of_work.first.present? }
manuscripts = manuscripts.select { |m| m.date_of_work.first.attributes['start'].present? }
manuscripts = manuscripts.select { |m| Date::strptime(m.date_of_work.first.attributes['start'][0..3], "%Y").year < 1850 }
manuscripts = manuscripts.select { |m| m.genre.none? 'Rare books' }
manuscript_assets = Set.new()
manuscript_child_works = Set.new()
manuscripts.each { |m| manuscript_assets.merge( m.all_descendent_members.where(kithe_model_type:'asset', published: 'true')) }
manuscripts.each { |m| manuscript_child_works.merge( m.all_descendent_members.where(kithe_model_type:'work', published: 'true')) }
manuscripts.count
13
manuscript_child_works.count
4
manuscript_assets.count
1196
rare_books = Work.where("json_attributes -> 'genre' ? 'Rare books'").where(published:true).where(parent:nil)
rare_book_assets = Set.new()
rare_book_child_works = Set.new()
rare_books.each { |m| rare_book_assets.merge( m.all_descendent_members.where(kithe_model_type:'asset', published: 'true')) }
rare_books.each { |m| rare_book_child_works.merge( m.all_descendent_members.where(kithe_model_type:'work', published: 'true')) }
rare_books.count
70
rare_book_child_works.count
757
rare_book_assets.count
7004
List of our 13 manuscript titles:
List of our 70 rare book titles:
As part of a grant application, I spent some time looking into our inventory of rare books and manuscripts in the digital collections. What we want is work counts, child work counts, and asset counts for sets:
Manuscripts:
Manuscripts
Rare Books
(to avoid double-counting)Rare books:
Rare books
(regardless of other genres)