Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • openbis/openbis-public/jupyter/jupyter-openbis-gui-server
1 result
Show changes
Commits on Source (2)
{
"ServerApp": {
"jpserver_extensions": {
"jupyter-openbis-server.main": true
}
}
}
...@@ -97,8 +97,6 @@ class DataSetTypesHandler(IPythonHandler): ...@@ -97,8 +97,6 @@ class DataSetTypesHandler(IPythonHandler):
return return
try: try:
dataset_types = conn.openbis.get_dataset_types()
# get all dataset types # get all dataset types
ds_type_dicts = [] ds_type_dicts = []
for dt in conn.openbis.get_dataset_types(): for dt in conn.openbis.get_dataset_types():
...@@ -106,23 +104,28 @@ class DataSetTypesHandler(IPythonHandler): ...@@ -106,23 +104,28 @@ class DataSetTypesHandler(IPythonHandler):
# get property assignments for every dataset-type # get property assignments for every dataset-type
# and add them in the key «propertyAssignments» # and add them in the key «propertyAssignments»
pas = dt.get_property_assignments() pas = dt.get_property_assignments()
pa_dicts = pas.df[['propertyType','mandatory','ordinal','section']].to_dict(orient='records')
dt_dict['propertyAssignments'] = pa_dicts pas_columns = ['propertyType', 'mandatory', 'ordinal', 'section']
if not set(pas.df).isdisjoint(pas_columns):
for pa_dict in pa_dicts: pa_dicts = pas.df[pas_columns].to_dict(orient='records')
# add a few more attributes to the property assignments dt_dict['propertyAssignments'] = pa_dicts
pt = conn.openbis.get_property_type(pa_dict['propertyType'])
pa_dict['code'] = pt.code for pa_dict in pa_dicts:
pa_dict['label'] = pt.label # add a few more attributes to the property assignments
pa_dict['description'] = pt.description pt = conn.openbis.get_property_type(pa_dict['propertyType'])
pa_dict['dataType'] = pt.dataType pa_dict['code'] = pt.code
# add vocabulary, if exists, as key «terms» pa_dict['label'] = pt.label
if pt.dataType == 'CONTROLLEDVOCABULARY': pa_dict['description'] = pt.description
terms = conn.openbis.get_terms(pt.vocabulary) pa_dict['dataType'] = pt.dataType
terms_dict = terms.df[['code','label','description','official','ordinal']].to_dict(orient='records') # add vocabulary, if exists, as key «terms»
pa_dict['terms'] = terms_dict if pt.dataType == 'CONTROLLEDVOCABULARY':
terms = conn.openbis.get_terms(pt.vocabulary)
ds_type_dicts.append(dt_dict) terms_columns = ['code', 'label', 'description', 'official', 'ordinal']
if not set(terms.df).isdisjoint(terms_columns):
terms_dict = terms.df[terms_columns].to_dict(orient='records')
pa_dict['terms'] = terms_dict
ds_type_dicts.append(dt_dict)
self.write({ self.write({
"dataSetTypes": ds_type_dicts "dataSetTypes": ds_type_dicts
......
...@@ -11,7 +11,7 @@ with open("README.md", "r", encoding="utf-8") as fh: ...@@ -11,7 +11,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setup( setup(
name='jupyter-openbis-server', name='jupyter-openbis-server',
version= '0.4.0', version= '0.4.1rc2',
author='Swen Vermeul | ID SIS | ETH Zürich', author='Swen Vermeul | ID SIS | ETH Zürich',
author_email='swen@ethz.ch', author_email='swen@ethz.ch',
description='Server Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself', description='Server Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself',
......