dina 0.7.5.0 → 0.8.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ccd7e97e13338d74abe532c9682da8c190428a6a49e9f185ab8b8ced6ac31ac
4
- data.tar.gz: 65fbba40026990fd8cfaa90803e8c909dc3431eea4585800093d9c433801bb25
3
+ metadata.gz: 0c6ae5abbf48a7b17f398ef9b7847f4e2a971f1819669c0202147a085cd20268
4
+ data.tar.gz: e59a3c1ab3548dba76c6294dcc7536b9c8644be776123b367c1484b7a5981122
5
5
  SHA512:
6
- metadata.gz: 0a13c0b80dea86b275fa961cb0f6c17d7645c5a0ed99fc09b6dbbe087923aa6dc95dcc746bc3ebbdfe26f4200f7486fb94355295ea1ead24a632bcebebf5a233
7
- data.tar.gz: 1b4fc2d14a4766fbd598cec301c4e39c002e044e34c70b6a6c48fe4852539e00775def68611a1197807e932de23802a9a568abceb76a04f2907d7405dcf09d74
6
+ metadata.gz: c4693d5abe72117aa16129a3f436ea7548537371446e6bc2ed335ddf03f4e2890816ffcf7093c02a481ec436b50c1d13203a1794d7ea119d59014488b33871c2
7
+ data.tar.gz: bfea8c578a6afdf3f30ea7857f1ebaafff6168a0952a47c0d6a8ab8c4c316eb1e05ce821a1cc66d6728016e85c99811b91c420817a34ec43996e9214506ff290
@@ -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
@@ -0,0 +1,21 @@
1
+ module Dina
2
+ class GeographicSource
3
+ attr_accessor :sourceUrl
4
+ attr_accessor :customGeographicPlace
5
+ attr_accessor :selectedGeographicPlace
6
+ attr_accessor :higherGeographicPlaces
7
+ attr_accessor :stateProvince
8
+ attr_accessor :country
9
+ attr_accessor :recordedOn
10
+
11
+ def initialize
12
+ end
13
+
14
+ def to_hash
15
+ hash = {}
16
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
17
+ hash.deep_symbolize_keys
18
+ end
19
+
20
+ end
21
+ 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 = Dina::Search.execute(index: "agent", payload: payload)[: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
 
@@ -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 :managedAttributeType, type: :string
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 :managedAttributeType, message: "managedAttributeType is required"
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.managedAttributeType.nil? && !self.class.accepted_types.include?(self.managedAttributeType)
56
- raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for managedAttributeType is one of #{self.class.accepted_types.join(", ")}"
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
@@ -35,7 +35,7 @@ module Dina
35
35
  property :notPubliclyReleasableReason, type: :string, default: nil
36
36
  property :tags, type: :array, default: []
37
37
  property :geographicPlaceNameSource, type: :string
38
- property :geographicPlaceNameSourceDetail, type: :array, default: [{ sourceID: nil, sourceIdType: nil, sourceURL: nil }]
38
+ property :geographicPlaceNameSourceDetail, type: :object, default: {}
39
39
  property :managedAttributes, type: :array, default: []
40
40
  property :geoReferenceAssertions, type: :array, default: []
41
41
  property :eventGeom, type: :string
@@ -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 :managedAttributeType, type: :string
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.managedAttributeType.nil? && !ManagedAttribute.accepted_types.include?(self.managedAttributeType)
26
- raise PropertyValueInvalid, "#{self.class} is invalid. Accepted value for managedAttributeType is one of #{ManagedAttribute.accepted_types.join(", ")}"
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/"
data/lib/dina/version.rb CHANGED
@@ -2,8 +2,8 @@ module Dina
2
2
  class Version
3
3
 
4
4
  MAJOR = 0
5
- MINOR = 7
6
- PATCH = 5
5
+ MINOR = 8
6
+ PATCH = 1
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
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.7.5.0
4
+ version: 0.8.1.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-12 00:00:00.000000000 Z
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,8 +150,10 @@ 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
156
+ - lib/dina/components/geographic_source.rb
155
157
  - lib/dina/components/georeference_assertion.rb
156
158
  - lib/dina/components/shipment.rb
157
159
  - lib/dina/exceptions.rb