labimotion 2.2.0.rc18 → 2.3.0.rc3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac9e13a86048207de58add4ce3c2670dd3d3ece7b334103a4b8afef774309bd7
4
- data.tar.gz: a21c3957630ea45d248eec5f49999e31424d3ea30c70b3d9b34b11dbe3105c12
3
+ metadata.gz: b0961f712ff20e446cf716475b209f77990f76aceb5c96865fe0c499346e8e9c
4
+ data.tar.gz: f2e699a236095280fed0a264da3ec973e189a1e97721a641132e107bab030b3d
5
5
  SHA512:
6
- metadata.gz: 7ec1e065535fe7fbfa1c94f82f1f5f06057857aa6439b41fab7e8570b4b584276a9625fd5d806431a6abe3307b147107f6e91469c65b351bcf3b5a9f868d8d83
7
- data.tar.gz: 4ab8e424d00107d029dbe0cdd97740a2d2470994121c1d82b40fd902c5bbd1d1712849756da75631f675666ee39f09a4d56f0839452eb0a29a9b8a78c1ef37bc
6
+ metadata.gz: 65b886fcb89fc1eec184337c0ab4779b40a3cac97f2f3c801ff6d8479d1dd80195c738fe0a07241edb1cc3cae50061920c52c7e43f8f07036887f69bf117e58a
7
+ data.tar.gz: aa4a29222063fa59aeb2e2f9c06e1d64c481c58b9e4c9ff33d334718531225ca091986d573e3caec03ac42022240a170224d1af4f7619475edbc0b6ad65246bb
@@ -2,39 +2,103 @@
2
2
 
3
3
  module Labimotion
4
4
  class ConverterAPI < Grape::API
5
+ helpers Labimotion::DatasetHelpers
5
6
  helpers do
7
+ def load_converter_config!
8
+ @conf = Rails.configuration.converter&.url
9
+ @profile = Rails.configuration.converter&.profile
10
+ error!(406) unless @conf && @profile
11
+ end
12
+
13
+ def require_converter_admin!
14
+ error!(401) unless current_user.profile&.data&.fetch('converter_admin', false)
15
+ end
16
+
17
+ def uploaded_file
18
+ params[:file].is_a?(Array) ? params[:file][0] : params[:file]
19
+ end
6
20
  end
21
+
7
22
  resource :converter do
23
+ resource :datasets do
24
+ desc 'list Generic Dataset Klass'
25
+ get do
26
+ list = klass_list(true, false)
27
+ list.map do |kl|
28
+ pr = kl.properties_release
29
+ pr['name'] = kl.label
30
+ pr['ols'] = kl.ols_term_id
31
+ pr
32
+ end || []
33
+ end
34
+ end
35
+
36
+ resource :datasets_units do
37
+ desc 'list Generic Dataset Klass'
38
+ get do
39
+ Labimotion::Units::FIELDS
40
+ end
41
+ end
42
+
8
43
  resource :profiles do
44
+
9
45
  before do
10
- @conf = Rails.configuration.try(:converter).try(:url)
11
- @profile = Rails.configuration.try(:converter).try(:profile)
12
- error!(406) unless @conf && @profile
46
+ load_converter_config!
13
47
  end
14
- desc 'fetch profiles'
48
+
49
+ desc 'Fetch profiles (no admin required)'
15
50
  get do
16
51
  profiles = Labimotion::Converter.fetch_profiles
17
52
  { profiles: profiles, client: @profile }
18
53
  end
19
- desc 'create profile'
54
+
55
+ desc 'Create profile'
20
56
  post do
57
+ require_converter_admin!
21
58
  Labimotion::Converter.create_profile(params)
22
59
  end
23
- desc 'update profile'
60
+
24
61
  route_param :id do
62
+ desc 'Update profile'
25
63
  put do
64
+ require_converter_admin!
26
65
  Labimotion::Converter.update_profile(params)
27
66
  end
28
- end
29
- desc 'delete profile'
30
- route_param :id do
67
+
68
+ desc 'Delete profile'
31
69
  delete do
32
- id = params[:id]
33
- Labimotion::Converter.delete_profile(id)
70
+ require_converter_admin!
71
+ Labimotion::Converter.delete_profile(params[:id])
34
72
  end
35
73
  end
36
- end
37
74
 
75
+ resource :restore do
76
+ route_param :profile_id,
77
+ requirements: {
78
+ profile_id: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/
79
+ } do
80
+
81
+ route_param :profile_version,
82
+ requirements: {
83
+ profile_version: /\d+\.\d+/
84
+ } do
85
+ get do
86
+ {test_version: params[:profile_id], version: params[:profile_version]}
87
+ end
88
+ desc 'Restore profile'
89
+ post do
90
+ require_converter_admin!
91
+
92
+ Labimotion::Converter.restore(
93
+ params[:profile_id],
94
+ params[:profile_version],
95
+ params[:hard]
96
+ )
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
38
102
  resource :structure do
39
103
  helpers do
40
104
  def convert_structure(molfile)
@@ -66,10 +130,8 @@ module Labimotion
66
130
 
67
131
  resource :options do
68
132
  before do
69
- error!(401) unless current_user.profile&.data['converter_admin'] == true
70
- @conf = Rails.configuration.try(:converter).try(:url)
71
- @profile = Rails.configuration.try(:converter).try(:profile)
72
- error!(406) unless @conf && @profile
133
+ load_converter_config!
134
+ require_converter_admin!
73
135
  end
74
136
  desc 'fetch options'
75
137
  get do
@@ -80,18 +142,31 @@ module Labimotion
80
142
 
81
143
  resource :tables do
82
144
  before do
83
- error!(401) unless current_user.profile&.data['converter_admin'] == true
84
- @conf = Rails.configuration.try(:converter).try(:url)
85
- @profile = Rails.configuration.try(:converter).try(:profile)
86
- error!(406) unless @conf && @profile
145
+ load_converter_config!
146
+ require_converter_admin!
87
147
  end
88
148
  desc 'create tables'
89
149
  post do
90
- res = Labimotion::Converter.create_tables(params[:file][0]['tempfile']) unless params[:file].empty?
91
- res['metadata']['file_name'] = params[:file][0]['filename']
150
+ file = uploaded_file
151
+ res = Labimotion::Converter.create_tables(file['tempfile']) unless file.nil?
152
+ res['metadata']['file_name'] = file['filename']
92
153
  res
93
154
  end
94
155
  end
156
+
157
+ resource :conversions do
158
+ before do
159
+ load_converter_config!
160
+ require_converter_admin!
161
+ end
162
+ desc 'convert file'
163
+ post do
164
+ file = uploaded_file
165
+ res = Labimotion::Converter.test_conversions(file['tempfile'], params[:format]) unless file.nil?
166
+ res
167
+ end
168
+ end
169
+
95
170
  end
96
171
  end
97
- end
172
+ end
@@ -51,6 +51,20 @@ module Labimotion
51
51
  { "key": "pmol", "label": "pmol", "nm": 1.0e12 }
52
52
  ]
53
53
  },
54
+ {
55
+ "type": "numeric",
56
+ "field": "areal_density",
57
+ "label": "Areal density",
58
+ "default": "",
59
+ "position": 38,
60
+ "placeholder": "areal density",
61
+ "units": [
62
+ { "key": "kg_m2", "label": "kg m<sup>-2</sup>", "nm": 1 },
63
+ { "key": "t_m2", "label": "t m<sup>-2</sup>", "nm": 0.001 },
64
+ { "key": "kg_cm2", "label": "kg cm<sup>-2</sup>", "nm": 1e-4 },
65
+ { "key": "g_m2", "label": "g m<sup>-2</sup>", "nm": 1000 }
66
+ ]
67
+ },
54
68
  {
55
69
  "type": "numeric",
56
70
  "field": "molarity",
@@ -93,16 +107,34 @@ module Labimotion
93
107
  "field": "conductivity",
94
108
  "label": "Conductivity",
95
109
  "default": "",
96
- "position": 66,
110
+ "position": 62,
97
111
  "placeholder": "conductivity",
98
- "units": [{ "key": "s_m", "label": "S/m", "nm": 1 }]
112
+ "units": [
113
+ { "key": "s_m", "label": "S/m", "nm": 1 },
114
+ { "key": "ms_cm", "label": "mS/cm", "nm": 10 }
115
+ ]
116
+ },
117
+ {
118
+ "type": "numeric",
119
+ "field": "currency",
120
+ "label": "Currency",
121
+ "default": "",
122
+ "position": 64,
123
+ "placeholder": "Currency",
124
+ "units": [
125
+ { "key": "eur", "label": "EUR", "nm": 1, "unit_type": "eur" },
126
+ { "key": "chf", "label": "CHF", "nm": 1, "unit_type": "chf" },
127
+ { "key": "gbp", "label": "GBP", "nm": 1, "unit_type": "gbp" },
128
+ { "key": "usd", "label": "USD", "nm": 1, "unit_type": "usd" },
129
+ { "key": "jpy", "label": "JPY", "nm": 1, "unit_type": "jpy" }
130
+ ]
99
131
  },
100
132
  {
101
133
  "type": "numeric",
102
134
  "field": "current",
103
135
  "label": "Current",
104
136
  "default": "",
105
- "position": 60,
137
+ "position": 67,
106
138
  "placeholder": "Current",
107
139
  "units": [
108
140
  { "key": "A", "label": "A", "nm": 1 },
@@ -251,6 +283,17 @@ module Labimotion
251
283
  { "key": "k_j", "label": "kJ", "nm": 1 }
252
284
  ]
253
285
  },
286
+ {
287
+ "type": "numeric",
288
+ "field": "free_energy",
289
+ "label": "Free Energy/enthalpy",
290
+ "default": "",
291
+ "position": 89,
292
+ "placeholder": "Free Energy/enthalpy",
293
+ "units": [
294
+ { "key": "kj_mol", "label": "kJ/mol", "nm": 1 }
295
+ ]
296
+ },
254
297
  {
255
298
  "type": "numeric",
256
299
  "field": "enzyme_activity",
@@ -260,9 +303,9 @@ module Labimotion
260
303
  "placeholder": "Enzyme activity",
261
304
  "units": [
262
305
  { "key": "u_l", "label": "U/L", "nm": 1 },
263
- { "key": "u_ml", "label": "U/mL", "nm": 10e-3 },
264
- { "key": "u_g", "label": "U/g", "nm": 10e-3 },
265
- { "key": "u_mg", "label": "U/mg", "nm": 10e-6 }
306
+ { "key": "u_ml", "label": "U/mL", "nm": 1e-3 },
307
+ { "key": "u_g", "label": "U/g", "nm": 1e-3 },
308
+ { "key": "u_mg", "label": "U/mg", "nm": 1e-6 }
266
309
  ]
267
310
  },
268
311
  {
@@ -284,9 +327,10 @@ module Labimotion
284
327
  "position": 100,
285
328
  "placeholder": "Flow rate",
286
329
  "units": [
287
- { "key": "ul_min", "label": "µl/min", "nm": 1000000 },
288
- { "key": "ml_min", "label": "ml/min", "nm": 1000 },
289
- { "key": "l_m", "label": "l/m", "nm": 1 }
330
+ { "key": "l_m", "label": "L/min", "nm": 1 },
331
+ { "key": "ml_min", "label": "mL/min", "nm": 1000 },
332
+ { "key": "ul_min", "label": "µL/min", "nm": 1000000 },
333
+ { "key": "ml_h", "label": "mL/h", "nm": 60000 }
290
334
  ]
291
335
  },
292
336
  {
@@ -297,19 +341,26 @@ module Labimotion
297
341
  "position": 103,
298
342
  "placeholder": "frequency",
299
343
  "units": [
300
- { "key": "mhz", "label": "MHz", "nm": 1000000 },
301
- { "key": "hz", "label": "Hz", "nm": 1000 },
302
- { "key": "khz", "label": "kHz", "nm": 1 }
344
+ { "key": "hz", "label": "Hz", "nm": 1 },
345
+ { "key": "khz", "label": "kHz", "nm": 1e-3 },
346
+ { "key": "mhz", "label": "MHz", "nm": 1e-6 }
303
347
  ]
304
348
  },
305
349
  {
306
350
  "type": "numeric",
307
351
  "field": "heating_rate",
308
- "label": "Heating rate",
352
+ "label": "Heating rate (Temperature ramp)",
309
353
  "default": "",
310
354
  "position": 106,
311
355
  "placeholder": "heating rate",
312
- "units": [{ "key": "k_min", "label": "K/min", "nm": 1 }]
356
+ "units": [
357
+ { "key": "k_min", "label": "K/min", "nm": 1 },
358
+ { "key": "k_s", "label": "K/s", "nm": 0.016666666666667 },
359
+ { "key": "k_h", "label": "K/h", "nm": 60 },
360
+ { "key": "degc_min", "label": "°C min<sup>-1</sup>", "nm": 1 },
361
+ { "key": "degc_s", "label": "°C s<sup>-1</sup>", "nm": 0.016666666666667 },
362
+ { "key": "degc_h", "label": "°C h<sup>-1</sup>", "nm": 60 }
363
+ ]
313
364
  },
314
365
  {
315
366
  "type": "numeric",
@@ -346,6 +397,29 @@ module Labimotion
346
397
  { "key": "ug", "label": "µg", "nm": 1000000 }
347
398
  ]
348
399
  },
400
+ {
401
+ "type": "numeric",
402
+ "field": "mass_fraction",
403
+ "label": "Mass fraction",
404
+ "default": "",
405
+ "position": 123,
406
+ "placeholder": "mass fraction",
407
+ "units": [
408
+ { "key": "wt_p", "label": "wt.%", "nm": 1 }
409
+ ]
410
+ },
411
+ {
412
+ "type": "numeric",
413
+ "field": "mass_loading",
414
+ "label": "Mass loading",
415
+ "default": "",
416
+ "position": 125,
417
+ "placeholder": "mass loading",
418
+ "units": [
419
+ { "key": "g_cm2", "label": "g cm<sup>-2</sup>", "nm": 1 },
420
+ { "key": "mg_cm2", "label": "mg cm<sup>-2</sup>", "nm": 1000 }
421
+ ]
422
+ },
349
423
  {
350
424
  "type": "numeric",
351
425
  "field": "mass_molecule",
@@ -358,6 +432,28 @@ module Labimotion
358
432
  { "key": "kilo_dalton", "label": "kD", "nm": 1 }
359
433
  ]
360
434
  },
435
+ {
436
+ "type": "numeric",
437
+ "field": "molar_conductivity",
438
+ "label": "Molar conductivity",
439
+ "default": "",
440
+ "position": 127,
441
+ "placeholder": "molar conductivity",
442
+ "units": [
443
+ { "key": "s_cm2_mol", "label": "S cm<sup>2</sup> mol<sup>-1</sup>", "nm": 1 }
444
+ ]
445
+ },
446
+ {
447
+ "type": "numeric",
448
+ "field": "molar_entropy",
449
+ "label": "Molar Entropy",
450
+ "default": "",
451
+ "position": 128,
452
+ "placeholder": "Molar Entropy",
453
+ "units": [
454
+ { "key": "j_mol_k", "label": "J/(mol*K)", "nm": 1 }
455
+ ]
456
+ },
361
457
  {
362
458
  "type": "numeric",
363
459
  "field": "molecular_weight",
@@ -402,6 +498,30 @@ module Labimotion
402
498
  { "key": "mbar", "label": "mbar", "nm": 1013.25 }
403
499
  ]
404
500
  },
501
+ {
502
+ "type": "numeric",
503
+ "field": "process_rate",
504
+ "label": "Process rate",
505
+ "default": "",
506
+ "position": 143,
507
+ "placeholder": "Process rate",
508
+ "units": [
509
+ { "key": "1_s", "label": "1/s", "nm": 1 },
510
+ { "key": "1_min", "label": "1/min", "nm": 60 },
511
+ { "key": "1_h", "label": "1/h", "nm": 3600 }
512
+ ]
513
+ },
514
+ {
515
+ "type": "numeric",
516
+ "field": "rate_constant",
517
+ "label": "Rate constant",
518
+ "default": "",
519
+ "position": 146,
520
+ "placeholder": "Rate constant",
521
+ "units": [
522
+ { "key": "1_m_s", "label": "1/(M*s)", "nm": 1 }
523
+ ]
524
+ },
405
525
  {
406
526
  "type": "numeric",
407
527
  "field": "reaction_rate",
@@ -410,8 +530,8 @@ module Labimotion
410
530
  "position": 150,
411
531
  "placeholder": "Reaction rate",
412
532
  "units": [
413
- { "key": "mol_lmin", "label": "mol/Lmin", "nm": 1 },
414
- { "key": "mol_lsec", "label": "mol/Ls", "nm": 60 }
533
+ { "key": "mol_lmin", "label": "mol L<sup>-1</sup> min<sup>-1</sup>", "nm": 1 },
534
+ { "key": "mol_lsec", "label": "mol L<sup>-1</sup> s<sup>-1</sup>", "nm": 0.016666666666667 }
415
535
  ]
416
536
  },
417
537
  {
@@ -448,8 +568,9 @@ module Labimotion
448
568
  "units": [
449
569
  { "key": "ma_g", "label": "mA/g", "nm": 1000, "unit_type": "mass" },
450
570
  { "key": "a_g", "label": "A/g", "nm": 1, "unit_type": "mass" },
571
+ { "key": "ma_cm2", "label": "mA/cm<sup>2</sup>", "nm": 1000, "unit_type": "area" },
451
572
  { "key": "a_cm2", "label": "A/cm<sup>2</sup>", "nm": 1, "unit_type": "area" },
452
- { "key": "ma_cm2", "label": "mA/cm<sup>2</sup>", "nm": 1000, "unit_type": "area" }
573
+ { "key": "a_mm2", "label": "A/mm<sup>2</sup>", "nm": 0.01, "unit_type": "area" }
453
574
  ]
454
575
  },
455
576
  {
@@ -495,7 +616,7 @@ module Labimotion
495
616
  { "key": "cm_s", "label": "cm/s", "nm": 1 },
496
617
  { "key": "mm_s", "label": "mm/s", "nm": 10 },
497
618
  { "key": "um_m", "label": "µm/min", "nm": 600000 },
498
- { "key": "nm_m", "label": "nm/min", "nm": 60000000 },
619
+ { "key": "nm_m", "label": "nm/min", "nm": 600000000 },
499
620
  { "key": "cm_h", "label": "cm/h", "nm": 3600 },
500
621
  { "key": "mm_h", "label": "mm/h", "nm": 36000 }
501
622
  ]
@@ -540,6 +661,31 @@ module Labimotion
540
661
  { "key": "K", "label": "K" }
541
662
  ]
542
663
  },
664
+ {
665
+ "type": "numeric",
666
+ "field": "tensile_force",
667
+ "label": "Tensile force",
668
+ "default": "",
669
+ "position": 185,
670
+ "placeholder": "tensile force",
671
+ "units": [
672
+ { "key": "n", "label": "N", "nm": 1 },
673
+ { "key": "kn", "label": "kN", "nm": 0.001 },
674
+ { "key": "mn", "label": "mN", "nm": 1000 }
675
+ ]
676
+ },
677
+ {
678
+ "type": "numeric",
679
+ "field": "tensile_stress",
680
+ "label": "Tensile stress",
681
+ "default": "",
682
+ "position": 186,
683
+ "placeholder": "tensile stress",
684
+ "units": [
685
+ { "key": "n_cm2", "label": "N cm<sup>-2</sup>", "nm": 1 },
686
+ { "key": "n_mm2", "label": "N mm<sup>-2</sup>", "nm": 0.01 }
687
+ ]
688
+ },
543
689
  {
544
690
  "type": "numeric",
545
691
  "field": "turnover_number",
@@ -575,7 +721,7 @@ module Labimotion
575
721
  "field": "voltage",
576
722
  "label": "Voltage",
577
723
  "default": "",
578
- "position": 200,
724
+ "position": 206,
579
725
  "placeholder": "voltage",
580
726
  "units": [
581
727
  { "key": "mv", "label": "mV", "nm": 1000 },
@@ -597,6 +743,17 @@ module Labimotion
597
743
  { "key": "nl", "label": "nl", "nm": 1000000000 }
598
744
  ]
599
745
  },
746
+ {
747
+ "type": "numeric",
748
+ "field": "volume_fraction",
749
+ "label": "Volume fraction",
750
+ "default": "",
751
+ "position": 218,
752
+ "placeholder": "volume fraction",
753
+ "units": [
754
+ { "key": "vol_p", "label": "vol.%", "nm": 1 }
755
+ ]
756
+ },
600
757
  {
601
758
  "type": "numeric",
602
759
  "field": "volumes_metric",
@@ -610,6 +767,6 @@ module Labimotion
610
767
  { "key": "m3", "label": "m³", "nm": 0.000001 }
611
768
  ]
612
769
  }
613
- ]
770
+ ]
614
771
  end
615
772
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '2.2.0.rc18'
5
+ VERSION = '2.3.0.rc3'
6
6
  end
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.2.0.rc18
4
+ version: 2.3.0.rc3
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: 2026-07-01 00:00:00.000000000 Z
12
+ date: 2026-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: caxlsx