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

Implement MARC export workflow #909

Merged
merged 1 commit into from
Feb 22, 2022
Merged

Implement MARC export workflow #909

merged 1 commit into from
Feb 22, 2022

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Feb 15, 2022

Why these changes are being introduced:

We need an automated way to export published records as MARC and
send them to the cataloging team.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-564

How this addresses that need:

  • Adds a MarcBatch model that builds a compressed marcxml
    file from an array of theses.
  • Adds a BatchMailer that attaches a compressed marcxml file
    built by the MarcBatch model and sends it to the cataloging
    team.
  • Adds a MarcExportJob that takes an array of theses, builds
    a marcxml file for them, and sends a BatchMailer email.
  • Updates DspacePublicationResultsJob to run MarcExportJob for
    all published theses in the results queue.

Side effects of this change:

  • MarcExportJob doesn't employ the 'prep job' pattern that we use
    elsewhere. It didn't seem necessary here to differentiate between
    processing a single thesis versus an array, since I couldn't
    figure a use case for exporting a single thesis. If I'm wrong
    about that, this can easily be refactored.
  • The tempfiles used to build the compressed marcxml file are
    explicitly unlinked in the MarcBatch class, so we pass binary data
    to the mailer instead. This felt safer than relying on garbage
    collection, but it's a bit less direct than reading the tempfile
    in the mailer.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod (with engx email as placeholder value)
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@mitlib mitlib temporarily deployed to thesis-submit-pr-909 February 15, 2022 17:53 Inactive
@coveralls
Copy link

coveralls commented Feb 15, 2022

Coverage Status

Coverage increased (+0.07%) to 97.088% when pulling 9643ddb on ETD-546-alma-oclc-export into e8f2ede on main.

@jazairi jazairi force-pushed the ETD-546-alma-oclc-export branch from 08452f3 to 4cf7ee7 Compare February 15, 2022 18:00
@jazairi jazairi temporarily deployed to thesis-submit-pr-909 February 15, 2022 18:01 Inactive
@JPrevost JPrevost self-assigned this Feb 15, 2022
@jazairi jazairi temporarily deployed to thesis-submit-pr-909 February 15, 2022 18:59 Inactive
@JPrevost JPrevost temporarily deployed to thesis-submit-pr-909 February 16, 2022 14:35 Inactive
app/models/marc_batch.rb Outdated Show resolved Hide resolved
test/jobs/marc_export_job_test.rb Outdated Show resolved Hide resolved
test/mailers/batch_mailer_test.rb Show resolved Hide resolved
@jazairi jazairi temporarily deployed to thesis-submit-pr-909 February 17, 2022 22:22 Inactive
@jazairi jazairi requested a review from JPrevost February 17, 2022 22:24
@jazairi
Copy link
Contributor Author

jazairi commented Feb 17, 2022

@JPrevost I just pushed a refactor to use the tempfiles as attachments. Could you re-review?

@jazairi jazairi temporarily deployed to thesis-submit-pr-909 February 18, 2022 20:20 Inactive
@jazairi jazairi requested a review from JPrevost February 18, 2022 20:20
Why these changes are being introduced:

We need an automated way to export published records as MARC and
send them to the cataloging team.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-564

How this addresses that need:

* Adds a MarcBatch model that builds a compressed marcxml
file from an array of theses.
* Adds a BatchMailer that attaches a compressed marcxml file
built by the MarcBatch model and sends it to the cataloging
team.
* Adds a MarcExportJob that takes an array of theses, builds
a marcxml file for them, and sends a BatchMailer email.
* Updates DspacePublicationResultsJob to run MarcExportJob for
all published theses in the results queue.

Side effects of this change:

* MarcExportJob doesn't employ the 'prep job' pattern that we use
elsewhere. It didn't seem necessary here to differentiate between
processing a single thesis versus an array, since I couldn't
figure a use case for exporting a single thesis. If I'm wrong
about that, this can easily be refactored.
* We are using `deliver_now` instead of enqueueing the email
because ActiveJob doesn't support tempfiles as attachments. We
consider this low-risk as we already use `deliver_now` to send
mail in the DspacePublicationResultsJob.
@jazairi jazairi force-pushed the ETD-546-alma-oclc-export branch from c1789d8 to 9643ddb Compare February 22, 2022 18:54
@jazairi jazairi temporarily deployed to thesis-submit-pr-909 February 22, 2022 18:54 Inactive
@jazairi jazairi merged commit ecc77d1 into main Feb 22, 2022
@jazairi jazairi deleted the ETD-546-alma-oclc-export branch February 22, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants