labimotion 1.4.1 → 2.0.0.rc2
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 +1 -0
- data/lib/labimotion/apis/generic_klass_api.rb +3 -2
- data/lib/labimotion/apis/labimotion_api.rb +13 -0
- data/lib/labimotion/apis/standard_api.rb +26 -0
- data/lib/labimotion/apis/standard_layer_api.rb +100 -0
- data/lib/labimotion/apis/vocabulary_api.rb +107 -0
- data/lib/labimotion/entities/dataset_entity.rb +2 -1
- data/lib/labimotion/entities/properties_entity.rb +167 -55
- data/lib/labimotion/entities/segment_entity.rb +1 -0
- data/lib/labimotion/entities/vocabulary_entity.rb +39 -0
- data/lib/labimotion/helpers/element_helpers.rb +8 -6
- data/lib/labimotion/helpers/param_helpers.rb +137 -82
- data/lib/labimotion/helpers/segment_helpers.rb +1 -1
- data/lib/labimotion/helpers/vocabulary_helpers.rb +16 -0
- data/lib/labimotion/libs/converter.rb +13 -33
- data/lib/labimotion/libs/data/vocab/Standard.json +385 -0
- data/lib/labimotion/libs/data/vocab/System.json +131 -0
- data/lib/labimotion/libs/nmr_mapper.rb +2 -1
- data/lib/labimotion/libs/sample_association.rb +4 -0
- data/lib/labimotion/libs/vocabulary_handler.rb +118 -0
- data/lib/labimotion/models/concerns/attachment_converter.rb +5 -4
- data/lib/labimotion/models/concerns/datasetable.rb +1 -0
- data/lib/labimotion/models/concerns/segmentable.rb +2 -0
- data/lib/labimotion/models/std_layer.rb +9 -0
- data/lib/labimotion/models/std_layers_revision.rb +9 -0
- data/lib/labimotion/models/vocabulary.rb +12 -0
- data/lib/labimotion/version.rb +1 -1
- data/lib/labimotion.rb +10 -0
- metadata +20 -5
@@ -0,0 +1,385 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"identifier": "std-atmosphere",
|
4
|
+
"name": "atmosphere",
|
5
|
+
"label": "Atmosphere",
|
6
|
+
"field_type": "text",
|
7
|
+
"ontology": {
|
8
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C54711",
|
9
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C54711",
|
10
|
+
"short_form": "NCIT_C54711",
|
11
|
+
"obo_id": "NCIT:C54711",
|
12
|
+
"label": "Atmosphere",
|
13
|
+
"description": [
|
14
|
+
"Non-SI unit of pressure equal to 101 325 Pa."
|
15
|
+
],
|
16
|
+
"ontology_name": "ncit",
|
17
|
+
"ontology_prefix": "NCIT",
|
18
|
+
"type": "class"
|
19
|
+
},
|
20
|
+
"source": "Standard"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"identifier": "std-calibration",
|
24
|
+
"name": "calibration",
|
25
|
+
"label": "Calibration",
|
26
|
+
"field_type": "text",
|
27
|
+
"ontology": {
|
28
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C69187",
|
29
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C69187",
|
30
|
+
"short_form": "NCIT_C69187",
|
31
|
+
"obo_id": "NCIT:C69187",
|
32
|
+
"label": "Calibration",
|
33
|
+
"description": [
|
34
|
+
"The act of checking or adjusting (by comparison with a standard) the accuracy of a measuring instrument."
|
35
|
+
],
|
36
|
+
"ontology_name": "ncit",
|
37
|
+
"ontology_prefix": "NCIT",
|
38
|
+
"type": "class"
|
39
|
+
},
|
40
|
+
"source": "Standard"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"identifier": "std-coating",
|
44
|
+
"name": "coating",
|
45
|
+
"label": "Coating",
|
46
|
+
"field_type": "text",
|
47
|
+
"ontology": {
|
48
|
+
"id": "afo:class:http://purl.allotrope.org/ontologies/process#AFP_0001986",
|
49
|
+
"iri": "http://purl.allotrope.org/ontologies/process#AFP_0001986",
|
50
|
+
"short_form": "AFP_0001986",
|
51
|
+
"obo_id": "AFP:0001986",
|
52
|
+
"label": "coating",
|
53
|
+
"description": [
|
54
|
+
"The application of a thin cover to a material. [CHMO]"
|
55
|
+
],
|
56
|
+
"ontology_name": "afo",
|
57
|
+
"ontology_prefix": "AFO",
|
58
|
+
"type": "class"
|
59
|
+
},
|
60
|
+
"source": "Standard"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"identifier": "std-coating_material",
|
64
|
+
"name": "coating_material",
|
65
|
+
"label": "Coating Material",
|
66
|
+
"field_type": "text",
|
67
|
+
"ontology": {
|
68
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C172794",
|
69
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C172794",
|
70
|
+
"short_form": "NCIT_C172794",
|
71
|
+
"obo_id": "NCIT:C172794",
|
72
|
+
"label": "Coating Material",
|
73
|
+
"description": [
|
74
|
+
"A layer of material covering the surface of a device."
|
75
|
+
],
|
76
|
+
"ontology_name": "ncit",
|
77
|
+
"ontology_prefix": "NCIT",
|
78
|
+
"type": "class"
|
79
|
+
},
|
80
|
+
"source": "Standard"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"identifier": "std-wavelength",
|
84
|
+
"name": "wavelength",
|
85
|
+
"label": "Wavelength",
|
86
|
+
"field_type": "text",
|
87
|
+
"ontology": {
|
88
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C48158",
|
89
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C48158",
|
90
|
+
"short_form": "NCIT_C48158",
|
91
|
+
"obo_id": "NCIT:C48158",
|
92
|
+
"label": "Wavelength",
|
93
|
+
"description": [
|
94
|
+
"The distance (measured in the direction of propagation) between two points in the same phase in consecutive cycles of a wave."
|
95
|
+
],
|
96
|
+
"ontology_name": "ncit",
|
97
|
+
"ontology_prefix": "NCIT",
|
98
|
+
"type": "class"
|
99
|
+
},
|
100
|
+
"source": "Standard"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"identifier": "std-sample_size",
|
104
|
+
"name": "sample_size",
|
105
|
+
"label": "Sample Size",
|
106
|
+
"field_type": "text",
|
107
|
+
"ontology": {
|
108
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C53190",
|
109
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C53190",
|
110
|
+
"short_form": "NCIT_C53190",
|
111
|
+
"obo_id": "NCIT:C53190",
|
112
|
+
"label": "Sample Size",
|
113
|
+
"ontology_name": "ncit",
|
114
|
+
"ontology_prefix": "NCIT",
|
115
|
+
"type": "class"
|
116
|
+
},
|
117
|
+
"source": "Standard"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"identifier": "std-instrument",
|
121
|
+
"name": "instrument",
|
122
|
+
"label": "Instrument",
|
123
|
+
"field_type": "text",
|
124
|
+
"ontology": {
|
125
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000463",
|
126
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000463",
|
127
|
+
"short_form": "NMR:1000463",
|
128
|
+
"label": "instrument",
|
129
|
+
"description": [
|
130
|
+
"Description of the instrument or the mass spectrometer."
|
131
|
+
],
|
132
|
+
"ontology_name": "nmrcv",
|
133
|
+
"ontology_prefix": "NMRCV",
|
134
|
+
"type": "class"
|
135
|
+
},
|
136
|
+
"source": "Standard"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"identifier": "std-irr_freq",
|
140
|
+
"name": "irr_freq",
|
141
|
+
"label": "Irradiation frequency",
|
142
|
+
"field_type": "text",
|
143
|
+
"ontology": {
|
144
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000463",
|
145
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000463",
|
146
|
+
"short_form": "NMR:1000463",
|
147
|
+
"label": "instrument",
|
148
|
+
"description": [
|
149
|
+
"Description of the instrument or the mass spectrometer."
|
150
|
+
],
|
151
|
+
"ontology_name": "nmrcv",
|
152
|
+
"ontology_prefix": "NMRCV",
|
153
|
+
"type": "class"
|
154
|
+
},
|
155
|
+
"source": "Standard"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"identifier": "std-num_scans",
|
159
|
+
"name": "num_scans",
|
160
|
+
"label": "Number of scans",
|
161
|
+
"field_type": "text",
|
162
|
+
"ontology": {
|
163
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400087",
|
164
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1400087",
|
165
|
+
"short_form": "NMR:1400087",
|
166
|
+
"label": "number of scans",
|
167
|
+
"description": [
|
168
|
+
"def: The number of repeat scans performed and summed to create the data set for an NMR sample."
|
169
|
+
],
|
170
|
+
"ontology_name": "nmrcv",
|
171
|
+
"ontology_prefix": "NMRCV",
|
172
|
+
"type": "class"
|
173
|
+
},
|
174
|
+
"source": "Standard"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"identifier": "std-sample_ph",
|
178
|
+
"name": "sample_ph",
|
179
|
+
"label": "Sample pH",
|
180
|
+
"field_type": "text",
|
181
|
+
"ontology": {
|
182
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000019",
|
183
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000019",
|
184
|
+
"short_form": "NMR:1000019",
|
185
|
+
"label": "sample pH",
|
186
|
+
"ontology_name": "nmrcv",
|
187
|
+
"ontology_prefix": "NMRCV",
|
188
|
+
"type": "class"
|
189
|
+
},
|
190
|
+
"source": "Standard"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"identifier": "std-pulse_seq",
|
194
|
+
"name": "pulse_seq",
|
195
|
+
"label": "NMR pulse sequence",
|
196
|
+
"field_type": "text",
|
197
|
+
"ontology": {
|
198
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400037",
|
199
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1400037",
|
200
|
+
"short_form": "NMR:1400037",
|
201
|
+
"label": "NMR pulse sequence",
|
202
|
+
"description": [
|
203
|
+
"def: A sequence of excitation pulses.",
|
204
|
+
"http://www.bmrb.wisc.edu/tools/choose_pulse_info.php"
|
205
|
+
],
|
206
|
+
"ontology_name": "nmrcv",
|
207
|
+
"ontology_prefix": "NMRCV",
|
208
|
+
"type": "class"
|
209
|
+
},
|
210
|
+
"source": "Standard"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"identifier": "std-sample_conc",
|
214
|
+
"name": "sample_conc",
|
215
|
+
"label": "sample concentration",
|
216
|
+
"field_type": "text",
|
217
|
+
"ontology": {
|
218
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000006",
|
219
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000006",
|
220
|
+
"short_form": "NMR:1000006",
|
221
|
+
"label": "sample concentration",
|
222
|
+
"description": [
|
223
|
+
"Concentration of sample in picomol/ul, femtomol/ul or attomol/ul solution used."
|
224
|
+
],
|
225
|
+
"ontology_name": "nmrcv",
|
226
|
+
"ontology_prefix": "NMRCV",
|
227
|
+
"type": "class"
|
228
|
+
},
|
229
|
+
"source": "Standard"
|
230
|
+
},
|
231
|
+
{
|
232
|
+
"identifier": "std-scan_range",
|
233
|
+
"name": "scan_range",
|
234
|
+
"label": "scan range",
|
235
|
+
"field_type": "text",
|
236
|
+
"ontology": {
|
237
|
+
"id": "afo:class:http://purl.allotrope.org/ontologies/result#AFR_0001957",
|
238
|
+
"iri": "http://purl.allotrope.org/ontologies/result#AFR_0001957",
|
239
|
+
"short_form": "AFR_0001957",
|
240
|
+
"obo_id": "AFR:0001957",
|
241
|
+
"label": "detector scan rate setting",
|
242
|
+
"description": [
|
243
|
+
"A detector setting that sets the frequency of scans per time unit. [Allotrope]"
|
244
|
+
],
|
245
|
+
"ontology_name": "afo",
|
246
|
+
"ontology_prefix": "AFO",
|
247
|
+
"type": "class"
|
248
|
+
},
|
249
|
+
"source": "Standard"
|
250
|
+
},
|
251
|
+
{
|
252
|
+
"identifier": "std-software_name",
|
253
|
+
"name": "software_name",
|
254
|
+
"label": "Software Name",
|
255
|
+
"field_type": "text",
|
256
|
+
"ontology": {
|
257
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C150832",
|
258
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C150832",
|
259
|
+
"short_form": "NCIT_C150832",
|
260
|
+
"obo_id": "NCIT:C150832",
|
261
|
+
"label": "Software Name",
|
262
|
+
"description": [
|
263
|
+
"The literal identifier of the software program."
|
264
|
+
],
|
265
|
+
"ontology_name": "ncit",
|
266
|
+
"ontology_prefix": "NCIT",
|
267
|
+
"type": "class"
|
268
|
+
},
|
269
|
+
"source": "Standard"
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"identifier": "std-software_ver",
|
273
|
+
"name": "software_ver",
|
274
|
+
"label": "Software Version",
|
275
|
+
"field_type": "text",
|
276
|
+
"ontology": {
|
277
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C111093",
|
278
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C111093",
|
279
|
+
"short_form": "NCIT_C111093",
|
280
|
+
"obo_id": "NCIT:C111093",
|
281
|
+
"label": "Software Version",
|
282
|
+
"description": [
|
283
|
+
"A form or variant of software; one of a sequence of copies of a software program, each incorporating new modifications."
|
284
|
+
],
|
285
|
+
"ontology_name": "ncit",
|
286
|
+
"ontology_prefix": "NCIT",
|
287
|
+
"type": "class"
|
288
|
+
},
|
289
|
+
"source": "Standard"
|
290
|
+
},
|
291
|
+
{
|
292
|
+
"identifier": "std-solvent",
|
293
|
+
"name": "nmr_solvent",
|
294
|
+
"label": "NMR Solvent",
|
295
|
+
"field_type": "text",
|
296
|
+
"ontology": {
|
297
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000330",
|
298
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000330",
|
299
|
+
"short_form": "NMR:1000330",
|
300
|
+
"label": "NMR solvent",
|
301
|
+
"description": [
|
302
|
+
"Use Chebi entities here."
|
303
|
+
],
|
304
|
+
"ontology_name": "nmrcv",
|
305
|
+
"ontology_prefix": "NMRCV",
|
306
|
+
"type": "class"
|
307
|
+
},
|
308
|
+
"source": "Standard"
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"identifier": "std-sample_volume",
|
312
|
+
"name": "sample_volume",
|
313
|
+
"label": "sample volume",
|
314
|
+
"field_type": "text",
|
315
|
+
"ontology": {
|
316
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1000005",
|
317
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1000005",
|
318
|
+
"short_form": "NMR:1000005",
|
319
|
+
"label": "sample volume",
|
320
|
+
"description": [
|
321
|
+
"Total volume of solution used."
|
322
|
+
],
|
323
|
+
"ontology_name": "nmrcv",
|
324
|
+
"ontology_prefix": "NMRCV",
|
325
|
+
"type": "class"
|
326
|
+
},
|
327
|
+
"source": "Standard"
|
328
|
+
},
|
329
|
+
{
|
330
|
+
"identifier": "std-solvent_info",
|
331
|
+
"name": "solvent_info",
|
332
|
+
"label": "NMR solvent information",
|
333
|
+
"field_type": "text",
|
334
|
+
"ontology": {
|
335
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1002010",
|
336
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1002010",
|
337
|
+
"short_form": "NMR:1002010",
|
338
|
+
"label": "NMR solvent information",
|
339
|
+
"ontology_name": "nmrcv",
|
340
|
+
"ontology_prefix": "NMRCV",
|
341
|
+
"type": "class"
|
342
|
+
},
|
343
|
+
"source": "Standard"
|
344
|
+
},
|
345
|
+
{
|
346
|
+
"identifier": "std-sample_tube",
|
347
|
+
"name": "sample_tube",
|
348
|
+
"label": "NMR sample tube",
|
349
|
+
"field_type": "text",
|
350
|
+
"ontology": {
|
351
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400132",
|
352
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1400132",
|
353
|
+
"short_form": "NMR:1400132",
|
354
|
+
"label": "NMR sample tube",
|
355
|
+
"description": [
|
356
|
+
"http://en.wikipedia.org/wiki/NMR_tube",
|
357
|
+
"sortal dimensions are Vendor, Size (Diameter, length), Material (glass, quarz, pyrex ...), Frequency, Concentricity, OD and ID",
|
358
|
+
"The sample-tube holds the NMR sample and sits in the NMR probe. It is usually a glass tube of 5-20mm diameter."
|
359
|
+
],
|
360
|
+
"ontology_name": "nmrcv",
|
361
|
+
"ontology_prefix": "NMRCV",
|
362
|
+
"type": "class"
|
363
|
+
},
|
364
|
+
"source": "Standard"
|
365
|
+
},
|
366
|
+
{
|
367
|
+
"identifier": "temperature",
|
368
|
+
"name": "Temperature",
|
369
|
+
"label": "Temperature",
|
370
|
+
"field_type": "text",
|
371
|
+
"ontology": {
|
372
|
+
"id": "nmrcv:class:http://nmrML.org/nmrCV#NMR:1400025",
|
373
|
+
"iri": "http://nmrML.org/nmrCV#NMR:1400025",
|
374
|
+
"short_form": "NMR:1400025",
|
375
|
+
"label": "sample temperature in magnet",
|
376
|
+
"description": [
|
377
|
+
"def: The temperature of an NMR sample whilst in the magnet of an NMR instrument."
|
378
|
+
],
|
379
|
+
"ontology_name": "nmrcv",
|
380
|
+
"ontology_prefix": "NMRCV",
|
381
|
+
"type": "class"
|
382
|
+
},
|
383
|
+
"source": "Standard"
|
384
|
+
}
|
385
|
+
]
|
@@ -0,0 +1,131 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"identifier": "dateTime-create",
|
5
|
+
"name": "create_time",
|
6
|
+
"label": "Create Time",
|
7
|
+
"field_type": "datetime",
|
8
|
+
"opid": 9,
|
9
|
+
"term_id": "NCIT_C164483",
|
10
|
+
"ontology": {
|
11
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C164483",
|
12
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C164483",
|
13
|
+
"type": "class",
|
14
|
+
"label": "Created Date",
|
15
|
+
"obo_id": "NCIT:C164483",
|
16
|
+
"short_form": "NCIT_C164483",
|
17
|
+
"description": [
|
18
|
+
"The date on which the activity or entity is created."
|
19
|
+
],
|
20
|
+
"ontology_name": "ncit",
|
21
|
+
"ontology_prefix": "NCIT"
|
22
|
+
},
|
23
|
+
"source": "System",
|
24
|
+
"voc": {
|
25
|
+
"source": "System"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": 2,
|
30
|
+
"identifier": "dateTime-update",
|
31
|
+
"name": "update_time",
|
32
|
+
"label": "Update Time",
|
33
|
+
"field_type": "datetime",
|
34
|
+
"opid": 9,
|
35
|
+
"term_id": "NCIT_C25164",
|
36
|
+
"ontology": {
|
37
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C25710",
|
38
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C25710",
|
39
|
+
"short_form": "NCIT_C25710",
|
40
|
+
"obo_id": "NCIT:C25710",
|
41
|
+
"label": "Update",
|
42
|
+
"description": [
|
43
|
+
"Make current; supply with recent information or technology."
|
44
|
+
],
|
45
|
+
"ontology_name": "ncit",
|
46
|
+
"ontology_prefix": "NCIT",
|
47
|
+
"type": "class"
|
48
|
+
},
|
49
|
+
"source": "System",
|
50
|
+
"voc": {
|
51
|
+
"source": "System"
|
52
|
+
}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"id": 4,
|
56
|
+
"identifier": "user-name",
|
57
|
+
"name": "creator",
|
58
|
+
"label": "Creator",
|
59
|
+
"field_type": "text",
|
60
|
+
"opid": 9,
|
61
|
+
"term_id": "NCIT_C42628",
|
62
|
+
"ontology": {
|
63
|
+
"id": "ncit:class:http://purl.obolibrary.org/obo/NCIT_C42628",
|
64
|
+
"iri": "http://purl.obolibrary.org/obo/NCIT_C42628",
|
65
|
+
"type": "class",
|
66
|
+
"label": "Created By",
|
67
|
+
"obo_id": "NCIT:C42628",
|
68
|
+
"short_form": "NCIT_C42628",
|
69
|
+
"description": [
|
70
|
+
"Indicates the person or authoritative body who brought the item into existence."
|
71
|
+
],
|
72
|
+
"ontology_name": "ncit",
|
73
|
+
"ontology_prefix": "NCIT"
|
74
|
+
},
|
75
|
+
"source": "User",
|
76
|
+
"voc": {
|
77
|
+
"source": "User"
|
78
|
+
}
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"id": 2,
|
82
|
+
"identifier": "element-id",
|
83
|
+
"name": "element_id",
|
84
|
+
"label": "Element Id",
|
85
|
+
"field_type": "text",
|
86
|
+
"opid": 9,
|
87
|
+
"term_id": "NCIT_C25364",
|
88
|
+
"source": "Element",
|
89
|
+
"voc": {
|
90
|
+
"source": "Element"
|
91
|
+
}
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"id": 5,
|
95
|
+
"identifier": "element-name",
|
96
|
+
"name": "element_name",
|
97
|
+
"label": "Element Name",
|
98
|
+
"field_type": "text",
|
99
|
+
"opid": 8,
|
100
|
+
"term_id": "NCIT_C42694",
|
101
|
+
"source": "Element",
|
102
|
+
"voc": {
|
103
|
+
"source": "Element"
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"id": 3,
|
108
|
+
"identifier": "element-short_label",
|
109
|
+
"name": "element_short_label",
|
110
|
+
"label": "Element Short Label",
|
111
|
+
"field_type": "text",
|
112
|
+
"opid": 9,
|
113
|
+
"term_id": "NCIT_C45561",
|
114
|
+
"source": "Element",
|
115
|
+
"voc": {
|
116
|
+
"source": "Element"
|
117
|
+
}
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"id": 3,
|
121
|
+
"identifier": "element-class",
|
122
|
+
"name": "element_class",
|
123
|
+
"label": "Element Class",
|
124
|
+
"field_type": "text",
|
125
|
+
"opid": 9,
|
126
|
+
"source": "Element",
|
127
|
+
"voc": {
|
128
|
+
"source": "Element"
|
129
|
+
}
|
130
|
+
}
|
131
|
+
]
|
@@ -13,7 +13,7 @@ module Labimotion
|
|
13
13
|
result = is_brucker_binary(id)
|
14
14
|
if result[:is_bagit] == true
|
15
15
|
att.update_column(:con_state, Labimotion::ConState::CONVERTED)
|
16
|
-
Labimotion::Converter.metadata(id)
|
16
|
+
Labimotion::Converter.metadata(id, current_user)
|
17
17
|
Labimotion::ConState::COMPLETED
|
18
18
|
elsif result[:metadata] == nil
|
19
19
|
Labimotion::ConState::NONE
|
@@ -256,6 +256,7 @@ module Labimotion
|
|
256
256
|
new_prop[Labimotion::Prop::LAYERS]['set'][Labimotion::Prop::FIELDS][idx] = fi
|
257
257
|
end
|
258
258
|
end
|
259
|
+
new_prop = Labimotion::VocabularyHandler.update_vocabularies(new_prop, current_user, element)
|
259
260
|
dataset.properties = new_prop
|
260
261
|
dataset.save!
|
261
262
|
end
|
@@ -78,6 +78,8 @@ module Labimotion
|
|
78
78
|
field_samples = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_SAMPLE }
|
79
79
|
field_samples.each do |field|
|
80
80
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
81
|
+
return if field.is_a?(String) || properties.is_a?(String)
|
82
|
+
|
81
83
|
sid = field.dig('value', 'el_id')
|
82
84
|
next if sid.blank?
|
83
85
|
|
@@ -100,6 +102,8 @@ module Labimotion
|
|
100
102
|
field_elements = layer[Labimotion::Prop::FIELDS].select { |ss| ss['type'] == Labimotion::FieldType::DRAG_ELEMENT }
|
101
103
|
field_elements.each do |field|
|
102
104
|
idx = properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS].index(field)
|
105
|
+
next if field['value'].is_a?(String)
|
106
|
+
|
103
107
|
sid = field.dig('value', 'el_id')
|
104
108
|
next if element.nil? || sid.blank? || sid == element.id
|
105
109
|
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Labimotion
|
4
|
+
class VocabularyHandler
|
5
|
+
class << self
|
6
|
+
def update_vocabularies(properties, current_user, element)
|
7
|
+
properties[Labimotion::Prop::LAYERS].each do |key, layer|
|
8
|
+
update_layer_vocabularies(layer, key, properties, current_user, element)
|
9
|
+
end
|
10
|
+
properties
|
11
|
+
rescue StandardError => e
|
12
|
+
Labimotion.log_exception(e, current_user)
|
13
|
+
properties
|
14
|
+
end
|
15
|
+
|
16
|
+
def load_all_vocabularies
|
17
|
+
load_from_files + load_from_database
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_app_vocabularies
|
21
|
+
load_from_files
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def update_layer_vocabularies(layer, key, properties, current_user, element)
|
27
|
+
field_vocabularies = layer[Labimotion::Prop::FIELDS].select { |field| field['is_voc'] }
|
28
|
+
field_vocabularies.each do |field|
|
29
|
+
idx = layer[Labimotion::Prop::FIELDS].index(field)
|
30
|
+
val = get_vocabulary_value(field, current_user, element)
|
31
|
+
update_field_value(properties, key, idx, val) if val.present?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_vocabulary_value(field, current_user, element)
|
36
|
+
case field['source']
|
37
|
+
when 'System'
|
38
|
+
get_system_value(field)
|
39
|
+
when 'User'
|
40
|
+
get_user_value(field, current_user)
|
41
|
+
when 'Element'
|
42
|
+
get_element_value(field, element)
|
43
|
+
when 'Segment'
|
44
|
+
get_segment_value(field, element)
|
45
|
+
when 'Dataset'
|
46
|
+
# TODO: Implement Dataset logic here
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_system_value(field)
|
52
|
+
current_time = Time.now.strftime('%d/%m/%Y %H:%M')
|
53
|
+
case field['identifier']
|
54
|
+
when 'dateTime-update'
|
55
|
+
current_time
|
56
|
+
when 'dateTime-create'
|
57
|
+
current_time if field['value'].blank?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_user_value(field, current_user)
|
62
|
+
current_user.name if field['identifier'] == 'user-name' && current_user.present?
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_element_value(field, element)
|
66
|
+
case field['identifier']
|
67
|
+
when 'element-id'
|
68
|
+
element.id.to_s
|
69
|
+
when 'element-short_label'
|
70
|
+
element.short_label if element.has_attribute?(:short_label)
|
71
|
+
when 'element-name'
|
72
|
+
element.name if element.has_attribute?(:name)
|
73
|
+
when 'element-class'
|
74
|
+
element.class.name === 'Labimotion::Element' ? element.element_klass.label : element.class.name
|
75
|
+
else
|
76
|
+
ek = element.element_klass
|
77
|
+
return if ek.nil? || ek.identifier != field['source_id']
|
78
|
+
|
79
|
+
el_prop = element.properties
|
80
|
+
fields = el_prop[Labimotion::Prop::LAYERS][field['layer_id']][Labimotion::Prop::FIELDS]
|
81
|
+
fields.find { |ss| ss['field'] == field['field_id'] }&.dig('value')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_segment_value(field, element)
|
86
|
+
segments = element.segments.joins(:segment_klass).find_by('segment_klasses.identifier = ?', field['source_id'])
|
87
|
+
return if segments.nil?
|
88
|
+
|
89
|
+
seg_prop = segments.properties
|
90
|
+
fields = seg_prop[Labimotion::Prop::LAYERS][field['layer_id']][Labimotion::Prop::FIELDS]
|
91
|
+
fields.find { |ss| ss['field'] == field['field_id'] }&.dig('value')
|
92
|
+
end
|
93
|
+
|
94
|
+
def update_field_value(properties, key, idx, val)
|
95
|
+
properties[Labimotion::Prop::LAYERS][key][Labimotion::Prop::FIELDS][idx]['value'] = val
|
96
|
+
properties
|
97
|
+
end
|
98
|
+
|
99
|
+
def load_from_files
|
100
|
+
merged_data = []
|
101
|
+
merged_data.concat(load_json_file('System.json'))
|
102
|
+
merged_data.concat(load_json_file('Standard.json'))
|
103
|
+
merged_data
|
104
|
+
end
|
105
|
+
|
106
|
+
def load_json_file(filename)
|
107
|
+
file_path = File.join(__dir__, 'data', 'vocab', filename)
|
108
|
+
file_content = File.read(file_path)
|
109
|
+
JSON.parse(file_content)
|
110
|
+
end
|
111
|
+
|
112
|
+
def load_from_database
|
113
|
+
vocabularies = Labimotion::Vocabulary.all.sort_by(&:name)
|
114
|
+
Labimotion::VocabularyEntity.represent(vocabularies, serializable: true)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|