Python script and instructions on how to edit metadata from a marked spreadsheet in CONTENTdm +++++ note: this will obsolete when CONTENTdm upgrades to new version in ?summer? 2024
GITHUB: https://github.com/grahaa/batch-edit-metadata-in-CDM Yes, this works for individual items as well as compound objects
-
export a collection or portion of a collection. Nice because you can export a portion (search results) of the entire collection. https://server16786.contentdm.oclc.org/cgi-bin/admin/start.exe
-
bring data into excel (Anne can do this so quickly and easily so she usually do it)
-
Anne sends spreadsheet to user
-
User changes any fields and colors EVERY CHANGED CELL to indicate there has been a change
-
User sends spreadsheet to Anne
-
Eliminate any fields and columns that are not colored
-
MUST retain the contentdm number (far right edge of spreadsheet)
-
Get field nicknames from admin interface, field properties (hover over "edit" button and watch lower left edge of screen, there is a pause)
-
Create a csv with this structure: record number,fieldnickname,value [be sure to choose a good delimiter, often use "~"]
-
Bring csv into Notepad++ and do searches for difficult characters such as "&"
-
Open proj client in collection of interest
-
Search for specific records (or download all) and add to the project
-
Sort by title - can take a couple minutes
-
Go to directory of project C:\Users\yourprofilename\AppData\Roaming\OCLC\CONTENTdm Project Client\collectioname\Project #
-
Make a backup of the desc files, place in some safe subdirectory. Can roll back if there is a problem or mistake!
-
Copy the .py file (python 3 script) and the csv file into this directory
-
Close the project client!
-
Open a windows terminal (CMD) and change directory to the directory of the project (where the .desc files are)
-
Run the script: python editmetadata.py script asks for: name of csv file (give full file name) delimiter you want to use, usually ~
-
Assuming it ends gracefully, open project client and see if the edits are visible - they should be
-
Upload, approve, and index the collection.
Note: you may need to turn off a field's controlled vocabulary setting before approving, and turn it back on after indexing.
Note: Anne is planning to write a followup script to check every record to be sure it changed exactly as specified (up till now been doing this by hand with a fresh export)