uc3-dmp-id 0.1.34 → 0.1.36

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: e8ed82601dab8f040bdef2ca093b8a2c90f81160c5a990533947ff3750a5d97c
4
- data.tar.gz: 563c25f02e5c85a41960bad34687bdb4376228cce26e00a8c92024ab4f289055
3
+ metadata.gz: 60af308240750c987c1bf26d88daedb3bef5a65faaed4e71a508626c44539873
4
+ data.tar.gz: bc7c71413c2faf9d1d9c838bbc6069a094e2e48a19754de3998b2056295f4f17
5
5
  SHA512:
6
- metadata.gz: fdd55f05e2c95cf243e8398070e9d690e4ecf7d2d35ba639f937956298e2dcb6c28e9d5600af8a846b7bc8bc0c507b1456f55a56f82f80c456a885311e64e84b
7
- data.tar.gz: 0ae5115a0d8856b72f10f86afe311e835e6bf52a950eaf5dd87a3b4af5acae3ad72958c3198485f53ff56184df2034f6c9347d69f745ad71b4d7e9d35e670fd1
6
+ metadata.gz: 0ff7acaf1a66c9fcc54b76860a86e1544e1ff03c0de11258610e6c1ba93698099d47b81f4cb96bdafc38098505c28f14150f3455e0c9d226b29aa83776d6a158
7
+ data.tar.gz: c576d006c4167ba347047c6693965539d54f3093108c8288882070527e67ba32869b3816340e928632f3dbab8a3b82d40460f35d4e985b39ed343f3816ee1aae
@@ -24,6 +24,8 @@ module Uc3DmpId
24
24
  @details_hash = {}
25
25
 
26
26
  @dmps = args.fetch(:dmps, [])
27
+
28
+ @logger&.debug(message: 'Comparator DMPs', details: @dmps)
27
29
  raise ComparatorError, MSG_MISSING_DMPS if @dmps.empty?
28
30
  end
29
31
 
@@ -56,14 +58,13 @@ module Uc3DmpId
56
58
  scoring = []
57
59
  return scoring unless hash.is_a?(Hash) && !hash['title'].nil?
58
60
 
59
- @dmps.each do |entry|
60
- dmp = entry.fetch('_source', {})
61
-
61
+ @dmps.each do |dmp|
62
+ @logger&.debug(message: 'Incoming external work', details: hash)
62
63
  # Compare the grant ids. If we have a match return the response immediately since that is
63
64
  # a very positive match!
64
65
  response = { confidence: 'None', score: 0, notes: [] }
65
66
  response = _grants_match?(array: hash.fetch('grant_ids', []), dmp:, response:)
66
- scoring << respoonse if response[:confidence] != 'None'
67
+ scoring << response if response[:confidence] != 'None'
67
68
  next if response[:confidence] != 'None'
68
69
 
69
70
  # Compare the people involved, their affiliations and any funding opportunity numbers
@@ -79,7 +80,7 @@ module Uc3DmpId
79
80
  next if response[:score] <= 2
80
81
 
81
82
  # Set the confidence level based on the score
82
- response[:dmp_id] = entry['_id']
83
+ response[:dmp_id] = "DMP##{dmp['dmp_id']}"
83
84
  response[:confidence] = if response[:score] > 10
84
85
  'High'
85
86
  else
@@ -112,6 +113,7 @@ module Uc3DmpId
112
113
  matched = _compare_arrays(array_a: dmp['grant_ids'], array_b: ids)
113
114
  return response if matched <= 0
114
115
 
116
+ @logger&.debug(message: 'Grant ID match!', details: { dmp: dmp['grant_ids'], work: ids })
115
117
  response[:confidence] = 'Absolute'
116
118
  response[:score] = 100
117
119
  response[:notes] << 'the grant ID matched'
@@ -135,6 +137,7 @@ module Uc3DmpId
135
137
  matched = _compare_arrays(array_a: dmp['funder_opportunity_ids'], array_b: ids)
136
138
  return response if matched <= 0
137
139
 
140
+ @logger&.debug(message: 'Opportunities match!', details: { dmp: dmp['funder_opportunity_ids'], work: ids })
138
141
  response[:score] += 5
139
142
  response[:notes] << 'the funding opportunity number matched'
140
143
  response
@@ -161,6 +164,7 @@ module Uc3DmpId
161
164
  matched = _compare_arrays(array_a: dmp['people_ids'], array_b: ids)
162
165
  return response if matched <= 0
163
166
 
167
+ @logger&.debug(message: 'ORCID match!', details: { dmp: dmp['people_ids'], work: ids })
164
168
  response[:score] += (matched * 2)
165
169
  response[:notes] << 'contributor ORCIDs matched'
166
170
  response
@@ -184,6 +188,14 @@ module Uc3DmpId
184
188
  affil_names_matched = _compare_arrays(array_a: dmp.fetch('affiliations', []), array_b: hash['affiliations'])
185
189
  return response if last_names_matched <= 0 && rors_matched <= 0 && affil_names_matched <= 0
186
190
 
191
+ @logger&.debug(
192
+ message: 'Contributor name match',
193
+ details: {
194
+ people: { dmp: dmp['people'], work: hash['people'] },
195
+ rors: { dmp: dmp['affiliation_ids'], work: hash['affiliation_ids'] },
196
+ places: { dmp: dmp['affiliations'], work: hash['affiliations'] }
197
+ }
198
+ )
187
199
  response[:score] += last_names_matched + rors_matched + affil_names_matched
188
200
  response[:notes] << 'contributor names and affiliations matched'
189
201
  response
@@ -203,6 +215,7 @@ module Uc3DmpId
203
215
  matched = _compare_arrays(array_a: dmp['repo_ids'], array_b: hash['repo_ids'])
204
216
  return response if matched <= 0
205
217
 
218
+ @logger&.debug(message: 'Repos match!', details: { dmp: dmp['repo_ids'], work: hash['repo_ids'] })
206
219
  response[:score] += matched
207
220
  response[:notes] << 'repositories matched'
208
221
  response
@@ -226,6 +239,8 @@ module Uc3DmpId
226
239
  # @logger&.debug(message: 'Text::WhiteSimilarity score', details:)
227
240
  return response if details[:nlp_score] < 0.5
228
241
 
242
+ @logger&.debug(message: 'Titles match', details: { dmp: dmp['title'], work: text }) if type == 'title'
243
+ @logger&.debug(message: 'Abstracts match', details: { dmp: dmp['description'], work: text }) unless type == 'title'
229
244
  response[:score] += details[:nlp_score] >= 0.75 ? 5 : 2
230
245
  response[:notes] << "#{type}s are similar"
231
246
  response
@@ -246,6 +246,7 @@ module Uc3DmpId
246
246
 
247
247
  # Change the name of the `logic` array to `notes`
248
248
  rec['notes'] = rec['logic']
249
+ rec['score'] = rec['score'].to_s
249
250
  # For `work-type` that equal `outputmanagementplan`, change it to `output_management_plan`
250
251
  rec['work_type'] = 'output_management_plan' if rec['work_type'] == 'outputmanagementplan'
251
252
 
@@ -204,6 +204,7 @@ module Uc3DmpId
204
204
  mods['related_works'][related.identifier]['status'] = related['status']
205
205
  end
206
206
  end
207
+
207
208
  client.put_item(json: mods, logger:)
208
209
  json.delete('dmphub_modifications')
209
210
  json
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.34'
4
+ VERSION = '0.1.36'
5
5
  end
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.34
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-24 00:00:00.000000000 Z
11
+ date: 2024-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json