uc3-dmp-id 0.1.11 → 0.1.13
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/augmenter.rb +8 -12
- data/lib/uc3-dmp-id/comparator.rb +2 -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: d66a6f468a0f6d8db5ae871ca3981e7eb88e78a31dd4ee3c156532c9afd546fe
|
4
|
+
data.tar.gz: 92b20512b11ab92808db115a40b8cf5a1e7c5369d890f591fc4745c73f93c3d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 858aaabd9f1cf699257b076309851ea26a44a8262bddd0ad0c99956f2c872ba6a7a705c8edd45cadd45b64097caa8ad9a16b9caa896490e2a2f23622664a4986
|
7
|
+
data.tar.gz: 37b83f9bd35d43285879c57d59af76b836ad49c5fc6708c81c34d04685db3238bac1f8e4a80abfbbdc992b7c67560341806c28f80bbfdb696646b4696da89a9d
|
data/lib/uc3-dmp-id/augmenter.rb
CHANGED
@@ -11,7 +11,7 @@ module Uc3DmpId
|
|
11
11
|
# Class that adds items to the :dmphub_modifications array or directly to the
|
12
12
|
# :dmpraodmap_related_identifiers array if the confidence level was 'Absolute'
|
13
13
|
class Augmenter
|
14
|
-
attr_accessor :augmenter, :dmp, :known_mods, :known_works, :known_awards, :logger
|
14
|
+
attr_accessor :augmenter, :run_id, :dmp, :known_mods, :known_works, :known_awards, :logger
|
15
15
|
|
16
16
|
MSG_MISSING_ANNOTATIONS = 'DMP must have its DMPHub specific annotations!'
|
17
17
|
MSG_MISSING_AUGMENTER = 'No Augmenter specified!'
|
@@ -21,6 +21,7 @@ module Uc3DmpId
|
|
21
21
|
def initialize(**args)
|
22
22
|
@logger = args[:logger]
|
23
23
|
@augmenter = args[:augmenter]
|
24
|
+
@run_id = args.fetch(:run_id, 'None')
|
24
25
|
raise AugmenterError, MSG_MISSING_AUGMENTER unless @augmenter.is_a?(Hash) && !@augmenter['PK'].nil?
|
25
26
|
|
26
27
|
@dmp = args.fetch(:dmp, {})['dmp'].nil? ? args[:dmp] : args.fetch(:dmp, {})['dmp']
|
@@ -54,7 +55,6 @@ module Uc3DmpId
|
|
54
55
|
|
55
56
|
# Save the DMP
|
56
57
|
@dmp['dmphub_modifications'] = (@known_mods.nil? ? [] : @known_mods) << mod_hash
|
57
|
-
|
58
58
|
client = Uc3DmpDynamo::Client.new
|
59
59
|
resp = client.put_item(json: @dmp, logger:)
|
60
60
|
raise AugmenterError, Helper::MSG_DMP_NO_DMP_ID if resp.nil?
|
@@ -70,6 +70,7 @@ module Uc3DmpId
|
|
70
70
|
JSON.parse({
|
71
71
|
id: "#{Time.now.utc.strftime('%Y-%m-%d')}-#{SecureRandom.hex(4)}",
|
72
72
|
provenance: @augmenter['name'],
|
73
|
+
augmenter_run_id: @run_id,
|
73
74
|
timestamp: Time.now.utc.iso8601,
|
74
75
|
dmproadmap_related_identifiers: [],
|
75
76
|
funding: []
|
@@ -106,7 +107,7 @@ module Uc3DmpId
|
|
106
107
|
return nil unless funding.is_a?(Hash) && (!funding['awardUri'] || !funding['awardNumber'])
|
107
108
|
return nil if @known_awards.include?(funding['awardUri']) || @known_awards.include?(funding['awardNumber'])
|
108
109
|
|
109
|
-
id = funding['awardUri'] if funding.fetch('awardUri', '')
|
110
|
+
id = funding['awardUri'] if funding.fetch('awardUri', '')&.start_with?('http')
|
110
111
|
id = funding['awardNumber'] if id.nil?
|
111
112
|
|
112
113
|
ret = {
|
@@ -115,16 +116,11 @@ module Uc3DmpId
|
|
115
116
|
score: work['score'],
|
116
117
|
notes: work['notes'],
|
117
118
|
name: funding['funderName'],
|
118
|
-
funding_status: 'granted'
|
119
|
-
grant_id: {
|
120
|
-
type: if id.start_with?('http')
|
121
|
-
id.include?('doi') ? 'doi' : 'url'
|
122
|
-
else
|
123
|
-
'other'
|
124
|
-
end,
|
125
|
-
identifier: id
|
126
|
-
}
|
119
|
+
funding_status: id.nil? ? 'planned' : 'granted'
|
127
120
|
}
|
121
|
+
id_type = id.start_with?('http') ? (id.include?('doi') ? 'doi' : 'url') : 'other' unless id.nil?
|
122
|
+
ret[:grant_id] = { type: id_type, identifier: id } unless id.nil?
|
123
|
+
|
128
124
|
funder_id = funding['funderIdentifier']
|
129
125
|
@logger&.debug(message: "Assessing Work: #{work['id']} (pre funder_id)", details: ret)
|
130
126
|
return JSON.parse(ret.to_json) if funder_id.nil?
|
@@ -101,6 +101,7 @@ module Uc3DmpId
|
|
101
101
|
keywords: dmp.fetch('dataset', []).map { |ds| ds.fetch('keyword', []) }.flatten.compact.uniq,
|
102
102
|
identifiers: [dmp.fetch('dmp_id', {})['identifier']],
|
103
103
|
last_names: [],
|
104
|
+
orcids: [],
|
104
105
|
affiliation_ids: [],
|
105
106
|
affiliations: [],
|
106
107
|
funder_names: [],
|
@@ -165,6 +166,7 @@ module Uc3DmpId
|
|
165
166
|
name = entry.fetch('name', '')&.downcase&.strip
|
166
167
|
last_name = name.include?(', ') ? name.split(', ').first : name.split.last
|
167
168
|
|
169
|
+
@details_hash[:orcids] << id unless id.nil?
|
168
170
|
@details_hash[:identifiers] << [id, ror&.downcase&.strip]
|
169
171
|
@details_hash[:last_names] << last_name
|
170
172
|
@details_hash[:affiliation_ids] << ror
|
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.1.
|
4
|
+
version: 0.1.13
|
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-10-
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|