Skip to content

Latest commit

 

History

History
44 lines (25 loc) · 3.12 KB

more-bag-activities.md

File metadata and controls

44 lines (25 loc) · 3.12 KB

MORE BAGIT ACTIVITIES AND SCRIPTS

Recommendations for activities and tasks to increase comfort with using the Python build of BagIt, including small scripts to accomplish tasks that were previously built into the CLI instance of the BagIt Java build.

ADDING BAG METADATA WHILE CREATING BAGS

  1. Use NDSR_BagIt_sample_03 to play around with bag metadata that can be added to the bag-info.txt file. Read about the optional descriptive information you can include in that file in Bag Metadata: bag-info.txt section of the BagIt spec.

  2. Add your phone number, a description, and a unique identifier when you create a new bag using the command line.

  • Options are structured like:

    --optionName 'The information you want to add to the bag-info.txt file'

So a command would look like:

bagit.py --contact-name 'Kathryn Gronsbell' --contact-email 'kgronsbell at gmail dot com' --external-description 'There may be something a little off about this bag...' /Users/kathryngronsbell/Desktop/NDSR_BagIt_sample_02

  1. Look at the bag-info.txt in the new NDSR_BagIt_sample_03.
  • Does the bag metadata you entered in the command show up?
  • How could this be useful for an organization's collections? Having a dedicated field for external identifier and descriptive information increases transparency and interoperability.

"LIBRARY USAGE" aka PROGRAMMING TASKS RELATED TO YOUR BAGS

On the Library of Congress' bagit-python page, they include examples of Python scripts to accomplish certain tasks.

To do this exercise, you will need to be running atleast Python 3. You can find out what version of Python you have by typing python --version into Terminal. If you think you might have Python 3 already installed, try typing python3 --version.

  1. Included in the sample bag is bagmetadata_update.py, which is a Python script cribbed from the bagit-python page linked above. It will change the metadata in the bag-info.txt by using the "info" property on a bag.

  2. Invoke the provided Python script.

python3 [drag and drop bagmetadata_update.py] [drag and drop NDSR_BagIt_samples_03]

  1. Open the bag-info.txt in NDSR_BagIt_samples_03. Does it match the example one below?

bag metadata update

  1. Open bagmetadata_update.py. Change the values between the ' ' characters in lines 9 and 10. You can use any text editor (NOT MICROSOFT WORD). Save the file with the new values. Run the command from Step 3 again, and check the updated bag-info.txt.

MESS WITH YOUR BAGS

  1. Create a bag with copied files from your own materials. REMEMBER, YOU WILL BAG-IN-PLACE WITH THE PYTHON BAGIT BUILD. Use copies of your data!

  2. In the bag's data payload, modify text or image files. Delete a few payload files. Modify information in the generated BagIt text files (eg. BagIt.txt).

  3. Validate the bag. What kind of error messages do you get? What do they mean?