uc3-dmp-id 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/comparator.rb +5 -9
- 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: ed142333899fd7e57c9dc8c5052b51205b13494bb513b2199583397eef7162c7
|
4
|
+
data.tar.gz: 01cd7806f0900434cec2a2c5e43488fd9da112e1521e44914a81a51c2a5d7742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 102d4e2cafbf9594f6a69d195e9c2659f34e19505bded960979ce24901d144d07d0851b92a6d94a979b87e081a984d3c4999e0933cb667014b38c95fdd781495
|
7
|
+
data.tar.gz: 5301292abe35dcaf79c1ae053d5035a057986a671442f4e0d06087441373b607256de5c951603be764f857ef273643bbd17ee6fa42179d9f7b6ef6ea49033755
|
@@ -17,17 +17,13 @@ module Uc3DmpId
|
|
17
17
|
# See the bottom of this file for a hard-coded crosswalk between Crossref funder ids and ROR ids
|
18
18
|
# Some APIs do not support ROR fully for funder ids, so we need to be able to reference both
|
19
19
|
|
20
|
-
attr_accessor :
|
20
|
+
attr_accessor :dmp, :details_hash, :logger
|
21
21
|
|
22
22
|
# rubocop:disable Metrics/AbcSize
|
23
23
|
def initialize(**args)
|
24
24
|
@logger = args[:logger]
|
25
25
|
@details_hash = {}
|
26
26
|
|
27
|
-
@augmenter = args[:augmenter]
|
28
|
-
raise ComparatorError, MSG_MISSING_AUGMENTER if @augmenter.nil? ||
|
29
|
-
!@augmenter['PK']&.start_with?('AUGMENTERS#')
|
30
|
-
|
31
27
|
@dmp = args.fetch(:dmp, {})['dmp'].nil? ? args[:dmp] : args.fetch(:dmp, {})['dmp']
|
32
28
|
_extract_dmp_details(dmp:)
|
33
29
|
raise ComparatorError, MSG_MISSING_DMP if @details_hash.empty?
|
@@ -57,7 +53,7 @@ module Uc3DmpId
|
|
57
53
|
# }
|
58
54
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
59
55
|
def compare(hash:)
|
60
|
-
response = { confidence: 'None', score: 0, notes: []
|
56
|
+
response = { confidence: 'None', score: 0, notes: [] }
|
61
57
|
return response unless hash.is_a?(Hash) && !hash['title'].nil?
|
62
58
|
|
63
59
|
# Compare the grant ids. If we have a match return the response immediately since that is
|
@@ -71,17 +67,17 @@ module Uc3DmpId
|
|
71
67
|
|
72
68
|
# Only process the following if we had some matching contributors, affiliations or opportuniy nbrs
|
73
69
|
response = _repository_match?(array: hash['repositories'], response:) if response[:score].positive?
|
74
|
-
response = _keyword_match?(array: hash['
|
70
|
+
response = _keyword_match?(array: hash['keywords'], response:) if response[:score].positive?
|
75
71
|
response = _text_match?(type: 'title', text: hash['title'], response:) if response[:score].positive?
|
76
72
|
response = _text_match?(type: 'abstract', text: hash['abstract'], response:) if response[:score].positive?
|
77
73
|
# If the score is less than 3 then we have no confidence that it is a match
|
78
74
|
return response if response[:score] <= 2
|
79
75
|
|
80
76
|
# Set the confidence level based on the score
|
81
|
-
response[:confidence] = if response[:score] >
|
77
|
+
response[:confidence] = if response[:score] > 10
|
82
78
|
'High'
|
83
79
|
else
|
84
|
-
(response[:score] >
|
80
|
+
(response[:score] > 5 ? 'Medium' : 'Low')
|
85
81
|
end
|
86
82
|
response
|
87
83
|
end
|
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.6
|
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-10-
|
11
|
+
date: 2023-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|