[Archivesspace_Users_Group] Plugin: Custom import mapping for MarcXML Agents, help

Brian Hoffman brianjhoffman at gmail.com
Fri Sep 11 09:55:15 EDT 2015


Hi Carlos,

Yes, that’s actually something I overlooked. The way the importers are constructed, you can’t actually access the queue of records to import from the configuration code. So, I posted an example of a workaround (and some workarounds for a few other issues with the way importers are sub-classed):

https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb <https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb>

Brian




> On Sep 10, 2015, at 12:44 AM, Carlos Lemus <carlos.lemus at unlv.edu> wrote:
> 
> Hello Brian,
> 
> Sorry if I'm not replying to our current thread correctly. I have yet to set up git for the plugin, but as soon as I do I will let you know. It is mostly some of the yale marcxml plugin setup and a lot of commented trial and error code at this point anyways. 
> 
> I tried the code you gave me and I think you understand perfectly what my issue is and I understand what you're trying to do by matching the agent to the current resource, exactly what I need. 
> However, it's not working because the batch object seems to be Null. Not sure if maybe I'm required to import something.
> 
> Error: #<NoMethodError: undefined method `working_area' for nil:NilClass>
> 
> Here is the current state of my code 
> 
> UNLVMarcXMLAgentsConverter.configure do |config|
> config["/record"][:map]["controlfield[@tag='001']"] = -> resource, node {
> 		existing_agent_uri = resource.linked_agents.find {|link| link[:ref] =~ /people/ }
> 		existing_agent = @batch.working_area.find {|obj| obj.uri == existing_agent_uri }
> 		make(:name_person) do |name|
> 		name.primary = node.xpath("subfield[@code='a']").inner_text
> 		
> 		# add more name fields as necessary
> 		
> 		val = node.inner_text
> 		name['authority_id'] = val  
> 		existing_agent.names << name
> 		 end
> 	}
> end
> Thanks for the quick reply by the way. I would have gotten to you sooner, but I didn't get an email that you had replied. I'll keep an eye on the listserv from now on. 
> 
> Carlos Lemus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150911/15e092a7/attachment.html>


More information about the Archivesspace_Users_Group mailing list