dina 0.7.4.0 → 0.8.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/components/address.rb +22 -0
- data/lib/dina/models/agent/person.rb +5 -1
- data/lib/dina/models/base_model.rb +7 -30
- data/lib/dina/models/managed_attribute.rb +4 -4
- data/lib/dina/models/object_store/object_store_managed_attribute.rb +3 -3
- data/lib/dina/models/sequence/index_set.rb +6 -0
- data/lib/dina/models/sequence/molecular_sample.rb +22 -0
- data/lib/dina/models/sequence/pcr_batch.rb +2 -0
- data/lib/dina/models/sequence/pcr_primer.rb +47 -0
- data/lib/dina/models/sequence/product.rb +7 -0
- data/lib/dina/models/sequence/region.rb +8 -0
- data/lib/dina/models/sequence/thermocycler_profile.rb +9 -0
- data/lib/dina/utils/multi_lingual_description.rb +18 -0
- data/lib/dina/utils/multi_lingual_title.rb +18 -0
- data/lib/dina/version.rb +2 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a15f64f21867881cc89efca164d7753aff7916b1399bc3525f5375bb13c38f
|
4
|
+
data.tar.gz: 27e916b183b9413093544901367e3103553f9a91b4c9c5de476fe15d0bfc12e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e8b0c69ea6169539823a31d3ea10dab1b4a3f62f5358eaf2bf10d484472356610c317c1dbfb0a187957aca071daf68a142d207872fdaca71d8655fab8ed639
|
7
|
+
data.tar.gz: 15894af41ce11caa23c126e86fc31be365bae97cee056b8c7f90dee4585fde800ab05537c87a8749c2ffdd3625a693eb6533a4af4fd1c4c8371d9494693bc73c
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Dina
|
2
|
+
class Address
|
3
|
+
attr_accessor :receiverName
|
4
|
+
attr_accessor :companyName
|
5
|
+
attr_accessor :addressLine1
|
6
|
+
attr_accessor :addressLine2
|
7
|
+
attr_accessor :city
|
8
|
+
attr_accessor :provinceState
|
9
|
+
attr_accessor :zipCode
|
10
|
+
attr_accessor :country
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_hash
|
16
|
+
hash = {}
|
17
|
+
instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
|
18
|
+
hash.deep_symbolize_keys
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -35,6 +35,10 @@ module Dina
|
|
35
35
|
where("email": email).all
|
36
36
|
end
|
37
37
|
|
38
|
+
# Searches for a Person by name using the search module
|
39
|
+
#
|
40
|
+
# @param name [String] any portion of a person's name
|
41
|
+
# @return array [Array] an array of Person objects, ordered by relevance
|
38
42
|
def self.search_by_name(name)
|
39
43
|
payload = {
|
40
44
|
query: {
|
@@ -51,7 +55,7 @@ module Dina
|
|
51
55
|
}
|
52
56
|
}
|
53
57
|
}
|
54
|
-
hits =
|
58
|
+
hits = Search.execute(index: "agent", payload: payload)[:hits]
|
55
59
|
hits.map{|a| self.find(a[:_source][:data][:id]).first }
|
56
60
|
end
|
57
61
|
|
@@ -2,6 +2,7 @@ module Dina
|
|
2
2
|
class BaseModel < JsonApiClient::Resource
|
3
3
|
include JsonApiClient::Helpers::Callbacks
|
4
4
|
|
5
|
+
self.raise_on_blank_find_param = true
|
5
6
|
self.json_key_format = :camelized_key
|
6
7
|
self.paginator = JsonApiClient::Paginating::NestedParamPaginator
|
7
8
|
|
@@ -38,44 +39,20 @@ module Dina
|
|
38
39
|
symbolized_params = params.transform_keys(&:to_sym)
|
39
40
|
params["id"] = SecureRandom.uuid if !symbolized_params[:id]
|
40
41
|
super
|
42
|
+
extend_model_methods
|
41
43
|
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
def set_multilingualDescription(opts = {})
|
45
|
+
private
|
46
|
+
|
47
|
+
def extend_model_methods
|
47
48
|
if self.respond_to?(:multilingualDescription)
|
48
|
-
|
49
|
-
self.multilingualDescription = opts
|
50
|
-
else
|
51
|
-
descriptions = multilingualDescription["descriptions"]
|
52
|
-
descriptions.delete_if{|o| o["lang"] == opts.keys[0].to_s}
|
53
|
-
descriptions << { "lang" => opts.keys[0].to_s, "desc" => opts[opts.keys[0]] }
|
54
|
-
end
|
55
|
-
else
|
56
|
-
raise PropertyInvalid, "#{self.class} does not have the property multilingualDescription"
|
49
|
+
extend MultiLingualDescription
|
57
50
|
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Adds or updates a multilingualTitle with a language key
|
61
|
-
#
|
62
|
-
# @param opts [Hash] the title expessed as { en: "My title" }
|
63
|
-
def set_multilingualTitle(opts = {})
|
64
51
|
if self.respond_to?(:multilingualTitle)
|
65
|
-
|
66
|
-
self.multilingualTitle = opts
|
67
|
-
else
|
68
|
-
titles = multilingualTitle["titles"]
|
69
|
-
titles.delete_if{|o| o["lang"] == opts.keys[0].to_s}
|
70
|
-
titles << { "lang" => opts.keys[0].to_s, "title" => opts[opts.keys[0]] }
|
71
|
-
end
|
72
|
-
else
|
73
|
-
raise PropertyInvalid, "#{self.class} does not have the property multilingualTitle"
|
52
|
+
extend MultiLingualTitle
|
74
53
|
end
|
75
54
|
end
|
76
55
|
|
77
|
-
private
|
78
|
-
|
79
56
|
def on_before_create
|
80
57
|
self.attributes.delete_if { |k, v| v.nil? || v == "" }
|
81
58
|
self.attributes = self.attributes.deep_symbolize_keys
|
@@ -6,7 +6,7 @@ module Dina
|
|
6
6
|
property :group, type: :string
|
7
7
|
property :name, type: :string
|
8
8
|
property :key, type: :string
|
9
|
-
property :
|
9
|
+
property :vocabularyElementType, type: :string
|
10
10
|
property :managedAttributeComponent, type: :string
|
11
11
|
property :acceptedValues, type: :array
|
12
12
|
property :multilingualDescription, type: :multilingual_description
|
@@ -15,7 +15,7 @@ module Dina
|
|
15
15
|
|
16
16
|
validates_presence_of :group, message: "group is required"
|
17
17
|
validates_presence_of :name, message: "name is required"
|
18
|
-
validates_presence_of :
|
18
|
+
validates_presence_of :vocabularyElementType, message: "vocabularyElementType is required"
|
19
19
|
|
20
20
|
attr_accessor :accepted_components, :accepted_types
|
21
21
|
|
@@ -52,8 +52,8 @@ module Dina
|
|
52
52
|
if !self.managedAttributeComponent.nil? && !self.class.accepted_components.include?(self.managedAttributeComponent)
|
53
53
|
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for managedAttributeComponent is one of #{self.class.accepted_components.join(", ")}"
|
54
54
|
end
|
55
|
-
if !self.
|
56
|
-
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for
|
55
|
+
if !self.vocabularyElementType.nil? && !self.class.accepted_types.include?(self.vocabularyElementType)
|
56
|
+
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for vocabularyElementType is one of #{self.class.accepted_types.join(", ")}"
|
57
57
|
end
|
58
58
|
super
|
59
59
|
end
|
@@ -5,7 +5,7 @@ module Dina
|
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :name, type: :string
|
7
7
|
property :key, type: :string
|
8
|
-
property :
|
8
|
+
property :vocabularyElementType, type: :string
|
9
9
|
property :acceptedValues, type: :array
|
10
10
|
property :multilingualDescription, type: :multilingual_description
|
11
11
|
property :createdBy, type: :string
|
@@ -22,8 +22,8 @@ module Dina
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def on_before_save
|
25
|
-
if !self.
|
26
|
-
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for
|
25
|
+
if !self.vocabularyElementType.nil? && !ManagedAttribute.accepted_types.include?(self.vocabularyElementType)
|
26
|
+
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for vocabularyElementType is one of #{ManagedAttribute.accepted_types.join(", ")}"
|
27
27
|
end
|
28
28
|
super
|
29
29
|
end
|
@@ -4,8 +4,14 @@ module Dina
|
|
4
4
|
class IndexSet < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
8
|
+
property :forwardAdapter, type: :string
|
9
|
+
property :reverseAdapter, type: :string
|
10
|
+
property :createdBy, type: :string
|
11
|
+
property :createdOn, type: :time
|
7
12
|
|
8
13
|
validates_presence_of :group, message: "group is required"
|
14
|
+
validates_presence_of :name, message: "name is required"
|
9
15
|
|
10
16
|
def self.endpoint_path
|
11
17
|
"seqdb-api/"
|
@@ -4,8 +4,15 @@ module Dina
|
|
4
4
|
class MolecularSample < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
8
|
+
property :createdBy, type: :string
|
9
|
+
property :createdOn, type: :time
|
10
|
+
|
11
|
+
has_one :kit, class_name: "Product"
|
12
|
+
has_one :materialSample, class_name: "MaterialSample"
|
7
13
|
|
8
14
|
validates_presence_of :group, message: "group is required"
|
15
|
+
validates_presence_of :name, message: "name is required"
|
9
16
|
|
10
17
|
def self.endpoint_path
|
11
18
|
"seqdb-api/"
|
@@ -15,5 +22,20 @@ module Dina
|
|
15
22
|
"molecular-sample"
|
16
23
|
end
|
17
24
|
|
25
|
+
def self.sample_type
|
26
|
+
[
|
27
|
+
"DNA"
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def on_before_save
|
34
|
+
if !self.sampleType.nil? && !self.class.sample_type.include?(self.type)
|
35
|
+
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for sampleType is one of #{self.class.sample_type.join(", ")}"
|
36
|
+
end
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
18
40
|
end
|
19
41
|
end
|
@@ -4,8 +4,10 @@ module Dina
|
|
4
4
|
class PcrBatch < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
7
8
|
|
8
9
|
validates_presence_of :group, message: "group is required"
|
10
|
+
validates_presence_of :name, message: "name is required"
|
9
11
|
|
10
12
|
def self.endpoint_path
|
11
13
|
"seqdb-api/"
|
@@ -4,8 +4,36 @@ module Dina
|
|
4
4
|
class PcrPrimer < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :type, type: :string
|
8
|
+
property :name, type: :string
|
9
|
+
property :version, type: :integer
|
10
|
+
property :seq, type: :string
|
11
|
+
property :position, type: :string
|
12
|
+
property :tmCalculated, type: :string
|
13
|
+
property :tmPe, type: :integer
|
14
|
+
property :application, type: :string
|
15
|
+
property :direction, type: :string
|
16
|
+
property :reference, type: :string
|
17
|
+
property :pooledPrimer, type: :string
|
18
|
+
property :lotNumber, type: :string
|
19
|
+
property :sequenceLength, type: :integer
|
20
|
+
property :targetSpecies, type: :string
|
21
|
+
property :supplier, type: :string
|
22
|
+
property :dateOrdered, type: :time
|
23
|
+
property :dateDestroyed, type: :time
|
24
|
+
property :purification, type: :string
|
25
|
+
property :designedBy, type: :string
|
26
|
+
property :stockConcentration, type: :string
|
27
|
+
property :lotNumber, type: :integer
|
28
|
+
property :region, type: :string
|
29
|
+
property :note, type: :string
|
30
|
+
property :createdBy, type: :string
|
31
|
+
property :createdOn, type: :time
|
7
32
|
|
8
33
|
validates_presence_of :group, message: "group is required"
|
34
|
+
validates_presence_of :name, message: "name is required"
|
35
|
+
validates_presence_of :type, message: "type is required"
|
36
|
+
validates_presence_of :lotNumber, message: "lotNumber is required"
|
9
37
|
|
10
38
|
def self.endpoint_path
|
11
39
|
"seqdb-api/"
|
@@ -15,5 +43,24 @@ module Dina
|
|
15
43
|
"pcr-primer"
|
16
44
|
end
|
17
45
|
|
46
|
+
def self.accepted_types
|
47
|
+
[
|
48
|
+
"PRIMER",
|
49
|
+
"MID",
|
50
|
+
"FUSION_PRIMER",
|
51
|
+
"ILLUMINA_INDEX",
|
52
|
+
"ITRU_PRIMER"
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def on_before_save
|
59
|
+
if !self.type.nil? && !self.class.accepted_types.include?(self.type)
|
60
|
+
raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for type is one of #{self.class.accepted_types.join(", ")}"
|
61
|
+
end
|
62
|
+
super
|
63
|
+
end
|
64
|
+
|
18
65
|
end
|
19
66
|
end
|
@@ -4,8 +4,15 @@ module Dina
|
|
4
4
|
class Product < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
8
|
+
property :upc, type: :string
|
9
|
+
property :type, type: :string
|
10
|
+
property :description, type: :string
|
11
|
+
property :createdBy, type: :string
|
12
|
+
property :createdOn, type: :time
|
7
13
|
|
8
14
|
validates_presence_of :group, message: "group is required"
|
15
|
+
validates_presence_of :name, message: "name is required"
|
9
16
|
|
10
17
|
def self.endpoint_path
|
11
18
|
"seqdb-api/"
|
@@ -4,8 +4,16 @@ module Dina
|
|
4
4
|
class Region < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
8
|
+
property :symbol, type: :string
|
9
|
+
property :description, type: :string
|
10
|
+
property :aliases, type: :string
|
11
|
+
property :applicableOrganisms, type: :string
|
12
|
+
property :createdBy, type: :string
|
13
|
+
property :createdOn, type: :time
|
7
14
|
|
8
15
|
validates_presence_of :group, message: "group is required"
|
16
|
+
validates_presence_of :symbol, message: "symbol is required"
|
9
17
|
|
10
18
|
def self.endpoint_path
|
11
19
|
"seqdb-api/"
|
@@ -4,8 +4,17 @@ module Dina
|
|
4
4
|
class ThermocyclerProfile < BaseModel
|
5
5
|
property :id, type: :string, default: SecureRandom.uuid
|
6
6
|
property :group, type: :string
|
7
|
+
property :name, type: :string
|
8
|
+
property :application, type: :string
|
9
|
+
property :cycles, type: :string
|
10
|
+
property :steps, type: :array
|
11
|
+
property :createdBy, type: :string
|
12
|
+
property :createdOn, type: :time
|
13
|
+
|
14
|
+
has_one :region, class_name: "Region"
|
7
15
|
|
8
16
|
validates_presence_of :group, message: "group is required"
|
17
|
+
validates_presence_of :name, message: "name is required"
|
9
18
|
|
10
19
|
def self.endpoint_path
|
11
20
|
"seqdb-api/"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dina
|
2
|
+
module MultiLingualDescription
|
3
|
+
|
4
|
+
# Adds or updates a multilingualDescription with a language key
|
5
|
+
#
|
6
|
+
# @param opts [Hash] the description expessed as { en: "My description" }
|
7
|
+
def set_multilingualDescription(opts = {})
|
8
|
+
if self.multilingualDescription.nil?
|
9
|
+
self.multilingualDescription = opts
|
10
|
+
else
|
11
|
+
descriptions = multilingualDescription["descriptions"]
|
12
|
+
descriptions.delete_if{|o| o["lang"] == opts.keys[0].to_s}
|
13
|
+
descriptions << { "lang" => opts.keys[0].to_s, "desc" => opts[opts.keys[0]] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dina
|
2
|
+
module MultiLingualTitle
|
3
|
+
|
4
|
+
# Adds or updates a multilingualTitle with a language key
|
5
|
+
#
|
6
|
+
# @param opts [Hash] the title expessed as { en: "My title" }
|
7
|
+
def set_multilingualTitle(opts = {})
|
8
|
+
if self.multilingualTitle.nil?
|
9
|
+
self.multilingualTitle = opts
|
10
|
+
else
|
11
|
+
titles = multilingualTitle["titles"]
|
12
|
+
titles.delete_if{|o| o["lang"] == opts.keys[0].to_s}
|
13
|
+
titles << { "lang" => opts.keys[0].to_s, "title" => opts[opts.keys[0]] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/dina/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/dina/casters/multilingual_title.rb
|
151
151
|
- lib/dina/casters/multilingual_title_caster.rb
|
152
152
|
- lib/dina/casters/object_caster.rb
|
153
|
+
- lib/dina/components/address.rb
|
153
154
|
- lib/dina/components/agent_role.rb
|
154
155
|
- lib/dina/components/determination.rb
|
155
156
|
- lib/dina/components/georeference_assertion.rb
|
@@ -199,6 +200,8 @@ files:
|
|
199
200
|
- lib/dina/search/search_mapping.rb
|
200
201
|
- lib/dina/utils/identifier.rb
|
201
202
|
- lib/dina/utils/identifier_type.rb
|
203
|
+
- lib/dina/utils/multi_lingual_description.rb
|
204
|
+
- lib/dina/utils/multi_lingual_title.rb
|
202
205
|
- lib/dina/version.rb
|
203
206
|
homepage: https://github.com/dshorthouse/dina
|
204
207
|
licenses:
|