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

Update usage docs #67

Merged
merged 2 commits into from
Apr 2, 2019
Merged

Update usage docs #67

merged 2 commits into from
Apr 2, 2019

Conversation

cole
Copy link
Contributor

@cole cole commented Mar 29, 2019

Adds basic usage documentation. I don't think this covers all of @replaceafill's use cases yet, but it's a start hopefully.

Connects to archivematica/Issues#609.

Copy link
Contributor

@replaceafill replaceafill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely a nice start @cole.

Regarding use cases, these are some things we've been doing with the library to parse the METS:

  • Iterate file entries in the <fileSec> according to their @USE:
mets = metsrw.METSDocument.fromfile(path)
original_files = [entry for entry in mets.all_files() if entry.use == "original"]
  • Filter PREMIS events of a file entry by type:
# entry is a FSEntry object
reingestion_events = [
    event for event in entry.get_premis_events() if event.type == 'reingestion'
]
  • Use the METS tree to get the <amdSec> from a file entry:
# entry is a FSEntry object
amdSec = mets.tree.find(
    'mets:amdSec[@ID="{}"]'.format(entry.admids[0]),
    namespaces={...},
)

@cole
Copy link
Contributor Author

cole commented Apr 2, 2019

Thanks @replaceafill! I'm going to merge this and try to address those cases in a new PR.

@cole cole merged commit bc6a6e1 into master Apr 2, 2019
@cole cole deleted the dev/documentation branch April 2, 2019 21:47
@currmie
Copy link

currmie commented Apr 2, 2019

Hi @cole - just some more food for thought and ideas for the future. What you've got has been super helpful!

METS provides a way to link digital content with applications or code in the behaviorSec that can be used with other info in a METS document to transform or display the digital object(s). Not sure if this section is used much by the AtoM community. Just thought it might be nice to include the behaviorSec elements and attributes in the metsrw API Documentation > Metadata classes section.

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.

None yet

3 participants