From 8fb87238720f32f4b458af180826d84c2838ad2b Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Wed, 17 Apr 2024 17:21:16 -0400 Subject: [PATCH 1/4] Commit a schema change --- db/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 396b13e17..45e88e830 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_02_29_234258) do +ActiveRecord::Schema.define(version: 2024_03_07_053156) do # These are extensions that must be enabled in order to support this database enable_extension "hstore" @@ -550,6 +550,7 @@ t.datetime "updated_at", null: false t.string "internal_resource" t.integer "lock_version" + t.index "(((metadata -> 'bulkrax_identifier'::text) ->> 0))", name: "index_on_bulkrax_identifier", where: "((metadata -> 'bulkrax_identifier'::text) IS NOT NULL)" t.index ["internal_resource"], name: "index_orm_resources_on_internal_resource" t.index ["metadata"], name: "index_orm_resources_on_metadata", using: :gin t.index ["metadata"], name: "index_orm_resources_on_metadata_jsonb_path_ops", opclass: :jsonb_path_ops, using: :gin From 3edef243f77bcd4e60407a60c07750b0b3cdae3a Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Wed, 17 Apr 2024 17:21:38 -0400 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=81=20IiifPrint=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds configurations to support tenants in iiif_print PDF splitting feature. --- Dockerfile | 5 +++++ app/services/iiif_print/tenant_config.rb | 11 +++++++++++ config/initializers/iiif_print.rb | 1 + 3 files changed, 17 insertions(+) diff --git a/Dockerfile b/Dockerfile index 325d61452..1993d9913 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,6 +46,11 @@ RUN wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-57.t && rm -rf ImageMagick* \ && rm -rf /var/cache/apk/* +# Install "best" training data for Tesseract +RUN echo "📚 Installing Tesseract Best (training data)!" && \ + cd /usr/share/tessdata/ && \ + wget https://github.com/tesseract-ocr/tessdata_best/blob/main/eng.traineddata?raw=true -O eng_best.traineddata + ARG VIPS_VERSION=8.11.3 RUN set -x -o pipefail \ diff --git a/app/services/iiif_print/tenant_config.rb b/app/services/iiif_print/tenant_config.rb index 14ef3642b..4ec49e382 100644 --- a/app/services/iiif_print/tenant_config.rb +++ b/app/services/iiif_print/tenant_config.rb @@ -100,6 +100,11 @@ module PdfSplitter mattr_accessor :iiif_print_splitter self.iiif_print_splitter = ::IiifPrint::SplitPdfs::PagesToJpgsSplitter + ## + def self.never_split_pdfs? + !TenantConfig.use_iiif_print? + end + ## # @api public def self.call(*args) @@ -147,6 +152,12 @@ def service # In Hyrax::WorkShowPresenter we're only looking at the underlying file_sets. But IiifPrint # needs to look at multiple places. module WorkShowPresenterDecorator + ## + # @return [Boolean] Identifies whether IiifPrint PDF splitting is active for this work's tenant + def split_pdfs? + TenantConfig.use_iiif_print? + end + ## # @return [Array] predicate methods (e.g. ending in "?") that reflect the types # of files we want to consider for showing in the IIIF Viewer. diff --git a/config/initializers/iiif_print.rb b/config/initializers/iiif_print.rb index e83325c64..15c567a70 100644 --- a/config/initializers/iiif_print.rb +++ b/config/initializers/iiif_print.rb @@ -22,4 +22,5 @@ # config.sort_iiif_manifest_canvases_by = :date_published config.default_iiif_manifest_version = 3 config.persistence_adapter = IiifPrint::PersistenceLayer::ValkyrieAdapter + config.additional_tesseract_options = "-l eng_best" end From deaa15c5758902e7d7eee1a41cff649b84d97991 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Tue, 30 Apr 2024 14:36:55 -0400 Subject: [PATCH 3/4] Modify migration to check for column Updates IiifPring::PendingRelationships migration --- ...etails_to_iiif_print_pending_relationships.iiif_print.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20240214005253_add_model_details_to_iiif_print_pending_relationships.iiif_print.rb b/db/migrate/20240214005253_add_model_details_to_iiif_print_pending_relationships.iiif_print.rb index 234377154..280e3e067 100644 --- a/db/migrate/20240214005253_add_model_details_to_iiif_print_pending_relationships.iiif_print.rb +++ b/db/migrate/20240214005253_add_model_details_to_iiif_print_pending_relationships.iiif_print.rb @@ -1,8 +1,8 @@ # This migration comes from iiif_print (originally 20231110163052) class AddModelDetailsToIiifPrintPendingRelationships < ActiveRecord::Migration[5.2] def change - add_column :iiif_print_pending_relationships, :parent_model, :string - add_column :iiif_print_pending_relationships, :child_model, :string - add_column :iiif_print_pending_relationships, :file_id, :string + add_column :iiif_print_pending_relationships, :parent_model, :string unless column_exists?(:iif_print_pending_relationships, :parent_model) + add_column :iiif_print_pending_relationships, :child_model, :string unless column_exists?(:iif_print_pending_relationships, :child_model) + add_column :iiif_print_pending_relationships, :file_id, :string unless column_exists?(:iif_print_pending_relationships, :file_id) end end From d36047ae0fca322f67bef82d51edfc370a61e038 Mon Sep 17 00:00:00 2001 From: Shana Moore Date: Thu, 9 May 2024 09:45:20 -0700 Subject: [PATCH 4/4] update iiif_print to pull in split work --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5f296efdf..30ac12d91 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -219,7 +219,7 @@ GIT GIT remote: https://github.com/scientist-softserv/iiif_print.git - revision: 122e86634f17c8f40d9ae4d59d2d7deca00f1694 + revision: cee97520f95e90a9e75d4dbcf159db337676e3c6 branch: main specs: iiif_print (1.0.0)