bam-masterdata 0.6.2__tar.gz → 0.7.0__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.
Files changed (159) hide show
  1. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.github/workflows/mkdocs-deploy.yml +3 -4
  2. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.gitignore +4 -1
  3. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/PKG-INFO +3 -1
  4. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/README.md +1 -0
  5. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/_version.py +16 -3
  6. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/masterdata_validator.py +1 -1
  7. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/source_loader.py +1 -7
  8. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/cli.py +15 -121
  9. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/excel_to_entities.py +1 -4
  10. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/fill_masterdata.py +1 -2
  11. bam_masterdata-0.7.0/bam_masterdata/cli/run_parser.py +180 -0
  12. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/excel/excel_to_entities.py +1 -4
  13. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/metadata/entities.py +177 -118
  14. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/PKG-INFO +3 -1
  15. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/SOURCES.txt +20 -20
  16. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/requires.txt +1 -0
  17. bam_masterdata-0.7.0/docs/assets/drawio/UML.drawio +1258 -0
  18. bam_masterdata-0.7.0/docs/assets/parsing/Card1ParserApp.jpg +0 -0
  19. bam_masterdata-0.7.0/docs/assets/parsing/Card2.jpg +0 -0
  20. bam_masterdata-0.7.0/docs/assets/parsing/Card3Logs.jpg +0 -0
  21. bam_masterdata-0.7.0/docs/assets/parsing/ETLParsingNewColors.drawio.png +0 -0
  22. bam_masterdata-0.7.0/docs/assets/parsing/ETLParsingNewColors.drawio.svg +4 -0
  23. bam_masterdata-0.7.0/docs/assets/parsing/LoginParserApp.jpg +0 -0
  24. bam_masterdata-0.7.0/docs/explanations/parsing_structure.md +86 -0
  25. bam_masterdata-0.7.0/docs/explanations/schema_defs.md +2 -0
  26. bam_masterdata-0.7.0/docs/howtos/parsing/create_new_parsers.md +357 -0
  27. bam_masterdata-0.7.0/docs/howtos/parsing/parser_app.md +90 -0
  28. bam_masterdata-0.7.0/docs/index.md +63 -0
  29. bam_masterdata-0.7.0/docs/references/api.md +186 -0
  30. bam_masterdata-0.7.0/docs/references/extra.md +506 -0
  31. bam_masterdata-0.7.0/docs/references/glossary.md +11 -0
  32. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/stylesheets/extra.css +40 -8
  33. bam_masterdata-0.7.0/docs/tutorials/getting_started.md +378 -0
  34. bam_masterdata-0.7.0/docs/tutorials/parsing.md +540 -0
  35. bam_masterdata-0.7.0/mkdocs.yml +74 -0
  36. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/pyproject.toml +1 -0
  37. bam_masterdata-0.7.0/tests/__init__.py +0 -0
  38. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/checker/test_source_loader.py +166 -2
  39. bam_masterdata-0.7.0/tests/cli/test_run_parser.py +76 -0
  40. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/conftest.py +77 -2
  41. bam_masterdata-0.7.0/tests/data/cli/test_parser.txt +1 -0
  42. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/metadata/test_entities.py +25 -3
  43. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/metadata/test_entities_dict.py +6 -3
  44. bam_masterdata-0.6.2/docs/assets/drawio/parsing.drawio +0 -124
  45. bam_masterdata-0.6.2/docs/assets/drawio/uml-structure.drawio +0 -532
  46. bam_masterdata-0.6.2/docs/explanations/data-store.md +0 -3
  47. bam_masterdata-0.6.2/docs/explanations/openbis.md +0 -3
  48. bam_masterdata-0.6.2/docs/explanations/pybis.md +0 -3
  49. bam_masterdata-0.6.2/docs/howtos/overview.md +0 -3
  50. bam_masterdata-0.6.2/docs/howtos/pybis/collections.md +0 -3
  51. bam_masterdata-0.6.2/docs/howtos/pybis/datasets.md +0 -3
  52. bam_masterdata-0.6.2/docs/howtos/pybis/objects.md +0 -3
  53. bam_masterdata-0.6.2/docs/howtos/pybis/objects_props.md +0 -3
  54. bam_masterdata-0.6.2/docs/howtos/pybis/parent_child.md +0 -3
  55. bam_masterdata-0.6.2/docs/howtos/pybis/projects.md +0 -3
  56. bam_masterdata-0.6.2/docs/howtos/pybis/searches.md +0 -3
  57. bam_masterdata-0.6.2/docs/howtos/pybis/setup.md +0 -3
  58. bam_masterdata-0.6.2/docs/howtos/pybis/spaces.md +0 -3
  59. bam_masterdata-0.6.2/docs/index.md +0 -55
  60. bam_masterdata-0.6.2/docs/references/collection.md +0 -3
  61. bam_masterdata-0.6.2/docs/references/controlled-vocabulary.md +0 -3
  62. bam_masterdata-0.6.2/docs/references/dataset.md +0 -3
  63. bam_masterdata-0.6.2/docs/tutorials/create-masterdata.md +0 -3
  64. bam_masterdata-0.6.2/docs/tutorials/pybis.md +0 -3
  65. bam_masterdata-0.6.2/mkdocs.yml +0 -78
  66. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.coveragerc +0 -0
  67. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.github/release.yml +0 -0
  68. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.github/workflows/actions.yml +0 -0
  69. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.github/workflows/coveralls.yml +0 -0
  70. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.github/workflows/publish.yml +0 -0
  71. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/.vscode/settings.json +0 -0
  72. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/AUTHORS +0 -0
  73. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/LICENSE +0 -0
  74. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/LICENSE.datamodel +0 -0
  75. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/NOTICE +0 -0
  76. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/__init__.py +0 -0
  77. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/__init__.py +0 -0
  78. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/checker.py +0 -0
  79. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/validation_rules/all_validation_rules.json +0 -0
  80. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/validation_rules/excel_validation_rules.json +0 -0
  81. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/checker/validation_rules/validation_rules.json +0 -0
  82. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/__init__.py +0 -0
  83. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/entities_to_excel.py +0 -0
  84. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/cli/entities_to_rdf.py +0 -0
  85. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/datamodel/__init__.py +0 -0
  86. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/datamodel/collection_types.py +0 -0
  87. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/datamodel/dataset_types.py +0 -0
  88. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/datamodel/object_types.py +0 -0
  89. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/datamodel/vocabulary_types.py +0 -0
  90. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/excel/__init__.py +0 -0
  91. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/logger.py +0 -0
  92. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/metadata/__init__.py +0 -0
  93. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/metadata/_maps.py +0 -0
  94. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/metadata/definitions.py +0 -0
  95. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/metadata/entities_dict.py +0 -0
  96. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/openbis/__init__.py +0 -0
  97. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/openbis/get_entities.py +0 -0
  98. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/openbis/login.py +0 -0
  99. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/parsing/__init__.py +0 -0
  100. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/parsing/parsing.py +0 -0
  101. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/utils/__init__.py +0 -0
  102. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/utils/paths.py +0 -0
  103. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata/utils/utils.py +0 -0
  104. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/dependency_links.txt +0 -0
  105. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/entry_points.txt +0 -0
  106. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/bam_masterdata.egg-info/top_level.txt +0 -0
  107. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/bammasterdata_blue_transparent.png +0 -0
  108. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/bammasterdata_blue_transparent_text.png +0 -0
  109. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/bammasterdata_blue_transparent_text.svg +0 -0
  110. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/bammasterdata_blue_white.png +0 -0
  111. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/bammasterdata_blue_white_text.png +0 -0
  112. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/datastore-logo-white.png +0 -0
  113. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/datastore-logo.png +0 -0
  114. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/drawio/checker-structure.drawio +0 -0
  115. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/drawio/levels_base_entities.drawio +0 -0
  116. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/drawio/masterdata-workflow.drawio +0 -0
  117. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/fonts/BAMKlavika-Light.ttf +0 -0
  118. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/fonts/BAMKlavika-LightItalic.ttf +0 -0
  119. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/fonts/BAMKlavika-Medium.ttf +0 -0
  120. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/docs/assets/fonts/BAMKlavika-MediumItalic.ttf +0 -0
  121. {bam_masterdata-0.6.2/docs/assets/drawio → bam_masterdata-0.7.0/docs/assets}/masterdata-workflow.drawio.png +0 -0
  122. /bam_masterdata-0.6.2/tests/__init__.py → /bam_masterdata-0.7.0/docs/howtos/overview.md +0 -0
  123. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/scripts/install_python_dependencies.bat +0 -0
  124. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/scripts/install_python_dependencies.sh +0 -0
  125. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/scripts/pkg_size.py +0 -0
  126. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/setup.cfg +0 -0
  127. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/cli/test_entities_to_excel.py +0 -0
  128. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/cli/test_entities_to_rdf.py +0 -0
  129. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/datamodel_test/collection_types.py +0 -0
  130. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/datamodel_test/dataset_types.py +0 -0
  131. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/datamodel_test/object_types.py +0 -0
  132. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example01_codedoesnoteexists.xlsx +0 -0
  133. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example02_codeexists_proptype_datatypechanged.xlsx +0 -0
  134. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example03_codeexists_proptype_contvoccodechanged.xlsx +0 -0
  135. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example04_codeexists_proptype_objectcodechanged.xlsx +0 -0
  136. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example05_codeexists_proptype_warningdefschanged.xlsx +0 -0
  137. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example06_codeexists_proptype_vocobjcodemiss.xlsx +0 -0
  138. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example07_codeexists_objtype_warningdefschanged.xlsx +0 -0
  139. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example08_codeexists_objtype_assignprop_listcodeschanged_add.xlsx +0 -0
  140. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example09_codeexists_objtype_assignprop_listcodeschanged_del.xlsx +0 -0
  141. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example10_codeexists_objtype_assignprop_codedoesnotexists.xlsx +0 -0
  142. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example11_codeexists_objtype_assignprop_listcodeschanged_datatypechanged.xlsx +0 -0
  143. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example12_codeexists_objtype_assignprop_listcodeschanged_warningdefschanged.xlsx +0 -0
  144. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example13_codeexists_objtype_assignprop_coincide2objects.xlsx +0 -0
  145. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example_incoming_excel.xlsx +0 -0
  146. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example_incoming_python/collection_types.py +0 -0
  147. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example_incoming_python/dataset_types.py +0 -0
  148. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/example_incoming_python/object_types.py +0 -0
  149. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/masterdata_example.xlsx +0 -0
  150. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/masterdata_excel_output.json +0 -0
  151. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/checker/masterdata_python_output.json +0 -0
  152. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/metadata/example_vocabulary.py +0 -0
  153. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/utils/example_prop_types_1.py +0 -0
  154. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/data/utils/example_prop_types_2.py +0 -0
  155. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/excel/test_excel_to_entities.py +0 -0
  156. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/metadata/test_definitions.py +0 -0
  157. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/test_logger.py +0 -0
  158. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/utils/test_paths.py +0 -0
  159. {bam_masterdata-0.6.2 → bam_masterdata-0.7.0}/tests/utils/test_utils.py +0 -0
@@ -22,8 +22,7 @@ jobs:
22
22
  run: |
23
23
  pip install --upgrade pip
24
24
  pip install .[docu]
25
- - name: Deploy docs
26
- uses: mhausenblas/mkdocs-deploy-gh-pages@master
25
+ - name: Deploy documentation
26
+ run: mkdocs gh-deploy --force
27
27
  env:
28
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
- CONFIG_FILE: mkdocs.yml
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -176,4 +176,7 @@ pytest-coverage.txt
176
176
  # artifacts
177
177
  artifacts
178
178
  # and tmp files
179
- tmp/
179
+ tmp/
180
+
181
+ # testing python file
182
+ bam_masterdata/test.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bam-masterdata
3
- Version: 0.6.2
3
+ Version: 0.7.0
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>
@@ -59,6 +59,7 @@ Requires-Dist: pytest-cov; extra == "dev"
59
59
  Provides-Extra: docu
60
60
  Requires-Dist: mkdocs-material; extra == "docu"
61
61
  Requires-Dist: mkdocs-click; extra == "docu"
62
+ Requires-Dist: mkdocstrings; extra == "docu"
62
63
  Requires-Dist: mkdocstrings-python; extra == "docu"
63
64
  Dynamic: license-file
64
65
 
@@ -189,4 +190,5 @@ The main code developers are:
189
190
  | Name | E-mail |
190
191
  | ------------------- | ------------------------------------------------------------ |
191
192
  | Carlos Madariaga | [carlos.madariaga@bam.de](mailto:carlos.madariaga@bam.de) |
193
+ | Lucas Zimmermann | [lucas.zimmermann@bam.de](mailto:lucas.zimmermann@bam.de) |
192
194
  | Dr. Jose M. Pizarro | [jose.pizarro-blanco@bam.de](mailto:jose.pizarro-blanco@bam.de) |
@@ -125,4 +125,5 @@ The main code developers are:
125
125
  | Name | E-mail |
126
126
  | ------------------- | ------------------------------------------------------------ |
127
127
  | Carlos Madariaga | [carlos.madariaga@bam.de](mailto:carlos.madariaga@bam.de) |
128
+ | Lucas Zimmermann | [lucas.zimmermann@bam.de](mailto:lucas.zimmermann@bam.de) |
128
129
  | Dr. Jose M. Pizarro | [jose.pizarro-blanco@bam.de](mailto:jose.pizarro-blanco@bam.de) |
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '0.6.2'
21
- __version_tuple__ = version_tuple = (0, 6, 2)
31
+ __version__ = version = '0.7.0'
32
+ __version_tuple__ = version_tuple = (0, 7, 0)
33
+
34
+ __commit_id__ = commit_id = 'g08075a92e'
@@ -13,7 +13,7 @@ class MasterdataValidator:
13
13
  Args:
14
14
  new_entities (dict): The incoming datamodel.
15
15
  current_model (dict): The existing datamodel.
16
- rules_path (str): Path to the validation rules JSON file.
16
+ validation_rules (dict): The validation rules to apply.
17
17
  """
18
18
  self.new_entities = new_entities
19
19
  self.current_model = current_model
@@ -46,7 +46,7 @@ class SourceLoader:
46
46
  else:
47
47
  raise NotImplementedError(f"Source type {self.source_type} not supported.")
48
48
 
49
- def entities_to_json(self):
49
+ def entities_to_json(self) -> dict:
50
50
  """
51
51
  Transforms the dictionary of entities returned by the Excel extractor into a dictionary in JSON format for later check.
52
52
 
@@ -158,9 +158,3 @@ class SourceLoader:
158
158
  transformed_data[entity_type][entity_name] = transformed_entity
159
159
 
160
160
  return transformed_data
161
-
162
- # # Save the transformed JSON
163
- # with open(output_json_path, "w", encoding="utf-8") as json_file:
164
- # json.dump(transformed_data, json_file, indent=2, ensure_ascii=False)
165
-
166
- # print(f"Transformed JSON saved at: {output_json_path}")
@@ -9,18 +9,16 @@ from pathlib import Path
9
9
  import click
10
10
  from decouple import config as environ
11
11
  from openpyxl import Workbook
12
- from pybis import Openbis
13
12
  from rdflib import Graph
14
13
 
15
14
  from bam_masterdata.checker import MasterdataChecker
16
15
  from bam_masterdata.cli.entities_to_excel import entities_to_excel
17
16
  from bam_masterdata.cli.entities_to_rdf import entities_to_rdf
18
17
  from bam_masterdata.cli.fill_masterdata import MasterdataCodeGenerator
18
+ from bam_masterdata.cli.run_parser import run_parser
19
19
  from bam_masterdata.logger import logger
20
- from bam_masterdata.metadata.entities import CollectionType, PropertyTypeAssignment
21
20
  from bam_masterdata.metadata.entities_dict import EntitiesDict
22
21
  from bam_masterdata.openbis.login import ologin
23
- from bam_masterdata.parsing import AbstractParser
24
22
  from bam_masterdata.utils import (
25
23
  DATAMODEL_DIR,
26
24
  delete_and_create_dir,
@@ -585,119 +583,6 @@ def push_to_openbis(file_path, datamodel_path):
585
583
  )
586
584
 
587
585
 
588
- def run_parser(
589
- openbis: Openbis = None,
590
- files_parser: dict[AbstractParser, list[str]] = {},
591
- project_name: str = "PROJECT",
592
- collection_name: str = "COLLECTION",
593
- ) -> None:
594
- """
595
- Run the parsers on the specified files and collect the results.
596
- Args:
597
- login with save_token=True dont forget!!
598
- files_parser (dict): A dictionary where keys are parser instances and values are lists of file paths to be parsed.
599
- space (str): The space in openBIS where the entities will be stored.
600
- project (str): The project in openBIS where the entities will be stored.
601
- collection (str): The collection in openBIS where the entities will be stored.
602
- """
603
- # Ensure the space, project, and collection are set
604
- if not (project_name or collection_name):
605
- logger.error(
606
- "The name of the project and collection must be specified for the parser to run."
607
- )
608
- return
609
- # Ensure the files_parser is not empty
610
- if not files_parser:
611
- logger.error(
612
- "No files or parsers to parse. Please provide valid file paths or contact an Admin to add missing parser."
613
- )
614
- return
615
-
616
- # Specify the space and project for the data
617
- space = openbis.get_space(openbis.username)
618
- if space is None:
619
- logger.error(
620
- f"Space {openbis.username} does not exist in openBIS. Please create it first."
621
- )
622
- return
623
- if project_name.upper() in [p.code for p in space.get_projects()]:
624
- project = space.get_project(project_name)
625
- else:
626
- project = space.new_project(
627
- code=project_name,
628
- description="New project created via automated parsing with `bam_masterdata`.",
629
- )
630
- project.save()
631
-
632
- # Create a new pybis `COLLECTION` to store the generated objects
633
- if collection_name.upper() in [c.code for c in project.get_collections()]:
634
- collection_openbis = space.get_collection(
635
- f"/{openbis.username}/{project_name}/{collection_name}".upper()
636
- )
637
- else:
638
- collection_openbis = openbis.new_collection(
639
- code=collection_name,
640
- type="COLLECTION",
641
- project=project,
642
- )
643
- collection_openbis.save()
644
-
645
- # Create a bam_masterdata CollectionType instance for storing parsed results
646
- collection = CollectionType()
647
- # Iterate over each parser and its associated files and store them in `collection`
648
- for parser, files in files_parser.items():
649
- parser.parse(files, collection, logger=logger)
650
-
651
- # Map the objects added to CollectionType to objects in openBIS using pyBIS
652
- openbis_id_map = {}
653
- for object_id, object_instance in collection.attached_objects.items():
654
- # Map PropertyTypeAssignment to pybis props dictionary
655
- obj_props = {}
656
- for key in object_instance._properties.keys():
657
- value = getattr(object_instance, key, None)
658
- if value is None or isinstance(value, PropertyTypeAssignment):
659
- continue
660
- obj_props[object_instance._property_metadata[key].code.lower()] = value
661
-
662
- object_openbis = openbis.new_object(
663
- type=object_instance.defs.code,
664
- space=space,
665
- project=project,
666
- collection=collection_openbis,
667
- props=obj_props,
668
- )
669
- object_openbis.save()
670
-
671
- # save local and openbis IDs to map parent-child relationships
672
- openbis_id_map[object_id] = object_openbis.identifier
673
- click.echo(
674
- f"Object {obj_props.get('$name')} stored in openBIS collection {collection_name}."
675
- )
676
- for _, files in files_parser.items():
677
- # Upload the file to openBIS
678
- dataset = openbis.new_dataset(
679
- type="RAW_DATA",
680
- files=files,
681
- collection=collection_openbis,
682
- )
683
- dataset.save()
684
- click.echo(f"Files uploaded to openBIS collection {collection_name}.")
685
-
686
- # Map parent-child relationships
687
- for parent_id, child_id in collection.relationships.values():
688
- if parent_id in openbis_id_map and child_id in openbis_id_map:
689
- parent_openbis_id = openbis_id_map[parent_id]
690
- child_openbis_id = openbis_id_map[child_id]
691
-
692
- child_openbis = openbis.get_object(child_openbis_id)
693
- child_openbis.add_parents(parent_openbis_id)
694
- child_openbis.save()
695
-
696
- click.echo(
697
- f"Linked child {child_openbis_id} to parent {parent_openbis_id} in collection {collection_name}."
698
- )
699
-
700
-
701
586
  @cli.command(
702
587
  name="parser",
703
588
  help="Parses a list of files using the specified parsers and stores the results in openBIS.",
@@ -712,8 +597,8 @@ def run_parser(
712
597
  help="Parser name and file path tuple: 'ExampleParser file1.txt'",
713
598
  )
714
599
  @click.option(
715
- "--project_name",
716
- "project-name", # alias
600
+ "--project-name",
601
+ "project_name", # alias
717
602
  type=str,
718
603
  required=True,
719
604
  help="OpenBIS project name",
@@ -722,10 +607,17 @@ def run_parser(
722
607
  "--collection-name",
723
608
  "collection_name", # alias
724
609
  type=str,
725
- required=True,
610
+ required=False,
726
611
  help="OpenBIS collection name",
727
612
  )
728
- def parser(files_parser, project_name, collection_name):
613
+ @click.option(
614
+ "--space-name",
615
+ "space_name", # alias
616
+ type=str,
617
+ required=False,
618
+ help="OpenBIS space name",
619
+ )
620
+ def parser(files_parser, project_name, collection_name, space_name):
729
621
  parser_map = {} # TODO load from configuration from yaml file
730
622
  parse_file_dict = {}
731
623
  for parser_key, filepath in files_parser:
@@ -739,9 +631,11 @@ def parser(files_parser, project_name, collection_name):
739
631
  parse_file_dict[parser_cls].append(filepath)
740
632
 
741
633
  run_parser(
742
- files_parser=parse_file_dict,
634
+ openbis=ologin(url=environ("OPENBIS_URL")),
635
+ space_name=space_name,
743
636
  project_name=project_name,
744
637
  collection_name=collection_name,
638
+ files_parser=parse_file_dict,
745
639
  )
746
640
 
747
641
 
@@ -644,11 +644,8 @@ class MasterdataExcelExtractor:
644
644
  """
645
645
  Extracts entities from an Excel file and returns them as a dictionary.
646
646
 
647
- Args:
648
- output_directory: The directory to store the output files.
649
-
650
647
  Returns:
651
- A dictionary where each key is a normalized sheet name and the value is a dictionary
648
+ dict[str, dict[str, Any]]: A dictionary where each key is a normalized sheet name and the value is a dictionary
652
649
  containing the extracted entities. Returns an empty dictionary if all sheets are empty.
653
650
  """
654
651
  sheets_dict: dict[str, dict[str, Any]] = {}
@@ -58,7 +58,6 @@ class MasterdataCodeGenerator:
58
58
  class_names (dict): A dictionary with the class names of the entities.
59
59
  default (str): The default parent class if the parent class does not exist.
60
60
  lines (list): A list of strings to be printed to the Python module.
61
- logger (BoundLoggerLazyProxy): The logger to log messages.
62
61
  Returns:
63
62
  tuple: The parent code, parent class, and class name of the entity.
64
63
  """
@@ -84,7 +83,7 @@ class MasterdataCodeGenerator:
84
83
  Get the object code (or vocabulary code) used for reference for the assigned property with `prop_code`.
85
84
 
86
85
  Args:
87
- prop_code (str): The code of the assigned property.
86
+ prop_data (dict): The data information for the property as obtained from openBIS.
88
87
 
89
88
  Returns:
90
89
  str: The object/vocabulary code used for reference for the assigned property.
@@ -0,0 +1,180 @@
1
+ from pybis import Openbis
2
+
3
+ from bam_masterdata.logger import logger
4
+ from bam_masterdata.metadata.entities import CollectionType, PropertyTypeAssignment
5
+ from bam_masterdata.parsing import AbstractParser
6
+
7
+
8
+ def run_parser(
9
+ openbis: Openbis | None = None,
10
+ space_name: str = "",
11
+ project_name: str = "PROJECT",
12
+ collection_name: str = "",
13
+ files_parser: dict[AbstractParser, list[str]] = {},
14
+ ) -> None:
15
+ """
16
+ Run the parsers on the specified files and collect the results.
17
+ login with save_token=True don't forget!!
18
+
19
+ Args:
20
+ openbis (Openbis): An instance of the Openbis class from pyBIS, already logged in.
21
+ space_name (str): The space in openBIS where the entities will be stored.
22
+ project_name (str): The project in openBIS where the entities will be stored.
23
+ collection_name (str): The collection in openBIS where the entities will be stored.
24
+ 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"]}
25
+ """
26
+ # Ensure openbis is provided
27
+ if openbis is None:
28
+ logger.error("An instance of Openbis must be provided for the parser to run.")
29
+ return
30
+ # Ensure the space, project, and collection are set
31
+ if not project_name:
32
+ logger.error("The Project name must be specified for the parser to run.")
33
+ return
34
+ # Ensure the files_parser is not empty
35
+ if not files_parser:
36
+ logger.error(
37
+ "No files or parsers to parse. Please provide valid file paths or contact an Admin to add missing parser."
38
+ )
39
+ return
40
+
41
+ # Specify the space
42
+ try:
43
+ space = openbis.get_space(space_name)
44
+ except Exception:
45
+ space = None
46
+ # If space is not found, use the user space
47
+ if space is None:
48
+ # user name as default space
49
+ for s in openbis.get_spaces():
50
+ if s.code.endswith(openbis.username.upper()):
51
+ space = s
52
+ logger.warning(
53
+ f"Space {space_name} does not exist in openBIS. "
54
+ f"Loading space for {openbis.username}."
55
+ )
56
+ break
57
+ # no space found
58
+ if space is None:
59
+ logger.error(
60
+ f"No usable Space for {openbis.username} in openBIS. Please create it first or notify an Admin."
61
+ )
62
+ return
63
+
64
+ # Get project if `project_name` already exists under the space or create a new one if it does not
65
+ if project_name.upper() in [p.code for p in space.get_projects()]:
66
+ project = space.get_project(project_name)
67
+ else:
68
+ logger.info("Replacing project code with uppercase and underscores.")
69
+ project = space.new_project(
70
+ code=project_name.replace(" ", "_").upper(),
71
+ description="New project created via automated parsing with `bam_masterdata`.",
72
+ )
73
+ project.save()
74
+
75
+ # Create a new pybis `COLLECTION` to store the generated objects
76
+ if not collection_name:
77
+ logger.info(
78
+ "No Collection name specified. Attaching objects directly to Project."
79
+ )
80
+ collection_openbis = project
81
+ else:
82
+ if collection_name.upper() in [c.code for c in project.get_collections()]:
83
+ collection_openbis = space.get_collection(
84
+ f"/{space_name}/{project_name}/{collection_name}".upper()
85
+ )
86
+ else:
87
+ logger.info("Replacing collection code with uppercase and underscores.")
88
+ collection_openbis = openbis.new_collection(
89
+ code=collection_name.replace(" ", "_").upper(),
90
+ type="DEFAULT_EXPERIMENT",
91
+ project=project,
92
+ )
93
+ collection_openbis.save()
94
+
95
+ # Create a bam_masterdata CollectionType instance for storing parsed results
96
+ collection = CollectionType()
97
+ # Iterate over each parser and its associated files and store them in `collection`
98
+ for parser, files in files_parser.items():
99
+ parser.parse(files, collection, logger=logger)
100
+
101
+ # Map the objects added to CollectionType to objects in openBIS using pyBIS
102
+ openbis_id_map = {}
103
+ for object_id, object_instance in collection.attached_objects.items():
104
+ # Map PropertyTypeAssignment to pybis props dictionary
105
+ obj_props = {}
106
+ for key in object_instance._properties.keys():
107
+ value = getattr(object_instance, key, None)
108
+ if value is None or isinstance(value, PropertyTypeAssignment):
109
+ continue
110
+ obj_props[object_instance._property_metadata[key].code.lower()] = value
111
+
112
+ # Check if object already exists in openBIS, and if so, notify and get for updating properties
113
+ if not object_instance.code:
114
+ if not collection_name:
115
+ object_openbis = openbis.new_object(
116
+ type=object_instance.defs.code,
117
+ space=space,
118
+ project=project,
119
+ props=obj_props,
120
+ )
121
+ else:
122
+ object_openbis = openbis.new_object(
123
+ type=object_instance.defs.code,
124
+ space=space,
125
+ project=project,
126
+ collection=collection_openbis,
127
+ props=obj_props,
128
+ )
129
+ object_openbis.save()
130
+ else:
131
+ identifier = (
132
+ f"/{space_name}/{project_name}/{object_instance.code}"
133
+ if not collection_name
134
+ else f"/{space_name}/{project_name}/{collection_name}/{object_instance.code}"
135
+ )
136
+ object_openbis = space.get_object(identifier)
137
+ object_openbis.set_props(obj_props)
138
+ object_openbis.save()
139
+ logger.info(
140
+ f"Object {identifier} already exists in openBIS, updating properties."
141
+ )
142
+
143
+ # save local and openbis IDs to map parent-child relationships
144
+ openbis_id_map[object_id] = object_openbis.identifier
145
+
146
+ # Storing files as datasets in openBIS
147
+ for files in files_parser.values():
148
+ try:
149
+ if not collection_name:
150
+ # ! This won't work on a project -> datasets only attached to collections in pyBIS
151
+ dataset = openbis.new_dataset(
152
+ type="RAW_DATA",
153
+ files=files,
154
+ project=project,
155
+ )
156
+ else:
157
+ dataset = openbis.new_dataset(
158
+ type="RAW_DATA",
159
+ files=files,
160
+ collection=collection_openbis,
161
+ )
162
+ dataset.save()
163
+ except Exception as e:
164
+ logger.warning(f"Error uploading files {files} to openBIS: {e}")
165
+ continue
166
+ logger.info(f"Files uploaded to openBIS collection {collection_name}.")
167
+
168
+ # Map parent-child relationships
169
+ for parent_id, child_id in collection.relationships.values():
170
+ if parent_id in openbis_id_map and child_id in openbis_id_map:
171
+ parent_openbis_id = openbis_id_map[parent_id]
172
+ child_openbis_id = openbis_id_map[child_id]
173
+
174
+ child_openbis = openbis.get_object(child_openbis_id)
175
+ child_openbis.add_parents(parent_openbis_id)
176
+ child_openbis.save()
177
+
178
+ logger.info(
179
+ f"Linked child {child_openbis_id} to parent {parent_openbis_id} in collection {collection_name}."
180
+ )
@@ -645,11 +645,8 @@ class MasterdataExcelExtractor:
645
645
  """
646
646
  Extracts entities from an Excel file and returns them as a dictionary.
647
647
 
648
- Args:
649
- output_directory: The directory to store the output files.
650
-
651
648
  Returns:
652
- A dictionary where each key is a normalized sheet name and the value is a dictionary
649
+ dict[str, dict[str, Any]]: A dictionary where each key is a normalized sheet name and the value is a dictionary
653
650
  containing the extracted entities. Returns an empty dictionary if all sheets are empty.
654
651
  """
655
652
  sheets_dict: dict[str, dict[str, Any]] = {}