uc3-dmp-id 0.1.35 → 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: 5828afe1afaf7214cdea0e02ed8b834587068be56f1f1a060050c7768c4d19a8
4
- data.tar.gz: 10c0bb60320d71414959a9623e435d71ab52b74b758a38fc23cb7fad68f5bd3e
3
+ metadata.gz: 60af308240750c987c1bf26d88daedb3bef5a65faaed4e71a508626c44539873
4
+ data.tar.gz: bc7c71413c2faf9d1d9c838bbc6069a094e2e48a19754de3998b2056295f4f17
5
5
  SHA512:
6
- metadata.gz: f4195fb80461a995b42d10e41ff6828aa79692d3cf92c7ce942f71f830c74d2544806a4c0ada2924d0aa7bf8c310c8b8f03a63eeacbd8754d4262aeb343f7dba
7
- data.tar.gz: a1108d2311d8c8331b2b176278ae10d9283bdcbb0f4568c0b7d488e22268293b0356c36a51937857f709c64be89edcf2c8a8f98d74d98a66eda3c08f9ef0dea2
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
 
@@ -57,11 +59,12 @@ module Uc3DmpId
57
59
  return scoring unless hash.is_a?(Hash) && !hash['title'].nil?
58
60
 
59
61
  @dmps.each do |dmp|
62
+ @logger&.debug(message: 'Incoming external work', details: hash)
60
63
  # Compare the grant ids. If we have a match return the response immediately since that is
61
64
  # a very positive match!
62
65
  response = { confidence: 'None', score: 0, notes: [] }
63
66
  response = _grants_match?(array: hash.fetch('grant_ids', []), dmp:, response:)
64
- scoring << respoonse if response[:confidence] != 'None'
67
+ scoring << response if response[:confidence] != 'None'
65
68
  next if response[:confidence] != 'None'
66
69
 
67
70
  # Compare the people involved, their affiliations and any funding opportunity numbers
@@ -110,6 +113,7 @@ module Uc3DmpId
110
113
  matched = _compare_arrays(array_a: dmp['grant_ids'], array_b: ids)
111
114
  return response if matched <= 0
112
115
 
116
+ @logger&.debug(message: 'Grant ID match!', details: { dmp: dmp['grant_ids'], work: ids })
113
117
  response[:confidence] = 'Absolute'
114
118
  response[:score] = 100
115
119
  response[:notes] << 'the grant ID matched'
@@ -133,6 +137,7 @@ module Uc3DmpId
133
137
  matched = _compare_arrays(array_a: dmp['funder_opportunity_ids'], array_b: ids)
134
138
  return response if matched <= 0
135
139
 
140
+ @logger&.debug(message: 'Opportunities match!', details: { dmp: dmp['funder_opportunity_ids'], work: ids })
136
141
  response[:score] += 5
137
142
  response[:notes] << 'the funding opportunity number matched'
138
143
  response
@@ -159,6 +164,7 @@ module Uc3DmpId
159
164
  matched = _compare_arrays(array_a: dmp['people_ids'], array_b: ids)
160
165
  return response if matched <= 0
161
166
 
167
+ @logger&.debug(message: 'ORCID match!', details: { dmp: dmp['people_ids'], work: ids })
162
168
  response[:score] += (matched * 2)
163
169
  response[:notes] << 'contributor ORCIDs matched'
164
170
  response
@@ -182,6 +188,14 @@ module Uc3DmpId
182
188
  affil_names_matched = _compare_arrays(array_a: dmp.fetch('affiliations', []), array_b: hash['affiliations'])
183
189
  return response if last_names_matched <= 0 && rors_matched <= 0 && affil_names_matched <= 0
184
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
+ )
185
199
  response[:score] += last_names_matched + rors_matched + affil_names_matched
186
200
  response[:notes] << 'contributor names and affiliations matched'
187
201
  response
@@ -201,6 +215,7 @@ module Uc3DmpId
201
215
  matched = _compare_arrays(array_a: dmp['repo_ids'], array_b: hash['repo_ids'])
202
216
  return response if matched <= 0
203
217
 
218
+ @logger&.debug(message: 'Repos match!', details: { dmp: dmp['repo_ids'], work: hash['repo_ids'] })
204
219
  response[:score] += matched
205
220
  response[:notes] << 'repositories matched'
206
221
  response
@@ -224,6 +239,8 @@ module Uc3DmpId
224
239
  # @logger&.debug(message: 'Text::WhiteSimilarity score', details:)
225
240
  return response if details[:nlp_score] < 0.5
226
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'
227
244
  response[:score] += details[:nlp_score] >= 0.75 ? 5 : 2
228
245
  response[:notes] << "#{type}s are similar"
229
246
  response
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.35'
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.35
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-05-01 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