uc3-dmp-id 0.1.36 → 0.1.38

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: 60af308240750c987c1bf26d88daedb3bef5a65faaed4e71a508626c44539873
4
- data.tar.gz: bc7c71413c2faf9d1d9c838bbc6069a094e2e48a19754de3998b2056295f4f17
3
+ metadata.gz: cec9b27f000aa3543c1a53c70c2ac6e6734ad1e0c70a98b7f583db986941ba43
4
+ data.tar.gz: da94a81c40adc7d9c4bea9767ec90bbdeab18f4445a27853fe1ae2e5d51b3c97
5
5
  SHA512:
6
- metadata.gz: 0ff7acaf1a66c9fcc54b76860a86e1544e1ff03c0de11258610e6c1ba93698099d47b81f4cb96bdafc38098505c28f14150f3455e0c9d226b29aa83776d6a158
7
- data.tar.gz: c576d006c4167ba347047c6693965539d54f3093108c8288882070527e67ba32869b3816340e928632f3dbab8a3b82d40460f35d4e985b39ed343f3816ee1aae
6
+ metadata.gz: e89112bbaae3d06adb736c4b0d846c82b27dbfdf90db8d73079a5b83740f04b1f771f8214121884275fd907a8150ad640e9b85689320d23e628d466c8f0d0a65
7
+ data.tar.gz: a2a27c70445f104015bbe15cd5e19e2fffb0de82eae908ee1d335438d18cc29809ad334bdcb92280066541a22a5cb040b4ce1f3ab1d54cd0d9a217b8d6aeff92
@@ -70,7 +70,8 @@ module Uc3DmpId
70
70
  # Compare the people involved, their affiliations and any funding opportunity numbers
71
71
  response = _opportunities_match?(array: hash.fetch('funder_opportunity_ids', []), dmp:, response:)
72
72
  response = _orcids_match?(array: hash.fetch('people_ids', []), dmp:, response:)
73
- response = _last_name_and_affiliation_match?(hash:, dmp:, response:)
73
+ response = _last_name_match?(hash:, dmp:, response:)
74
+ response = _affiliation_match?(hash:, dmp:, response:)
74
75
 
75
76
  # Only process the following if we had some matching people, affiliations or opportunity nbrs
76
77
  response = _repository_match?(hash:, dmp:, response:) if response[:score].positive?
@@ -178,29 +179,46 @@ module Uc3DmpId
178
179
  # affiliation_ids: ["https://ror.org/blah"]
179
180
  # }
180
181
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
181
- def _last_name_and_affiliation_match?(hash:, dmp:, response:)
182
+ def _last_name_match?(hash:, dmp:, response:)
182
183
  return response unless hash.is_a?(Hash) && dmp.is_a?(Hash) && response.is_a?(Hash)
183
184
  return response unless hash['people'].is_a?(Array)
184
185
 
185
186
  # Check the person last names and affiliation name and RORs
186
187
  last_names_matched = _compare_arrays(array_a: dmp['people'], array_b: hash['people'])
188
+ return response if last_names_matched <= 0
189
+
190
+ @logger&.debug(
191
+ message: 'Contributor name match',
192
+ details: {
193
+ people: { dmp: dmp['people'], work: hash['people'] }
194
+ }
195
+ )
196
+ response[:score] += last_names_matched * 2
197
+ response[:notes] << 'contributor names matched'
198
+ response
199
+ end
200
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
201
+
202
+ def _affiliation_match?(hash:, dmp:, response:)
203
+ return response unless hash.is_a?(Hash) && dmp.is_a?(Hash) && response.is_a?(Hash)
204
+ return response unless hash['affiliations'].is_a?(Array) || hash['affiliation_ids'].is_a?(Array)
205
+
206
+ # Check the affiliation names and RORs
187
207
  rors_matched = _compare_arrays(array_a: dmp.fetch('affiliation_ids', []), array_b: hash['affiliation_ids'])
188
208
  affil_names_matched = _compare_arrays(array_a: dmp.fetch('affiliations', []), array_b: hash['affiliations'])
189
- return response if last_names_matched <= 0 && rors_matched <= 0 && affil_names_matched <= 0
209
+ return response if rors_matched <= 0 && affil_names_matched <= 0
190
210
 
191
211
  @logger&.debug(
192
- message: 'Contributor name match',
212
+ message: 'Affiliation name match',
193
213
  details: {
194
- people: { dmp: dmp['people'], work: hash['people'] },
195
214
  rors: { dmp: dmp['affiliation_ids'], work: hash['affiliation_ids'] },
196
215
  places: { dmp: dmp['affiliations'], work: hash['affiliations'] }
197
216
  }
198
217
  )
199
- response[:score] += last_names_matched + rors_matched + affil_names_matched
200
- response[:notes] << 'contributor names and affiliations matched'
218
+ response[:score] += rors_matched + affil_names_matched
219
+ response[:notes] << 'affiliations matched'
201
220
  response
202
221
  end
203
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
204
222
 
205
223
  # Returns whether or not the incoming list of repositories match those defined in the DMP. Expecting:
206
224
  # {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.36'
4
+ VERSION = '0.1.38'
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.36
4
+ version: 0.1.38
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-02 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json