labimotion 1.3.0.rc3 → 1.3.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labimotion/apis/generic_element_api.rb +18 -17
- data/lib/labimotion/helpers/element_helpers.rb +0 -5
- data/lib/labimotion/libs/converter.rb +8 -27
- data/lib/labimotion/libs/export_dataset.rb +3 -12
- data/lib/labimotion/libs/export_element.rb +89 -25
- data/lib/labimotion/libs/nmr_mapper.rb +2 -15
- data/lib/labimotion/utils/field_type.rb +2 -0
- data/lib/labimotion/utils/units.rb +465 -0
- data/lib/labimotion/version.rb +1 -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: 99c322d38e4cd89d9983147d40d2ceb98aee8342fe9d036f6757034a52fc8b81
|
4
|
+
data.tar.gz: ccf53a3066ff47347a29f45594fbac4436fb6161078c56ef5461a672fa99e0db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce7a434025855de8eafc83450b4bb8808d77e237f306bc5c0f986bdbfb7cc72f46199d615eca43085353af365ea4315ca89f44bedc2ff487dc24d1c69e9a781d
|
7
|
+
data.tar.gz: fff821b8cf75223a50feb3d630eb229bb709de42c8644e1175cbe5c0cfad7a560e6ac9ca2548bfdecb1f2b6372c1e6ba9739ffbd712f82d017793b61e8b0e85b
|
@@ -46,11 +46,19 @@ module Labimotion
|
|
46
46
|
namespace :export do
|
47
47
|
desc 'export element'
|
48
48
|
params do
|
49
|
-
|
49
|
+
requires :id, type: Integer, desc: 'element id'
|
50
|
+
requires :klass, type: String, desc: 'Klass', values: %w[Element Segment Dataset]
|
50
51
|
optional :export_format, type: String, desc: 'export format'
|
51
52
|
end
|
52
53
|
get do
|
53
|
-
|
54
|
+
case params[:klass]
|
55
|
+
when 'Element'
|
56
|
+
element = Labimotion::Element.find(params[:id])
|
57
|
+
when 'Segment'
|
58
|
+
element = Labimotion::Segment.find(params[:id])
|
59
|
+
when 'Dataset'
|
60
|
+
element = Labimotion::Dataset.find(params[:id])
|
61
|
+
end
|
54
62
|
## byebug
|
55
63
|
export = Labimotion::ExportElement.new current_user, element, params[:export_format]
|
56
64
|
env['api.format'] = :binary
|
@@ -340,21 +348,14 @@ module Labimotion
|
|
340
348
|
|
341
349
|
get do
|
342
350
|
element = Labimotion::Element.find(params[:id])
|
343
|
-
|
344
|
-
|
345
|
-
element
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
element,
|
352
|
-
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
353
|
-
policy: @element_policy
|
354
|
-
),
|
355
|
-
attachments: attach_thumbnail(element&.attachments)
|
356
|
-
}
|
357
|
-
end
|
351
|
+
{
|
352
|
+
element: Labimotion::ElementEntity.represent(
|
353
|
+
element,
|
354
|
+
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
355
|
+
policy: @element_policy
|
356
|
+
),
|
357
|
+
attachments: attach_thumbnail(element&.attachments)
|
358
|
+
}
|
358
359
|
rescue StandardError => e
|
359
360
|
Labimotion.log_exception(e, current_user)
|
360
361
|
end
|
@@ -176,11 +176,6 @@ module Labimotion
|
|
176
176
|
)
|
177
177
|
end
|
178
178
|
(attach_ary << att_ary).flatten! unless att_ary&.empty?
|
179
|
-
|
180
|
-
if Labimotion::IS_RAILS5 == true
|
181
|
-
TransferThumbnailToPublicJob.set(queue: "transfer_thumbnail_to_public_#{current_user.id}").perform_now(attach_ary) unless attach_ary.empty?
|
182
|
-
TransferFileFromTmpJob.set(queue: "transfer_file_from_tmp_#{current_user.id}").perform_now(attach_ary) unless attach_ary.empty?
|
183
|
-
end
|
184
179
|
true
|
185
180
|
rescue StandardError => e
|
186
181
|
Labimotion.log_exception(e, current_user)
|
@@ -27,18 +27,10 @@ module Labimotion
|
|
27
27
|
|
28
28
|
dsr = []
|
29
29
|
ols = nil
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
dsr.push(res[:d]) unless res&.dig(:d).nil?
|
35
|
-
end
|
36
|
-
else
|
37
|
-
Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
|
38
|
-
res = Labimotion::Converter.collect_metadata(zip_file) if att.filename.split('.')&.last == 'zip'
|
39
|
-
ols = res[:o] unless res&.dig(:o).nil?
|
40
|
-
dsr.push(res[:d]) unless res&.dig(:d).nil?
|
41
|
-
end
|
30
|
+
Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
|
31
|
+
res = Labimotion::Converter.collect_metadata(zip_file) if att.filename.split('.')&.last == 'zip'
|
32
|
+
ols = res[:o] unless res&.dig(:o).nil?
|
33
|
+
dsr.push(res[:d]) unless res&.dig(:d).nil?
|
42
34
|
end
|
43
35
|
dsr.flatten!
|
44
36
|
dataset = build_ds(att.attachable_id, ols)
|
@@ -145,16 +137,9 @@ module Labimotion
|
|
145
137
|
created_by: oat.created_by,
|
146
138
|
created_for: oat.created_for,
|
147
139
|
)
|
148
|
-
|
149
|
-
if att.valid?
|
150
|
-
|
151
|
-
att.save!
|
152
|
-
end
|
153
|
-
if att.valid? && Labimotion::IS_RAILS5 == true
|
154
|
-
att.save!
|
155
|
-
primary_store = Rails.configuration.storage.primary_store
|
156
|
-
att.update!(storage: primary_store)
|
157
|
-
end
|
140
|
+
|
141
|
+
att.save! if att.valid?
|
142
|
+
|
158
143
|
process_ds(att.id)
|
159
144
|
rescue StandardError => e
|
160
145
|
raise e
|
@@ -168,11 +153,7 @@ module Labimotion
|
|
168
153
|
response = nil
|
169
154
|
begin
|
170
155
|
ofile = Rails.root.join(data[:f], data[:a].filename)
|
171
|
-
|
172
|
-
FileUtils.cp(data[:a].store.path, ofile)
|
173
|
-
else
|
174
|
-
FileUtils.cp(data[:a].attachment_url, ofile)
|
175
|
-
end
|
156
|
+
FileUtils.cp(data[:a].attachment_url, ofile)
|
176
157
|
|
177
158
|
File.open(ofile, 'r') do |f|
|
178
159
|
body = { file: f }
|
@@ -145,18 +145,9 @@ module Labimotion
|
|
145
145
|
sheet_name = "Sheet#{idx+1}"
|
146
146
|
sheet = @xfile.workbook.add_worksheet(name: sheet_name)
|
147
147
|
name_mapping.push([sheet_name, att.filename])
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
fi.each_line do |line|
|
152
|
-
sheet.add_row(line.split(','))
|
153
|
-
end
|
154
|
-
end
|
155
|
-
else
|
156
|
-
File.open(att.attachment_url) do |fi|
|
157
|
-
fi.each_line do |line|
|
158
|
-
sheet.add_row(line.split(','))
|
159
|
-
end
|
148
|
+
File.open(att.attachment_url) do |fi|
|
149
|
+
fi.each_line do |line|
|
150
|
+
sheet.add_row(line.split(','))
|
160
151
|
end
|
161
152
|
end
|
162
153
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'export_table'
|
3
3
|
require 'labimotion/version'
|
4
|
+
require 'labimotion/utils/units'
|
4
5
|
require 'sablon'
|
5
6
|
|
6
7
|
module Labimotion
|
@@ -8,6 +9,25 @@ module Labimotion
|
|
8
9
|
def initialize(current_user, element, export_format)
|
9
10
|
@current_user = current_user
|
10
11
|
@element = element
|
12
|
+
@parent =
|
13
|
+
case element.class.name
|
14
|
+
when 'Labimotion::Segment'
|
15
|
+
element&.element
|
16
|
+
when 'Labimotion::Dataset'
|
17
|
+
element&.element&.root_element
|
18
|
+
end
|
19
|
+
@element_klass =
|
20
|
+
case element.class.name
|
21
|
+
when 'Labimotion::Element'
|
22
|
+
element.element_klass
|
23
|
+
when 'Labimotion::Segment'
|
24
|
+
element.segment_klass
|
25
|
+
when 'Labimotion::Dataset'
|
26
|
+
element.dataset_klass
|
27
|
+
end
|
28
|
+
@name = @element.instance_of?(Labimotion::Element) ? element.name : @parent&.name
|
29
|
+
@short_label = @element.instance_of?(Labimotion::Element) ? element.short_label : @parent&.short_label
|
30
|
+
@element_name = "#{@element_klass.label}_#{@short_label}".gsub(/\s+/, '')
|
11
31
|
@properties = element.properties
|
12
32
|
@options = element.properties_release[Labimotion::Prop::SEL_OPTIONS]
|
13
33
|
@export_format = export_format
|
@@ -17,7 +37,12 @@ module Labimotion
|
|
17
37
|
|
18
38
|
def build_layers
|
19
39
|
objs = []
|
20
|
-
@properties[Labimotion::Prop::LAYERS]&.keys&.sort_by
|
40
|
+
@properties[Labimotion::Prop::LAYERS]&.keys&.sort_by do |key|
|
41
|
+
[
|
42
|
+
@properties[Labimotion::Prop::LAYERS].fetch(key, nil)&.fetch('position', 0) || 0,
|
43
|
+
@properties[Labimotion::Prop::LAYERS].fetch(key, nil)&.fetch('wf_position', 0) || 0
|
44
|
+
]
|
45
|
+
end&.each do |key|
|
21
46
|
layer = @properties[Labimotion::Prop::LAYERS][key] || {}
|
22
47
|
|
23
48
|
## Build fields html
|
@@ -53,23 +78,25 @@ module Labimotion
|
|
53
78
|
field_obj[:value] = (field['value'] && field['value']['el_label']) || ''
|
54
79
|
field_obj[:obj] = field['value'] ### change to object
|
55
80
|
when Labimotion::FieldType::DRAG_SAMPLE
|
56
|
-
val = field.fetch('value',
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
81
|
+
val = field.fetch('value', nil)
|
82
|
+
if val.present?
|
83
|
+
instance = Sample.find_by(id: val['el_id'])
|
84
|
+
field_obj[:value] = val['el_label']
|
85
|
+
field_obj[:has_structure] = true
|
86
|
+
obj_os = Entities::SampleReportEntity.new(
|
87
|
+
instance,
|
88
|
+
current_user: @current_user,
|
89
|
+
detail_levels: ElementDetailLevelCalculator.new(user: @current_user, element: instance).detail_levels,
|
90
|
+
).serializable_hash
|
91
|
+
obj_final = OpenStruct.new(obj_os)
|
92
|
+
field_obj[:structure] = Reporter::Docx::DiagramSample.new(obj: obj_final, format: 'png').generate
|
93
|
+
end
|
67
94
|
when Labimotion::FieldType::DRAG_MOLECULE
|
68
|
-
val = field.fetch('value',
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
95
|
+
val = field.fetch('value', nil)
|
96
|
+
if val.present?
|
97
|
+
obj = Molecule.find_by(id: val['el_id'])
|
98
|
+
field_obj[:value] = val['el_label']
|
99
|
+
end
|
73
100
|
when Labimotion::FieldType::SELECT
|
74
101
|
field_obj[:value] = @options.fetch(field['option_layers'], nil)&.fetch('options', nil)&.find { |ss| ss['key'] == field['value'] }&.fetch('label', nil) || field['value']
|
75
102
|
when Labimotion::FieldType::UPLOAD
|
@@ -82,7 +109,6 @@ module Labimotion
|
|
82
109
|
tbl = []
|
83
110
|
## tbl_idx = []
|
84
111
|
header = {}
|
85
|
-
|
86
112
|
sub_fields = field.fetch('sub_fields', [])
|
87
113
|
sub_fields.each_with_index do |sub_field, idx|
|
88
114
|
header["col#{idx}"] = sub_field['col_name']
|
@@ -107,6 +133,25 @@ module Labimotion
|
|
107
133
|
end
|
108
134
|
end
|
109
135
|
field_obj[:value] = val.join(' ')
|
136
|
+
when Labimotion::FieldType::WF_NEXT
|
137
|
+
if field['value'].present? && field['wf_options'].present?
|
138
|
+
field_obj[:value] = field['wf_options'].find { |ss| ss['key'] == field['value'] }&.fetch('label', nil)&.split('(')&.first&.strip
|
139
|
+
end
|
140
|
+
when Labimotion::FieldType::SYSTEM_DEFINED
|
141
|
+
_field = field
|
142
|
+
unit = Labimotion::Units::FIELDS.find { |o| o[:field] == _field['option_layers'] }&.fetch(:units, []).find { |u| u[:key] == _field['value_system'] }&.fetch(:label, '')
|
143
|
+
val = _field['value'].to_s + ' ' + unit
|
144
|
+
val = Sablon.content(:html, "<div>" + val + "</div>") if val.include? '<'
|
145
|
+
field_obj[:value] = val
|
146
|
+
when Labimotion::FieldType::TEXT_FORMULA
|
147
|
+
field.fetch('text_sub_fields', []).each do |sub_field|
|
148
|
+
va = @properties['layers'][sub_field.fetch('layer','')]['fields'].find { |f| f['field'] == sub_field.fetch('field','') }&.fetch('value',nil)
|
149
|
+
field_obj[:value] = (field_obj[:value] || '') + va.to_s + sub_field.fetch('separator','') if va.present?
|
150
|
+
end
|
151
|
+
# field_obj[:value] = (field['value'] && field['value']['el_label']) || ''
|
152
|
+
# field_obj[:obj] = field['value'] ### change to object
|
153
|
+
else
|
154
|
+
field_obj[:value] = field['value']
|
110
155
|
end
|
111
156
|
field_obj
|
112
157
|
rescue StandardError => e
|
@@ -117,10 +162,27 @@ module Labimotion
|
|
117
162
|
return '' if sub_field.fetch('id', nil).nil? || sub_val[sub_field['id']].nil?
|
118
163
|
|
119
164
|
case sub_field['type']
|
165
|
+
when Labimotion::FieldType::DRAG_SAMPLE
|
166
|
+
val = sub_val[sub_field['id']]['value'] || {}
|
167
|
+
label = val['el_label'].present? ? "Short Label: [#{val['el_label']}] \n" : ''
|
168
|
+
name = val['el_name'].present? ? "Name: [#{val['el_name']}] \n" : ''
|
169
|
+
ext = val['el_external_label'].present? ? "Ext. Label: [#{val['el_external_label']}] \n" : ''
|
170
|
+
mass = val['el_molecular_weight'].present? ? "Mass: [#{val['el_molecular_weight']}] \n" : ''
|
171
|
+
"#{label}#{name}#{ext}#{mass}"
|
172
|
+
when Labimotion::FieldType::DRAG_MOLECULE
|
173
|
+
val = sub_val[sub_field['id']]['value'] || {}
|
174
|
+
smile = val['el_smiles'].present? ? "SMILES: [#{val['el_smiles']}] \n" : ''
|
175
|
+
inchikey = val['el_inchikey'].present? ? "InChiKey:[#{val['el_inchikey']}] \n" : ''
|
176
|
+
iupac = val['el_iupac'].present? ? "IUPAC:[#{val['el_iupac']}] \n" : ''
|
177
|
+
mass = val['el_molecular_weight'].present? ? "MASS: [#{val['el_molecular_weight']}] \n" : ''
|
178
|
+
"#{smile}#{inchikey}#{iupac}#{mass}"
|
120
179
|
when Labimotion::FieldType::SELECT
|
121
180
|
sub_val[sub_field['id']]['value']
|
122
181
|
when Labimotion::FieldType::SYSTEM_DEFINED
|
123
|
-
|
182
|
+
unit = Labimotion::Units::FIELDS.find { |o| o[:field] == sub_field['option_layers'] }&.fetch(:units, [])&.find { |u| u[:key] == sub_field['value_system'] }&.fetch(:label, '')
|
183
|
+
val = sub_val[sub_field['id']]['value'].to_s + ' ' + unit
|
184
|
+
val = Sablon.content(:html, "<div>" + val + "</div>") if val.include? '<'
|
185
|
+
val
|
124
186
|
else
|
125
187
|
sub_val[sub_field['id']]
|
126
188
|
end
|
@@ -148,8 +210,11 @@ module Labimotion
|
|
148
210
|
template = Sablon.template(location)
|
149
211
|
layers = build_layers
|
150
212
|
context = {
|
151
|
-
|
152
|
-
|
213
|
+
label: @element_klass.label,
|
214
|
+
desc: @element_klass.desc,
|
215
|
+
name: @name,
|
216
|
+
parent_klass: @parent.present? ? "#{@parent&.class&.name&.split('::')&.last}: " : '',
|
217
|
+
short_label: @short_label,
|
153
218
|
date: Time.now.strftime('%d/%m/%Y'),
|
154
219
|
author: @current_user.name,
|
155
220
|
layers: layers
|
@@ -162,14 +227,13 @@ module Labimotion
|
|
162
227
|
Labimotion.log_exception(e)
|
163
228
|
ensure
|
164
229
|
# Close and delete the temporary file
|
165
|
-
tempfile
|
166
|
-
tempfile
|
230
|
+
tempfile&.close
|
231
|
+
tempfile&.unlink
|
167
232
|
end
|
168
233
|
|
169
234
|
|
170
235
|
def res_name
|
171
|
-
element_name
|
172
|
-
"#{element_name}_#{Time.now.strftime('%Y%m%d%H%M')}.docx"
|
236
|
+
"#{@element_name}_#{Time.now.strftime('%Y%m%d%H%M')}.docx"
|
173
237
|
rescue StandardError => e
|
174
238
|
Labimotion.log_exception(e)
|
175
239
|
end
|
@@ -28,8 +28,8 @@ module Labimotion
|
|
28
28
|
att = Attachment.find_by(id: id, con_state: Labimotion::ConState::NMR)
|
29
29
|
return if att.nil?
|
30
30
|
|
31
|
-
if
|
32
|
-
Zip::File.open(att.
|
31
|
+
if att&.attachment_attacher&.file&.url
|
32
|
+
Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
|
33
33
|
zip_file.each do |entry|
|
34
34
|
if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
|
35
35
|
metadata = entry.get_input_stream.read.force_encoding('UTF-8')
|
@@ -39,19 +39,6 @@ module Labimotion
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
else
|
43
|
-
if att&.attachment_attacher&.file&.url
|
44
|
-
Zip::File.open(att.attachment_attacher.file.url) do |zip_file|
|
45
|
-
zip_file.each do |entry|
|
46
|
-
if entry.name.include?('/pdata/') && entry.name.include?('parm.txt')
|
47
|
-
metadata = entry.get_input_stream.read.force_encoding('UTF-8')
|
48
|
-
return { is_bagit: false, metadata: metadata }
|
49
|
-
elsif entry.name.include?('metadata/') && entry.name.include?('converter.json')
|
50
|
-
return { is_bagit: true, metadata: nil }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
42
|
end
|
56
43
|
{ is_bagit: false, metadata: nil }
|
57
44
|
end
|
@@ -8,6 +8,8 @@ module Labimotion
|
|
8
8
|
SELECT = 'select'.freeze
|
9
9
|
INTEGER = 'integer'.freeze
|
10
10
|
INPUT_GROUP = 'input-group'.freeze
|
11
|
+
WF_NEXT = 'wf-next'.freeze
|
12
|
+
TEXT_FORMULA = 'text-formula'.freeze
|
11
13
|
SYSTEM_DEFINED = 'system-defined'.freeze
|
12
14
|
DRAG = 'drag'.freeze
|
13
15
|
DRAG_ELEMENT = 'drag_element'.freeze
|
@@ -0,0 +1,465 @@
|
|
1
|
+
module Labimotion
|
2
|
+
## Converter State
|
3
|
+
class Units
|
4
|
+
FIELDS = [
|
5
|
+
{
|
6
|
+
"type": "numeric",
|
7
|
+
"field": "acceleration",
|
8
|
+
"label": "Acceleration",
|
9
|
+
"default": "",
|
10
|
+
"position": 10,
|
11
|
+
"placeholder": "acceleration",
|
12
|
+
"units": [{ "key": "mm_s2", "label": "mm/s<sup>2</sup>" }]
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"type": "numeric",
|
16
|
+
"field": "agitation",
|
17
|
+
"label": "Agitation",
|
18
|
+
"default": "",
|
19
|
+
"position": 20,
|
20
|
+
"placeholder": "agitation",
|
21
|
+
"units": [{ "key": "rpm", "label": "rpm" }]
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"type": "numeric",
|
25
|
+
"field": "amount_enzyme",
|
26
|
+
"label": "Amount enzyme as μmol/min",
|
27
|
+
"default": "",
|
28
|
+
"position": 30,
|
29
|
+
"placeholder": "amount enzyme as μmol/min",
|
30
|
+
"units": [
|
31
|
+
{ "key": "u", "label": "U", "nm": 1 },
|
32
|
+
{ "key": "mu", "label": "mU", "nm": 1000 },
|
33
|
+
{ "key": "kat", "label": "kat", "nm": 1.667e-8 },
|
34
|
+
{ "key": "mkat", "label": "mkat", "nm": 1.667e-5 },
|
35
|
+
{ "key": "µkat", "label": "µkat", "nm": 0.01667 },
|
36
|
+
{ "key": "nkat", "label": "nkat", "nm": 16.67 }
|
37
|
+
]
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"type": "numeric",
|
41
|
+
"field": "amount_substance",
|
42
|
+
"label": "Amount of substance",
|
43
|
+
"default": "",
|
44
|
+
"position": 35,
|
45
|
+
"placeholder": "amount of substance",
|
46
|
+
"units": [
|
47
|
+
{ "key": "mol", "label": "mol (M)", "nm": 1 },
|
48
|
+
{ "key": "mmol", "label": "mmol (mM)", "nm": 1000 },
|
49
|
+
{ "key": "umol", "label": "µmol (µM)", "nm": 1000000 },
|
50
|
+
{ "key": "nmol", "label": "nmol (nM)", "nm": 1.0e9 },
|
51
|
+
{ "key": "pmol", "label": "pmol (pM)", "nm": 1.0e12 }
|
52
|
+
]
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"type": "numeric",
|
56
|
+
"field": "molarity",
|
57
|
+
"label": "Chem. concentration (Molarity)",
|
58
|
+
"default": "",
|
59
|
+
"position": 40,
|
60
|
+
"placeholder": "molarity",
|
61
|
+
"units": [
|
62
|
+
{ "key": "mol_l", "label": "mol/L (M/L)", "nm": 1 },
|
63
|
+
{ "key": "mmol_l", "label": "mmol/L (mM/L)", "nm": 1000 },
|
64
|
+
{ "key": "umol_l", "label": "µmol/L (µM/L)", "nm": 1000000 },
|
65
|
+
{ "key": "nmol_l", "label": "nmol/L (nM/L)", "nm": 1000000000 },
|
66
|
+
{ "key": "pmol_l", "label": "pmol/L (pM/L)", "nm": 1000000000000 }
|
67
|
+
]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"type": "numeric",
|
71
|
+
"field": "chem_distances",
|
72
|
+
"label": "Chem. distances",
|
73
|
+
"default": "",
|
74
|
+
"position": 50,
|
75
|
+
"placeholder": "Chem. distances",
|
76
|
+
"units": [{ "key": "angstrom", "label": "Å" }]
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"type": "numeric",
|
80
|
+
"field": "concentration",
|
81
|
+
"label": "Concentration",
|
82
|
+
"default": "",
|
83
|
+
"position": 60,
|
84
|
+
"placeholder": "concentration",
|
85
|
+
"units": [
|
86
|
+
{ "key": "ng_l", "label": "ng/L", "nm": 1000000 },
|
87
|
+
{ "key": "mg_l", "label": "mg/L", "nm": 1000 },
|
88
|
+
{ "key": "g_l", "label": "g/L", "nm": 1 }
|
89
|
+
]
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"type": "numeric",
|
93
|
+
"field": "conductivity",
|
94
|
+
"label": "Conductivity",
|
95
|
+
"default": "",
|
96
|
+
"position": 66,
|
97
|
+
"placeholder": "conductivity",
|
98
|
+
"units": [{ "key": "s_m", "label": "S/m", "nm": 1 }]
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"type": "numeric",
|
102
|
+
"field": "current",
|
103
|
+
"label": "Current",
|
104
|
+
"default": "",
|
105
|
+
"position": 60,
|
106
|
+
"placeholder": "Current",
|
107
|
+
"units": [
|
108
|
+
{ "key": "A", "label": "A", "nm": 1 },
|
109
|
+
{ "key": "mA", "label": "mA", "nm": 1000 },
|
110
|
+
{ "key": "uA", "label": "µA", "nm": 1000000 },
|
111
|
+
{ "key": "nA", "label": "nA", "nm": 1000000000 }
|
112
|
+
]
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"type": "numeric",
|
116
|
+
"field": "degree",
|
117
|
+
"label": "Degree",
|
118
|
+
"default": "",
|
119
|
+
"position": 70,
|
120
|
+
"placeholder": "degree",
|
121
|
+
"units": [{ "key": "degree", "label": "°" }]
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"type": "numeric",
|
125
|
+
"field": "density",
|
126
|
+
"label": "Density",
|
127
|
+
"default": "",
|
128
|
+
"position": 75,
|
129
|
+
"placeholder": "density",
|
130
|
+
"units": [
|
131
|
+
{ "key": "g_cm3", "label": "g/cm<sup>3</sup>", "nm": 1 },
|
132
|
+
{ "key": "kg_l", "label": "kg/l", "nm": 1 }
|
133
|
+
]
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"type": "numeric",
|
137
|
+
"field": "duration",
|
138
|
+
"label": "Duration",
|
139
|
+
"default": "",
|
140
|
+
"position": 80,
|
141
|
+
"placeholder": "duration",
|
142
|
+
"units": [
|
143
|
+
{ "key": "d", "label": "d", "nm": 1 },
|
144
|
+
{ "key": "h", "label": "h", "nm": 24 },
|
145
|
+
{ "key": "min", "label": "m", "nm": 1440 },
|
146
|
+
{ "key": "s", "label": "s", "nm": 86400 }
|
147
|
+
]
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"type": "numeric",
|
151
|
+
"field": "elastic_modulus",
|
152
|
+
"label": "Elastic modulus",
|
153
|
+
"default": "",
|
154
|
+
"position": 84,
|
155
|
+
"placeholder": "Elastic modulus",
|
156
|
+
"units": [
|
157
|
+
{ "key": "m_pa", "label": "MPa", "nm": 1 },
|
158
|
+
{ "key": "k_pa", "label": "kPa", "nm": 1000 },
|
159
|
+
{ "key": "pa", "label": "Pa", "nm": 1000000 }
|
160
|
+
]
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"type": "numeric",
|
164
|
+
"field": "electric_charge_c",
|
165
|
+
"label": "Electric Charge in C",
|
166
|
+
"default": "",
|
167
|
+
"position": 85,
|
168
|
+
"placeholder": "Electric Charge in C",
|
169
|
+
"units": [{ "key": "ec_c", "label": "C", "nm": 1 }]
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"type": "numeric",
|
173
|
+
"field": "electric_field",
|
174
|
+
"label": "Electric field",
|
175
|
+
"default": "",
|
176
|
+
"position": 86,
|
177
|
+
"placeholder": "Electric field",
|
178
|
+
"units": [{ "key": "v_m", "label": "V/m", "nm": 1 }]
|
179
|
+
},
|
180
|
+
{
|
181
|
+
"type": "numeric",
|
182
|
+
"field": "energy",
|
183
|
+
"label": "Energy",
|
184
|
+
"default": "",
|
185
|
+
"position": 88,
|
186
|
+
"placeholder": "Joule",
|
187
|
+
"units": [
|
188
|
+
{ "key": "eV", "label": "eV", "nm": 6.241509e21 },
|
189
|
+
{ "key": "keV", "label": "keV", "nm": 6.241509e18 },
|
190
|
+
{ "key": "j", "label": "J", "nm": 1000 },
|
191
|
+
{ "key": "k_j", "label": "kJ", "nm": 1 }
|
192
|
+
]
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"type": "numeric",
|
196
|
+
"field": "enzyme_activity",
|
197
|
+
"label": "Enzyme activity",
|
198
|
+
"default": "",
|
199
|
+
"position": 90,
|
200
|
+
"placeholder": "Enzyme activity",
|
201
|
+
"units": [
|
202
|
+
{ "key": "u_l", "label": "U/L", "nm": 1 },
|
203
|
+
{ "key": "u_ml", "label": "U/mL", "nm": 1000 }
|
204
|
+
]
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"type": "numeric",
|
208
|
+
"field": "faraday",
|
209
|
+
"label": "Faraday",
|
210
|
+
"default": "",
|
211
|
+
"position": 95,
|
212
|
+
"placeholder": "Faraday",
|
213
|
+
"units": [
|
214
|
+
{ "key": "faraday", "label": "C/m", "nm": 1 }
|
215
|
+
]
|
216
|
+
},
|
217
|
+
{
|
218
|
+
"type": "numeric",
|
219
|
+
"field": "flow_rate",
|
220
|
+
"label": "Flow rate",
|
221
|
+
"default": "",
|
222
|
+
"position": 100,
|
223
|
+
"placeholder": "Flow rate",
|
224
|
+
"units": [
|
225
|
+
{ "key": "ul_min", "label": "µl/min", "nm": 1000000 },
|
226
|
+
{ "key": "ml_min", "label": "ml/min", "nm": 1000 },
|
227
|
+
{ "key": "l_m", "label": "l/m", "nm": 1 }
|
228
|
+
]
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"type": "numeric",
|
232
|
+
"field": "frequency",
|
233
|
+
"label": "Frequency",
|
234
|
+
"default": "",
|
235
|
+
"position": 100,
|
236
|
+
"placeholder": "frequency",
|
237
|
+
"units": [
|
238
|
+
{ "key": "mhz", "label": "MHz", "nm": 1000000 },
|
239
|
+
{ "key": "hz", "label": "Hz", "nm": 1000 },
|
240
|
+
{ "key": "khz", "label": "kHz", "nm": 1 }
|
241
|
+
]
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"type": "numeric",
|
245
|
+
"field": "heating_rate",
|
246
|
+
"label": "Heating rate",
|
247
|
+
"default": "",
|
248
|
+
"position": 106,
|
249
|
+
"placeholder": "heating rate",
|
250
|
+
"units": [{ "key": "k_min", "label": "K/min", "nm": 1 }]
|
251
|
+
},
|
252
|
+
{
|
253
|
+
"type": "numeric",
|
254
|
+
"field": "length",
|
255
|
+
"label": "Length",
|
256
|
+
"default": "",
|
257
|
+
"position": 110,
|
258
|
+
"placeholder": "length",
|
259
|
+
"units": [
|
260
|
+
{ "key": "mm", "label": "mm", "nm": 1000 },
|
261
|
+
{ "key": "cm", "label": "cm", "nm": 100 },
|
262
|
+
{ "key": "m", "label": "m", "nm": 1 }
|
263
|
+
]
|
264
|
+
},
|
265
|
+
{
|
266
|
+
"type": "numeric",
|
267
|
+
"field": "magnetic_flux_density",
|
268
|
+
"label": "Magnetic flux density/inductivity",
|
269
|
+
"default": "",
|
270
|
+
"position": 120,
|
271
|
+
"placeholder": "",
|
272
|
+
"units": [{ "key": "T", "label": "T", "nm": 1 }]
|
273
|
+
},
|
274
|
+
{
|
275
|
+
"type": "numeric",
|
276
|
+
"field": "mass",
|
277
|
+
"label": "Mass",
|
278
|
+
"default": "",
|
279
|
+
"position": 120,
|
280
|
+
"placeholder": "mass",
|
281
|
+
"units": [
|
282
|
+
{ "key": "g", "label": "g", "nm": 1 },
|
283
|
+
{ "key": "mg", "label": "mg", "nm": 1000 },
|
284
|
+
{ "key": "ug", "label": "µg", "nm": 1000000 }
|
285
|
+
]
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"type": "numeric",
|
289
|
+
"field": "mass_molecule",
|
290
|
+
"label": "Mass of molecule",
|
291
|
+
"default": "",
|
292
|
+
"position": 126,
|
293
|
+
"placeholder": "mass of molecule",
|
294
|
+
"units": [
|
295
|
+
{ "key": "dalton", "label": "D", "nm": 1000 },
|
296
|
+
{ "key": "kilo_dalton", "label": "kD", "nm": 1 }
|
297
|
+
]
|
298
|
+
},
|
299
|
+
{
|
300
|
+
"type": "numeric",
|
301
|
+
"field": "molecular_weight",
|
302
|
+
"label": "Molecular weight",
|
303
|
+
"default": "",
|
304
|
+
"position": 130,
|
305
|
+
"placeholder": "Molecular weight",
|
306
|
+
"units": [{ "key": "g_mol", "label": "g/mol" }]
|
307
|
+
},
|
308
|
+
{
|
309
|
+
"type": "numeric",
|
310
|
+
"field": "percentage",
|
311
|
+
"label": "Percentage",
|
312
|
+
"default": "",
|
313
|
+
"position": 136,
|
314
|
+
"placeholder": "percentage",
|
315
|
+
"units": [{ "key": "p", "label": "%", "nm": 1 }]
|
316
|
+
},
|
317
|
+
{
|
318
|
+
"type": "numeric",
|
319
|
+
"field": "pressure",
|
320
|
+
"label": "Pressure",
|
321
|
+
"default": "",
|
322
|
+
"position": 140,
|
323
|
+
"placeholder": "pressure",
|
324
|
+
"units": [
|
325
|
+
{ "key": "atm", "label": "atm", "nm": 1 },
|
326
|
+
{ "key": "pa", "label": "Pa", "nm": 101325 },
|
327
|
+
{ "key": "torr", "label": "Torr", "nm": 760 }
|
328
|
+
]
|
329
|
+
},
|
330
|
+
{
|
331
|
+
"type": "numeric",
|
332
|
+
"field": "reaction_rate",
|
333
|
+
"label": "Reaction rate",
|
334
|
+
"default": "",
|
335
|
+
"position": 150,
|
336
|
+
"placeholder": "Reaction rate",
|
337
|
+
"units": [
|
338
|
+
{ "key": "mol_lmin", "label": "mol/Lmin", "nm": 1 },
|
339
|
+
{ "key": "mol_lsec", "label": "mol/Ls", "nm": 60 }
|
340
|
+
]
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"type": "numeric",
|
344
|
+
"field": "specific_volume",
|
345
|
+
"label": "Specific Volume",
|
346
|
+
"default": "",
|
347
|
+
"position": 160,
|
348
|
+
"placeholder": "Specific Volume",
|
349
|
+
"units": [{ "key": "cm3_g", "label": "cm<sup>3</sup>/g", "nm": 1 }]
|
350
|
+
},
|
351
|
+
{
|
352
|
+
"type": "numeric",
|
353
|
+
"field": "speed",
|
354
|
+
"label": "Speed",
|
355
|
+
"default": "",
|
356
|
+
"position": 165,
|
357
|
+
"placeholder": "speed",
|
358
|
+
"units": [
|
359
|
+
{ "key": "cm_s", "label": "cm/s", "nm": 1 },
|
360
|
+
{ "key": "mm_s", "label": "mm/s", "nm": 10 },
|
361
|
+
{ "key": "um_m", "label": "µm/min", "nm": 600000 },
|
362
|
+
{ "key": "nm_m", "label": "nm/min", "nm": 60000000 },
|
363
|
+
{ "key": "cm_h", "label": "cm/h", "nm": 3600 },
|
364
|
+
{ "key": "mm_h", "label": "mm/h", "nm": 36000 }
|
365
|
+
]
|
366
|
+
},
|
367
|
+
{
|
368
|
+
"type": "numeric",
|
369
|
+
"field": "subatomic_length",
|
370
|
+
"label": "Subatomic length",
|
371
|
+
"default": "",
|
372
|
+
"position": 168,
|
373
|
+
"placeholder": "Subatomic length",
|
374
|
+
"units": [
|
375
|
+
{ "key": "um", "label": "µm", "nm": 1 },
|
376
|
+
{ "key": "nm", "label": "nm", "nm": 1000 },
|
377
|
+
{ "key": "pm", "label": "pm", "nm": 1000000 }
|
378
|
+
]
|
379
|
+
},
|
380
|
+
{
|
381
|
+
"type": "numeric",
|
382
|
+
"field": "surface",
|
383
|
+
"label": "Surface",
|
384
|
+
"default": "",
|
385
|
+
"position": 170,
|
386
|
+
"placeholder": "surface",
|
387
|
+
"units": [
|
388
|
+
{ "key": "a_2", "label": "A<sup>2</sup>", "nm": 1.0e16 },
|
389
|
+
{ "key": "um_2", "label": "µm<sup>2</sup>", "nm": 1.0e8 },
|
390
|
+
{ "key": "mm_2", "label": "mm<sup>2</sup>", "nm": 100 },
|
391
|
+
{ "key": "cm_2", "label": "cm<sup>2</sup>", "nm": 1 }
|
392
|
+
]
|
393
|
+
},
|
394
|
+
{
|
395
|
+
"type": "numeric",
|
396
|
+
"field": "temperature",
|
397
|
+
"label": "Temperature",
|
398
|
+
"default": "",
|
399
|
+
"position": 180,
|
400
|
+
"placeholder": "temperature",
|
401
|
+
"units": [
|
402
|
+
{ "key": "C", "label": "°C" },
|
403
|
+
{ "key": "F", "label": "°F" },
|
404
|
+
{ "key": "K", "label": "K" }
|
405
|
+
]
|
406
|
+
},
|
407
|
+
{
|
408
|
+
"type": "numeric",
|
409
|
+
"field": "turnover_number",
|
410
|
+
"label": "Turnover number",
|
411
|
+
"default": "",
|
412
|
+
"position": 190,
|
413
|
+
"placeholder": "Turnover number",
|
414
|
+
"units": [{ "key": "1_s", "label": "1/s", "nm": 1 }, { "key": "1_m", "label": "1/m", "nm": 60 }]
|
415
|
+
},
|
416
|
+
{
|
417
|
+
"type": "numeric",
|
418
|
+
"field": "viscosity",
|
419
|
+
"label": "Dynamic Viscosity",
|
420
|
+
"default": "",
|
421
|
+
"position": 200,
|
422
|
+
"placeholder": "Dynamic Viscosity",
|
423
|
+
"units": [
|
424
|
+
{ "key": "pas", "label": "Pas", "nm": 1 },
|
425
|
+
{ "key": "mpas", "label": "mPas", "nm": 1000 }
|
426
|
+
]
|
427
|
+
},
|
428
|
+
{
|
429
|
+
"type": "numeric",
|
430
|
+
"field": "kinematic_viscosity",
|
431
|
+
"label": "Kinematic Viscosity",
|
432
|
+
"default": "",
|
433
|
+
"position": 205,
|
434
|
+
"placeholder": "Kinematic Viscosity",
|
435
|
+
"units": [{ "key": "m2_s", "label": "m<sup>2</sup>/s", "nm": 1 }]
|
436
|
+
},
|
437
|
+
{
|
438
|
+
"type": "numeric",
|
439
|
+
"field": "voltage",
|
440
|
+
"label": "Voltage",
|
441
|
+
"default": "",
|
442
|
+
"position": 200,
|
443
|
+
"placeholder": "voltage",
|
444
|
+
"units": [
|
445
|
+
{ "key": "mv", "label": "mV", "nm": 1000 },
|
446
|
+
{ "key": "v", "label": "V", "nm": 1 }
|
447
|
+
]
|
448
|
+
},
|
449
|
+
{
|
450
|
+
"type": "numeric",
|
451
|
+
"field": "volumes",
|
452
|
+
"label": "Volumes",
|
453
|
+
"default": "",
|
454
|
+
"position": 210,
|
455
|
+
"placeholder": "volume",
|
456
|
+
"units": [
|
457
|
+
{ "key": "l", "label": "l", "nm": 1 },
|
458
|
+
{ "key": "ml", "label": "ml", "nm": 1000 },
|
459
|
+
{ "key": "ul", "label": "µl", "nm": 1000000 },
|
460
|
+
{ "key": "nl", "label": "nl", "nm": 1000000000 }
|
461
|
+
]
|
462
|
+
}
|
463
|
+
]
|
464
|
+
end
|
465
|
+
end
|
data/lib/labimotion/version.rb
CHANGED
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.3.0.
|
4
|
+
version: 1.3.0.rc4
|
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-
|
12
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/labimotion/utils/prop.rb
|
102
102
|
- lib/labimotion/utils/search.rb
|
103
103
|
- lib/labimotion/utils/serializer.rb
|
104
|
+
- lib/labimotion/utils/units.rb
|
104
105
|
- lib/labimotion/utils/utils.rb
|
105
106
|
- lib/labimotion/version.rb
|
106
107
|
homepage: https://github.com/LabIMotion/labimotion
|