uc3-dmp-id 0.0.68 → 0.0.70

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b94c8ef3d724aa5d75d88a1f58f8180c8aa9021b11b56c7f431ce0c68a250aaa
4
- data.tar.gz: 160e795437ca56d665d5c1a67b515c191a976954c4132198fd8ae5c402e771cd
3
+ metadata.gz: f0ca5545af2c686ec3c72c6d87ee6035f2c32d15e4e02e88a2242405d989c723
4
+ data.tar.gz: dc8abcfa7e6f83b0f4c65701595d57f6dfa8a3ba59049b3a90814eaa08036c35
5
5
  SHA512:
6
- metadata.gz: 6f7052975061b7d34e12ef319c9581b0738f8525f7fe8fead743ebc0546d21e01078435f31d9907363aa5539b7a33fd03c8f85a34c1d02246feebaa977e41ae1
7
- data.tar.gz: e1b9537db7d56889619d9bb2feca761aac0441822203a3507effa36f35510a2c2a2b819a277895fd2703baa1308ee4adb2788a902782fb3909489d4e5e058ebe
6
+ metadata.gz: f1396221ec09ad597c60b0227263589ef4ab5dbec2a0522ccfd264d87d4c7125bb69d0953be1faa3a3bb1cf0e9ad0a10472d1933501edb7d54a8fdd137017d7c
7
+ data.tar.gz: 00b202a1a166b2ad2a334503991e20d470e0ed445e5635a199c244c5622e2d3f8bbbf13da07989b2958625904f13c3fd067a96ff5eaec6d304630b723f5886f6
@@ -138,7 +138,8 @@ module Uc3DmpId
138
138
  return nil unless json.is_a?(Hash)
139
139
 
140
140
  dmp = json['dmp'].nil? ? json : json['dmp']
141
- owner_org = dmp.fetch('contact', {}).fetch('contact_id', {})['identifier']
141
+ id = dmp.fetch('contact', {}).fetch('contact_id', {})['identifier']
142
+ return id unless id.nil?
142
143
 
143
144
  dmp.fetch('contributor', []).map { |contributor| contributor.fetch('contact_id', {})['identifier'] }.first
144
145
  end
@@ -160,7 +161,7 @@ module Uc3DmpId
160
161
  # Add DMPHub specific fields to the DMP ID JSON
161
162
  def annotate_dmp_json(provenance:, p_key:, json:)
162
163
  json = parse_json(json: json)
163
- return json if provenance.nil? || owner_org.nil? || p_key.nil? || !json.is_a?(Hash)
164
+ return json if provenance.nil? || p_key.nil? || !json.is_a?(Hash)
164
165
 
165
166
  # Fail the json as is if the :PK does not match the :dmp_id if the json has a :PK
166
167
  id = dmp_id_to_pk(json: json.fetch('dmp_id', {}))
@@ -190,9 +191,15 @@ module Uc3DmpId
190
191
  json.fetch('dmp_id', {})['identifier'].nil?
191
192
 
192
193
  # Record the original Provenance system's identifier
193
- annotated['dmphub_provenance_identifier'] = format_provenance_id(
194
- provenance: provenance, value: json.fetch('dmp_id', {})['identifier']
195
- )
194
+ # If we are currently seeding records for existing DMP IDs, then use the :dmproadmap_links
195
+ if provenance.fetch('seedingWithLiveDmpIds', false).to_s.downcase == 'true' &&
196
+ !annotated.fetch('dmproadmap_links', {})['get'].nil?
197
+ annotated['dmphub_provenance_identifier'] = annotated.fetch('dmproadmap_links', {})['get']
198
+ else
199
+ annotated['dmphub_provenance_identifier'] = format_provenance_id(
200
+ provenance: provenance, value: json.fetch('dmp_id', {})['identifier']
201
+ )
202
+ end
196
203
  annotated
197
204
  end
198
205
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.68'
4
+ VERSION = '0.0.70'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.68
4
+ version: 0.0.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley