bam-masterdata 0.3.0__tar.gz → 0.3.1__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.3.0 → bam_masterdata-0.3.1}/PKG-INFO +1 -1
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/_version.py +2 -2
- bam_masterdata-0.3.1/bam_masterdata/checker/__init__.py +1 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/checker.py +17 -2
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/masterdata_validator.py +3 -2
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/cli/cli.py +49 -37
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/cli/entities_to_rdf.py +1 -1
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/utils/__init__.py +1 -0
- bam_masterdata-0.3.1/bam_masterdata/utils/paths.py +43 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/utils/utils.py +2 -1
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/PKG-INFO +1 -1
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/SOURCES.txt +2 -0
- bam_masterdata-0.3.1/tests/utils/test_paths.py +14 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/utils/test_utils.py +1 -0
- bam_masterdata-0.3.0/bam_masterdata/checker/__init__.py +0 -1
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.coveragerc +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.github/workflows/actions.yml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.github/workflows/coveralls.yml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.github/workflows/mkdocs-deploy.yml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.github/workflows/publish.yml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.gitignore +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/.vscode/settings.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/LICENSE +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/README.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/source_loader.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/validation_rules/all_validation_rules.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/validation_rules/excel_validation_rules.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/validation_rules/validation_rules.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/cli/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/cli/entities_to_excel.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/cli/fill_masterdata.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/datamodel/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/datamodel/collection_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/datamodel/dataset_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/datamodel/object_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/datamodel/vocabulary_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/excel/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/excel/excel_to_entities.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/logger.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/metadata/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/metadata/definitions.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/metadata/entities.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/metadata/entities_dict.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/openbis/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/openbis/get_entities.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/openbis/login.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/validation_rules/excel_validation_rules.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/validation_rules/validation_rules.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/dependency_links.txt +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/entry_points.txt +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/requires.txt +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata.egg-info/top_level.txt +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent_text.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent_text.svg +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_white.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_white_text.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/datastore-logo-white.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/datastore-logo.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/drawio/checker-structure.drawio +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/drawio/masterdata-workflow.drawio +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/drawio/masterdata-workflow.drawio.png +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/fonts/BAMKlavika-Light.ttf +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/fonts/BAMKlavika-LightItalic.ttf +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/fonts/BAMKlavika-Medium.ttf +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/fonts/BAMKlavika-MediumItalic.ttf +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/explanations/data-store.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/explanations/openbis.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/explanations/pybis.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/overview.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/collections.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/datasets.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/objects.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/objects_props.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/parent_child.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/projects.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/searches.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/setup.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/howtos/pybis/spaces.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/index.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/references/collection.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/references/controlled-vocabulary.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/references/dataset.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/stylesheets/extra.css +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/tutorials/create-masterdata.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/tutorials/pybis.md +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/mkdocs.yml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/pyproject.toml +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/scripts/install_python_dependencies.sh +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/scripts/pkg_size.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/setup.cfg +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/setup.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/__init__.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/checker/test_source_loader.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/cli/test_entities_to_excel.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/cli/test_entities_to_rdf.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/conftest.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/collection_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/dataset_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/object_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example01_codedoesnoteexists.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example02_codeexists_proptype_datatypechanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example03_codeexists_proptype_contvoccodechanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example04_codeexists_proptype_objectcodechanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example05_codeexists_proptype_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example06_codeexists_proptype_vocobjcodemiss.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example07_codeexists_objtype_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example08_codeexists_objtype_assignprop_listcodeschanged_add.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example09_codeexists_objtype_assignprop_listcodeschanged_del.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example10_codeexists_objtype_assignprop_codedoesnotexists.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example11_codeexists_objtype_assignprop_listcodeschanged_datatypechanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example12_codeexists_objtype_assignprop_listcodeschanged_warningdefschanged.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example13_codeexists_objtype_assignprop_coincide2objects.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example_incoming_excel.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example_incoming_python/collection_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example_incoming_python/dataset_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example_incoming_python/object_types.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/masterdata_example.xlsx +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/masterdata_excel_output.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/masterdata_python_output.json +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/utils/example_prop_types_1.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/utils/example_prop_types_2.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/excel/test_excel_to_entities.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/metadata/test_definitions.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/metadata/test_entities.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/metadata/test_entities_dict.py +0 -0
- {bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/test_logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bam-masterdata
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .checker import MasterdataChecker, no_validation_errors
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
from bam_masterdata.checker.masterdata_validator import MasterdataValidator
|
|
4
2
|
from bam_masterdata.checker.source_loader import SourceLoader
|
|
5
3
|
from bam_masterdata.logger import logger
|
|
@@ -47,6 +45,7 @@ class MasterdataChecker:
|
|
|
47
45
|
- "validate" -> Validate both the current model and new entities.
|
|
48
46
|
- "compare" -> Compare new entities against the current model.
|
|
49
47
|
- "all" -> Run both validation types.
|
|
48
|
+
- "individual" -> Run individual repositories validations.
|
|
50
49
|
|
|
51
50
|
Before running, ensure that required models are loaded based on the mode.
|
|
52
51
|
|
|
@@ -84,3 +83,19 @@ class MasterdataChecker:
|
|
|
84
83
|
self.new_entities, self.current_model, self.validation_rules
|
|
85
84
|
)
|
|
86
85
|
return validator.validate(mode)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def no_validation_errors(validation_results: dict) -> bool:
|
|
89
|
+
"""
|
|
90
|
+
Check if there are no validation errors in the results.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
validation_results (dict): The dictionary containing the specific validation results.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
bool: True if there are no validation errors, False otherwise.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
if not isinstance(validation_results, dict):
|
|
100
|
+
return False
|
|
101
|
+
return all(no_validation_errors(v) for v in validation_results.values())
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/checker/masterdata_validator.py
RENAMED
|
@@ -30,6 +30,7 @@ class MasterdataValidator:
|
|
|
30
30
|
- "validate": Validate both current and incoming models but do not compare.
|
|
31
31
|
- "compare": Validate new entities against the current model.
|
|
32
32
|
- "all": Run both.
|
|
33
|
+
- "individual": Validate new entities and compare them with the current model.
|
|
33
34
|
|
|
34
35
|
Returns:
|
|
35
36
|
dict: Validation results.
|
|
@@ -568,10 +569,10 @@ class MasterdataValidator:
|
|
|
568
569
|
codes.add(property_item["code"])
|
|
569
570
|
# Recursively check for more nested structures
|
|
570
571
|
elif isinstance(value, (dict, list)):
|
|
571
|
-
codes.
|
|
572
|
+
codes.update(self.extract_property_codes(value))
|
|
572
573
|
|
|
573
574
|
elif isinstance(data, list):
|
|
574
575
|
for item in data:
|
|
575
|
-
codes.
|
|
576
|
+
codes.update(self.extract_property_codes(item))
|
|
576
577
|
|
|
577
578
|
return codes
|
|
@@ -9,13 +9,14 @@ from decouple import config as environ
|
|
|
9
9
|
from openpyxl import Workbook
|
|
10
10
|
from rdflib import Graph
|
|
11
11
|
|
|
12
|
-
from bam_masterdata.checker import MasterdataChecker
|
|
12
|
+
from bam_masterdata.checker import MasterdataChecker, no_validation_errors
|
|
13
13
|
from bam_masterdata.cli.entities_to_excel import entities_to_excel
|
|
14
14
|
from bam_masterdata.cli.entities_to_rdf import entities_to_rdf
|
|
15
15
|
from bam_masterdata.cli.fill_masterdata import MasterdataCodeGenerator
|
|
16
16
|
from bam_masterdata.logger import logger
|
|
17
17
|
from bam_masterdata.metadata.entities_dict import EntitiesDict
|
|
18
18
|
from bam_masterdata.utils import (
|
|
19
|
+
DATAMODEL_DIR,
|
|
19
20
|
delete_and_create_dir,
|
|
20
21
|
duplicated_property_types,
|
|
21
22
|
import_module,
|
|
@@ -23,27 +24,6 @@ from bam_masterdata.utils import (
|
|
|
23
24
|
)
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
def find_datamodel_dir():
|
|
27
|
-
"""Search for 'datamodel/' in possible locations and return its absolute path."""
|
|
28
|
-
possible_locations = [
|
|
29
|
-
# Case: Running from a project with `datamodel/`
|
|
30
|
-
Path.cwd() / "datamodel",
|
|
31
|
-
# Case: Running inside bam-masterdata
|
|
32
|
-
Path.cwd() / "bam_masterdata" / "datamodel",
|
|
33
|
-
# Case: Running inside installed package
|
|
34
|
-
Path(__file__).parent.parent / "datamodel",
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
for path in possible_locations:
|
|
38
|
-
if path.exists():
|
|
39
|
-
return str(path.resolve())
|
|
40
|
-
|
|
41
|
-
raise FileNotFoundError("Could not find a valid 'datamodel/' directory.")
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
DATAMODEL_DIR = find_datamodel_dir()
|
|
45
|
-
|
|
46
|
-
|
|
47
27
|
@click.group(help="Entry point to run `bam_masterdata` CLI commands.")
|
|
48
28
|
def cli():
|
|
49
29
|
pass
|
|
@@ -389,7 +369,8 @@ def export_to_rdf(force_delete, python_path, export_dir):
|
|
|
389
369
|
"--mode",
|
|
390
370
|
"mode", # alias
|
|
391
371
|
type=click.Choice(
|
|
392
|
-
["self", "incoming", "validate", "compare", "all"],
|
|
372
|
+
["self", "incoming", "validate", "compare", "all", "individual"],
|
|
373
|
+
case_sensitive=False,
|
|
393
374
|
),
|
|
394
375
|
default="all",
|
|
395
376
|
help="""Specify the mode for the checker. Options are:
|
|
@@ -397,7 +378,8 @@ def export_to_rdf(force_delete, python_path, export_dir):
|
|
|
397
378
|
"incoming" -> Validate only the new entity structure.
|
|
398
379
|
"validate" -> Validate both the current model and new entities.
|
|
399
380
|
"compare" -> Compare new entities against the current model.
|
|
400
|
-
"all" -> Run all validations and comparison. (Default)
|
|
381
|
+
"all" -> Run all validations and comparison. (Default).
|
|
382
|
+
"individual" -> Run individual repositories validations.""",
|
|
401
383
|
)
|
|
402
384
|
@click.option(
|
|
403
385
|
"--datamodel-path",
|
|
@@ -420,27 +402,57 @@ def checker(file_path, mode, datamodel_path):
|
|
|
420
402
|
validation_results = checker.check(mode=mode)
|
|
421
403
|
|
|
422
404
|
# Check if there are problems with the current model
|
|
423
|
-
if mode in ["self", "all", "validate"] and validation_results.get(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
)
|
|
405
|
+
if mode in ["self", "all", "validate"] and validation_results.get(
|
|
406
|
+
"current_model", {}
|
|
407
|
+
):
|
|
408
|
+
for entity, errors in validation_results.get("current_model", {}).items():
|
|
409
|
+
if errors:
|
|
410
|
+
click.echo(
|
|
411
|
+
f"There are problems in the current model for entity {entity} that need to be solved"
|
|
412
|
+
)
|
|
413
|
+
click.echo(f"Errors: {errors}")
|
|
427
414
|
|
|
428
415
|
# Check if there are problems with the incoming model
|
|
429
416
|
if mode in ["incoming", "all", "validate"] and validation_results.get(
|
|
430
|
-
"incoming_model"
|
|
417
|
+
"incoming_model", {}
|
|
431
418
|
):
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
419
|
+
for entity, errors in validation_results.get("incoming_model", {}).items():
|
|
420
|
+
if errors:
|
|
421
|
+
click.echo(
|
|
422
|
+
f"There are problems in the incoming model in {file_path} for entity {entity} that need to be solved"
|
|
423
|
+
)
|
|
424
|
+
click.echo(f"Errors: {errors}")
|
|
435
425
|
|
|
436
426
|
# Check if there are comparison problems
|
|
437
|
-
if mode in ["compare", "all"] and validation_results.get("comparisons"):
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
427
|
+
if mode in ["compare", "all"] and validation_results.get("comparisons", {}):
|
|
428
|
+
for entity, errors in validation_results.get("comparisons", {}).items():
|
|
429
|
+
if errors:
|
|
430
|
+
click.echo(
|
|
431
|
+
f"There are problems when checking the incoming model in {file_path} against the current model {datamodel_path} for entity {entity} that need to be solved"
|
|
432
|
+
)
|
|
433
|
+
click.echo(f"Errors: {errors}")
|
|
434
|
+
|
|
435
|
+
# Check if there are individual repository problems
|
|
436
|
+
if (
|
|
437
|
+
mode in ["individual"]
|
|
438
|
+
and validation_results.get("incoming_model", {})
|
|
439
|
+
and validation_results.get("comparisons", {})
|
|
440
|
+
):
|
|
441
|
+
for entity, errors in validation_results.get("individual", {}).items():
|
|
442
|
+
if errors:
|
|
443
|
+
click.echo(
|
|
444
|
+
f"There are problems in the individual repositories when validating them for entity {entity} that need to be solved"
|
|
445
|
+
)
|
|
446
|
+
click.echo(f"Errors: {errors}")
|
|
447
|
+
for entity, errors in validation_results.get("comparisons", {}).items():
|
|
448
|
+
if errors:
|
|
449
|
+
click.echo(
|
|
450
|
+
f"There are problems in the individual repositories when comparing them with respect to bam-masterdata for entity {entity} that need to be solved"
|
|
451
|
+
)
|
|
452
|
+
click.echo(f"Errors: {errors}")
|
|
441
453
|
|
|
442
454
|
# Check if no problems were found
|
|
443
|
-
if
|
|
455
|
+
if no_validation_errors(validation_results):
|
|
444
456
|
click.echo("No problems found in the datamodel and incoming model.")
|
|
445
457
|
|
|
446
458
|
|
|
@@ -11,7 +11,7 @@ from rdflib.namespace import DC, OWL, RDF, RDFS
|
|
|
11
11
|
|
|
12
12
|
from bam_masterdata.utils import import_module
|
|
13
13
|
|
|
14
|
-
BAM = Namespace("https://bamresearch.github.io/bam-masterdata
|
|
14
|
+
BAM = Namespace("https://bamresearch.github.io/bam-masterdata/#")
|
|
15
15
|
PROV = Namespace("http://www.w3.org/ns/prov#")
|
|
16
16
|
|
|
17
17
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def find_dir(possible_locations: list[Path]) -> str:
|
|
5
|
+
"""
|
|
6
|
+
Search for a valid directory in a list of possible locations.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
possible_locations (list[Path]): A list of possible locations to search for a directory.
|
|
10
|
+
|
|
11
|
+
Raises:
|
|
12
|
+
FileNotFoundError: If no valid directory is found.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
str: The path of the valid directory.
|
|
16
|
+
"""
|
|
17
|
+
for path in possible_locations:
|
|
18
|
+
if path.exists():
|
|
19
|
+
return str(path.resolve())
|
|
20
|
+
|
|
21
|
+
raise FileNotFoundError("Could not find a valid directory.")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
DIRECTORIES = {
|
|
25
|
+
"datamodel": [
|
|
26
|
+
# Case: Running from a project with `datamodel/`
|
|
27
|
+
Path.cwd() / "datamodel",
|
|
28
|
+
# Case: Running inside bam-masterdata
|
|
29
|
+
Path.cwd() / "bam_masterdata" / "datamodel",
|
|
30
|
+
# Case: Running inside installed package
|
|
31
|
+
Path(__file__).parent.parent / "datamodel",
|
|
32
|
+
],
|
|
33
|
+
"validation_rules_checker": [
|
|
34
|
+
Path.cwd() / "bam_masterdata" / "checker" / "validation_rules",
|
|
35
|
+
Path(__file__).parent.parent / "checker" / "validation_rules",
|
|
36
|
+
],
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
DATAMODEL_DIR = find_dir(possible_locations=DIRECTORIES["datamodel"])
|
|
41
|
+
VALIDATION_RULES_DIR = find_dir(
|
|
42
|
+
possible_locations=DIRECTORIES["validation_rules_checker"]
|
|
43
|
+
)
|
|
@@ -10,6 +10,7 @@ from itertools import chain
|
|
|
10
10
|
from typing import TYPE_CHECKING, Any, Optional
|
|
11
11
|
|
|
12
12
|
from bam_masterdata.logger import logger
|
|
13
|
+
from bam_masterdata.utils import VALIDATION_RULES_DIR
|
|
13
14
|
|
|
14
15
|
if TYPE_CHECKING:
|
|
15
16
|
from structlog._config import BoundLoggerLazyProxy
|
|
@@ -142,7 +143,7 @@ def code_to_class_name(
|
|
|
142
143
|
|
|
143
144
|
def load_validation_rules(
|
|
144
145
|
logger: "BoundLoggerLazyProxy",
|
|
145
|
-
file_path: str = "
|
|
146
|
+
file_path: str = os.path.join(VALIDATION_RULES_DIR, "validation_rules.json"),
|
|
146
147
|
):
|
|
147
148
|
if not os.path.exists(file_path):
|
|
148
149
|
logger.error(f"Validation rules file not found: {file_path}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bam-masterdata
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
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>
|
|
@@ -46,6 +46,7 @@ bam_masterdata/openbis/__init__.py
|
|
|
46
46
|
bam_masterdata/openbis/get_entities.py
|
|
47
47
|
bam_masterdata/openbis/login.py
|
|
48
48
|
bam_masterdata/utils/__init__.py
|
|
49
|
+
bam_masterdata/utils/paths.py
|
|
49
50
|
bam_masterdata/utils/utils.py
|
|
50
51
|
bam_masterdata/validation_rules/excel_validation_rules.json
|
|
51
52
|
bam_masterdata/validation_rules/validation_rules.json
|
|
@@ -120,4 +121,5 @@ tests/excel/test_excel_to_entities.py
|
|
|
120
121
|
tests/metadata/test_definitions.py
|
|
121
122
|
tests/metadata/test_entities.py
|
|
122
123
|
tests/metadata/test_entities_dict.py
|
|
124
|
+
tests/utils/test_paths.py
|
|
123
125
|
tests/utils/test_utils.py
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from bam_masterdata.utils import DATAMODEL_DIR, VALIDATION_RULES_DIR, find_dir
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_find_dir():
|
|
7
|
+
assert find_dir(possible_locations=[Path.cwd()]) == str(Path.cwd())
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_default_dirs():
|
|
11
|
+
assert DATAMODEL_DIR == str(Path.cwd() / "bam_masterdata" / "datamodel")
|
|
12
|
+
assert VALIDATION_RULES_DIR == str(
|
|
13
|
+
Path.cwd() / "bam_masterdata" / "checker" / "validation_rules"
|
|
14
|
+
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .checker import MasterdataChecker
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/bam_masterdata/validation_rules/validation_rules.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent.png
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent_text.png
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/bammasterdata_blue_transparent_text.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/docs/assets/drawio/masterdata-workflow.drawio.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/collection_types.py
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/dataset_types.py
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/datamodel_test/object_types.py
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example01_codedoesnoteexists.xlsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/example_incoming_excel.xlsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/masterdata_excel_output.json
RENAMED
|
File without changes
|
{bam_masterdata-0.3.0 → bam_masterdata-0.3.1}/tests/data/checker/masterdata_python_output.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|