bam-masterdata 0.8.2__tar.gz → 0.8.4__tar.gz
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.
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/PKG-INFO +1 -1
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/_version.py +3 -3
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/cli.py +9 -1
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/run_parser.py +9 -1
- {bam_masterdata-0.8.2/bam_masterdata/cli → bam_masterdata-0.8.4/bam_masterdata/excel}/excel_to_entities.py +11 -4
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/PKG-INFO +1 -1
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/SOURCES.txt +0 -1
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/index.md +1 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/references/api.md +2 -2
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/references/extra.md +6 -5
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/tutorials/parsing.md +12 -3
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/cli/test_run_parser.py +42 -0
- bam_masterdata-0.8.2/bam_masterdata/excel/excel_to_entities.py +0 -722
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.coveragerc +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.github/release.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.github/workflows/actions.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.github/workflows/coveralls.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.github/workflows/mkdocs-deploy.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.github/workflows/publish.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.gitignore +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/.vscode/settings.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/AUTHORS +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/LICENSE +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/LICENSE.datamodel +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/NOTICE +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/README.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/checker.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/masterdata_validator.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/source_loader.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/validation_rules/all_validation_rules.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/validation_rules/excel_validation_rules.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/checker/validation_rules/validation_rules.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/entities_to_excel.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/entities_to_rdf.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/cli/fill_masterdata.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/datamodel/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/datamodel/collection_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/datamodel/dataset_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/datamodel/object_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/datamodel/vocabulary_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/excel/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/logger.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/metadata/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/metadata/_maps.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/metadata/definitions.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/metadata/entities.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/metadata/entities_dict.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/openbis/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/openbis/get_entities.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/openbis/login.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/parsing/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/parsing/parsing.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/utils/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/utils/paths.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/utils/users.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata/utils/utils.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/dependency_links.txt +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/entry_points.txt +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/requires.txt +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/bam_masterdata.egg-info/top_level.txt +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/bammasterdata_blue_transparent.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/bammasterdata_blue_transparent_text.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/bammasterdata_blue_transparent_text.svg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/bammasterdata_blue_white.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/bammasterdata_blue_white_text.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/datastore-logo-white.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/datastore-logo.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/drawio/UML.drawio +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/drawio/checker-structure.drawio +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/drawio/levels_base_entities.drawio +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/drawio/masterdata-workflow.drawio +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/fonts/BAMKlavika-Light.ttf +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/fonts/BAMKlavika-LightItalic.ttf +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/fonts/BAMKlavika-Medium.ttf +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/fonts/BAMKlavika-MediumItalic.ttf +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/masterdata-workflow.drawio.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/Card1ParserApp.jpg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/Card2.jpg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/Card3Logs.jpg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/ETLParsingNewColors.drawio.png +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/ETLParsingNewColors.drawio.svg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/assets/parsing/LoginParserApp.jpg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/explanations/parsing_structure.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/explanations/schema_defs.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/howtos/object_references.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/howtos/overview.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/howtos/parsing/create_new_parsers.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/howtos/parsing/parser_app.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/references/glossary.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/stylesheets/extra.css +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/docs/tutorials/getting_started.md +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/mkdocs.yml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/pyproject.toml +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/scripts/install_python_dependencies.bat +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/scripts/install_python_dependencies.sh +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/scripts/pkg_size.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/setup.cfg +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/__init__.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/checker/test_source_loader.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/cli/test_entities_to_excel.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/cli/test_entities_to_rdf.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/conftest.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/datamodel_test/collection_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/datamodel_test/dataset_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/datamodel_test/object_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example01_codedoesnoteexists.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example02_codeexists_proptype_datatypechanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example03_codeexists_proptype_contvoccodechanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example04_codeexists_proptype_objectcodechanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example05_codeexists_proptype_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example06_codeexists_proptype_vocobjcodemiss.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example07_codeexists_objtype_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example08_codeexists_objtype_assignprop_listcodeschanged_add.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example09_codeexists_objtype_assignprop_listcodeschanged_del.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example10_codeexists_objtype_assignprop_codedoesnotexists.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example11_codeexists_objtype_assignprop_listcodeschanged_datatypechanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example12_codeexists_objtype_assignprop_listcodeschanged_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example13_codeexists_objtype_assignprop_coincide2objects.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example_incoming_excel.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example_incoming_python/collection_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example_incoming_python/dataset_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/example_incoming_python/object_types.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/masterdata_example.xlsx +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/masterdata_excel_output.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/checker/masterdata_python_output.json +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/cli/test_parser.txt +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/metadata/example_vocabulary.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/utils/example_prop_types_1.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/data/utils/example_prop_types_2.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/excel/test_excel_to_entities.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/metadata/test_definitions.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/metadata/test_entities.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/metadata/test_entities_dict.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/metadata/test_object_data_type.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/test_logger.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/utils/test_paths.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/utils/test_users.py +0 -0
- {bam_masterdata-0.8.2 → bam_masterdata-0.8.4}/tests/utils/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bam-masterdata
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
4
4
|
Summary: The BAM Data Store utility tools and masterdata models wrapped in a Python package with a front-end web interface.
|
|
5
5
|
Author-email: BAM Data Store <datastore@bam.de>
|
|
6
6
|
Maintainer-email: "Jose M. Pizarro" <jose.pizarro-blanco@bam.de>
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.8.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 8,
|
|
31
|
+
__version__ = version = '0.8.4'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 8, 4)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g79f8723d1'
|
|
@@ -617,7 +617,14 @@ def push_to_openbis(file_path, datamodel_path):
|
|
|
617
617
|
required=False,
|
|
618
618
|
help="OpenBIS space name",
|
|
619
619
|
)
|
|
620
|
-
|
|
620
|
+
@click.option(
|
|
621
|
+
"--collection-type",
|
|
622
|
+
"collection_type", # alias
|
|
623
|
+
type=click.Choice(["COLLECTION", "DEFAULT_EXPERIMENT"], case_sensitive=False),
|
|
624
|
+
default="COLLECTION",
|
|
625
|
+
help="Type of collection to create in openBIS. Options are 'COLLECTION' or 'DEFAULT_EXPERIMENT'. Defaults to 'COLLECTION'.",
|
|
626
|
+
)
|
|
627
|
+
def parser(files_parser, project_name, collection_name, space_name, collection_type):
|
|
621
628
|
parser_map = {} # TODO load from configuration from yaml file
|
|
622
629
|
parse_file_dict = {}
|
|
623
630
|
for parser_key, filepath in files_parser:
|
|
@@ -636,6 +643,7 @@ def parser(files_parser, project_name, collection_name, space_name):
|
|
|
636
643
|
project_name=project_name,
|
|
637
644
|
collection_name=collection_name,
|
|
638
645
|
files_parser=parse_file_dict,
|
|
646
|
+
collection_type=collection_type.upper(),
|
|
639
647
|
)
|
|
640
648
|
|
|
641
649
|
|
|
@@ -15,6 +15,7 @@ def run_parser(
|
|
|
15
15
|
project_name: str = "PROJECT",
|
|
16
16
|
collection_name: str = "",
|
|
17
17
|
files_parser: dict[AbstractParser, list[str]] = {},
|
|
18
|
+
collection_type: str = "COLLECTION",
|
|
18
19
|
) -> None:
|
|
19
20
|
"""
|
|
20
21
|
Run the parsers on the specified files and collect the results.
|
|
@@ -26,6 +27,7 @@ def run_parser(
|
|
|
26
27
|
project_name (str): The project in openBIS where the entities will be stored.
|
|
27
28
|
collection_name (str): The collection in openBIS where the entities will be stored.
|
|
28
29
|
files_parser (dict): A dictionary where keys are parser instances and values are lists of file paths to be parsed. E.g., {MasterdataParserExample(): ["path/to/file.json", "path/to/another_file.json"]}
|
|
30
|
+
collection_type (str): The type of collection to create in openBIS. Options are "COLLECTION" or "DEFAULT_EXPERIMENT". Defaults to "COLLECTION".
|
|
29
31
|
"""
|
|
30
32
|
# Ensure openbis is provided
|
|
31
33
|
if openbis is None:
|
|
@@ -41,6 +43,12 @@ def run_parser(
|
|
|
41
43
|
"No files or parsers to parse. Please provide valid file paths or contact an Admin to add missing parser."
|
|
42
44
|
)
|
|
43
45
|
return
|
|
46
|
+
# Ensure collection_type is valid
|
|
47
|
+
if collection_type not in ["COLLECTION", "DEFAULT_EXPERIMENT"]:
|
|
48
|
+
logger.error(
|
|
49
|
+
f"Invalid collection_type '{collection_type}'. Must be either 'COLLECTION' or 'DEFAULT_EXPERIMENT'."
|
|
50
|
+
)
|
|
51
|
+
return
|
|
44
52
|
|
|
45
53
|
# Specify the space
|
|
46
54
|
try:
|
|
@@ -91,7 +99,7 @@ def run_parser(
|
|
|
91
99
|
logger.info("Replacing collection code with uppercase and underscores.")
|
|
92
100
|
collection_openbis = openbis.new_collection(
|
|
93
101
|
code=collection_name.replace(" ", "_").upper(),
|
|
94
|
-
type=
|
|
102
|
+
type=collection_type,
|
|
95
103
|
project=project,
|
|
96
104
|
)
|
|
97
105
|
collection_openbis.save()
|
|
@@ -160,6 +160,8 @@ class MasterdataExcelExtractor:
|
|
|
160
160
|
sheet_title=sheet_title,
|
|
161
161
|
)
|
|
162
162
|
elif is_data:
|
|
163
|
+
# Normalize data type to uppercase
|
|
164
|
+
val = val.upper()
|
|
163
165
|
if val not in [dt.value for dt in DataType]:
|
|
164
166
|
self.logger.error(
|
|
165
167
|
error_message
|
|
@@ -581,10 +583,15 @@ class MasterdataExcelExtractor:
|
|
|
581
583
|
"permId": extracted_columns["Code"][i],
|
|
582
584
|
"code": extracted_columns["Code"][i],
|
|
583
585
|
}
|
|
584
|
-
for
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
586
|
+
for key, pybis_val in {
|
|
587
|
+
"Description": "descriptions",
|
|
588
|
+
"Url template": "url_template",
|
|
589
|
+
"Label": "label",
|
|
590
|
+
"Official": "official",
|
|
591
|
+
}.items():
|
|
592
|
+
if extracted_columns.get(key):
|
|
593
|
+
value = extracted_columns[key][i]
|
|
594
|
+
terms_dict[extracted_columns["Code"][i]][pybis_val] = value
|
|
588
595
|
|
|
589
596
|
return terms_dict
|
|
590
597
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bam-masterdata
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
4
4
|
Summary: The BAM Data Store utility tools and masterdata models wrapped in a Python package with a front-end web interface.
|
|
5
5
|
Author-email: BAM Data Store <datastore@bam.de>
|
|
6
6
|
Maintainer-email: "Jose M. Pizarro" <jose.pizarro-blanco@bam.de>
|
|
@@ -33,7 +33,6 @@ bam_masterdata/cli/__init__.py
|
|
|
33
33
|
bam_masterdata/cli/cli.py
|
|
34
34
|
bam_masterdata/cli/entities_to_excel.py
|
|
35
35
|
bam_masterdata/cli/entities_to_rdf.py
|
|
36
|
-
bam_masterdata/cli/excel_to_entities.py
|
|
37
36
|
bam_masterdata/cli/fill_masterdata.py
|
|
38
37
|
bam_masterdata/cli/run_parser.py
|
|
39
38
|
bam_masterdata/datamodel/__init__.py
|
|
@@ -62,7 +62,7 @@ cli/
|
|
|
62
62
|
|
|
63
63
|
---
|
|
64
64
|
|
|
65
|
-
::: bam_masterdata.
|
|
65
|
+
::: bam_masterdata.excel.excel_to_entities
|
|
66
66
|
options:
|
|
67
67
|
show_root_heading: true
|
|
68
68
|
members:
|
|
@@ -189,4 +189,4 @@ utils/
|
|
|
189
189
|
options:
|
|
190
190
|
show_root_heading: true
|
|
191
191
|
|
|
192
|
-
---
|
|
192
|
+
---
|
|
@@ -367,16 +367,17 @@ for obj_code, obj_data in object_types.items():
|
|
|
367
367
|
|
|
368
368
|
```bash
|
|
369
369
|
# Export all masterdata to Excel
|
|
370
|
-
|
|
370
|
+
bam_masterdata export_to_excel masterdata_export.xlsx
|
|
371
371
|
|
|
372
372
|
# Export specific entity types to JSON
|
|
373
|
-
|
|
373
|
+
bam_masterdata export_to_json --entity-types object_types dataset_types output.json
|
|
374
374
|
|
|
375
375
|
# Run consistency checker
|
|
376
|
-
|
|
376
|
+
bam_masterdata checker --verbose
|
|
377
377
|
|
|
378
378
|
# Fill masterdata from OpenBIS
|
|
379
|
-
|
|
379
|
+
# environment variables OPENBIS_USERNAME and OPENBIS_PASSWORD are required for authentication
|
|
380
|
+
bam_masterdata fill_masterdata --url https://openbis.example.com
|
|
380
381
|
```
|
|
381
382
|
|
|
382
383
|
### How to Generate Code from Masterdata
|
|
@@ -503,4 +504,4 @@ for entity_data in batch_data:
|
|
|
503
504
|
|
|
504
505
|
# Create all at once
|
|
505
506
|
result = openbis.create_objects(entities_to_create)
|
|
506
|
-
```
|
|
507
|
+
```
|
|
@@ -54,6 +54,7 @@ The whole process then depends on the inputs and output `run_parser()`:
|
|
|
54
54
|
- `space_name`: _string_, this coincides with the space name you have associated in your openBIS instance
|
|
55
55
|
- `project_name`: _string_, the name of the project where you want to store the parsed objects
|
|
56
56
|
- `collection_name`: _string_, optional, the name of the collection you want to store the parsed objects
|
|
57
|
+
- `collection_type`: _string_, optional, the type of collection to create in openBIS. Options are `"COLLECTION"` or `"DEFAULT_EXPERIMENT"`. Defaults to `"COLLECTION"`.
|
|
57
58
|
- `files_parser`: _dict_, a dictionary where the keys are the parser class instances (see below) and the values are the files you want to pass to the specific parser class
|
|
58
59
|
- **Output**: the metadata objects and relationships mapped to your space/project/collection in openBIS
|
|
59
60
|
|
|
@@ -193,10 +194,18 @@ run_parser(
|
|
|
193
194
|
space_name="MY_RESEARCH_SPACE",
|
|
194
195
|
project_name="MY_PROJECT",
|
|
195
196
|
collection_name="MY_EXPERIMENT_COLLECTION",
|
|
196
|
-
files_parser=files_parser
|
|
197
|
+
files_parser=files_parser,
|
|
198
|
+
collection_type="COLLECTION" # Optional: defaults to "COLLECTION"
|
|
197
199
|
)
|
|
198
200
|
```
|
|
199
201
|
|
|
202
|
+
!!! tip "Collection Types"
|
|
203
|
+
You can choose between two collection types:
|
|
204
|
+
- `"COLLECTION"` (default): A general-purpose collection type
|
|
205
|
+
- `"DEFAULT_EXPERIMENT"`: A collection type designed for experiments with additional metadata fields like start/end dates, experimental goals, etc.
|
|
206
|
+
|
|
207
|
+
If you don't specify `collection_type`, it defaults to `"COLLECTION"`. We recommend keeping the default `collection_type`, as future openBIS releases will get rid of the collection concept and we will, as a result, deprecate this feature.
|
|
208
|
+
|
|
200
209
|
### What Happens Next?
|
|
201
210
|
|
|
202
211
|
When you call `run_parser()`, the following steps occur automatically:
|
|
@@ -235,7 +244,7 @@ run_parser(
|
|
|
235
244
|
space_name="MY_RESEARCH_SPACE",
|
|
236
245
|
project_name="MY_PROJECT",
|
|
237
246
|
collection_name="MULTI_DATA_COLLECTION",
|
|
238
|
-
files_parser=files_parser
|
|
247
|
+
files_parser=files_parser,
|
|
239
248
|
)
|
|
240
249
|
```
|
|
241
250
|
|
|
@@ -456,7 +465,7 @@ def main():
|
|
|
456
465
|
space_name="RESEARCH_SPACE",
|
|
457
466
|
project_name="AUTOMATION_TEST",
|
|
458
467
|
collection_name="BATCH_EXPERIMENTS",
|
|
459
|
-
files_parser=files_parser
|
|
468
|
+
files_parser=files_parser,
|
|
460
469
|
)
|
|
461
470
|
|
|
462
471
|
print("Metadata injection complete!")
|
|
@@ -67,6 +67,7 @@ def test_run_parser_with_test_parser(cleared_log_storage, mock_openbis):
|
|
|
67
67
|
project_name="TEST_PROJECT",
|
|
68
68
|
collection_name="TEST_COLLECTION",
|
|
69
69
|
files_parser=files_parser,
|
|
70
|
+
collection_type="COLLECTION",
|
|
70
71
|
)
|
|
71
72
|
|
|
72
73
|
# Check that objects were created in openbis
|
|
@@ -105,6 +106,7 @@ def test_run_parser_with_object_reference(cleared_log_storage, mock_openbis):
|
|
|
105
106
|
project_name="TEST_PROJECT",
|
|
106
107
|
collection_name="TEST_COLLECTION",
|
|
107
108
|
files_parser=files_parser,
|
|
109
|
+
collection_type="COLLECTION",
|
|
108
110
|
)
|
|
109
111
|
|
|
110
112
|
# Only 2 instruments are created (the person is referenced but not persisted)
|
|
@@ -122,4 +124,44 @@ def test_run_parser_with_object_reference(cleared_log_storage, mock_openbis):
|
|
|
122
124
|
)
|
|
123
125
|
|
|
124
126
|
|
|
127
|
+
def test_run_parser_with_default_experiment_type(cleared_log_storage, mock_openbis):
|
|
128
|
+
"""Test run_parser with DEFAULT_EXPERIMENT collection type."""
|
|
129
|
+
file = "./tests/data/cli/test_parser.txt"
|
|
130
|
+
files_parser = {TestParser(): [file]}
|
|
131
|
+
run_parser(
|
|
132
|
+
openbis=mock_openbis,
|
|
133
|
+
space_name="USERNAME_SPACE",
|
|
134
|
+
project_name="TEST_PROJECT",
|
|
135
|
+
collection_name="TEST_COLLECTION",
|
|
136
|
+
files_parser=files_parser,
|
|
137
|
+
collection_type="DEFAULT_EXPERIMENT",
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
# Check that objects were created in openbis
|
|
141
|
+
assert len(mock_openbis._objects) == 1
|
|
142
|
+
|
|
143
|
+
# Check logs for success messages
|
|
144
|
+
assert any("Added test object" in log["event"] for log in cleared_log_storage)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def test_run_parser_defaults_to_collection_type(cleared_log_storage, mock_openbis):
|
|
148
|
+
"""Test that run_parser defaults to COLLECTION type when not specified."""
|
|
149
|
+
file = "./tests/data/cli/test_parser.txt"
|
|
150
|
+
files_parser = {TestParser(): [file]}
|
|
151
|
+
# Call without specifying collection_type - should default to "COLLECTION"
|
|
152
|
+
run_parser(
|
|
153
|
+
openbis=mock_openbis,
|
|
154
|
+
space_name="USERNAME_SPACE",
|
|
155
|
+
project_name="TEST_PROJECT",
|
|
156
|
+
collection_name="TEST_COLLECTION",
|
|
157
|
+
files_parser=files_parser,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Check that objects were created in openbis
|
|
161
|
+
assert len(mock_openbis._objects) == 1
|
|
162
|
+
|
|
163
|
+
# Check logs for success messages
|
|
164
|
+
assert any("Added test object" in log["event"] for log in cleared_log_storage)
|
|
165
|
+
|
|
166
|
+
|
|
125
167
|
# TODO add other tests for the different situations in `run_parser()` and parsers from `conftest.py`
|