Skip to content
Snippets Groups Projects
Commit 182d3986 authored by Swen Vermeul's avatar Swen Vermeul
Browse files

Added documentation for various ELN settings

parent 3323ea12
No related branches found
No related tags found
No related merge requests found
...@@ -208,19 +208,18 @@ o.get_tags() ...@@ -208,19 +208,18 @@ o.get_tags()
The first step in creating a new entity type is to create a so called **property type**: The first step in creating a new entity type is to create a so called **property type**:
``` ```
pt = o.new_property_type( pt_text = o.new_property_type(
code = 'MY_NEW_PROPERTY_TYPE', code = 'MY_NEW_PROPERTY_TYPE',
label = 'yet another property type', label = 'yet another property type',
description = 'my first property', description = 'my first property',
dataType = 'VARCHAR', dataType = 'VARCHAR',
) )
pt.save() pt_text.save()
pt_int = o.new_property_type( pt_int = o.new_property_type(
code = '$DEFAULT_OBJECT_TYPE', code = 'MY_NUMBER',
label = 'default object type for ELN-LIMS', label = 'property contains a number',
dataType = 'VARCHAR', dataType = 'INTEGER',
managedInternally = True,
) )
pt_int.save() pt_int.save()
...@@ -232,6 +231,24 @@ pt_voc = o.new_property_type( ...@@ -232,6 +231,24 @@ pt_voc = o.new_property_type(
vocabulary = 'STORAGE', vocabulary = 'STORAGE',
) )
pt_voc.save() pt_voc.save()
pt_richtext = o.new_property_type(
code = 'MY_RICHTEXT_PROPERTY',
label = 'richtext data',
description = 'property contains rich text',
dataType = 'MULTILINE_VARCHAR',
metaData = {'custom_widget' : 'Word Processor'}
)
pt_richtext.save()
pt_spread = o.new_property_type(
code = 'MY_TABULAR_DATA',
label = 'data in a table',
description = 'property contains a spreadsheet',
dataType = 'XML',
metaData = {'custom_widget': 'Spreadsheet'}
)
pt_spread.save()
``` ```
The `dataType` attribute can contain any of these values: The `dataType` attribute can contain any of these values:
...@@ -247,7 +264,13 @@ The `dataType` attribute can contain any of these values: ...@@ -247,7 +264,13 @@ The `dataType` attribute can contain any of these values:
* `CONTROLLEDVOCABULARY` * `CONTROLLEDVOCABULARY`
* `MATERIAL` * `MATERIAL`
When choosing `CONTROLLEDVOCABULARY`, you must specify a `vocabulary` attribute (see example). Likewise, when choosing `MATERIAL`, a `materialType` attribute must be provided. PropertyTypes that start with a \$ are by definition `managedInternally` and therefore this attribute must be set to True. When choosing `CONTROLLEDVOCABULARY`, you must specify a `vocabulary` attribute (see example). Likewise, when choosing `MATERIAL`, a `materialType` attribute must be provided.
To create a **richtext property**, use `MULTILINE_VARCHAR` as `dataType` and set `metaData` to `{'custom_widget' : 'Word Processor'}` as shown in the example above.
To create a **tabular, spreadsheet-like property**, use `XML` as `dataType` and set `metaData` to `{'custom_widget' : 'Spreadhseet'}`as shown in the example above.
**Note**: PropertyTypes that start with a \$ are by definition `managedInternally` and therefore this attribute must be set to True.
## create sample types / object types ## create sample types / object types
...@@ -272,9 +295,6 @@ sample_type = o.new_sample_type( ...@@ -272,9 +295,6 @@ sample_type = o.new_sample_type(
sample_type.save() sample_type.save()
``` ```
## assign and revoke properties to sample type / object type ## assign and revoke properties to sample type / object type
The third step, after saving the sample type, is to **assign or revoke properties** to the newly created sample type. This assignment procedure applies to all entity types (dataset type, experiment type). The third step, after saving the sample type, is to **assign or revoke properties** to the newly created sample type. This assignment procedure applies to all entity types (dataset type, experiment type).
...@@ -1078,7 +1098,7 @@ ds_new.save() ...@@ -1078,7 +1098,7 @@ ds_new.save()
* relative path will be shortened to its basename. For example: * relative path will be shortened to its basename. For example:
| local | openBIS | | local | openBIS |
|----------------------------|------------| | -------------------------- | ---------- |
| `../../myData/` | `myData/` | | `../../myData/` | `myData/` |
| `some/experiment/results/` | `results/` | | `some/experiment/results/` | `results/` |
...@@ -1302,3 +1322,89 @@ term.move_after_term('-40') ...@@ -1302,3 +1322,89 @@ term.move_after_term('-40')
term.save() term.save()
term.delete() term.delete()
``` ```
## Change ELN Settings via pyBIS
### Main Menu
The ELN settings are stored as a **JSON string** in the `$eln_settings` property of the `GENERAL_ELN_SETTINGS` sample. You can show the **Main Menu settings** like this:
```python
import json
settings_sample = o.get_sample("/ELN_SETTINGS/GENERAL_ELN_SETTINGS")
settings = json.loads(settings_sample.props["$eln_settings"])
print(settings["mainMenu"])
{'showLabNotebook': True,
'showInventory': True,
'showStock': True,
'showObjectBrowser': True,
'showExports': True,
'showStorageManager': True,
'showAdvancedSearch': True,
'showUnarchivingHelper': True,
'showTrashcan': False,
'showVocabularyViewer': True,
'showUserManager': True,
'showUserProfile': True,
'showZenodoExportBuilder': False,
'showBarcodes': False,
'showDatasets': True}
```
To modify the **Main Menu settings**, you have to change the settings dictionary, convert it back to json and save the sample:
```python
settings['mainMenu']['showTrashcan'] = False
settings_sample.props['$eln_settings'] = json.dumps(settings)
settings_sample.save()
```
### Storages
The **ELN storages settings** can be found in the samples of project `/ELN_SETTINGS/STORAGES`
```python
o.get_samples(project='/ELN_SETTINGS/STORAGES')
```
To change the settings, just change the sample's properties and save the sample:
```python
sto = o.get_sample('/ELN_SETTINGS/STORAGES/BENCH')
sto.props()
{'$name': 'Bench',
'$storage.row_num': '1',
'$storage.column_num': '1',
'$storage.box_num': '9999',
'$storage.storage_space_warning': '80',
'$storage.box_space_warning': '80',
'$storage.storage_validation_level': 'BOX_POSITION',
'$xmlcomments': None,
'$annotations_state': None}
sto.props['$storage.box_space_warning']= '80'
sto.save()
```
### Templates
The **ELN templates settings** can be found in the samples of project `/ELN_SETTINGS/TEMPLATES`
```python
o.get_samples(project='/ELN_SETTINGS/TEMPLATES')
```
To change the settings, use the same technique as shown above with the storages settings.
### Custom Widgets
To change the **Custom Widgets settings**, get the `property_type` and set the `metaData` attribute:
```python
pt = o.get_property_type('YEAST.SOURCE')
pt.metaData = {'custom_widget': 'Spreadsheet'}
pt.save()
```
Currently, the value of the `custom_widget` key can be set to either
- `Spreadsheet` (for tabular, Excel-like data)
- `Word Processor` (for rich text data)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment