labimotion 2.0.0 → 2.1.0.rc11

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/labimotion/apis/exporter_api.rb +271 -0
  3. data/lib/labimotion/apis/generic_dataset_api.rb +37 -3
  4. data/lib/labimotion/apis/generic_element_api.rb +106 -4
  5. data/lib/labimotion/apis/generic_klass_api.rb +42 -2
  6. data/lib/labimotion/apis/labimotion_api.rb +1 -0
  7. data/lib/labimotion/apis/segment_api.rb +5 -3
  8. data/lib/labimotion/entities/application_entity.rb +7 -80
  9. data/lib/labimotion/entities/dataset_entity.rb +8 -3
  10. data/lib/labimotion/entities/dataset_klass_entity.rb +3 -2
  11. data/lib/labimotion/entities/element_entity.rb +1 -1
  12. data/lib/labimotion/entities/element_klass_entity.rb +2 -2
  13. data/lib/labimotion/entities/element_revision_entity.rb +3 -1
  14. data/lib/labimotion/entities/eln_element_entity.rb +4 -2
  15. data/lib/labimotion/entities/generic_klass_entity.rb +8 -9
  16. data/lib/labimotion/entities/generic_public_entity.rb +5 -3
  17. data/lib/labimotion/entities/klass_revision_entity.rb +2 -1
  18. data/lib/labimotion/entities/properties_entity.rb +5 -0
  19. data/lib/labimotion/entities/segment_entity.rb +5 -2
  20. data/lib/labimotion/entities/segment_revision_entity.rb +4 -2
  21. data/lib/labimotion/entities/vocabulary_entity.rb +2 -2
  22. data/lib/labimotion/helpers/converter_helpers.rb +16 -3
  23. data/lib/labimotion/helpers/dataset_helpers.rb +31 -6
  24. data/lib/labimotion/helpers/element_helpers.rb +7 -4
  25. data/lib/labimotion/helpers/exporter_helpers.rb +139 -0
  26. data/lib/labimotion/helpers/param_helpers.rb +6 -0
  27. data/lib/labimotion/helpers/segment_helpers.rb +2 -2
  28. data/lib/labimotion/libs/converter.rb +14 -0
  29. data/lib/labimotion/libs/data/layer/StdDataset.json +212 -0
  30. data/lib/labimotion/libs/data/mapper/Chemwiki.json +2 -2
  31. data/lib/labimotion/libs/dataset_builder.rb +2 -1
  32. data/lib/labimotion/libs/export_element.rb +11 -2
  33. data/lib/labimotion/libs/nmr_mapper.rb +13 -0
  34. data/lib/labimotion/libs/properties_handler.rb +12 -2
  35. data/lib/labimotion/libs/sample_association.rb +7 -4
  36. data/lib/labimotion/libs/template_matcher.rb +39 -0
  37. data/lib/labimotion/libs/vocabulary_handler.rb +8 -6
  38. data/lib/labimotion/libs/xlsx_exporter.rb +285 -0
  39. data/lib/labimotion/models/concerns/datasetable.rb +3 -3
  40. data/lib/labimotion/models/concerns/element_fetchable.rb +53 -0
  41. data/lib/labimotion/models/concerns/generic_klass.rb +16 -0
  42. data/lib/labimotion/models/concerns/segmentable.rb +44 -7
  43. data/lib/labimotion/models/dataset_klass.rb +30 -2
  44. data/lib/labimotion/models/device_description.rb +36 -0
  45. data/lib/labimotion/models/element.rb +37 -1
  46. data/lib/labimotion/models/element_klass.rb +12 -1
  47. data/lib/labimotion/models/reaction.rb +36 -0
  48. data/lib/labimotion/models/research_plan.rb +40 -0
  49. data/lib/labimotion/models/sample.rb +36 -0
  50. data/lib/labimotion/models/screen.rb +36 -0
  51. data/lib/labimotion/models/segment_klass.rb +12 -4
  52. data/lib/labimotion/models/wellplate.rb +40 -0
  53. data/lib/labimotion/utils/serializer.rb +2 -0
  54. data/lib/labimotion/utils/units.rb +609 -468
  55. data/lib/labimotion/utils/utils.rb +42 -0
  56. data/lib/labimotion/version.rb +1 -1
  57. data/lib/labimotion.rb +12 -0
  58. metadata +45 -8
@@ -107,5 +107,47 @@ module Labimotion
107
107
  pkg['labimotion'] = Labimotion::VERSION
108
108
  pkg
109
109
  end
110
+
111
+ # Safely resolve a Labimotion class from a string name
112
+ # @param class_name [String] the class name (e.g., 'Element', 'Segment', 'ElementKlass')
113
+ # @param namespace [Boolean] whether to include the Labimotion namespace (default: true)
114
+ # @return [Class, nil] the resolved class or nil if not found
115
+ # @raise [NameError] if the class cannot be constantized
116
+ #
117
+ # @example
118
+ # Utils.resolve_class('Element') #=> Labimotion::Element
119
+ # Utils.resolve_class('Sample', false) #=> Sample
120
+ def self.resolve_class(class_name, namespace: true)
121
+ return nil if class_name.nil? || class_name.to_s.strip.empty?
122
+
123
+ full_name = namespace ? "Labimotion::#{class_name}" : class_name.to_s
124
+ full_name.constantize
125
+ rescue NameError => e
126
+ Labimotion.log_exception(e)
127
+ raise
128
+ end
129
+
130
+ # Resolve a Labimotion entity class from a string name
131
+ # @param class_name [String] the base class name (e.g., 'Element', 'Segment')
132
+ # @return [Class, nil] the resolved entity class
133
+ #
134
+ # @example
135
+ # Utils.resolve_entity_class('Element') #=> Labimotion::ElementEntity
136
+ def self.resolve_entity_class(class_name)
137
+ resolve_class("#{class_name}Entity")
138
+ end
139
+
140
+ # Resolve a Labimotion revision class from a string name
141
+ # @param class_name [String] the base class name (e.g., 'Element', 'Segment')
142
+ # @param plural [Boolean] whether to use plural form (default: false)
143
+ # @return [Class, nil] the resolved revision class
144
+ #
145
+ # @example
146
+ # Utils.resolve_revision_class('Element') #=> Labimotion::ElementsRevision
147
+ # Utils.resolve_revision_class('ElementKlass', plural: true) #=> Labimotion::ElementKlassesRevision
148
+ def self.resolve_revision_class(class_name, plural: false)
149
+ suffix = plural ? 'esRevision' : 'sRevision'
150
+ resolve_class("#{class_name}#{suffix}")
151
+ end
110
152
  end
111
153
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '2.0.0'
5
+ VERSION = '2.1.0.rc11'
6
6
  end
data/lib/labimotion.rb CHANGED
@@ -24,6 +24,7 @@ module Labimotion
24
24
  autoload :SegmentAPI, 'labimotion/apis/segment_api'
25
25
  autoload :LabimotionHubAPI, 'labimotion/apis/labimotion_hub_api'
26
26
  autoload :ConverterAPI, 'labimotion/apis/converter_api'
27
+ autoload :ExporterAPI, 'labimotion/apis/exporter_api'
27
28
  autoload :StandardLayerAPI, 'labimotion/apis/standard_layer_api'
28
29
  autoload :VocabularyAPI, 'labimotion/apis/vocabulary_api'
29
30
 
@@ -57,6 +58,7 @@ module Labimotion
57
58
  autoload :SearchHelpers, 'labimotion/helpers/search_helpers'
58
59
  autoload :ParamHelpers, 'labimotion/helpers/param_helpers'
59
60
  autoload :ConverterHelpers, 'labimotion/helpers/converter_helpers'
61
+ autoload :ExporterHelpers, 'labimotion/helpers/exporter_helpers'
60
62
  autoload :SampleAssociationHelpers, 'labimotion/helpers/sample_association_helpers'
61
63
  autoload :RepositoryHelpers, 'labimotion/helpers/repository_helpers'
62
64
  autoload :VocabularyHelpers, 'labimotion/helpers/vocabulary_helpers'
@@ -67,11 +69,13 @@ module Labimotion
67
69
  autoload :NmrMapper, 'labimotion/libs/nmr_mapper'
68
70
  autoload :NmrMapperRepo, 'labimotion/libs/nmr_mapper_repo' ## for Chemotion Repository
69
71
  autoload :TemplateHub, 'labimotion/libs/template_hub'
72
+ autoload :TemplateMatcher, 'labimotion/libs/template_matcher'
70
73
  autoload :ExportDataset, 'labimotion/libs/export_dataset'
71
74
  autoload :SampleAssociation, 'labimotion/libs/sample_association'
72
75
  autoload :PropertiesHandler, 'labimotion/libs/properties_handler'
73
76
  autoload :AttachmentHandler, 'labimotion/libs/attachment_handler'
74
77
  autoload :VocabularyHandler, 'labimotion/libs/vocabulary_handler'
78
+ autoload :XlsxExporter, 'labimotion/libs/xlsx_exporter'
75
79
 
76
80
  ######## Utils
77
81
  autoload :Prop, 'labimotion/utils/prop'
@@ -109,9 +113,17 @@ module Labimotion
109
113
  autoload :StdLayer, 'labimotion/models/std_layer'
110
114
  autoload :StdLayersRevision, 'labimotion/models/std_layers_revision'
111
115
 
116
+ autoload :DeviceDescription, 'labimotion/models/device_description'
117
+ autoload :Reaction, 'labimotion/models/reaction'
118
+ autoload :ResearchPlan, 'labimotion/models/research_plan'
119
+ autoload :Sample, 'labimotion/models/sample'
120
+ autoload :Screen, 'labimotion/models/screen'
121
+ autoload :Wellplate, 'labimotion/models/wellplate'
122
+
112
123
  ######## Models/Concerns
113
124
  autoload :GenericKlassRevisions, 'labimotion/models/concerns/generic_klass_revisions'
114
125
  autoload :GenericRevisions, 'labimotion/models/concerns/generic_revisions'
126
+ autoload :ElementFetchable, 'labimotion/models/concerns/element_fetchable'
115
127
  autoload :Segmentable, 'labimotion/models/concerns/segmentable'
116
128
  autoload :Datasetable, 'labimotion/models/concerns/datasetable'
117
129
  autoload :AttachmentConverter, 'labimotion/models/concerns/attachment_converter.rb'
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: 2.0.0
4
+ version: 2.1.0.rc11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chia-Lin Lin
@@ -9,22 +9,42 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-03-25 00:00:00.000000000 Z
12
+ date: 2025-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: caxlsx
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 6.1.7
20
+ version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 6.1.7
27
+ version: '4.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rails
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '6.1'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '8.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '6.1'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '8.0'
28
48
  description:
29
49
  email:
30
50
  - chia-lin.lin@kit.edu
@@ -35,6 +55,7 @@ extra_rdoc_files: []
35
55
  files:
36
56
  - lib/labimotion.rb
37
57
  - lib/labimotion/apis/converter_api.rb
58
+ - lib/labimotion/apis/exporter_api.rb
38
59
  - lib/labimotion/apis/generic_dataset_api.rb
39
60
  - lib/labimotion/apis/generic_element_api.rb
40
61
  - lib/labimotion/apis/generic_klass_api.rb
@@ -67,6 +88,7 @@ files:
67
88
  - lib/labimotion/helpers/converter_helpers.rb
68
89
  - lib/labimotion/helpers/dataset_helpers.rb
69
90
  - lib/labimotion/helpers/element_helpers.rb
91
+ - lib/labimotion/helpers/exporter_helpers.rb
70
92
  - lib/labimotion/helpers/generic_helpers.rb
71
93
  - lib/labimotion/helpers/param_helpers.rb
72
94
  - lib/labimotion/helpers/repository_helpers.rb
@@ -76,6 +98,7 @@ files:
76
98
  - lib/labimotion/helpers/vocabulary_helpers.rb
77
99
  - lib/labimotion/libs/attachment_handler.rb
78
100
  - lib/labimotion/libs/converter.rb
101
+ - lib/labimotion/libs/data/layer/StdDataset.json
79
102
  - lib/labimotion/libs/data/mapper/Chemwiki.json
80
103
  - lib/labimotion/libs/data/mapper/Source.json
81
104
  - lib/labimotion/libs/data/vocab/Standard.json
@@ -87,10 +110,14 @@ files:
87
110
  - lib/labimotion/libs/properties_handler.rb
88
111
  - lib/labimotion/libs/sample_association.rb
89
112
  - lib/labimotion/libs/template_hub.rb
113
+ - lib/labimotion/libs/template_matcher.rb
90
114
  - lib/labimotion/libs/vocabulary_handler.rb
115
+ - lib/labimotion/libs/xlsx_exporter.rb
91
116
  - lib/labimotion/models/collections_element.rb
92
117
  - lib/labimotion/models/concerns/attachment_converter.rb
93
118
  - lib/labimotion/models/concerns/datasetable.rb
119
+ - lib/labimotion/models/concerns/element_fetchable.rb
120
+ - lib/labimotion/models/concerns/generic_klass.rb
94
121
  - lib/labimotion/models/concerns/generic_klass_revisions.rb
95
122
  - lib/labimotion/models/concerns/generic_revisions.rb
96
123
  - lib/labimotion/models/concerns/linked_properties.rb
@@ -100,6 +127,7 @@ files:
100
127
  - lib/labimotion/models/dataset_klass.rb
101
128
  - lib/labimotion/models/dataset_klasses_revision.rb
102
129
  - lib/labimotion/models/datasets_revision.rb
130
+ - lib/labimotion/models/device_description.rb
103
131
  - lib/labimotion/models/element.rb
104
132
  - lib/labimotion/models/element_klass.rb
105
133
  - lib/labimotion/models/element_klasses_revision.rb
@@ -107,6 +135,10 @@ files:
107
135
  - lib/labimotion/models/elements_revision.rb
108
136
  - lib/labimotion/models/elements_sample.rb
109
137
  - lib/labimotion/models/hub_log.rb
138
+ - lib/labimotion/models/reaction.rb
139
+ - lib/labimotion/models/research_plan.rb
140
+ - lib/labimotion/models/sample.rb
141
+ - lib/labimotion/models/screen.rb
110
142
  - lib/labimotion/models/segment.rb
111
143
  - lib/labimotion/models/segment_klass.rb
112
144
  - lib/labimotion/models/segment_klasses_revision.rb
@@ -114,6 +146,7 @@ files:
114
146
  - lib/labimotion/models/std_layer.rb
115
147
  - lib/labimotion/models/std_layers_revision.rb
116
148
  - lib/labimotion/models/vocabulary.rb
149
+ - lib/labimotion/models/wellplate.rb
117
150
  - lib/labimotion/utils/con_state.rb
118
151
  - lib/labimotion/utils/export_utils.rb
119
152
  - lib/labimotion/utils/field_type.rb
@@ -132,6 +165,7 @@ metadata:
132
165
  homepage_uri: https://github.com/LabIMotion/labimotion
133
166
  source_code_uri: https://github.com/LabIMotion/labimotion
134
167
  bug_tracker_uri: https://github.com/LabIMotion/labimotion/discussions
168
+ rubygems_mfa_required: 'true'
135
169
  post_install_message:
136
170
  rdoc_options: []
137
171
  require_paths:
@@ -140,12 +174,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
174
  requirements:
141
175
  - - ">="
142
176
  - !ruby/object:Gem::Version
143
- version: '0'
177
+ version: '2.7'
178
+ - - "<"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.4'
144
181
  required_rubygems_version: !ruby/object:Gem::Requirement
145
182
  requirements:
146
- - - ">="
183
+ - - ">"
147
184
  - !ruby/object:Gem::Version
148
- version: '0'
185
+ version: 1.3.1
149
186
  requirements: []
150
187
  rubygems_version: 3.1.6
151
188
  signing_key: