uc3-dmp-id 0.0.127 → 0.0.129
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/creator.rb +14 -0
- data/lib/uc3-dmp-id/helper.rb +10 -0
- data/lib/uc3-dmp-id/updater.rb +14 -0
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2024007f975c53df4f9be8e39229ad6e4779ba792be21888853bc00ce9631715
|
4
|
+
data.tar.gz: 6cde371bb0f84552394e20aac0f9a811d72ca79495b6dd1559dc87bf70f84099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f507041a4466514e498da66af95bbd5e404325e897655dfb15b5fc4d8de17e7c5df3f8d688048481c63283629bdabf139709329ec1d6a1b73e60e554b1427bad
|
7
|
+
data.tar.gz: 1160d4404031406cf7ddf89ed3e1e25faf74a8f2c8cb9f1c2f07290c44d2bd3bf85cadb2f56c6797275f06bc3548ef1c3f1dafd3c01baa30f81e2fe344682ebf
|
data/lib/uc3-dmp-id/creator.rb
CHANGED
@@ -92,6 +92,20 @@ module Uc3DmpId
|
|
92
92
|
# Publish the change to the EventBridge
|
93
93
|
publisher = Uc3DmpEventBridge::Publisher.new
|
94
94
|
publisher.publish(source: 'DmpCreator', dmp: json, logger: logger)
|
95
|
+
|
96
|
+
# Determine if there are any related identifiers that we should try to fetch a citation for
|
97
|
+
citable_identifiers = Helper.citable_related_identifiers(related_identifiers: json)
|
98
|
+
return true if citable_identifiers.empty?
|
99
|
+
|
100
|
+
# Process each citation individually because they can be slow to fetch
|
101
|
+
citable_identifiers.each do |identifier|
|
102
|
+
citer_detail = {
|
103
|
+
PK: json['PK'],
|
104
|
+
SK: json['SK'],
|
105
|
+
dmproadmap_related_identifier: identifier
|
106
|
+
}
|
107
|
+
publisher.publish(source: 'DmpCreator', dmp: json, event_type: 'Citation Fetch', detail: citer_detail, logger: logger)
|
108
|
+
end
|
95
109
|
true
|
96
110
|
end
|
97
111
|
end
|
data/lib/uc3-dmp-id/helper.rb
CHANGED
@@ -232,6 +232,16 @@ module Uc3DmpId
|
|
232
232
|
end
|
233
233
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
234
234
|
|
235
|
+
# Extracts the related identifiers that we can fetch a citation for
|
236
|
+
def citable_related_identifiers(related_identifiers: [])
|
237
|
+
# Ignore the identifier that points to the narrative PDF document and any identifiers that
|
238
|
+
# we have already fetched the citation for
|
239
|
+
related_identifiers.reject do |id|
|
240
|
+
(id['work_type'] == 'output_management_plan' && id['descriptor'] == 'is_metadata_for') ||
|
241
|
+
(id['type'] == 'doi' && !id['citation'].nil?)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
235
245
|
# Ruby's clone/dup methods do not clone/dup the children, so we need to do it here
|
236
246
|
# --------------------------------------------------------------
|
237
247
|
# rubocop:disable Metrics/AbcSize
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -141,6 +141,20 @@ module Uc3DmpId
|
|
141
141
|
# Publish the change to the EventBridge
|
142
142
|
publisher = Uc3DmpEventBridge::Publisher.new
|
143
143
|
publisher.publish(source: 'DmpUpdater', dmp: json, logger: logger)
|
144
|
+
|
145
|
+
# Determine if there are any related identifiers that we should try to fetch a citation for
|
146
|
+
citable_identifiers = Helper.citable_related_identifiers(related_identifiers: json)
|
147
|
+
return true if citable_identifiers.empty?
|
148
|
+
|
149
|
+
# Process each citation individually because they can be slow to fetch
|
150
|
+
citable_identifiers.each do |identifier|
|
151
|
+
citer_detail = {
|
152
|
+
PK: json['PK'],
|
153
|
+
SK: json['SK'],
|
154
|
+
dmproadmap_related_identifier: identifier
|
155
|
+
}
|
156
|
+
publisher.publish(source: 'DmpCreator', dmp: json, event_type: 'Citation Fetch', detail: citer_detail, logger: logger)
|
157
|
+
end
|
144
158
|
true
|
145
159
|
end
|
146
160
|
end
|
data/lib/uc3-dmp-id/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.129
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|