uc3-dmp-id 0.1.60 → 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 +16 -10
- 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: 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,28 +19,34 @@ 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
|
25
31
|
def search_dmps(args:, logger: nil)
|
26
32
|
# Fetch the DMPs for each of the possible filter options
|
27
33
|
client = Uc3DmpDynamo::Client.new(table: ENV['DYNAMO_INDEX_TABLE'])
|
28
|
-
|
29
|
-
|
30
|
-
|
34
|
+
owner = args['owner']
|
35
|
+
org = args['org']
|
36
|
+
funder = args['funder']
|
37
|
+
|
38
|
+
owner_pks = owner.nil? ? [] : _by_owner(owner: owner, client:, logger:)
|
39
|
+
org_pks = org.nil? ? [] : _by_org(org: org, client:, logger:)
|
40
|
+
funder_pks = funder.nil? ? [] : _by_funder(funder: funder, client:, logger:)
|
41
|
+
pks = [owner_pks, org_pks, funder_pks].reject(&:empty?)
|
31
42
|
return [] if owner_pks.empty? && org_pks.empty? && funder_pks.empty?
|
32
43
|
|
33
44
|
# Only use the DMPs that fit all of the filter criteria
|
34
|
-
dmps =
|
45
|
+
dmps = pks.reduce(:&).flatten.uniq
|
35
46
|
return [] if dmps.nil? || dmps.empty?
|
36
47
|
|
37
|
-
# Perfom search operations
|
38
48
|
|
39
|
-
#
|
40
|
-
|
41
|
-
# Handle pagination
|
42
|
-
|
43
|
-
# Fetch full DMP records
|
49
|
+
# Fetch full DMP records for the results
|
44
50
|
client = Uc3DmpDynamo::Client.new(table: ENV['DYNAMO_TABLE'])
|
45
51
|
_fetch_dmps(client:, pks: dmps.map { |dmp| dmp['pk'] }, logger:)
|
46
52
|
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.62
|
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-07-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|