Creating inventory spaces using PyBIS?

Dear all,

I’m trying to define and fill our schema from python.
I noticed that I can create spaces with:

space_equipment_new = oBis.new_space(code=code_space_equipment, description='Equipment and devices')
space_equipment_new.save()

However, this ends up in Others, how do I make it appear in Inventory spaces?

Many thanks
Ulrich

Dear Ulrich,

this is described here: Space Management — Python documentation

Dear @cbarillari,

many thanks - yes, hm, I can create the new inventory space in the ELN without problem, but is it possible to do so from pyBIS?
The webpage refers to the ELN/Core UI?

All the best
Ulrich

Unfortunately not, because Inventory and Lab Notebook only exist in the ELN UI, not in openBIS.

You can create a space with pyBIS and by default it will be shown in the ELN under Lab Notebook. You then need to move it to the Inventory in the ELN Settings.

Dear Ulrich,

you can do this with pybis, but it’s a bit tricky. After you created a space you need to:

  1. load the global or group specific ELN settings as a sample/object (with get_sample)
  2. convert its property $eln_settings from JSON to python objects (with json.loads)
  3. add the space to the list inventorySpaces
  4. dump the settings back to JSON format (json.dumps) and apply to the property $eln_settings
  5. save the settings sample

This works for us.

2 Likes