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

Carlos Lemus carlos.lemus at unlv.edu
Mon Sep 21 18:34:04 EDT 2015


Sorry Brian, the message got cut off. It's concatenating the names to the
agent accordingly, however the names are still separated and I believe it
is still looking for a primary name in that name

Here is an example of the JSON

For JSONModel(:agent_person): #<JSONModel(:agent_person)
{"jsonmodel_type"=>"agent_person", "agent_contacts"=>[],
"linked_agent_roles"=>[], "external_documents"=>[],
"rights_statements"=>[], "notes"=>[], "dates_of_existence"=>[],
"names"=>[{"jsonmodel_type"=>"name_person", "use_dates"=>[],
"authorized"=>false, "is_display_name"=>false,
"sort_name_auto_generate"=>true, "uri"=>nil, "primary_name"=>"Goodman",
"rest_of_name"=>"Oscar Baylin,", "dates"=>"1939-",
"name_order"=>"inverted", "source"=>"ingest"},
{"jsonmodel_type"=>"name_person", "use_dates"=>[], "authorized"=>false,
"is_display_name"=>false, "sort_name_auto_generate"=>true, "uri"=>nil,
"authority_id"=>"n 2003051366", "name_order"=>"direct",
"source"=>"ingest"}], "related_agents"=>[],
"uri"=>"/agents/people/import_4cd10c10-330e-4d71-916d-1f354f4e1f89"}>

and here is the code for the plugin
https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/tree/master/unlv_importer

I am still having trouble making it only one name_person instead of two
under the agent person. I appreciate your help, sorry again for the delay
and the double message.

Thank you,
Carlos Lemus

On Mon, Sep 21, 2015 at 3:30 PM, Carlos Lemus <carlos.lemus at unlv.edu> wrote:

> Hello Brian,
>
> Sorry for getting back to you so late, I have been attempting to implement
> your code. It's concatenating the names to the agent accordingly, however
> the names are still separated and I believe it is still looking for a
> primary name in that name
>
> Here is an example of the JSON
>
>
> On Fri, Sep 11, 2015 at 6:55 AM, Brian Hoffman <brianjhoffman at gmail.com>
> wrote:
>
>> 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
>>
>> 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/20150921/a2a39115/attachment.html>


More information about the Archivesspace_Users_Group mailing list