From ffda702380b7cd2e48d659c55f87926231fcd3f4 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 16:54:32 -0500 Subject: [PATCH 1/6] Support adding special mappings from multiple extensions --- lib/collectionspace/mapper/authority.rb | 14 +++++++-- lib/collectionspace/mapper/column_mappings.rb | 25 +++++++++------- lib/collectionspace/mapper/date_details.rb | 29 ++++++++++++------- lib/collectionspace/mapper/media.rb | 12 ++++++-- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/lib/collectionspace/mapper/authority.rb b/lib/collectionspace/mapper/authority.rb index 57134377..12796357 100644 --- a/lib/collectionspace/mapper/authority.rb +++ b/lib/collectionspace/mapper/authority.rb @@ -4,11 +4,21 @@ module CollectionSpace module Mapper # special behavior for authority mapping module Authority - def special_mappings + module_function + + def extended(mod) + if mod.respond_to?(:add_mapping) + special_mappings(mod).each do |mapping| + mod.add_mapping(mapping) + end + end + end + + def special_mappings(mod) [ { fieldname: "shortIdentifier", - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "not in input data", diff --git a/lib/collectionspace/mapper/column_mappings.rb b/lib/collectionspace/mapper/column_mappings.rb index 3118efcc..bf114631 100644 --- a/lib/collectionspace/mapper/column_mappings.rb +++ b/lib/collectionspace/mapper/column_mappings.rb @@ -10,20 +10,23 @@ class ColumnMappings include Enumerable extend Forwardable + attr_reader :handler + def_delegators :@all, :each, :reject! # @param mappings [Array] from record mapper JSON file # @param hander [CollectionSpace::Mapper::DataHandler] def initialize(mappings:, handler:) @handler = handler - handler.record.extensions.each { |ext| extend ext } @transforms = handler.batch.transforms @all = [] @lkup = {} + handler.record.extensions.each { |ext| extend ext } mappings.each { |mapping| add_mapping(mapping) } - special_mappings.each { |mapping| add_mapping(mapping) } + # binding.pry + # special_mappings.each { |mapping| add_mapping(mapping) } end def <<(mapping) @@ -47,21 +50,21 @@ def required_columns all.select(&:required?) end - private - - attr_reader :handler, :transforms, :all, :lkup - def add_mapping(mapping) mapobj = CollectionSpace::Mapper::ColumnMapping.new( mapping: mapping ) - all << mapobj - lkup[mapobj.datacolumn] = mapobj + @all << mapobj + @lkup[mapobj.datacolumn] = mapobj end - def special_mappings - [] - end + private + + attr_reader :transforms, :all, :lkup + + # def special_mappings + # [] + # end end end end diff --git a/lib/collectionspace/mapper/date_details.rb b/lib/collectionspace/mapper/date_details.rb index 49f218c3..221a5c45 100644 --- a/lib/collectionspace/mapper/date_details.rb +++ b/lib/collectionspace/mapper/date_details.rb @@ -3,12 +3,21 @@ module CollectionSpace module Mapper module DateDetails - # Methods used in ColumnMappings - def special_mappings + module_function + + def extended(mod) + if mod.respond_to?(:add_mapping) + special_mappings(mod).each do |mapping| + mod.add_mapping(mapping) + end + end + end + + def special_mappings(mod) base = [ { fieldname: "date_field_group", - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "y", @@ -19,7 +28,7 @@ def special_mappings }, { fieldname: "scalarValuesComputed", - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "y", @@ -29,10 +38,10 @@ def special_mappings transforms: {special: ["boolean"]} } ] - [base, vocab_mappings, optionlist_mappings].flatten + [base, vocab_mappings(mod), optionlist_mappings(mod)].flatten end - def vocab_mappings + def vocab_mappings(mod) { "dateLatestQualifierUnit" => "datequalifier", "dateLatestEra" => "dateera", @@ -43,7 +52,7 @@ def vocab_mappings }.map do |fieldname, vocab| { fieldname: fieldname, - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "n", @@ -57,14 +66,14 @@ def vocab_mappings end end - def optionlist_mappings + def optionlist_mappings(mod) { "dateLatestQualifier" => "dateQualifiers", "dateEarliestSingleQualifier" => "dateQualifiers" }.map do |fieldname, vocab| { fieldname: fieldname, - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "n", @@ -93,7 +102,7 @@ def ensure_target_field_exists(response) "date_field_group value `#{val}` is not a known structured date "\ "field group in a #{handler.record.recordtype} record. You must "\ "enter a field that appears as a column header in the CSV "\ - "template for this record type." + "template for this record type. Case sensitive!" ) end diff --git a/lib/collectionspace/mapper/media.rb b/lib/collectionspace/mapper/media.rb index 486a93a3..49fcff2e 100644 --- a/lib/collectionspace/mapper/media.rb +++ b/lib/collectionspace/mapper/media.rb @@ -4,15 +4,21 @@ module CollectionSpace module Mapper # special behavior for media mapping module Media + module_function + def extended(mod) - puts "#{mod} extended with #{name}" + if mod.respond_to?(:add_mapping) + special_mappings(mod).each do |mapping| + mod.add_mapping(mapping) + end + end end - def special_mappings + def special_mappings(mod) [ { fieldname: "mediaFileURI", - namespace: handler.record.common_namespace, + namespace: mod.handler.record.common_namespace, data_type: "string", xpath: [], required: "n", From 8476501266b9a9f6fabcd01fe5faa9c7cc87994f Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 16:55:21 -0500 Subject: [PATCH 2/6] Convert %NULLVALUE% to false in Boolean transformer --- lib/collectionspace/mapper/value_transformer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/collectionspace/mapper/value_transformer.rb b/lib/collectionspace/mapper/value_transformer.rb index 83e0f49b..b0d17bd2 100644 --- a/lib/collectionspace/mapper/value_transformer.rb +++ b/lib/collectionspace/mapper/value_transformer.rb @@ -33,7 +33,9 @@ def call(value:, mapping:, handler:, response:) "y" => "true", "n" => "false", "t" => "true", - "f" => "false" + "f" => "false", + "%nullvalue%" => "false", + "%NULLVALUE%" => "false" } # @param value [String] From bd0cd821e1da1f414286325cd4a400cd4df2f39b Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 16:56:22 -0500 Subject: [PATCH 3/6] Map fields grouped with a structured date group --- lib/collectionspace/mapper/data_mapper.rb | 14 +- .../mapper/date_details/data_prepper.rb | 50 +++++- .../mapper/date_details/handler.rb | 57 +++++- .../mapper/handler_full_record.rb | 4 +- .../mapper/date_details/handler_spec.rb | 112 +++++------- spec/refnames.rb | 4 + .../core_datedetail_check_fields.yml | 115 ++++++++++++ .../cassettes/datahandler_process_and_map.yml | 110 ++++++++++++ ...ate_detail_datahandler_process_and_map.yml | 169 ++++++++++++++++++ .../citation_publicationdate_1.json | 16 ++ .../citation_publicationdate_2.json | 18 ++ .../citation_publicationdate_1.xml | 128 +++++++++++++ .../citation_publicationdate_2.xml | 161 +++++++++++++++++ 13 files changed, 873 insertions(+), 85 deletions(-) create mode 100644 spec/support/cassettes/core_datedetail_check_fields.yml create mode 100644 spec/support/cassettes/date_detail_datahandler_process_and_map.yml create mode 100644 spec/support/datahashes/date_details/citation_publicationdate_1.json create mode 100644 spec/support/datahashes/date_details/citation_publicationdate_2.json create mode 100644 spec/support/xml/date_details/citation_publicationdate_1.xml create mode 100644 spec/support/xml/date_details/citation_publicationdate_2.xml diff --git a/lib/collectionspace/mapper/data_mapper.rb b/lib/collectionspace/mapper/data_mapper.rb index 96738e30..da5bcccb 100644 --- a/lib/collectionspace/mapper/data_mapper.rb +++ b/lib/collectionspace/mapper/data_mapper.rb @@ -38,6 +38,7 @@ def set_identifier_value end thexpath = "//#{mapping.namespace}/#{mapping.fieldname}" value = doc.xpath(thexpath).first + value = value.text response.add_identifier(value) end @@ -53,22 +54,23 @@ def set_relation_id end def add_short_id - ns = handler.record.common_namespace - targetnode = doc.xpath("/document/#{ns}").first - child = Nokogiri::XML::Node.new("shortIdentifier", doc) - shortid = if response.transformed_data.key?("shortidentifier") - response.transformed_data["shortidentifier"] + response.transformed_data["shortidentifier"][0] else term = response.split_data["termdisplayname"][0] CollectionSpace::Mapper::Identifiers::AuthorityShortIdentifier.call( term ) end + response.add_identifier(shortid) + return if response.transformed_data.key?("shortidentifier") + + ns = handler.record.common_namespace + targetnode = doc.xpath("/document/#{ns}").first + child = Nokogiri::XML::Node.new("shortIdentifier", doc) child.content = shortid targetnode.add_child(child) - response.add_identifier(shortid) end def map(xpath) diff --git a/lib/collectionspace/mapper/date_details/data_prepper.rb b/lib/collectionspace/mapper/date_details/data_prepper.rb index 8d30ac13..0800a391 100644 --- a/lib/collectionspace/mapper/date_details/data_prepper.rb +++ b/lib/collectionspace/mapper/date_details/data_prepper.rb @@ -18,9 +18,17 @@ def initialize(data, handler) CollectionSpace::Mapper.structured_date_detailed_fields .map { |field| [field.downcase, field] } .to_h + @grouped_data = nil end def prep + unless handler.grouped_fields + handler.check_fields(response.merged_data) + end + if handler.grouped_handler + extract_grouped_data + grouped_prepped = handler.grouped_handler.prep(grouped_data) + end split_data transform_data handle_term_fields @@ -28,13 +36,14 @@ def prep clean_transformed readd_id combine_data_fields + merge_grouped_data(grouped_prepped) if grouped_data response end private attr_reader :id_field, :target, :target_mapping, :date_fields, - :date_field_lookup + :date_field_lookup, :grouped_data def date_data @date_data ||= response.merged_data @@ -46,6 +55,28 @@ def non_date_data .reject { |field, _value| date_fields.any?(field) } end + def extract_grouped_data + @grouped_data = {} + copy_id_field_to_grouped_data + move_grouped_fields_to_grouped_data + end + + def copy_id_field_to_grouped_data + if response.merged_data.key?(id_field) + grouped_data[id_field] = response.merged_data[id_field] + elsif response.merged_data.key?("termdisplayname") + grouped_data["termdisplayname"] = + response.merged_data["termdisplayname"] + end + end + + def move_grouped_fields_to_grouped_data + handler.grouped_fields.each do |field| + grouped_data[field] = response.merged_data[field] + response.merged_data.delete(field) + end + end + def split_data response.merged_data.each do |field, val| splitval = if identifier?(field) @@ -139,19 +170,32 @@ def clean_transformed def readd_id id = case id_field when "shortidentifier" - readd_authority_id + [authority_short_id] else response.split_data[id_field] end response.transformed_data[id_field] = id end - def readd_authority_id + def authority_short_id term = response.split_data["termdisplayname"][0] CollectionSpace::Mapper::Identifiers::AuthorityShortIdentifier.call( term ) end + + def merge_grouped_data(grouped_prepped) + path = handler.target_path + + response.combined_data[path].merge!( + grouped_prepped.combined_data[path] + ) + grouped_prepped.errors.each { |err| response.add_error(err) } + grouped_prepped.terms.each { |term| response.add_term(term) } + grouped_prepped.warnings.each do |warning| + response.add_warning(warning) + end + end end end end diff --git a/lib/collectionspace/mapper/date_details/handler.rb b/lib/collectionspace/mapper/date_details/handler.rb index 8390f3b2..b2a694ad 100644 --- a/lib/collectionspace/mapper/date_details/handler.rb +++ b/lib/collectionspace/mapper/date_details/handler.rb @@ -1,16 +1,43 @@ # frozen_string_literal: true -require "dry/monads" -require "dry/monads/do" - module CollectionSpace module Mapper module DateDetails class Handler < CollectionSpace::Mapper::HandlerFullRecord + attr_reader :grouped_handler, :grouped_fields, :target_path + + def check_fields(data) + initial = super(data) + @grouped_fields = [] + return initial if initial[:unknown_fields].empty? + + known = known_grouped(initial[:unknown_fields], data) + return initial if known.empty? + + @grouped_fields = known + known.each do |field| + initial[:known_fields] << field + initial[:unknown_fields].delete(field) + end + if initial[:unknown_fields].empty? + @grouped_handler = CollectionSpace::Mapper::HandlerFullRecord.new( + record_mapper: record_mapper, client: client, cache: termcache, + csid_cache: csidcache + ) + end + initial + end + private - def pre_initialize + attr_reader :record_mapper + + def pre_initialize(context) config.batch_mode = "date details" + @record_mapper = context.local_variable_get(:record_mapper) + @grouped_handler = nil + @grouped_fields = nil + @target_path = nil end def get_prepper_class @@ -33,6 +60,28 @@ def known_fields base << "termdisplayname" base end + + def known_grouped(fields, data) + target = data["date_field_group"] + @target_path = date_group_path(target) + in_group = grouped_fields_for + return [] if in_group.empty? + + fields.select { |field| in_group.include?(field) } + end + + def grouped_fields_for + record.mappings + .select { |mapping| mapping.fullpath == target_path } + .map(&:datacolumn) + end + + def date_group_path(target) + record.mappings + .select { |m| m.fieldname == target } + .first + .fullpath + end end end end diff --git a/lib/collectionspace/mapper/handler_full_record.rb b/lib/collectionspace/mapper/handler_full_record.rb index f3eba761..d357a96b 100644 --- a/lib/collectionspace/mapper/handler_full_record.rb +++ b/lib/collectionspace/mapper/handler_full_record.rb @@ -103,7 +103,7 @@ class HandlerFullRecord # @param config [Hash, String] parseable JSON string or already- # parsed JSON converted to Hash def initialize(record_mapper:, client:, cache:, csid_cache:, config: {}) - pre_initialize + pre_initialize(binding) @errors = [] @warnings = [] @@ -205,7 +205,7 @@ def to_s private - def pre_initialize + def pre_initialize(context) # Defined in subclasses end diff --git a/spec/collectionspace/mapper/date_details/handler_spec.rb b/spec/collectionspace/mapper/date_details/handler_spec.rb index 140c84c9..dbc52a7c 100644 --- a/spec/collectionspace/mapper/date_details/handler_spec.rb +++ b/spec/collectionspace/mapper/date_details/handler_spec.rb @@ -3,6 +3,8 @@ require "spec_helper" RSpec.describe CollectionSpace::Mapper::DateDetails::Handler do + include_context "data_mapper" + subject(:handler) do setup_handler( profile: profile, @@ -46,85 +48,55 @@ end end - # describe "#check_fields", vcr: "bonsai_domain_check" do - # let(:result) { handler.check_fields(data) } - # let(:profile){ 'bonsai' } - # let(:mapper){ "bonsai_4-1-1_conservation" } - # let(:data) do - # { - # "conservationNumber" => "123", - # "status" => "good", - # "conservator" => "Someone" - # } - # end - - # it "returns expected hash" do - # expected = { - # known_fields: %w[conservationnumber status], - # unknown_fields: %w[conservator] - # } - # expect(result).to eq(expected) - # end - # end - - # describe "#prep", vcr: "core_domain_check" do - # let(:datahash_path) { - # "spec/support/datahashes/core/authorityHierarchy1.json" - # } + describe "#check_fields", vcr: "core_datedetail_check_fields" do + let(:result) { handler.check_fields(datahash) } + let(:mapper) { "core_7-1-0_citation-local" } - # let(:data) { {"objectNumber" => "123"} } - - # it "can be called with response from validation" do - # vresult = handler.validate(data) - # result = handler.prep(vresult) - # expect(result).to be_a(CollectionSpace::Mapper::Response) - # end - - # it "can be called with just data" do - # result = handler.prep(data) - # expect(result).to be_a(CollectionSpace::Mapper::Response) - # end + context "with date fields only" do + let(:datahash_path) do + "spec/support/datahashes/date_details/citation_publicationdate_1.json" + end - # it "returned response includes detailed data transformation info" do - # result = handler.prep(data) + it "returns expected hash" do + expect(result[:unknown_fields]).to be_empty + expect(handler.grouped_fields).to be_empty + end + end - # expect(result.transformed_data).not_to be_empty - # end + context "with date and grouped fields only" do + let(:datahash_path) do + "spec/support/datahashes/date_details/citation_publicationdate_2.json" + end - # context "when response_mode = verbose" do - # let(:config){ {response_mode: 'verbose'} } + it "returns expected hash" do + expect(result[:unknown_fields]).to be_empty + expect(handler.grouped_fields.length).to eq(2) + end + end + end - # it "returned response includes detailed data transformation info" do - # result = handler.prep(data) - # expect(result.transformed_data).not_to be_empty - # end - # end - # end + describe "#process", vcr: "date_detail_datahandler_process_and_map" do + let(:mapper) { "core_7-1-0_citation-local" } - # describe "#process", vcr: "datahandler_process_and_map" do - # let(:data) do - # CollectionSpace::Mapper::Response.new( - # {"objectNumber" => "123"}, - # handler - # ) - # end + context "with date data only" do + let(:datahash_path) do + "spec/support/datahashes/date_details/citation_publicationdate_1.json" + end + let(:fixture_path) { "date_details/citation_publicationdate_1.xml" } - # it "can be called with response from validation" do - # validated = handler.validate(data) - # result = handler.process(validated) - # expect(result).to be_a(CollectionSpace::Mapper::Response) - # expect(result.transformed_data).to be_empty - # end + it_behaves_like "Mapped" + end - # context "when response_mode = verbose" do - # let(:config){ {response_mode: "verbose"} } + context "with date and grouped field data" do + let(:datahash_path) do + "spec/support/datahashes/date_details/citation_publicationdate_2.json" + end + let(:fixture_path) { "date_details/citation_publicationdate_2.xml" } - # it "returned response includes detailed data transformation info" do - # result = handler.process(data) - # expect(result.transformed_data).not_to be_empty - # end - # end - # end + # before { binding.pry } + it_behaves_like "Mapped" + end + end # describe "#map", vcr: "datahandler_process_and_map" do # let(:data) { {"objectNumber" => "123"} } diff --git a/spec/refnames.rb b/spec/refnames.rb index 512f720d..1f5b2e2b 100644 --- a/spec/refnames.rb +++ b/spec/refnames.rb @@ -296,6 +296,10 @@ def cacheable_refnames(domain) "urn:cspace:DOMAIN:placeauthorities:name(place):item:name(Early1599824413345)'Early'"], ["placeauthorities", "place", "Local", "urn:cspace:DOMAIN:placeauthorities:name(place):item:name(Local1599824385298)'Local'"], + ["placeauthorities", "place", "London", + "urn:cspace:DOMAIN:placeauthorities:name(place):item:name(foo)'London'"], + ["placeauthorities", "place", "New York", + "urn:cspace:DOMAIN:placeauthorities:name(place):item:name(foo)'New York'"], ["placeauthorities", "place", "York County, Pennsylvania", "urn:cspace:DOMAIN:placeauthorities:name(place):item:name(YorkCountyPennsylvania)'York County, Pennsylvania'"], ["placeauthorities", "tgn_place", "mzingga", diff --git a/spec/support/cassettes/core_datedetail_check_fields.yml b/spec/support/cassettes/core_datedetail_check_fields.yml new file mode 100644 index 00000000..95fa057d --- /dev/null +++ b/spec/support/cassettes/core_datedetail_check_fields.yml @@ -0,0 +1,115 @@ +--- +http_interactions: +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Thu, 01 Feb 2024 23:09:56 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=6F77305914AC7E6264DB249A06428D7D; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Thu, 01 Feb 2024 23:09:56 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 19:58:07 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=FA119448D1F2F773A84C2CD4E068397E; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Fri, 02 Feb 2024 19:58:07 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/cassettes/datahandler_process_and_map.yml b/spec/support/cassettes/datahandler_process_and_map.yml index a30cf51c..68bbb947 100644 --- a/spec/support/cassettes/datahandler_process_and_map.yml +++ b/spec/support/cassettes/datahandler_process_and_map.yml @@ -137,4 +137,114 @@ http_interactions: string: 02500csid|uri|refName|updatedAt|workflowState|objectNumber|objectName|title|responsibleDepartment recorded_at: Tue, 18 Apr 2023 23:22:20 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/citationauthorities/urn:cspace:name(citation)/items?as=citations_common:citationTermGroupList/0/termDisplayName%20=%20%27Foo%27&pgSz=25&sortBy=collectionspace_core:updatedAt%20DESC&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 01:35:27 GMT + Content-Type: + - application/xml + Content-Length: + - '402' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=977A34129568E18F7E4680AE96D471B7; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 02500csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|proposed|deprecated|termStatus|termDisplayName + recorded_at: Fri, 02 Feb 2024 01:35:27 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 16:00:09 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=9227DD4FBD0B101C89F940E0AB727F4C; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Fri, 02 Feb 2024 16:00:09 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/cassettes/date_detail_datahandler_process_and_map.yml b/spec/support/cassettes/date_detail_datahandler_process_and_map.yml new file mode 100644 index 00000000..6408cfc0 --- /dev/null +++ b/spec/support/cassettes/date_detail_datahandler_process_and_map.yml @@ -0,0 +1,169 @@ +--- +http_interactions: +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 19:56:48 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=BAB5FAF19282D7F96D25774C9C16CC43; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Fri, 02 Feb 2024 19:56:48 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 19:56:48 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=9DC78A22F277712D2D850CC49E38685C; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Fri, 02 Feb 2024 19:56:48 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/citationauthorities/urn:cspace:name(citation)/items?as=citations_common:citationTermGroupList/0/termDisplayName%20=%20%27Foo%27&pgSz=25&sortBy=collectionspace_core:updatedAt%20DESC&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Fri, 02 Feb 2024 19:56:48 GMT + Content-Type: + - application/xml + Content-Length: + - '402' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=AA20FE820CED140613A7BCCE679454C3; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 02500csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|proposed|deprecated|termStatus|termDisplayName + recorded_at: Fri, 02 Feb 2024 19:56:48 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/datahashes/date_details/citation_publicationdate_1.json b/spec/support/datahashes/date_details/citation_publicationdate_1.json new file mode 100644 index 00000000..5fe59262 --- /dev/null +++ b/spec/support/datahashes/date_details/citation_publicationdate_1.json @@ -0,0 +1,16 @@ +{ + "datedisplaydate": "1955|1975", + "dateearliestsingleyear": "1955|1975", + "dateearliestsinglemonth": "1|1", + "dateearliestsingleday": "1|1", + "dateearliestsingleera": "CE|CE", + "datelatestyear": "1955|1975", + "datelatestmonth": "12|12", + "datelatestday": "31|31", + "datelatestera": "CE|CE", + "dateearliestscalarvalue": "1955-01-01T00:00:00.000Z|1975-01-01T00:00:00.000Z", + "datelatestscalarvalue": "1955-12-31T00:00:00.000Z|1975-12-31T00:00:00.000Z", + "scalarvaluescomputed": "true|true", + "termdisplayname": "Foo", + "date_field_group": "publicationDate" +} diff --git a/spec/support/datahashes/date_details/citation_publicationdate_2.json b/spec/support/datahashes/date_details/citation_publicationdate_2.json new file mode 100644 index 00000000..82a20974 --- /dev/null +++ b/spec/support/datahashes/date_details/citation_publicationdate_2.json @@ -0,0 +1,18 @@ +{ + "publisher": "Organization 1|%NULLVALUE%|Bonsai Museum", + "publicationplaceplacelocal": "London|New York|%NULLVALUE%", + "datedisplaydate": "1955|%NULLVALUE%|1975", + "dateearliestsingleyear": "1955|%NULLVALUE%|1975", + "dateearliestsinglemonth": "1|%NULLVALUE%|1", + "dateearliestsingleday": "1|%NULLVALUE%|1", + "dateearliestsingleera": "CE|%NULLVALUE%|CE", + "datelatestyear": "1955|%NULLVALUE%|1975", + "datelatestmonth": "12|%NULLVALUE%|12", + "datelatestday": "31|%NULLVALUE%|31", + "datelatestera": "CE|%NULLVALUE%|CE", + "dateearliestscalarvalue": "1955-01-01T00:00:00.000Z|%NULLVALUE%|1975-01-01T00:00:00.000Z", + "datelatestscalarvalue": "1955-12-31T00:00:00.000Z|%NULLVALUE%|1975-12-31T00:00:00.000Z", + "scalarvaluescomputed": "true|%NULLVALUE%|true", + "termdisplayname": "Foo", + "date_field_group": "publicationDate" +} diff --git a/spec/support/xml/date_details/citation_publicationdate_1.xml b/spec/support/xml/date_details/citation_publicationdate_1.xml new file mode 100644 index 00000000..2f7df758 --- /dev/null +++ b/spec/support/xml/date_details/citation_publicationdate_1.xml @@ -0,0 +1,128 @@ + + + + 2024-02-02T01:27:49.911Z + admin@core.collectionspace.org + admin@core.collectionspace.org + project + 1 + urn:cspace:c.core.collectionspace.org:citationauthorities:name(citation):item:name(Foo1706837269913)'Foo' + /citationauthorities/725968f4-6170-4e97-b3c0/items/fa51b122-d840-409b-adee + 2024-02-02T01:27:49.911Z + + + 0 + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + false + fa51b122-d840-409b-adee + + + true + Foo3813187095 + + urn:cspace:c.core.collectionspace.org:citationauthorities:name(citation):item:name(Foo1706837269913)'Foo' + 725968f4-6170-4e97-b3c0 + + + + + + + + true + + + 1955-12-31T00:00:00.000Z + 1955 + + + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + + 1 + + 1955 + + 31 + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + 1955 + 1 + + + + + 1955-01-01T00:00:00.000Z + 12 + + + + + + + + + true + + + 1975-12-31T00:00:00.000Z + 1975 + + + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + + 1 + + 1975 + + 31 + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + 1975 + 1 + + + + + 1975-01-01T00:00:00.000Z + 12 + + + + + + + 183e3447-f1f3-4e8d-a23d-8023c8e92dff + Administrator + admin@core.collectionspace.org + 1 + + + diff --git a/spec/support/xml/date_details/citation_publicationdate_2.xml b/spec/support/xml/date_details/citation_publicationdate_2.xml new file mode 100644 index 00000000..2491b58d --- /dev/null +++ b/spec/support/xml/date_details/citation_publicationdate_2.xml @@ -0,0 +1,161 @@ + + + + 2024-02-02T01:27:49.911Z + admin@core.collectionspace.org + admin@core.collectionspace.org + project + 1 + urn:cspace:c.core.collectionspace.org:citationauthorities:name(citation):item:name(Foo1706837269913)'Foo' + /citationauthorities/725968f4-6170-4e97-b3c0/items/fa51b122-d840-409b-adee + 2024-02-02T01:40:57.463Z + + + 1 + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + false + fa51b122-d840-409b-adee + + + true + Foo3813187095 + + urn:cspace:c.core.collectionspace.org:citationauthorities:name(citation):item:name(Foo1706837269913)'Foo' + 725968f4-6170-4e97-b3c0 + + + urn:cspace:c.core.collectionspace.org:placeauthorities:name(place):item:name(foo)'London' + + urn:cspace:c.core.collectionspace.org:orgauthorities:name(organization):item:name(Organization11706837990833)'Organization 1' + + + true + + + 1955-12-31T00:00:00.000Z + 1955 + + + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + + 1 + + 1955 + + 31 + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + 1955 + 1 + + + + + 1955-01-01T00:00:00.000Z + 12 + + + + urn:cspace:c.core.collectionspace.org:placeauthorities:name(place):item:name(foo)'New York' + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + urn:cspace:c.core.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiMuseum1706838030748)'Bonsai Museum' + + + true + + + 1975-12-31T00:00:00.000Z + 1975 + + + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + + 1 + + 1975 + + 31 + urn:cspace:c.core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE' + 1975 + 1 + + + + + 1975-01-01T00:00:00.000Z + 12 + + + + + + + 183e3447-f1f3-4e8d-a23d-8023c8e92dff + Administrator + admin@core.collectionspace.org + 1 + + + From 76af049a93cc4c557a56e4663badef85368b54df Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 17:02:06 -0500 Subject: [PATCH 4/6] Bump version; update changelog --- CHANGELOG.md | 3 +++ Gemfile.lock | 2 +- lib/collectionspace/mapper/version.rb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ecb2c07..17892fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This project bumps the version number for any changes (including documentation u ## [Unreleased] - i.e. pushed to main branch but not yet tagged as a release +## [5.0.5] - 2024-02-02 +- For `date details` batch mode: add support for ingesting grouped fields at the same level as the structured date group. To find the group level of the structured date group, find the `date_field_group` value in the relevant CSV ingest template. If that field has a `REPEATING FIELD GROUP` value in the template, any other field values with the same `REPEATING FIELD GROUP` value can be ingested together. + ## [5.0.4] - 2024-02-01 - Ensure `shortid` field is populated when mapping date details for authorities diff --git a/Gemfile.lock b/Gemfile.lock index f99f5a45..94017908 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ GIT PATH remote: . specs: - collectionspace-mapper (5.0.4) + collectionspace-mapper (5.0.5) activesupport (= 7.0.4.3) chronic collectionspace-client (~> 0.15.0) diff --git a/lib/collectionspace/mapper/version.rb b/lib/collectionspace/mapper/version.rb index 43418bbe..92884506 100644 --- a/lib/collectionspace/mapper/version.rb +++ b/lib/collectionspace/mapper/version.rb @@ -2,6 +2,6 @@ module CollectionSpace module Mapper - VERSION = "5.0.4" + VERSION = "5.0.5" end end From ea35f057961f51de26dda6a95c908f03de8594c7 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 17:11:58 -0500 Subject: [PATCH 5/6] Appease rubocop --- lib/collectionspace/mapper/date_details/handler.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/collectionspace/mapper/date_details/handler.rb b/lib/collectionspace/mapper/date_details/handler.rb index b2a694ad..cb7a1528 100644 --- a/lib/collectionspace/mapper/date_details/handler.rb +++ b/lib/collectionspace/mapper/date_details/handler.rb @@ -78,8 +78,7 @@ def grouped_fields_for def date_group_path(target) record.mappings - .select { |m| m.fieldname == target } - .first + .find { |m| m.fieldname == target } .fullpath end end From d143e122d9dada82024cd79db6fdcc377dd25fb4 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Fri, 2 Feb 2024 19:21:57 -0500 Subject: [PATCH 6/6] Include termdisplayname in authority date details CSXML --- .../mapper/date_details/data_prepper.rb | 32 +++++++++-- .../mapper/date_details/handler.rb | 12 +++- .../mapper/handler_full_record.rb | 4 +- .../core_datedetail_check_fields.yml | 56 +++++++++++++++++++ ...ate_detail_datahandler_process_and_map.yml | 56 +++++++++++++++++++ .../citation_publicationdate_1.xml | 7 ++- .../citation_publicationdate_2.xml | 5 ++ 7 files changed, 163 insertions(+), 9 deletions(-) diff --git a/lib/collectionspace/mapper/date_details/data_prepper.rb b/lib/collectionspace/mapper/date_details/data_prepper.rb index 0800a391..df30d6a8 100644 --- a/lib/collectionspace/mapper/date_details/data_prepper.rb +++ b/lib/collectionspace/mapper/date_details/data_prepper.rb @@ -18,6 +18,7 @@ def initialize(data, handler) CollectionSpace::Mapper.structured_date_detailed_fields .map { |field| [field.downcase, field] } .to_h + @authority_data = nil @grouped_data = nil end @@ -25,6 +26,11 @@ def prep unless handler.grouped_fields handler.check_fields(response.merged_data) end + if handler.authority_handler + extract_authority_data + auth_prepped = handler.authority_handler + .prep(authority_data) + end if handler.grouped_handler extract_grouped_data grouped_prepped = handler.grouped_handler.prep(grouped_data) @@ -36,6 +42,7 @@ def prep clean_transformed readd_id combine_data_fields + merge_authority_data(auth_prepped) if authority_data merge_grouped_data(grouped_prepped) if grouped_data response end @@ -43,7 +50,7 @@ def prep private attr_reader :id_field, :target, :target_mapping, :date_fields, - :date_field_lookup, :grouped_data + :date_field_lookup, :grouped_data, :authority_data def date_data @date_data ||= response.merged_data @@ -55,17 +62,22 @@ def non_date_data .reject { |field, _value| date_fields.any?(field) } end + def extract_authority_data + @authority_data = {} + copy_id_field_to(authority_data) + end + def extract_grouped_data @grouped_data = {} - copy_id_field_to_grouped_data + copy_id_field_to(grouped_data) move_grouped_fields_to_grouped_data end - def copy_id_field_to_grouped_data + def copy_id_field_to(data_var) if response.merged_data.key?(id_field) - grouped_data[id_field] = response.merged_data[id_field] + data_var[id_field] = response.merged_data[id_field] elsif response.merged_data.key?("termdisplayname") - grouped_data["termdisplayname"] = + data_var["termdisplayname"] = response.merged_data["termdisplayname"] end end @@ -184,6 +196,16 @@ def authority_short_id ) end + def merge_authority_data(auth_prepped) + added_paths = auth_prepped.xpaths + .reject { |path, xpath| response.xpaths.key?(path) } + + added_paths.each do |path, xpath| + response.xpaths[path] = xpath + response.combined_data[path] = auth_prepped.combined_data[path] + end + end + def merge_grouped_data(grouped_prepped) path = handler.target_path diff --git a/lib/collectionspace/mapper/date_details/handler.rb b/lib/collectionspace/mapper/date_details/handler.rb index cb7a1528..f59b2077 100644 --- a/lib/collectionspace/mapper/date_details/handler.rb +++ b/lib/collectionspace/mapper/date_details/handler.rb @@ -4,7 +4,8 @@ module CollectionSpace module Mapper module DateDetails class Handler < CollectionSpace::Mapper::HandlerFullRecord - attr_reader :grouped_handler, :grouped_fields, :target_path + attr_reader :authority_handler, :grouped_handler, :grouped_fields, + :target_path def check_fields(data) initial = super(data) @@ -40,6 +41,15 @@ def pre_initialize(context) @target_path = nil end + def post_initialize(context) + return unless record.service_type == "authority" + + @authority_handler = CollectionSpace::Mapper::HandlerFullRecord.new( + record_mapper: record_mapper, client: client, cache: termcache, + csid_cache: csidcache + ) + end + def get_prepper_class CollectionSpace::Mapper::DateDetails::DataPrepper end diff --git a/lib/collectionspace/mapper/handler_full_record.rb b/lib/collectionspace/mapper/handler_full_record.rb index d357a96b..c21129d2 100644 --- a/lib/collectionspace/mapper/handler_full_record.rb +++ b/lib/collectionspace/mapper/handler_full_record.rb @@ -131,7 +131,7 @@ def initialize(record_mapper:, client:, cache:, csid_cache:, config: {}) self.config.status_checker = CollectionSpace::Mapper::Tools::RecordStatusServiceBuilder.call(self) - post_initialize + post_initialize(binding) end def add_error(error) @@ -230,7 +230,7 @@ def get_data_validator CollectionSpace::Mapper::DataValidator.new(self) end - def post_initialize + def post_initialize(context) # Defined in subclasses end diff --git a/spec/support/cassettes/core_datedetail_check_fields.yml b/spec/support/cassettes/core_datedetail_check_fields.yml index 95fa057d..ba899e44 100644 --- a/spec/support/cassettes/core_datedetail_check_fields.yml +++ b/spec/support/cassettes/core_datedetail_check_fields.yml @@ -112,4 +112,60 @@ http_interactions: Persons'2023-08-26T02:44:37.565Zproject3personLocal PersonsPersonAuthority recorded_at: Fri, 02 Feb 2024 19:58:07 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Sat, 03 Feb 2024 00:12:48 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=FF38AA20D3594DAD241CFCD88D4DDDC0; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Sat, 03 Feb 2024 00:12:48 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/cassettes/date_detail_datahandler_process_and_map.yml b/spec/support/cassettes/date_detail_datahandler_process_and_map.yml index 6408cfc0..4975c216 100644 --- a/spec/support/cassettes/date_detail_datahandler_process_and_map.yml +++ b/spec/support/cassettes/date_detail_datahandler_process_and_map.yml @@ -166,4 +166,60 @@ http_interactions: string: 02500csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|proposed|deprecated|termStatus|termDisplayName recorded_at: Fri, 02 Feb 2024 19:56:48 GMT +- request: + method: get + uri: https://core.dev.collectionspace.org/cspace-services/personauthorities?pgNum=0&pgSz=1&wf_deleted=false + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Authorization: + - Basic YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= + response: + status: + code: 200 + message: '' + headers: + Date: + - Sat, 03 Feb 2024 00:12:47 GMT + Content-Type: + - application/xml + Content-Length: + - '804' + Connection: + - keep-alive + Vary: + - Access-Control-Request-Headers + - Access-Control-Request-Method + - Origin + Set-Cookie: + - JSESSIONID=C7CA503A48807439A8055847CCCEB1F0; Path=/cspace-services; Secure; + HttpOnly + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + body: + encoding: UTF-8 + string: 0112csid|uri|refName|updatedAt|workflowState|rev|shortIdentifier|sas|displayName|vocabType4bea28cb-83be-4ca1-971b/personauthorities/4bea28cb-83be-4ca1-971burn:cspace:core.collectionspace.org:personauthorities:name(person)'Local + Persons'2023-08-26T02:44:37.565Zproject3personLocal + PersonsPersonAuthority + recorded_at: Sat, 03 Feb 2024 00:12:47 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/xml/date_details/citation_publicationdate_1.xml b/spec/support/xml/date_details/citation_publicationdate_1.xml index 2f7df758..5561cbf2 100644 --- a/spec/support/xml/date_details/citation_publicationdate_1.xml +++ b/spec/support/xml/date_details/citation_publicationdate_1.xml @@ -12,7 +12,12 @@ 0 - + + + Foo + + + diff --git a/spec/support/xml/date_details/citation_publicationdate_2.xml b/spec/support/xml/date_details/citation_publicationdate_2.xml index 2491b58d..6db1a897 100644 --- a/spec/support/xml/date_details/citation_publicationdate_2.xml +++ b/spec/support/xml/date_details/citation_publicationdate_2.xml @@ -14,6 +14,11 @@ 1 + + + Foo + +