uc3-dmp-id 0.1.61 → 0.1.62
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/finder.rb +9 -7
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289f8d64c3d235bd1dcfa4944f61f9b02df27a10269fe4e488f22e07858ca7a7
|
4
|
+
data.tar.gz: 8cf27583d3ac6dc860b451358d5ddc2c398138106f95829234ade8f075e1bbcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e37a65b597ce40874d7380ca16af810eb0a87a21251cbf9edd1b770cfa64d7fee113746669899879aaa9bd55abdbc91e5cfdde8ceabab73c4939193dbfcd9e1
|
7
|
+
data.tar.gz: 12f88664290e9d479c099d3fa28a1657182b40146dbb1cb4c55f28b0f44102d962ad0f11e1d30767b160dbfd502af0e24ee03ec54d1af484191f5853e500927f
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -19,6 +19,12 @@ module Uc3DmpId
|
|
19
19
|
|
20
20
|
ORCID_DOMAIN = 'https://orcid.org/'
|
21
21
|
ROR_DOMAIN = 'https://ror.org/'
|
22
|
+
SORT_OPTIONS = %w[title modified]
|
23
|
+
SORT_DIRECTIONS = %w[asc desc]
|
24
|
+
MAX_PAGE_SIZE = 100
|
25
|
+
DEFAULT_PAGE_SIZE = 25
|
26
|
+
DEFAULT_SORT_OPTION = 'modified'
|
27
|
+
DEFAULT_SORT_DIR = 'desc'
|
22
28
|
|
23
29
|
class << self
|
24
30
|
# TODO: Replace this with ElasticSearch
|
@@ -32,19 +38,15 @@ module Uc3DmpId
|
|
32
38
|
owner_pks = owner.nil? ? [] : _by_owner(owner: owner, client:, logger:)
|
33
39
|
org_pks = org.nil? ? [] : _by_org(org: org, client:, logger:)
|
34
40
|
funder_pks = funder.nil? ? [] : _by_funder(funder: funder, client:, logger:)
|
41
|
+
pks = [owner_pks, org_pks, funder_pks].reject(&:empty?)
|
35
42
|
return [] if owner_pks.empty? && org_pks.empty? && funder_pks.empty?
|
36
43
|
|
37
44
|
# Only use the DMPs that fit all of the filter criteria
|
38
|
-
dmps =
|
45
|
+
dmps = pks.reduce(:&).flatten.uniq
|
39
46
|
return [] if dmps.nil? || dmps.empty?
|
40
47
|
|
41
|
-
# Perfom search operations
|
42
48
|
|
43
|
-
#
|
44
|
-
|
45
|
-
# Handle pagination
|
46
|
-
|
47
|
-
# Fetch full DMP records
|
49
|
+
# Fetch full DMP records for the results
|
48
50
|
client = Uc3DmpDynamo::Client.new(table: ENV['DYNAMO_TABLE'])
|
49
51
|
_fetch_dmps(client:, pks: dmps.map { |dmp| dmp['pk'] }, logger:)
|
50
52
|
end
|
data/lib/uc3-dmp-id/version.rb
CHANGED