uc3-dmp-id 0.0.137 → 0.0.139
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/asserter.rb +22 -14
- data/lib/uc3-dmp-id/creator.rb +1 -1
- data/lib/uc3-dmp-id/deleter.rb +1 -1
- data/lib/uc3-dmp-id/updater.rb +1 -1
- 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: cb9d04c54e282c729615f79d23b6269419b885c85ead76717df87d3d913a99ee
|
4
|
+
data.tar.gz: d197c9c56d42e339b80863de0bc2f4cadbb0e813663925c27a70df9149f586da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6c0fb8f00efd9f29bed43ca71519c6e35728671cf322054ede4d2abb3e19cf6a7452f58126408d607c8a9c1978308eb07f002c0c3462cd01d443476fb2e7bd
|
7
|
+
data.tar.gz: 342cb856af47d06a18c6041784a8c379c4458d58bed55b609ec78c509453adb4c150e338408780c663c6bbd55b2c0ff86094d990dfc8e775e9f9de55ee63ee98
|
data/lib/uc3-dmp-id/asserter.rb
CHANGED
@@ -22,42 +22,42 @@ puts "ADDING ASSERTIONS: #{mods}"
|
|
22
22
|
# Return the DMP ID as-is if there are no assertable changes
|
23
23
|
return dmp if contact.nil? && contributor.empty? && project.empty?
|
24
24
|
|
25
|
-
# Clone any existing
|
26
|
-
assertions = Helper.deep_copy_dmp(obj: dmp.fetch('
|
25
|
+
# Clone any existing pending_assertions on the current DMP ID so we can manipulate them
|
26
|
+
assertions = Helper.deep_copy_dmp(obj: dmp.fetch('dmphub_modifications', []))
|
27
27
|
# Return the DMP ID as-is if the assertion is already on the record
|
28
|
-
return dmp if assertions.select { |entry| entry['provenance'] == updater && entry['
|
28
|
+
return dmp if assertions.select { |entry| entry['provenance'] == updater && entry['pending_assertions'] == mods }
|
29
29
|
|
30
30
|
assertions << _generate_assertion(updater: updater, mods: mods, note: note)
|
31
|
-
dmp['
|
31
|
+
dmp['dmphub_modifications'] = assertions.flatten
|
32
32
|
dmp
|
33
33
|
end
|
34
34
|
|
35
35
|
# Splice together assertions made while the user was updating the DMP ID
|
36
36
|
def splice(latest_version:, modified_version:, logger: nil)
|
37
37
|
|
38
|
-
puts "LATEST_VERSION ASSERTIONS: #{latest_version['
|
39
|
-
puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['
|
38
|
+
puts "LATEST_VERSION ASSERTIONS: #{latest_version['dmphub_modifications']}"
|
39
|
+
puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_modifications']}"
|
40
40
|
|
41
41
|
# Return the modified_version if the timestamps are the same (meaning no new assertions were made while the
|
42
42
|
# user was working on the DMP ID) OR neither version has assertions
|
43
43
|
return modified_version if latest_version['modified'] == modified_version['modified'] ||
|
44
|
-
(latest_version.fetch('
|
45
|
-
modified_version.fetch('
|
44
|
+
(latest_version.fetch('dmphub_modifications', []).empty? &&
|
45
|
+
modified_version.fetch('dmphub_modifications', []).empty?)
|
46
46
|
|
47
47
|
# Clone any existing assertions on the current DMP ID so we can manipulate them
|
48
|
-
existing_assertions = Helper.deep_copy_dmp(obj: latest_version.fetch('
|
49
|
-
incoming_assertions = Helper.deep_copy_dmp(obj: modified_version.fetch('
|
48
|
+
existing_assertions = Helper.deep_copy_dmp(obj: latest_version.fetch('dmphub_modifications', []))
|
49
|
+
incoming_assertions = Helper.deep_copy_dmp(obj: modified_version.fetch('dmphub_modifications', []))
|
50
50
|
logger.debug(message: "Existing assertions", details: existing_assertions) if logger.respond_to?(:debug)
|
51
51
|
logger.debug(message: "Incoming modifications", details: incoming_assertions) if logger.respond_to?(:debug)
|
52
52
|
|
53
53
|
# Keep any assetions that were made after the modified on the incoming changes
|
54
|
-
modified_version['
|
54
|
+
modified_version['dmphub_modifications'] = existing_assertions.select do |entry|
|
55
55
|
!entry['timestamp'].nil? && Time.parse(entry['timestamp']) > Time.parse(modified_version['modified'])
|
56
56
|
end
|
57
57
|
return modified_version unless incoming_assertions.any?
|
58
58
|
|
59
59
|
# Add any of the assertions still on the incoming record back to the latest record
|
60
|
-
incoming_assertions.each { |entry| modified_version['
|
60
|
+
incoming_assertions.each { |entry| modified_version['dmphub_modifications'] << entry }
|
61
61
|
modified_version
|
62
62
|
end
|
63
63
|
|
@@ -70,7 +70,7 @@ puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_assertions']}"
|
|
70
70
|
# "provenance": "dmphub",
|
71
71
|
# "timestamp": "2023-07-07T14:50:23+00:00",
|
72
72
|
# "note": "data received from the NIH API",
|
73
|
-
# "
|
73
|
+
# "pending_assertions": {
|
74
74
|
# "contact": {
|
75
75
|
# "name": "Wrong Person"
|
76
76
|
# },
|
@@ -80,6 +80,14 @@ puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_assertions']}"
|
|
80
80
|
# "role": ["Investigation"]
|
81
81
|
# }
|
82
82
|
# ],
|
83
|
+
# "dmproadmap_related_identifiers": [
|
84
|
+
# {
|
85
|
+
# "work_type": "article",
|
86
|
+
# "descriptor": "is_cited_by",
|
87
|
+
# "type": "doi",
|
88
|
+
# "identifier": "https://dx.doi.org/99.9876/ZYX987.V6"
|
89
|
+
# }
|
90
|
+
# ],
|
83
91
|
# "project": [
|
84
92
|
# {
|
85
93
|
# "start": "2024-01-01T00:00:00+07:00",
|
@@ -110,7 +118,7 @@ puts "MODIFIED_VERSION ASSERTIONS: #{modified_version['dmphub_assertions']}"
|
|
110
118
|
timestamp: Time.now.utc.iso8601,
|
111
119
|
status: 'new',
|
112
120
|
note: note,
|
113
|
-
|
121
|
+
pending_assertions: mods
|
114
122
|
}.to_json)
|
115
123
|
end
|
116
124
|
end
|
data/lib/uc3-dmp-id/creator.rb
CHANGED
@@ -91,7 +91,7 @@ module Uc3DmpId
|
|
91
91
|
json['dmphub_updater_is_provenance'] = true
|
92
92
|
# Publish the change to the EventBridge
|
93
93
|
publisher = Uc3DmpEventBridge::Publisher.new
|
94
|
-
publisher.publish(source: 'DmpCreator', dmp: json, logger: logger)
|
94
|
+
publisher.publish(source: 'DmpCreator', event_type: 'EZID update', dmp: json, logger: logger)
|
95
95
|
|
96
96
|
# Determine if there are any related identifiers that we should try to fetch a citation for
|
97
97
|
citable_identifiers = Helper.citable_related_identifiers(dmp: json)
|
data/lib/uc3-dmp-id/deleter.rb
CHANGED
@@ -67,7 +67,7 @@ module Uc3DmpId
|
|
67
67
|
json['dmphub_updater_is_provenance'] = true
|
68
68
|
# Publish the change to the EventBridge
|
69
69
|
publisher = Uc3DmpEventBridge::Publisher.new
|
70
|
-
publisher.publish(source: 'DmpDeleter', dmp: json, logger: logger)
|
70
|
+
publisher.publish(source: 'DmpDeleter', event_type: 'EZID update', dmp: json, logger: logger)
|
71
71
|
true
|
72
72
|
end
|
73
73
|
end
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -143,7 +143,7 @@ module Uc3DmpId
|
|
143
143
|
json['dmphub_updater_is_provenance'] = provenance['PK'] == json['dmphub_provenance_id']
|
144
144
|
# Publish the change to the EventBridge
|
145
145
|
publisher = Uc3DmpEventBridge::Publisher.new
|
146
|
-
publisher.publish(source: 'DmpUpdater', dmp: json, logger: logger)
|
146
|
+
publisher.publish(source: 'DmpUpdater', event_type: 'EZID update', dmp: json, logger: logger)
|
147
147
|
|
148
148
|
# Determine if there are any related identifiers that we should try to fetch a citation for
|
149
149
|
citable_identifiers = Helper.citable_related_identifiers(dmp: json)
|
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.139
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|