labimotion 1.4.1 → 2.0.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/labimotion/apis/generic_element_api.rb +1 -0
  3. data/lib/labimotion/apis/generic_klass_api.rb +3 -2
  4. data/lib/labimotion/apis/labimotion_api.rb +13 -0
  5. data/lib/labimotion/apis/standard_api.rb +26 -0
  6. data/lib/labimotion/apis/standard_layer_api.rb +100 -0
  7. data/lib/labimotion/apis/vocabulary_api.rb +107 -0
  8. data/lib/labimotion/entities/dataset_entity.rb +2 -1
  9. data/lib/labimotion/entities/properties_entity.rb +167 -55
  10. data/lib/labimotion/entities/segment_entity.rb +1 -0
  11. data/lib/labimotion/entities/vocabulary_entity.rb +39 -0
  12. data/lib/labimotion/helpers/element_helpers.rb +8 -6
  13. data/lib/labimotion/helpers/param_helpers.rb +137 -82
  14. data/lib/labimotion/helpers/segment_helpers.rb +1 -1
  15. data/lib/labimotion/helpers/vocabulary_helpers.rb +16 -0
  16. data/lib/labimotion/libs/converter.rb +13 -33
  17. data/lib/labimotion/libs/data/vocab/Standard.json +385 -0
  18. data/lib/labimotion/libs/data/vocab/System.json +131 -0
  19. data/lib/labimotion/libs/nmr_mapper.rb +2 -1
  20. data/lib/labimotion/libs/sample_association.rb +4 -0
  21. data/lib/labimotion/libs/vocabulary_handler.rb +118 -0
  22. data/lib/labimotion/models/concerns/attachment_converter.rb +5 -4
  23. data/lib/labimotion/models/concerns/datasetable.rb +1 -0
  24. data/lib/labimotion/models/concerns/segmentable.rb +2 -0
  25. data/lib/labimotion/models/std_layer.rb +9 -0
  26. data/lib/labimotion/models/std_layers_revision.rb +9 -0
  27. data/lib/labimotion/models/vocabulary.rb +12 -0
  28. data/lib/labimotion/version.rb +1 -1
  29. data/lib/labimotion.rb +10 -0
  30. metadata +20 -5
@@ -25,17 +25,18 @@ module Labimotion
25
25
  def exec_converter
26
26
  return if self.has_attribute?(:con_state) == false || self.con_state.nil? || self.con_state == Labimotion::ConState::NONE
27
27
 
28
- return if attachable_id.nil? && self.con_state != Labimotion::ConState::WAIT
28
+ return if attachable_id.nil? && con_state != Labimotion::ConState::WAIT
29
29
 
30
+ current_user = User.find_by(id: created_by)
30
31
  case con_state
31
32
  when Labimotion::ConState::NMR
32
- self.con_state = Labimotion::NmrMapper.process_ds(id)
33
+ self.con_state = Labimotion::NmrMapper.process_ds(id, current_user)
33
34
  update_column(:con_state, con_state)
34
35
  when Labimotion::ConState::WAIT
35
- self.con_state = Labimotion::Converter.jcamp_converter(id)
36
+ self.con_state = Labimotion::Converter.jcamp_converter(id, current_user)
36
37
  update_column(:con_state, con_state)
37
38
  when Labimotion::ConState::CONVERTED
38
- Labimotion::Converter.metadata(id)
39
+ Labimotion::Converter.metadata(id, current_user)
39
40
  end
40
41
  end
41
42
  end
@@ -42,6 +42,7 @@ module Labimotion
42
42
  props['identifier'] = klass.identifier if klass.identifier.present?
43
43
  props['uuid'] = uuid
44
44
  props['klass'] = 'Dataset'
45
+ props = Labimotion::VocabularyHandler.update_vocabularies(props, args[:current_user], args[:element])
45
46
 
46
47
  ds = Labimotion::Dataset.find_by(element_type: self.class.name, element_id: id)
47
48
  if ds.present? && (ds.klass_uuid != props['klass_uuid'] || ds.properties != props)
@@ -59,6 +59,8 @@ module Labimotion
59
59
  props['uuid'] = uuid
60
60
  props['klass'] = 'Segment'
61
61
  props = Labimotion::SampleAssociation.update_sample_association(props, args[:current_user_id])
62
+ current_user = User.find_by(id: args[:current_user_id])
63
+ props = Labimotion::VocabularyHandler.update_vocabularies(props, current_user, self)
62
64
  segment = Labimotion::Segment.where(element_type: self.class.name, element_id: self.id, segment_klass_id: seg['segment_klass_id']).order(id: :desc).first
63
65
  if segment.present? && (segment.klass_uuid != props['klass_uuid'] || segment.properties != props)
64
66
  segment.update!(properties_release: klass.properties_release, properties: props, uuid: uuid, klass_uuid: props['klass_uuid'])
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Labimotion
4
+ class StdLayer < ApplicationRecord
5
+ acts_as_paranoid
6
+ self.table_name = :layers
7
+ has_many :layer_tracks, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayersRevision'
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Labimotion
4
+ class StdLayersRevision < ApplicationRecord
5
+ acts_as_paranoid
6
+ self.table_name = :layer_tracks
7
+ belongs_to :layers, primary_key: 'identifier', foreign_key: 'identifier', class_name: 'Labimotion::StdLayer'
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ require 'labimotion/models/concerns/generic_klass_revisions'
3
+ require 'labimotion/models/concerns/workflow'
4
+
5
+ module Labimotion
6
+ class Vocabulary < ApplicationRecord
7
+ self.table_name = :vocabularies
8
+ acts_as_paranoid
9
+
10
+
11
+ end
12
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.1'
5
+ VERSION = '2.0.0.rc2'
6
6
  end
data/lib/labimotion.rb CHANGED
@@ -16,12 +16,15 @@ module Labimotion
16
16
  autoload :Utils, 'labimotion/utils/utils'
17
17
 
18
18
  ######## APIs
19
+ autoload :LabimotionAPI, 'labimotion/apis/labimotion_api'
19
20
  autoload :GenericKlassAPI, 'labimotion/apis/generic_klass_api'
20
21
  autoload :GenericElementAPI, 'labimotion/apis/generic_element_api'
21
22
  autoload :GenericDatasetAPI, 'labimotion/apis/generic_dataset_api'
22
23
  autoload :SegmentAPI, 'labimotion/apis/segment_api'
23
24
  autoload :LabimotionHubAPI, 'labimotion/apis/labimotion_hub_api'
24
25
  autoload :ConverterAPI, 'labimotion/apis/converter_api'
26
+ autoload :StandardLayerAPI, 'labimotion/apis/standard_layer_api'
27
+ autoload :VocabularyAPI, 'labimotion/apis/vocabulary_api'
25
28
 
26
29
  ######## Entities
27
30
  autoload :PropertiesEntity, 'labimotion/entities/properties_entity'
@@ -43,6 +46,7 @@ module Labimotion
43
46
  autoload :ElementRevisionEntity, 'labimotion/entities/element_revision_entity'
44
47
  autoload :SegmentRevisionEntity, 'labimotion/entities/segment_revision_entity'
45
48
  ## autoload :DatasetRevisionEntity, 'labimotion/entities/dataset_revision_entity'
49
+ autoload :VocabularyEntity, 'labimotion/entities/vocabulary_entity'
46
50
 
47
51
  ######## Helpers
48
52
  autoload :GenericHelpers, 'labimotion/helpers/generic_helpers'
@@ -54,6 +58,7 @@ module Labimotion
54
58
  autoload :ConverterHelpers, 'labimotion/helpers/converter_helpers'
55
59
  autoload :SampleAssociationHelpers, 'labimotion/helpers/sample_association_helpers'
56
60
  autoload :RepositoryHelpers, 'labimotion/helpers/repository_helpers'
61
+ autoload :VocabularyHelpers, 'labimotion/helpers/vocabulary_helpers'
57
62
 
58
63
  ######## Libs
59
64
  autoload :Converter, 'labimotion/libs/converter'
@@ -64,6 +69,7 @@ module Labimotion
64
69
  autoload :SampleAssociation, 'labimotion/libs/sample_association'
65
70
  autoload :PropertiesHandler, 'labimotion/libs/properties_handler'
66
71
  autoload :AttachmentHandler, 'labimotion/libs/attachment_handler'
72
+ autoload :VocabularyHandler, 'labimotion/libs/vocabulary_handler'
67
73
 
68
74
  ######## Utils
69
75
  autoload :Prop, 'labimotion/utils/prop'
@@ -84,6 +90,7 @@ module Labimotion
84
90
  autoload :ElementKlass, 'labimotion/models/element_klass'
85
91
  autoload :SegmentKlass, 'labimotion/models/segment_klass'
86
92
  autoload :DatasetKlass, 'labimotion/models/dataset_klass'
93
+ autoload :Vocabulary, 'labimotion/models/vocabulary'
87
94
 
88
95
  autoload :ElementsRevision, 'labimotion/models/elements_revision'
89
96
  autoload :SegmentsRevision, 'labimotion/models/segments_revision'
@@ -97,6 +104,9 @@ module Labimotion
97
104
  autoload :ElementsElement, 'labimotion/models/elements_element'
98
105
  autoload :CollectionsElement, 'labimotion/models/collections_element'
99
106
 
107
+ autoload :StdLayer, 'labimotion/models/std_layer'
108
+ autoload :StdLayersRevision, 'labimotion/models/std_layers_revision'
109
+
100
110
  ######## Models/Concerns
101
111
  autoload :GenericKlassRevisions, 'labimotion/models/concerns/generic_klass_revisions'
102
112
  autoload :GenericRevisions, 'labimotion/models/concerns/generic_revisions'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: labimotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 2.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chia-Lin Lin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-10-24 00:00:00.000000000 Z
12
+ date: 2024-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -38,8 +38,12 @@ files:
38
38
  - lib/labimotion/apis/generic_dataset_api.rb
39
39
  - lib/labimotion/apis/generic_element_api.rb
40
40
  - lib/labimotion/apis/generic_klass_api.rb
41
+ - lib/labimotion/apis/labimotion_api.rb
41
42
  - lib/labimotion/apis/labimotion_hub_api.rb
42
43
  - lib/labimotion/apis/segment_api.rb
44
+ - lib/labimotion/apis/standard_api.rb
45
+ - lib/labimotion/apis/standard_layer_api.rb
46
+ - lib/labimotion/apis/vocabulary_api.rb
43
47
  - lib/labimotion/collection/export.rb
44
48
  - lib/labimotion/collection/import.rb
45
49
  - lib/labimotion/conf.rb
@@ -58,6 +62,7 @@ files:
58
62
  - lib/labimotion/entities/segment_entity.rb
59
63
  - lib/labimotion/entities/segment_klass_entity.rb
60
64
  - lib/labimotion/entities/segment_revision_entity.rb
65
+ - lib/labimotion/entities/vocabulary_entity.rb
61
66
  - lib/labimotion/helpers/converter_helpers.rb
62
67
  - lib/labimotion/helpers/dataset_helpers.rb
63
68
  - lib/labimotion/helpers/element_helpers.rb
@@ -67,14 +72,18 @@ files:
67
72
  - lib/labimotion/helpers/sample_association_helpers.rb
68
73
  - lib/labimotion/helpers/search_helpers.rb
69
74
  - lib/labimotion/helpers/segment_helpers.rb
75
+ - lib/labimotion/helpers/vocabulary_helpers.rb
70
76
  - lib/labimotion/libs/attachment_handler.rb
71
77
  - lib/labimotion/libs/converter.rb
78
+ - lib/labimotion/libs/data/vocab/Standard.json
79
+ - lib/labimotion/libs/data/vocab/System.json
72
80
  - lib/labimotion/libs/export_dataset.rb
73
81
  - lib/labimotion/libs/export_element.rb
74
82
  - lib/labimotion/libs/nmr_mapper.rb
75
83
  - lib/labimotion/libs/properties_handler.rb
76
84
  - lib/labimotion/libs/sample_association.rb
77
85
  - lib/labimotion/libs/template_hub.rb
86
+ - lib/labimotion/libs/vocabulary_handler.rb
78
87
  - lib/labimotion/models/collections_element.rb
79
88
  - lib/labimotion/models/concerns/attachment_converter.rb
80
89
  - lib/labimotion/models/concerns/datasetable.rb
@@ -98,6 +107,9 @@ files:
98
107
  - lib/labimotion/models/segment_klass.rb
99
108
  - lib/labimotion/models/segment_klasses_revision.rb
100
109
  - lib/labimotion/models/segments_revision.rb
110
+ - lib/labimotion/models/std_layer.rb
111
+ - lib/labimotion/models/std_layers_revision.rb
112
+ - lib/labimotion/models/vocabulary.rb
101
113
  - lib/labimotion/utils/con_state.rb
102
114
  - lib/labimotion/utils/export_utils.rb
103
115
  - lib/labimotion/utils/field_type.rb
@@ -111,7 +123,10 @@ files:
111
123
  homepage: https://github.com/LabIMotion/labimotion
112
124
  licenses:
113
125
  - AGPL-3.0
114
- metadata: {}
126
+ metadata:
127
+ homepage_uri: https://github.com/LabIMotion/labimotion
128
+ source_code_uri: https://github.com/LabIMotion/labimotion
129
+ bug_tracker_uri: https://github.com/LabIMotion/labimotion/discussions
115
130
  post_install_message:
116
131
  rdoc_options: []
117
132
  require_paths:
@@ -123,9 +138,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
138
  version: '0'
124
139
  required_rubygems_version: !ruby/object:Gem::Requirement
125
140
  requirements:
126
- - - ">="
141
+ - - ">"
127
142
  - !ruby/object:Gem::Version
128
- version: '0'
143
+ version: 1.3.1
129
144
  requirements: []
130
145
  rubygems_version: 3.1.6
131
146
  signing_key: