Skip to content

Bulk Metadata Modifications

Josh Gum edited this page Dec 28, 2018 · 18 revisions

Sometimes we need to modify a bunch of metadata in one fell swoop. A rake task was built to facilitate this process.

Prerequisites

  • An issue to track the change request
  • A spreadsheet with the proper format and data
  • Running the rake task on the server

Spreadsheet Details

Special Considerations

  • The value in the from column must be filled in every row
  • A + value in the from column indicates that a value will be added the metadata field
  • A * value in the from column indicates that all current values in the metadata field will be replaced
  • The to column can have a pipe-delimited (|) value to add multiple values to the metadata field

Example Data

Consider the following data as an example of what the rake task expects for performing bulk metadata updates:

id,from,to,property																																												
fb494b17q,http://opaquenamespace.org/ns/osuAcademicUnits/qGjPkk5M,http://id.loc.gov/authorities/names/n80017721,degree_grantors																						
8623j0508,http://opaquenamespace.org/ns/osuAcademicUnits/qGjPkk5M,http://id.loc.gov/authorities/names/n80017721,degree_grantors																						
  • id : The ID of the work to be modified
  • from : The value as it exists in the system, this value can be a * to indicate any value.
  • to : The desired change to the existing value
  • property : The property name, as tracked in the Metadata Application Profile, of the metadata value to change

Run the rake task on the server

  • Transfer the spreadsheet, in comma-separated values format, to the server. A great directory might be ~/tmp/.
    • $ scp /path/to/file USER@SERVERNAME:/path/to/remote/server/file
  • Execute the rake task
    • $ bundle exec rails scholarsarchive:bulk_update_csv csv=/path/to/remove/server/file
  • Watch the logs generated by this task
    • $ ls -ltr log/bulk-update-csv*