Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎁 IiifPrint Enhancements to clean up split works as PDF fileset is deleted #288

Merged
merged 15 commits into from
Nov 15, 2023

Conversation

ShanaLMoore
Copy link
Contributor

@ShanaLMoore ShanaLMoore commented Nov 10, 2023

Note: using this update requires running rails iiif_print:install:migrations in your application to pull in the additional database migration.

related to

  • Add parent_model, child_model, and file_id to the iiif_print_pending_relationships table for easier queries.
    The goal here is twofold:

    1. Add file_id of the triggering PDF's fileset, to be able to tie pending relationships to a specific PDF file, rather than a work, as one work may have multiple PDF attachments begin split.
    2. Add parent & child model, to have everything needed in the PendingRelationship table to rerun a relationship job which may have run out of retries
  • Add service to destroy child works and pending relationships as a PDF fileset is destroyed.
    Future enhancements could include:

    1. Submitting the service as a background job
    2. Create a way to do the PDF splitting separate from an import, using this service to do the cleanup.
  • Removes IiifPrint::PendingRelationships table entries when relationships are formed without errors, regardless whether the count matches.
    Errors are still reported on the job, so followup can be done if needed, but the relationship table entries are unnecessary in this situation.

  • Destroys spawned child works as file_set is destroyed. Child works which were NOT created as part of PDF splitting will not be affected by this.

Screenshots

Work with two PDF filesets, both split into children

Screenshot 2023-11-13 at 10 56 15 PM

Work after one of the filesets is deleted through the UI

Screenshot 2023-11-13 at 10 56 34 PM

NOTES

ref: https://docs.google.com/document/d/1QPeT3bLHQkWWkhX5SQ9Pntgtlm-bqlUxoz5E5Xt1tRI/edit

@ShanaLMoore ShanaLMoore force-pushed the add-models-to-pending-relationships-table branch from f79bf7f to cff0d69 Compare November 10, 2023 16:39
@ShanaLMoore
Copy link
Contributor Author

TODO: Add file set id to pending table

@ShanaLMoore ShanaLMoore changed the title 🎁 add parent_model and child_model to iiif_print_pending_relationships 🎁 add helpful query attributes to iiif_print_pending_relationships Nov 10, 2023
@ShanaLMoore ShanaLMoore requested a review from laritakr November 10, 2023 23:31
laritakr
laritakr previously approved these changes Nov 13, 2023
LaRita Robinson added 5 commits November 13, 2023 14:58
After creating relationships remove the PendingRelationships entries,
as they are no longer needed, even if we have more relationships than
expected.

Cleanup may be needed so still log the error to report the excess relationships.
When a fileset is destroyed containing a PDF which was used to
split into child works, this service performs the necessary cleanup.
@laritakr laritakr dismissed their stale review November 14, 2023 03:45

shared work on pull request

@laritakr laritakr changed the title 🎁 add helpful query attributes to iiif_print_pending_relationships 🎁 IiifPrint Enhancements to clean up split works as PDF fileset is deleted Nov 14, 2023
LaRita Robinson added 2 commits November 14, 2023 10:07
This plugs into the cleanup file sets process, to add additional
cleanup of child works which were created as part of a IiifPrint PDF
split. Other child works are not affected.
@ShanaLMoore ShanaLMoore requested a review from jeremyf November 15, 2023 02:02
@@ -4,6 +4,10 @@ module RDF
class CustomIsChildTerm < Vocabulary('http://id.loc.gov/vocabulary/identifiers/')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe consider renaming this file since it's doing more than setting the child flag now. I suppose that would be a breaking change so we could also cut a new release?

Now that I say that, maybe that can be a TODO for later given the urgency 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol yeah I considered that but since it's included in EVERY repo that uses IiifPrint, it's def a breaking change which is why I left it. Plus it's still a type of child flag if you stretch hard enough. ;)

@orangewolf orangewolf merged commit 5d8383b into main Nov 15, 2023
9 checks passed
@orangewolf orangewolf deleted the add-models-to-pending-relationships-table branch November 15, 2023 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants