uc3-dmp-id 0.1.12 → 0.1.14
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 +17 -21
- data/lib/uc3-dmp-id/comparator.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: 7ae3b97965d06d3157328d0c23441eb32b63013b52d78f631cb8bd5a9459eebd
|
4
|
+
data.tar.gz: 4d731209d7649e2ed868d00cb7f69b061545edd75f36b73e7e0356aadae34a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236e174f59feb0b53bf812c7baf81eaa505e041e01fc9e5b5a689f402b746c9b53652aff506742a1210b9265e5341119d1e52d816e2fce99fac58e59132cf427
|
7
|
+
data.tar.gz: 3daabef6a600a9b490100b6a09db742c7e44e28368a9e936914371b34d25c8f2df996fbe3a19577cb64973c8f5a38a4c2d784563ceed4acd147779785277ee4b
|
data/lib/uc3-dmp-id/augmenter.rb
CHANGED
@@ -36,17 +36,18 @@ module Uc3DmpId
|
|
36
36
|
def add_modifications(works:)
|
37
37
|
mod_hash = _generate_mod_header
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
%w[publications datasets softwares].each do |work_type|
|
40
|
+
works.fetch(work_type, []).each do |work|
|
41
|
+
next if @known_works.include?(work['id'])
|
42
|
+
|
43
|
+
work_hash = _work_to_mod_entry(type: work_type[0..work_type.length - 2], work:)
|
44
|
+
mod_hash.fetch('dmproadmap_related_identifiers', []) << work_hash unless work_hash.nil?
|
45
|
+
fundings = publication.fetch('fundingReferences', [])
|
46
|
+
next unless fundings.any?
|
47
|
+
|
48
|
+
award_hash = fundings.map { |funding| _funding_to_mod_entry(work:, funding:) }
|
49
|
+
mod_hash.fetch('funding', []) << award_hash unless award_hash.nil?
|
50
|
+
end
|
50
51
|
end
|
51
52
|
return 0 unless mod_hash['dmproadmap_related_identifiers'].any? || mod_hash.fetch('funding', []).any?
|
52
53
|
|
@@ -107,7 +108,7 @@ module Uc3DmpId
|
|
107
108
|
return nil unless funding.is_a?(Hash) && (!funding['awardUri'] || !funding['awardNumber'])
|
108
109
|
return nil if @known_awards.include?(funding['awardUri']) || @known_awards.include?(funding['awardNumber'])
|
109
110
|
|
110
|
-
id = funding['awardUri'] if funding.fetch('awardUri', '')
|
111
|
+
id = funding['awardUri'] if funding.fetch('awardUri', '')&.start_with?('http')
|
111
112
|
id = funding['awardNumber'] if id.nil?
|
112
113
|
|
113
114
|
ret = {
|
@@ -116,16 +117,11 @@ module Uc3DmpId
|
|
116
117
|
score: work['score'],
|
117
118
|
notes: work['notes'],
|
118
119
|
name: funding['funderName'],
|
119
|
-
funding_status: 'granted'
|
120
|
-
grant_id: {
|
121
|
-
type: if id.start_with?('http')
|
122
|
-
id.include?('doi') ? 'doi' : 'url'
|
123
|
-
else
|
124
|
-
'other'
|
125
|
-
end,
|
126
|
-
identifier: id
|
127
|
-
}
|
120
|
+
funding_status: id.nil? ? 'planned' : 'granted'
|
128
121
|
}
|
122
|
+
id_type = id.start_with?('http') ? (id.include?('doi') ? 'doi' : 'url') : 'other' unless id.nil?
|
123
|
+
ret[:grant_id] = { type: id_type, identifier: id } unless id.nil?
|
124
|
+
|
129
125
|
funder_id = funding['funderIdentifier']
|
130
126
|
@logger&.debug(message: "Assessing Work: #{work['id']} (pre funder_id)", details: ret)
|
131
127
|
return JSON.parse(ret.to_json) if funder_id.nil?
|
@@ -143,7 +143,7 @@ module Uc3DmpId
|
|
143
143
|
@details_hash[:identifiers] << grant&.split('/')&.last&.downcase&.strip
|
144
144
|
@details_hash[:identifiers] << opportunity&.downcase&.strip
|
145
145
|
|
146
|
-
@details_hash[:funder_names] << funding['name']&.downcase&.strip
|
146
|
+
@details_hash[:funder_names] << funding['name']&.downcase&.split(' (').first&.strip
|
147
147
|
@details_hash[:funder_ids] << fundref
|
148
148
|
@details_hash[:opportunity_ids] << opportunity&.downcase&.strip
|
149
149
|
@details_hash[:grant_ids] << [grant&.downcase&.strip, grant&.split('/')&.last&.downcase&.strip]
|
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.14
|
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-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|