dina 2.3.0.0 → 3.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dina/models/agent/identifier.rb +1 -1
- data/lib/dina/models/agent/organization.rb +6 -6
- data/lib/dina/models/attachment.rb +4 -4
- data/lib/dina/models/base_model.rb +7 -1
- data/lib/dina/models/material_sample/collecting_event.rb +2 -2
- data/lib/dina/models/material_sample/collection.rb +2 -2
- data/lib/dina/models/material_sample/collection_method.rb +0 -2
- data/lib/dina/models/material_sample/material_sample.rb +8 -7
- data/lib/dina/models/object_store/derivative.rb +2 -2
- data/lib/dina/models/object_store/file.rb +3 -3
- data/lib/dina/models/object_store/file_connection.rb +3 -2
- data/lib/dina/models/object_store/object_store.rb +2 -2
- data/lib/dina/models/sequence/pcr_primer.rb +1 -1
- data/lib/dina/models/storage/storage_unit.rb +2 -1
- data/lib/dina/models/storage/storage_unit_usage.rb +27 -0
- data/lib/dina/search/search.rb +0 -1
- data/lib/dina/search/search_autocomplete.rb +0 -1
- data/lib/dina/search/search_connection.rb +2 -2
- data/lib/dina/search/search_count.rb +0 -1
- data/lib/dina/search/search_mapping.rb +0 -1
- data/lib/dina/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5df9be26541369dc33ef722b3e1c3683bc1fc981585f15a5915dfe65d7621b
|
4
|
+
data.tar.gz: 292638ee427d55bfecd10af5a67f60cbba64ebabc3594438b803a54ab295261d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b3dcde98ba46f4abd3ffb66750c9c7d90856da5b5f81d4d766bcac4e8028aa6287d4599ae0e3df9d3d7fa4c8edf647748cde129294476de46b96bb84f91c0fb
|
7
|
+
data.tar.gz: cd6f4bd3867f55ca17c7b8eed0d9024896d26ce3656e5c7b3a2d16f60fa635455469b1a7346756603bd524e7695230f3dc66a28755edfd03322f3dfb3eb3ab54
|
@@ -8,7 +8,7 @@ module Dina
|
|
8
8
|
property :createdBy, type: :string
|
9
9
|
property :createdOn, type: :time
|
10
10
|
|
11
|
-
belongs_to :person,
|
11
|
+
belongs_to :person, class_name: "Person", shallow_path: true
|
12
12
|
|
13
13
|
validates_presence_of :namespace, message: "namespace is required"
|
14
14
|
validates_presence_of :value, message: "value is required"
|
@@ -8,8 +8,8 @@ module Dina
|
|
8
8
|
property :createdBy, type: :string
|
9
9
|
property :createdOn, type: :time
|
10
10
|
|
11
|
-
validates :
|
12
|
-
validates :
|
11
|
+
validates :englishName, presence: true, on: :create
|
12
|
+
validates :frenchName, presence: true, on: :create
|
13
13
|
|
14
14
|
def self.endpoint_path
|
15
15
|
"agent-api/"
|
@@ -19,21 +19,21 @@ module Dina
|
|
19
19
|
"organization"
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def englishName=(name)
|
23
23
|
names.delete_if{|o| o[:languageCode] == "EN"}
|
24
24
|
names << { languageCode: "EN", name: name }
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def englishName
|
28
28
|
names.select{|o| o[:languageCode] == "EN"}.first[:name]
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def frenchName=(name)
|
32
32
|
names.delete_if{|o| o[:languageCode] == "FR"}
|
33
33
|
names << { languageCode: "FR", name: name }
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def frenchName
|
37
37
|
names.select{|o| o[:languageCode] == "FR"}.first[:name]
|
38
38
|
end
|
39
39
|
|
@@ -4,10 +4,10 @@ module Dina
|
|
4
4
|
class Attachment < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid_v7
|
6
6
|
|
7
|
-
belongs_to :
|
8
|
-
belongs_to :
|
9
|
-
belongs_to :project,
|
10
|
-
belongs_to :transaction,
|
7
|
+
belongs_to :materialSample, class_name: "MaterialSample", shallow_path: true
|
8
|
+
belongs_to :collectingEvent, class_name: "CollectingEvent", shallow_path: true
|
9
|
+
belongs_to :project, class_name: "Project", shallow_path: true
|
10
|
+
belongs_to :transaction, class_name: "Transaction", shallow_path: true
|
11
11
|
|
12
12
|
def self.endpoint_path
|
13
13
|
"collection-api/"
|
@@ -4,9 +4,15 @@ module Dina
|
|
4
4
|
|
5
5
|
self.raise_on_blank_find_param = true
|
6
6
|
self.add_defaults_to_changes = true
|
7
|
-
self.json_key_format = :camelized_key
|
8
7
|
self.paginator = JsonApiClient::Paginating::NestedParamPaginator
|
9
8
|
|
9
|
+
resolve_custom_type "collection-method", "Dina::CollectionMethod"
|
10
|
+
resolve_custom_type "collecting-event", "Dina::CollectingEvent"
|
11
|
+
resolve_custom_type "preparation-type", "Dina::PreparationType"
|
12
|
+
resolve_custom_type "preparation-method", "Dina::PreparationMethod"
|
13
|
+
resolve_custom_type "material-sample", "Dina::MaterialSample"
|
14
|
+
resolve_custom_type "storage-unit", "Dina::StorageUnit"
|
15
|
+
|
10
16
|
before_create :on_before_create
|
11
17
|
before_save :on_before_save
|
12
18
|
|
@@ -43,11 +43,11 @@ module Dina
|
|
43
43
|
property :createdBy, type: :string
|
44
44
|
property :createdOn, type: :time
|
45
45
|
|
46
|
+
has_one :protocol, class_name: "Protocol"
|
47
|
+
has_one :collectionMethod, class_name: "CollectionMethod"
|
46
48
|
has_many :collectors, class_name: "Person"
|
47
49
|
has_many :attachment, class_name: "Attachment"
|
48
50
|
|
49
|
-
has_one :collection_method, class_name: "CollectionMethod"
|
50
|
-
|
51
51
|
validates_presence_of :group, message: "group is required"
|
52
52
|
|
53
53
|
before_save :on_before_save
|
@@ -15,8 +15,8 @@ module Dina
|
|
15
15
|
property :createdBy, type: :string
|
16
16
|
property :createdOn, type: :time
|
17
17
|
|
18
|
-
belongs_to :institution,
|
19
|
-
has_one :
|
18
|
+
belongs_to :institution, class_name: "Institution", shallow_path: true
|
19
|
+
has_one :parentCollection, class_name: "Collection"
|
20
20
|
|
21
21
|
validates_presence_of :group, message: "group is required"
|
22
22
|
|
@@ -25,6 +25,7 @@ module Dina
|
|
25
25
|
property :stateChangedOn, type: :date
|
26
26
|
property :stateChangeRemarks, type: :string
|
27
27
|
property :materialSampleRemarks, type: :string
|
28
|
+
property :sourceSet, type: :string
|
28
29
|
property :extensionValues, type: :hash
|
29
30
|
property :restrictionFieldsExtension, type: :hash
|
30
31
|
property :restrictionRemarks, type: :string
|
@@ -40,14 +41,14 @@ module Dina
|
|
40
41
|
property :targetOrganismPrimaryScientificName, type: :string
|
41
42
|
property :allowDuplicateName, type: :boolean
|
42
43
|
|
44
|
+
has_one :collectingEvent, class_name: "CollectingEvent"
|
43
45
|
has_one :collection, class_name: "Collection"
|
44
|
-
has_one :
|
45
|
-
has_one :
|
46
|
-
has_one :
|
47
|
-
has_one :
|
48
|
-
has_one :
|
49
|
-
|
50
|
-
has_many :prepared_by, class_name: "Person"
|
46
|
+
has_one :preparationType, class_name: "PreparationType"
|
47
|
+
has_one :preparationMethod, class_name: "PreparationMethod"
|
48
|
+
has_one :parentMaterialSample, class_name: "MaterialSample"
|
49
|
+
has_one :preparationProtocol, class_name: "Protocol"
|
50
|
+
has_one :storageUnitUsage, class_name: "StorageUnitUsage"
|
51
|
+
has_many :preparedBy, class_name: "Person"
|
51
52
|
has_many :attachment, class_name: "Attachment"
|
52
53
|
has_many :projects, class_name: "Project"
|
53
54
|
has_many :assemblages, class_name: "Assemblage"
|
@@ -13,7 +13,7 @@ module Dina
|
|
13
13
|
property :derivativeType, type: :string
|
14
14
|
property :publiclyReleasable, type: :boolean, default: true
|
15
15
|
|
16
|
-
has_one :
|
16
|
+
has_one :acDerivedFrom, class_name: "ObjectStore"
|
17
17
|
|
18
18
|
validates_presence_of :bucket, message: "bucket is required"
|
19
19
|
validates_presence_of :dcFormat, message: "dcFormat is required"
|
@@ -33,7 +33,7 @@ module Dina
|
|
33
33
|
|
34
34
|
def on_before_save
|
35
35
|
if self.as_json_api["relationships"].nil? || !self.as_json_api["relationships"].has_key?("acDerivedFrom")
|
36
|
-
raise ObjectInvalid, "#{self.class} is invalid.
|
36
|
+
raise ObjectInvalid, "#{self.class} is invalid. acDerivedFrom relationship is required"
|
37
37
|
end
|
38
38
|
super
|
39
39
|
end
|
@@ -4,14 +4,14 @@ require_rel 'file_connection'
|
|
4
4
|
module Dina
|
5
5
|
|
6
6
|
class File < BaseModel
|
7
|
+
self.connection_class = FileConnection
|
8
|
+
|
7
9
|
property :id, type: :string, default: SecureRandom.uuid_v7
|
8
10
|
property :group, type: :string
|
9
11
|
property :filePath, type: :string
|
10
12
|
property :fileName, type: :string
|
11
13
|
property :dcFormat, type: :string
|
12
|
-
property :
|
13
|
-
|
14
|
-
self.connection_class = FileConnection
|
14
|
+
property :isDerivative, type: :boolean
|
15
15
|
|
16
16
|
validates_presence_of :group, message: "group is required"
|
17
17
|
validates_presence_of :filePath, message: "filePath is required"
|
@@ -10,6 +10,7 @@ module Dina
|
|
10
10
|
|
11
11
|
@faraday = Faraday.new(site, connection_options) do |builder|
|
12
12
|
builder.request :multipart
|
13
|
+
builder.response :json
|
13
14
|
builder.adapter(*adapter_options)
|
14
15
|
end
|
15
16
|
yield(self) if block_given?
|
@@ -17,7 +18,7 @@ module Dina
|
|
17
18
|
|
18
19
|
def run(request_method, path, params: nil, headers: {}, body: nil)
|
19
20
|
path = path + "/#{body[:data]["attributes"]["group"].downcase}"
|
20
|
-
if body[:data]["attributes"].key?("
|
21
|
+
if body[:data]["attributes"].key?("isDerivative")
|
21
22
|
path = path + "/derivative"
|
22
23
|
end
|
23
24
|
file_path = body[:data]["attributes"]["filePath"]
|
@@ -33,7 +34,7 @@ module Dina
|
|
33
34
|
response = @faraday.run_request(request_method, path, body, headers) do |request|
|
34
35
|
request.params.update(params) if params
|
35
36
|
end
|
36
|
-
attributes =
|
37
|
+
attributes = response.body.dup
|
37
38
|
response.body["meta"] = {}
|
38
39
|
response.body["errors"] = []
|
39
40
|
response.body["data"] = {
|
@@ -29,8 +29,8 @@ module Dina
|
|
29
29
|
property :orientation, type: :integer
|
30
30
|
property :resourceExternalURL, type: :string
|
31
31
|
|
32
|
-
has_one :
|
33
|
-
has_one :
|
32
|
+
has_one :acMetadataCreator, class_name: "Person"
|
33
|
+
has_one :dcCreator, class_name: "Person"
|
34
34
|
has_many :derivatives, class_name: "Derivative"
|
35
35
|
|
36
36
|
validates_presence_of :group, message: "group is required"
|
@@ -30,7 +30,7 @@ module Dina
|
|
30
30
|
property :createdBy, type: :string
|
31
31
|
property :createdOn, type: :time
|
32
32
|
|
33
|
-
has_one :region
|
33
|
+
has_one :region, class_name: "Region"
|
34
34
|
|
35
35
|
validates_presence_of :group, message: "group is required"
|
36
36
|
validates_presence_of :name, message: "name is required"
|
@@ -5,13 +5,14 @@ module Dina
|
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid_v7
|
6
6
|
property :group, type: :string
|
7
7
|
property :name, type: :string
|
8
|
+
property :isGeneric, type: :boolean
|
8
9
|
property :barcode, type: :string
|
9
10
|
property :storageUnitChildren, type: :array
|
10
11
|
property :hierarchy, type: :string
|
11
12
|
property :createdBy, type: :string
|
12
13
|
property :createdOn, type: :time
|
13
14
|
|
14
|
-
has_one :storage_unit_type
|
15
|
+
has_one :storage_unit_type, class_name: "StorageUnitType"
|
15
16
|
has_one :parent_storage_unit, class_name: "StorageUnit"
|
16
17
|
|
17
18
|
validates_presence_of :group, message: "group is required"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_rel '../base_model'
|
2
|
+
|
3
|
+
module Dina
|
4
|
+
class StorageUnitUsage < BaseModel
|
5
|
+
property :id, type: :string, default: SecureRandom.uuid_v7
|
6
|
+
property :usageType, type: :string
|
7
|
+
property :wellRow, type: :string
|
8
|
+
property :wellColumn, type: :string
|
9
|
+
property :cellNumber, type: :string
|
10
|
+
property :storageUnitName, type: :string
|
11
|
+
property :createdBy, type: :string
|
12
|
+
property :createdOn, type: :time
|
13
|
+
|
14
|
+
has_one :storage_unit, class_name: "StorageUnit"
|
15
|
+
has_one :storage_unit_type, class_name: "StorageUnitType"
|
16
|
+
|
17
|
+
validates_presence_of :usageType, message: "usageType is required"
|
18
|
+
|
19
|
+
def self.endpoint_path
|
20
|
+
"collection-api/"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.table_name
|
24
|
+
"storage-unit-usage"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/dina/search/search.rb
CHANGED
@@ -13,6 +13,7 @@ module Dina
|
|
13
13
|
|
14
14
|
@faraday = Faraday.new(site, connection_options) do |builder|
|
15
15
|
builder.request :json
|
16
|
+
builder.response :json
|
16
17
|
builder.adapter(*adapter_options)
|
17
18
|
end
|
18
19
|
yield(self) if block_given?
|
@@ -47,7 +48,7 @@ module Dina
|
|
47
48
|
request.body = payload
|
48
49
|
end
|
49
50
|
|
50
|
-
attributes =
|
51
|
+
attributes = response.body.dup
|
51
52
|
meta = {}
|
52
53
|
if attributes.has_key?("hits")
|
53
54
|
#TODO: does not work with SearchAutoComplete because response is different from Search
|
@@ -65,7 +66,6 @@ module Dina
|
|
65
66
|
|
66
67
|
def use(middleware, *args, &block)
|
67
68
|
return if faraday.builder.locked?
|
68
|
-
faraday.builder.insert_before(Middleware::ParseJson, middleware, *args, &block)
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
data/lib/dina/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_api_client
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- lib/dina/models/sequence/thermocycler_profile.rb
|
199
199
|
- lib/dina/models/storage/storage_unit.rb
|
200
200
|
- lib/dina/models/storage/storage_unit_type.rb
|
201
|
+
- lib/dina/models/storage/storage_unit_usage.rb
|
201
202
|
- lib/dina/models/transaction/transaction.rb
|
202
203
|
- lib/dina/models/user.rb
|
203
204
|
- lib/dina/rest_client_request_patch.rb
|