<div dir="ltr">Hello Brian,<div><br></div><div>Thank you for all your help! it's working now.</div><div><br></div><div>Carlos Lemus</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 7:40 AM, Brian Hoffman <span dir="ltr"><<a href="mailto:brianjhoffman@gmail.com" target="_blank">brianjhoffman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Carlos,<div><br></div><div>I think you can solve this by inserting above line 24:</div><div><br></div><div><span style="white-space:pre-wrap">     </span>return false unless AgentManager.known_agent_type?(record.class.record_type) || record.class.record_type == ‘subject'</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Brian</div></font></span><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Oct 27, 2015, at 9:31 PM, Carlos Lemus <<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>> wrote:</div><br><div><div dir="ltr">Hello Brian,<div><br></div><div>I just noticed something actually, that lines 47-50 are preventing a proper return value</div><div><br></div><div><span style="white-space:pre-wrap">            </span>  <a href="https://github.com/l3mus/ArchivesSpace-authority-project/blob/master/unlv_importer/backend/model/unlv_marcxml_converter.rb#L47-L50" target="_blank">https://github.com/l3mus/ArchivesSpace-authority-project/blob/master/unlv_importer/backend/model/unlv_marcxml_converter.rb#L47-L50</a></div><div><br></div><div>After removing those log values I get something like this. It's so close, I think the right agent is there, but now it's trying to export a resource, instead of an agent.</div><div><br></div><div><span style="color:rgb(51,238,51);font-family:monospace;font-size:13px;line-height:12.381px;white-space:pre-wrap;background-color:rgb(51,51,51)">extents : At least 1 item(s) is required
        dates : At least 1 item(s) is required
        title : Property is required but was missing


 For JSONModel(:resource): 
 #<JSONModel(:resource) {"jsonmodel_type"=>"resource", "external_ids"=>[], "subjects"=>[], "linked_events"=>[], "extents"=>[], "dates"=>[], "external_documents"=>[], "rights_statements"=>[], "linked_agents"=>[{"role"=>"subject", "terms"=>[], "ref"=>"/agents/people/import_fda55473-b8f5-43c1-85a3-955b37a57c28"}], "restrictions"=>false, "revision_statements"=>[], "instances"=>[], "deaccessions"=>[], "related_accessions"=>[], "classifications"=>[], "notes"=>[], "uri"=>"/repositories/import/resources/import_4b9b1731-28ba-4e9b-afd6-ed2d933ce882", "finding_aid_description_rules"=>"rda", "id_0"=>"imported-e5c9504d-33ea-4538-91ef-54fdc2cd67d5", "level"=>"collection"}>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span><br></div><div><span style="color:rgb(51,238,51);font-family:monospace;font-size:13px;line-height:12.381px;white-space:pre-wrap;background-color:rgb(51,51,51)"><br></span></div><div>Thank you,</div><div><br></div><div>Carlos Lemus</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 3:17 PM, Carlos Lemus <span dir="ltr"><<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Brian,<div><br></div><div>Sorry to keep bothering you with this, I was wondering if you got a chance to take a look at this.</div><div><a href="https://github.com/l3mus/ArchivesSpace-authority-project/tree/master/unlv_importer" target="_blank">https://github.com/l3mus/ArchivesSpace-authority-project/tree/master/unlv_importer</a><br></div><div><br></div><div>Thank you,</div><div><br></div><div>Carlos Lemus</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 3:01 PM, Carlos Lemus <span dir="ltr"><<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Brian,<div><br></div><div>Thank you for the reply, I have been able to piggy back of your code quite a bit which I'll update on github, but there is still some small issues. I've had to change the code a little bit to get it to work. For example it won't add the authority_id unless I first declare it because it's trying to add the authority_id to a nil object and then the source is duplicating multiple times. Also, the to_hash function wasn't seeming to return anything but to_hash(:raw) did. I have attached an example marcxml just in case. </div><div><br></div><div>Looking at the record, it doesn't seem like I'm even working with the right one. They all have different uri, especially the last one that is giving me the error. I think that last one that is giving me the error might be the one that actually needs to be changed, but I can't find where it's coming from. I'll keep looking into it.</div><div><br></div><div>I've got the other object to come out right </div><div>#<JSONModel(:agent_person) {"jsonmodel_type"=>"agent_person", "agent_contacts"=>[], "linked_agent_roles"=>[], "external_documents"=>[], "rights_statements"=>[], "notes"=>[], "dates_of_existence"=>[], "places"=>[], "names"=>[#<JSONModel(:name_person) {"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 ingest ingest", "authority_id"=>"  n 2003051366"}>], "related_agents"=>[], "uri"=>"/agents/people/import_8a20f2f4-3560-41de-92b1-2aa888253143", "dates"=>"1939-"}><br></div><div><br></div><div>and the record is still the same, maybe I should be updating this one instead I'm not sure.</div><div>#<JSONModel(:agent_person) {"jsonmodel_type"=>"agent_person", "agent_contacts"=>[], "linked_agent_roles"=>[], "external_documents"=>[], "rights_statements"=>[], "notes"=>[], "dates_of_existence"=>[], "places"=>[], "names"=>[#<JSONModel(:name_person) {"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_308b3936-d294-4e4e-96cb-e9d35447f8cb"}><br></div><div><br></div><div>but I'm getting an error for a completely different one</div><div><span style="background-color:rgb(255,255,255)"><font><span style="font-family:monospace;font-size:13px;line-height:14.8571px;white-space:pre-wrap">      names/0/primary_name : Property is required but was missing
 For JSONModel(:agent_person): 
 #<JSONModel(:agent_person) {"jsonmodel_type"=>"agent_person", "agent_contacts"=>[], "linked_agent_roles"=>[], "external_documents"=>[], "rights_statements"=>[], "notes"=>[], "dates_of_existence"=>[], "places"=>[], "names"=>[{"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_40843311-b96a-4e59-9ebb-2d685e3e63ea"}></span><br></font></span></div><div><span style="font-family:monospace;font-size:13px;line-height:14.8571px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font><br></font></span></div><div><span style="font-family:monospace;font-size:13px;line-height:14.8571px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font>Thank you</font></span></div><span><font color="#888888"><div><span style="font-family:monospace;font-size:13px;line-height:14.8571px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font>
Carlos Lemus</font></span></div></font></span><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 10:05 AM, Brian Hoffman <span dir="ltr"><<a href="mailto:brianjhoffman@gmail.com" target="_blank">brianjhoffman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Carlos,<div><br></div><div>I sent a pull request with an example of how you could merge names together. I hope this helps.</div><div><br></div><div><a href="https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/pull/2" target="_blank">https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/pull/2</a></div><span><font color="#888888"><div><br></div><div>Brian</div></font></span><div><div><div><br></div><div><br><div><blockquote type="cite"><div>On Sep 28, 2015, at 3:33 PM, Carlos Lemus <<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>> wrote:</div><br><div><div dir="ltr">Hello Brian,<div><br></div><div>I was just checking if you got a chance to look at this issue. I am still having some trouble merging the two names together and was wondering if there was something else I needed to do.<br><br></div><div>Thank you,</div><div><br></div><div>Carlos Lemus</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 21, 2015 at 3:34 PM, Carlos Lemus <span dir="ltr"><<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Sorry Brian, the message got cut off. <span style="font-size:12.8px">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 </span></font><span><div style="font-size:12.8px"><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is an example of the JSON</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></span><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font>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"}></font></span><br></font></div><div><span style="line-height:18.5714px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714px;white-space:pre-wrap;background-color:rgb(255,255,255)"><font>and here is the code for the plugin </font></span><font><span style="line-height:18.5714px;white-space:pre-wrap"><a href="https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/tree/master/unlv_importer" target="_blank">https://github.com/UNLV-Libraries/ArchivesSpace-authority-project/tree/master/unlv_importer</a></span></font></font></div><div><br></div><div>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.</div><div><br></div><div>Thank you,</div><div>Carlos Lemus</div><div><div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><br></font><div class="gmail_quote"><font face="arial, helvetica, sans-serif">On Mon, Sep 21, 2015 at 3:30 PM, Carlos Lemus <span dir="ltr"><<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>></span> wrote:<br></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Hello Brian,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">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 </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is an example of the JSON</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></div><div><div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><br></font><div class="gmail_quote"><font face="arial, helvetica, sans-serif">On Fri, Sep 11, 2015 at 6:55 AM, Brian Hoffman <span dir="ltr"><<a href="mailto:brianjhoffman@gmail.com" target="_blank">brianjhoffman@gmail.com</a>></span> wrote:<br></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><font face="arial, helvetica, sans-serif">Hi Carlos,</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">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):</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><a href="https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb" target="_blank"><font face="arial, helvetica, sans-serif">https://github.com/quoideneuf/aspace_single_agent_marcxml/blob/master/backend/model/marcxml_accession_converter.rb</font></a></div><span><font color="#888888" face="arial, helvetica, sans-serif"><div><br></div><div>Brian</div></font></span><div><div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><font face="arial, helvetica, sans-serif"><br></font><div><blockquote type="cite"><div><font face="arial, helvetica, sans-serif">On Sep 10, 2015, at 12:44 AM, Carlos Lemus <<a href="mailto:carlos.lemus@unlv.edu" target="_blank">carlos.lemus@unlv.edu</a>> wrote:</font></div><font face="arial, helvetica, sans-serif"><br></font><div><div dir="ltr"><font face="arial, helvetica, sans-serif">Hello Brian,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">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. </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">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. </font></div><div><font face="arial, helvetica, sans-serif">However, it's not working because the batch object seems to be Null. Not sure if maybe I'm required to import something.</font></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif">Error: #&lt;NoMethodError: undefined method `working_area' for nil:NilClass&gt;</font></span></div><div><span style="color:rgb(51,238,51);font-size:13px;line-height:18.5714282989502px;white-space:pre-wrap;background-color:rgb(51,51,51)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Here is the current state of my code </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap"><div><br></div><div>UNLVMarcXMLAgentsConverter.configure do |config|</div></span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">config["/record"][:map]["controlfield[@tag='001']"] = -> resource, node {</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">                </span>existing_agent_uri = resource.linked_agents.find {|link| link[:ref] =~ /people/ }</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">               </span>existing_agent = @batch.working_area.find {|obj| obj.uri == existing_agent_uri }</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">                </span>make(:name_person) do |name|</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">            </span>name.primary = node.xpath("subfield[@code='a']").inner_text</span></font></div><div><span style="white-space:pre-wrap;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif">         </font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">             </span># add more name fields as necessary</span></font></div><div><span style="white-space:pre-wrap;line-height:18.5714282989502px"><font face="arial, helvetica, sans-serif">           </font></span></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">             </span>val = node.inner_text</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">           </span>name['authority_id'] = val  </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">           </span>existing_agent.names << name</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">              </span> end</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px"><span style="white-space:pre-wrap">    </span>}</span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px">end</span><br></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Thanks for the quick reply by the way. I would have gotten to you sooner, but I didn't get an email </span><span style="line-height:18.5714px;white-space:pre-wrap">that you had replied. I'll keep an eye on the listserv from now on. </span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap"><br></span></font></div><div><font face="arial, helvetica, sans-serif"><span style="line-height:18.5714282989502px;white-space:pre-wrap">Carlos Lemus</span></font></div></div>
</div></blockquote></div><font face="arial, helvetica, sans-serif"><br></font></div></div></div></blockquote></div><font face="arial, helvetica, sans-serif"><br></font></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>