Skip to content

Commit

Permalink
Address ANW-1382
Browse files Browse the repository at this point in the history
  • Loading branch information
DonRichards committed Mar 2, 2022
1 parent 252f053 commit 8000ab6
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/app/converters/lib/marcxml_auth_agent_base_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def shared_subrecord_map(import_events)
"parent::record/controlfield[@tag='001'][not(following-sibling::controlfield[@tag='003']/text()='DLC' and following-sibling::datafield[@tag='010'])]" => agent_record_identifiers_base_map("//record/controlfield[@tag='001']"),
"parent::record/datafield[@tag='010']" => agent_record_identifiers_base_map("parent::record/datafield[@tag='010']/subfield[@code='a']"),
"parent::record/datafield[@tag='016']" => agent_record_identifiers_base_map("parent::record/datafield[@tag='016']/subfield[@code='a']"),
"parent::record/datafield[@tag='024']" => agent_record_identifiers_base_map("parent::record/datafield[@tag='024']/subfield[@code='a']"),
"parent::record/datafield[@tag='024']" => agent_record_identifiers_base_map("parent::record/datafield[@tag='024']/subfield[@code='a' or @code='0' or @code='1'][1]"),
"parent::record/datafield[@tag='035']" => agent_record_identifiers_base_map("parent::record/datafield[@tag='035']/subfield[@code='a']"),
"parent::record/datafield[@tag='040']/subfield[@code='e']" => convention_declaration_map,
"parent::record/datafield[@tag='046']" => dates_map,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<marcxml:record xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marcxml:leader xmlns:streams="info:lc/streams#">02702cz a2200337n 4500</marcxml:leader>
<marcxml:controlfield tag="001">n2009045056</marcxml:controlfield>
<marcxml:controlfield tag="003" xmlns:streams="info:lc/streams#">DLC</marcxml:controlfield>
<marcxml:controlfield tag="005" xmlns:streams="info:lc/streams#">20200801070648.0</marcxml:controlfield>
<marcxml:controlfield tag="008" xmlns:streams="info:lc/streams#">090721n| azannaabn |a aaa </marcxml:controlfield>
<marcxml:datafield tag="010" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">n 2009045056</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="024" ind1="8" ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="0">viaf91053810</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="100" ind1="1" ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">Harris, Kamala,</marcxml:subfield>
<marcxml:subfield code="d">1964-</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="377" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">eng</marcxml:subfield>
</marcxml:datafield>
</marcxml:record>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<marcxml:record xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marcxml:leader xmlns:streams="info:lc/streams#">02702cz a2200337n 4500</marcxml:leader>
<marcxml:controlfield tag="001">n2009045056</marcxml:controlfield>
<marcxml:controlfield tag="003" xmlns:streams="info:lc/streams#">DLC</marcxml:controlfield>
<marcxml:controlfield tag="005" xmlns:streams="info:lc/streams#">20200801070648.0</marcxml:controlfield>
<marcxml:controlfield tag="008" xmlns:streams="info:lc/streams#">090721n| azannaabn |a aaa </marcxml:controlfield>
<marcxml:datafield tag="010" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">n 2009045056</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="024" ind1="8" ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">http://viaf.org/viaf/91053810</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="100" ind1="1" ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">Harris, Kamala,</marcxml:subfield>
<marcxml:subfield code="d">1964-</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="377" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">eng</marcxml:subfield>
</marcxml:datafield>
</marcxml:record>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<marcxml:record xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<marcxml:leader xmlns:streams="info:lc/streams#">02702cz a2200337n 4500</marcxml:leader>
<marcxml:controlfield tag="001">n2009045056</marcxml:controlfield>
<marcxml:controlfield tag="003" xmlns:streams="info:lc/streams#">DLC</marcxml:controlfield>
<marcxml:controlfield tag="005" xmlns:streams="info:lc/streams#">20200801070648.0</marcxml:controlfield>
<marcxml:controlfield tag="008" xmlns:streams="info:lc/streams#">090721n| azannaabn |a aaa </marcxml:controlfield>
<marcxml:datafield tag="010" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">n 2009045056</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="024" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">10.25555/uhhfdm.777</marcxml:subfield>
<marcxml:subfield code="2">doi</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="100" ind1="1" ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">Harris, Kamala,</marcxml:subfield>
<marcxml:subfield code="d">1964-</marcxml:subfield>
</marcxml:datafield>
<marcxml:datafield tag="377" ind1=" " ind2=" " xmlns:streams="info:lc/streams#">
<marcxml:subfield code="a">eng</marcxml:subfield>
</marcxml:datafield>
</marcxml:record>
33 changes: 33 additions & 0 deletions backend/spec/lib_marcxml_auth_agent_converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ def my_converter
File.dirname(__FILE__))
end

let(:authority_agent_other_standard_identifier_a) do
File.expand_path('./examples/marc/authority_agent_other_standard_identifier_a.xml',
File.dirname(__FILE__))
end

let(:authority_agent_other_standard_identifier_0) do
File.expand_path('./examples/marc/authority_agent_other_standard_identifier_0.xml',
File.dirname(__FILE__))
end

let(:authority_agent_other_standard_identifier_both) do
File.expand_path('./examples/marc/authority_agent_other_standard_identifier_both.xml',
File.dirname(__FILE__))
end

describe 'agent person' do
before(:all) do
end
Expand Down Expand Up @@ -206,6 +221,24 @@ def my_converter
expect(record['agent_record_identifiers'][1]['primary_identifier']).to eq(false)
end

it 'imports authority_agent_other_standard_identifier_a to the correct agent' do
records = convert(authority_agent_other_standard_identifier_a).select { |r| r['jsonmodel_type'] == 'agent_person' }
expect(records[0]['agent_record_identifiers'][1]['record_identifier']).to eq('http://viaf.org/viaf/91053810')
expect(records[0]['agent_record_identifiers'][1]['primary_identifier']).to eq(false)
end

it 'imports authority_agent_other_standard_identifier_0 to the correct agent' do
records = convert(authority_agent_other_standard_identifier_0).select { |r| r['jsonmodel_type'] == 'agent_person' }
expect(records[0]['agent_record_identifiers'][1]['record_identifier']).to eq('viaf91053810')
expect(records[0]['agent_record_identifiers'][1]['primary_identifier']).to eq(false)
end

it 'imports authority_agent_other_standard_identifier_both to the correct agent' do
records = convert(authority_agent_other_standard_identifier_both).select { |r| r['jsonmodel_type'] == 'agent_person' }
expect(records[0]['agent_record_identifiers'][1]['record_identifier']).to eq('10.25555/uhhfdm.777')
expect(records[0]['agent_record_identifiers'][1]['primary_identifier']).to eq(false)
end

it 'imports agent_record_identifier from 035 prepended with (DLC) with proper source and type' do
record = convert(person_agent_2).select { |r| r['jsonmodel_type'] == 'agent_person' }.first

Expand Down

0 comments on commit 8000ab6

Please sign in to comment.