uc3-dmp-id 0.1.26 → 0.1.28
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/comparator.rb +16 -12
- 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: f984b52821821510b5be7f91887b366b67f2dfd9e85f29bfaa2a988b34dff2f3
|
4
|
+
data.tar.gz: 5e6d1ced0429757d65c61b5007e325e6ebe9ad8cd94b5fe67d4366289ed12c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d23256d8ef17d0644351ddb1087ce918f6e6868fbcb0a81e13e8322d9fe39451854f19924040cb9f43fcc2163d7dc1efad53d538b0fdbbf871f1a728e625043b
|
7
|
+
data.tar.gz: c054f89e7c9347a61e5ea6a8d7246c6739410995a10f4d433fd0837c0d64097b9b70e51710d275fb4f0c0ef051e9cb60e579c40ee258bfdd45235c3889e5410e
|
@@ -53,35 +53,39 @@ module Uc3DmpId
|
|
53
53
|
# }
|
54
54
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
55
55
|
def compare(hash:)
|
56
|
-
|
56
|
+
scoring = []
|
57
|
+
return scoring unless hash.is_a?(Hash) && !hash['title'].nil?
|
57
58
|
|
58
|
-
|
59
|
-
# a very positive match!
|
60
|
-
scoring = @dmps.map do |entry|
|
59
|
+
@dmps.each do |entry|
|
61
60
|
dmp = entry.fetch('_source', {})
|
62
|
-
|
61
|
+
|
62
|
+
# Compare the grant ids. If we have a match return the response immediately since that is
|
63
|
+
# a very positive match!
|
64
|
+
response = { confidence: 'None', score: 0, notes: [] }
|
63
65
|
response = _grants_match?(array: hash.fetch('grant_ids', []), dmp:, response:)
|
64
|
-
|
66
|
+
scoring << respoonse if response[:confidence] != 'None'
|
67
|
+
next if response[:confidence] != 'None'
|
65
68
|
|
69
|
+
# Compare the people involved, their affiliations and any funding opportunity numbers
|
66
70
|
response = _opportunities_match?(array: hash.fetch('funder_opportunity_ids', []), dmp:, response:)
|
67
71
|
response = _orcids_match?(array: hash.fetch('people_ids', []), dmp:, response:)
|
68
72
|
response = _last_name_and_affiliation_match?(hash:, dmp:, response:)
|
69
73
|
|
70
|
-
# Only process the following if we had some matching
|
74
|
+
# Only process the following if we had some matching people, affiliations or opportunity nbrs
|
71
75
|
response = _repository_match?(hash:, dmp:, response:) if response[:score].positive?
|
72
|
-
# response = _keyword_match?(array: hash['keywords'], response:) if response[:score].positive?
|
73
76
|
response = _text_match?(type: 'title', text: hash['title'], dmp:, response:) if response[:score].positive?
|
74
77
|
response = _text_match?(type: 'abstract', text: hash['description'], dmp:, response:) if response[:score].positive?
|
75
78
|
# If the score is less than 3 then we have no confidence that it is a match
|
76
|
-
|
79
|
+
next if response[:score] <= 2
|
77
80
|
|
78
81
|
# Set the confidence level based on the score
|
82
|
+
response[:dmp_id] = dmp['_id']
|
79
83
|
response[:confidence] = if response[:score] > 10
|
80
84
|
'High'
|
81
85
|
else
|
82
86
|
(response[:score] > 5 ? 'Medium' : 'Low')
|
83
87
|
end
|
84
|
-
response
|
88
|
+
scoring << response
|
85
89
|
end
|
86
90
|
|
87
91
|
# TODO: introduce a tie-breaker here (maybe the closes to the project_end date)
|
@@ -171,7 +175,7 @@ module Uc3DmpId
|
|
171
175
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
172
176
|
def _last_name_and_affiliation_match?(hash:, dmp:, response:)
|
173
177
|
return response unless hash.is_a?(Hash) && dmp.is_a?(Hash) && response.is_a?(Hash)
|
174
|
-
return response unless hash['people'].is_a?(Array)
|
178
|
+
return response unless hash['people'].is_a?(Array)
|
175
179
|
|
176
180
|
# Check the person last names and affiliation name and RORs
|
177
181
|
last_names_matched = _compare_arrays(array_a: dmp['people'], array_b: hash['people'])
|
@@ -193,7 +197,7 @@ module Uc3DmpId
|
|
193
197
|
# rubocop:disable Metrics/AbcSize
|
194
198
|
def _repository_match?(hash:, dmp:, response:)
|
195
199
|
return response unless hash.is_a?(Hash) && dmp.is_a?(Hash) && response.is_a?(Hash)
|
196
|
-
return response unless hash['repo_ids'].is_a?(Array)
|
200
|
+
return response unless hash['repo_ids'].is_a?(Array)
|
197
201
|
|
198
202
|
matched = _compare_arrays(array_a: dmp['repo_ids'], array_b: hash['repo_ids'])
|
199
203
|
return response if matched <= 0
|
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.28
|
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-03-
|
11
|
+
date: 2024-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|