[Archivesspace_Users_Group] We're working on an ArchivesSpace plugin...
Max Eckard
eckardm at umich.edu
Wed Mar 18 15:49:06 EDT 2015
Dear ArchivesSpace community,
Inspired by the recent post on customizing ASpace EAD importers and
exporters, we decided to write our own!
We have a lot of EADs with dao tags that have no title attributes. Like
this:
<c02 level="file"><did><container type="folder"
label="Folder">1</container><unittitle>Letters, <unitdate
type="inclusive">October 19, 1918-May 13,
1919</unitdate></unittitle><physdesc><extent>5
letters</extent></physdesc><dao href="andrewse0001" show="new"
actuate="onrequest"><daodesc><p>[view items]</p></daodesc></dao></did></c02>
Using the out-of-the-box EAD importer, we get an error when we try to
import EADs like this because ASpace uses the title attribute to form the
digital object's title.
We wanted to use the content from unittitle, so we wrote a simple ASpace
plugin to use the parent archival object title as the digital object title.
We used the existing ead_converter.rb
<https://github.com/archivesspace/archivesspace/blob/master/backend/app/converters/ead_converter.rb#L632-678>
code starting with "with 'dao' do," and then snagged some code from further
down after daogrp. Here's what it looks like:
with 'dao' do
# new stuff, borrowed from daogrp in the ead_converter.rb file...
title = ''
ancestor(:resource, :archival_object ) { |ao| title << ao.title }
make :instance, {
:instance_type => 'digital_object'
} do |instance|
set ancestor(:resource, :archival_object), :instances, instance
end
make :digital_object, {
:digital_object_id => SecureRandom.uuid,
# more new stuff...
:title => title,
} do |obj|
obj.file_versions << {
:use_statement => att('role'),
:file_uri => att('href'),
:xlink_actuate_attribute => att('actuate'),
:xlink_show_attribute => att('show')
}
set ancestor(:instance), :digital_object, obj
end
end
That works (and we were excited about that!), but now we'd like add some
code to handle cases when the parent archival object only has a date, not a
title, or title and date.
Specifically, what we're having trouble figuring out is how to form a
string similar to the one that gets created for archival object titles,
something like:
- If the archival object has a title and date, form a string using the
title and the date.
- Else if the archival object only has a title, use the title.
- Else if the archival object only has a date, use the date as the title.
We're pretty sure that something here
<https://github.com/cfitz/archivesspace/blob/master/backend/app/model/archival_object.rb#L37-56>
in the archival_object.rb code could help, but we're not sure how to
translate that for the EAD Converter.
Any help we could get on or off list would be greatly appreciated!
Thanks,
Max and Dallas
--
*Max Eckard*
*Assistant Archivist for Digital Curation*
Bentley Historical Library
1150 Beal Ave.
Ann Arbor, MI 48109-2113
734/763-7518 <734.763.7518>
http://bentley.umich.edu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150318/5fe6b2e4/attachment.html>
More information about the Archivesspace_Users_Group
mailing list