sciencehistory / scihist_digicoll

Science History Institute Digital Collections
Other
11 stars 0 forks source link

Count works and assets associated with rare books and manuscripts #1530

Closed eddierubeiz closed 2 years ago

eddierubeiz commented 2 years ago

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:

eddierubeiz commented 2 years ago

Summary of results:

eddierubeiz commented 2 years ago

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
eddierubeiz commented 2 years ago

List of our 13 manuscript titles:

eddierubeiz commented 2 years ago

List of our 70 rare book titles: