Conversation
Why these changes are being introduced: The metadata team has requested a JSON metadata export, as it would be easier for them to parse than the MARC file. Relevant ticket(s): - [ETD-695](https://mitlibraries.atlassian.net/browse/ETD-695) How this addresses that need: This adds JsonExporter and JsonBatch classes, which serialize thesis metadata and writes the metadata to a JSON file. This workflow is invoked in the MarcExportJob, and the output is included alongside the MARC file in the report email. It also creates two rake tasks: one to export the JSON metadata of a single thesis, and one to export all theses in a given term. This is primarily for testing purposes. Side effects of this change: The export job and batch emails are not clearly named for the time being. This feels like an acceptable short-term risk. We plan to retire the MARC export altogether, at which point we can rename those files accordingly.
There was a problem hiding this comment.
Pull request overview
Adds a JSON metadata export alongside the existing MARC batch export workflow, so downstream metadata consumers can parse thesis metadata without MARC processing.
Changes:
- Introduces
JsonExporterandJsonBatchto serialize thesis metadata and write a JSON export file. - Updates
MarcExportJobandBatchMailerto generate and email both MARC (zip) and JSON attachments. - Adds rake tasks and tests covering JSON export generation and email attachments.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
app/models/json_exporter.rb |
Defines per-thesis JSON-serializable metadata structure. |
app/models/json_batch.rb |
Builds a batch JSON file wrapping exported theses. |
app/jobs/marc_export_job.rb |
Generates JSON alongside MARC and attaches both to the batch email. |
app/mailers/batch_mailer.rb |
Extends batch email to include a JSON attachment and updates subject. |
app/views/batch_mailer/marc_batch_email.html.erb |
Updates email body to mention JSON alongside MARC. |
lib/tasks/metadata.rake |
Adds rake tasks for exporting JSON for a single thesis or a term batch. |
test/models/json_exporter_test.rb |
Adds unit tests for JsonExporter#to_hash. |
test/models/json_batch_test.rb |
Adds tests for JSON batch file structure/validity. |
test/mailers/batch_mailer_test.rb |
Updates mailer tests to expect both MARC+JSON attachments and new subject. |
test/jobs/marc_export_job_test.rb |
Adds coverage for both attachments and JSON validity in the export job email. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
I'm working with Ben on the content of the JSON file. I think this is ready for code review, but more changes may be coming depending on stakeholder feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why these changes are being introduced:
The metadata team has requested a JSON metadata
export, as it would be easier for them to parse
than the MARC file.
Relevant ticket(s):
How this addresses that need:
This adds JsonExporter and JsonBatch classes, which serialize thesis metadata and writes the metadata
to a JSON file. This workflow is invoked in the
MarcExportJob, and the output is included
alongside the MARC file in the report email.
It also creates two rake tasks: one to export
the JSON metadata of a single thesis, and one
to export all theses in a given term. This is
primarily for testing purposes.
Side effects of this change:
The export job and batch emails are not clearly
named for the time being. This feels like an
acceptable short-term risk. We plan to retire the
MARC export altogether, at which point we can
rename those files accordingly.
Developer
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)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO