lib/bolognese/readers/datacite_reader.rb in bolognese-1.2.20 vs lib/bolognese/readers/datacite_reader.rb in bolognese-1.3.1
- old
+ new
@@ -140,12 +140,16 @@
end.compact
dates << { "date" => meta.fetch("publicationYear", nil), "dateType" => "Issued" } if meta.fetch("publicationYear", nil).present? && get_date(dates, "Issued").blank?
sizes = Array.wrap(meta.dig("sizes", "size"))
formats = Array.wrap(meta.dig("formats", "format"))
funding_references = Array.wrap(meta.dig("fundingReferences", "fundingReference")).compact.map do |fr|
+ scheme_uri = parse_attributes(fr["funderIdentifier"], content: "schemeURI")
+ funder_identifier = parse_attributes(fr["funderIdentifier"])
+ funder_identifier = !funder_identifier.to_s.start_with?("https://") && scheme_uri.present? ? normalize_id(scheme_uri + funder_identifier) : normalize_id(funder_identifier)
+
{
"funderName" => fr["funderName"],
- "funderIdentifier" => normalize_id(parse_attributes(fr["funderIdentifier"])),
+ "funderIdentifier" => funder_identifier,
"funderIdentifierType" => parse_attributes(fr["funderIdentifier"], content: "funderIdentifierType"),
"awardNumber" => parse_attributes(fr["awardNumber"]),
"awardUri" => parse_attributes(fr["awardNumber"], content: "awardURI"),
"awardTitle" => fr["awardTitle"] }.compact
end