[Archivesspace_Users_Group] marcxml exporter plugin questions

Joshua D. Shaw Joshua.D.Shaw at dartmouth.edu
Wed Mar 2 08:57:16 EST 2016


Hi Esha-

I think you'll want something like the following, where I'm adding the ead_id to a new 035 field.

  def datafields
    extra_fields = []

    if @record.aspace_record.ead_id
      extra_fields << DataField.new('035', ' ', ' ', [SubField.new('a', @record.aspace_record.ead_id)])
    end

    (@record.datafields + extra_fields).sort_by(&:tag)
  end

There's a complete view of what Dartmouth is doing - at least in my local test environment against v1.4+ here: https://github.com/jdshaw/dartmouth_udf_exports/tree/1.5-compatible I've optimistically labeled it 1.5+ compatible, but I think it should work with 1.4 as well. It's a work in progress, so feel free to let me know if you spot some major nastiness!

We haven't updated from 1.3 in production yet, but I've rolled most of the changes to the exporter into a 1.3 version which ca be found here: https://github.com/jdshaw/dartmouth_udf_exports

Best,
Joshua


From: Esha Datta
Reply-To: "esha at nyu.edu<mailto:esha at nyu.edu>", Archivesspace Users Group
Date: Tuesday, March 1, 2016 at 1:16 PM
To: Archivesspace Users Group
Subject: [Archivesspace_Users_Group] marcxml exporter plugin questions

Hi,

I am trying to write a plugin to apply some custom mappings to the marc export for Archives Space records. I am using Hudson Molonglo's plugin<https://github.com/hudmol/dartmouth_udf_exports> and the ASpace plugin documentation<http://archivesspace.github.io/archivesspace/user/archivesspace-plug-ins-readme/> as a template. My question is how do I access the archives space object? So far, I have created a custom marc serializer class where I specify the class in the MarcSerializer add decorator method. I can inspect the object(record) in the MarcCustomFieldSerialize class and see the marc record...which is pretty cool. However, I also need to access the archives space object before it's transformed to marc to access some other values.

I see from the plugin listed above that the MarcModel class is being re-defined in it and is getting the aspace record. It also has some decorator logic which I assume got pulled back into the main code, as I see it there now. However, I'm not sure how object is being read in the plugin. I see how that's happening in the main source code.

So far, I have:
plugins/name/
plugin_init.rb:
   MARCSerializer.add_decorator(MARCCustomFieldSerialize)
and the class:
plugins/name/backend/lib/
class MARCCustomFieldSerialize
  ControlField = Struct.new(:tag, :text)
  DataField = Struct.new(:tag, :ind1, :ind2, :subfields)
  SubField = Struct.new(:code, :text)

  def initialize(record)
    @record = record
  end
end

I'd really appreciate any feedback on this. Thanks for your time! Please let me know if you need any clarifications.

Thanks.

Esha Datta
Senior Programmer/Analyst
Bobst Library
NYU


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20160302/8aa98c88/attachment.html>


More information about the Archivesspace_Users_Group mailing list