ctos-meval 1.1.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.
- ctos_meval-1.1.0/LICENSE +21 -0
- ctos_meval-1.1.0/PKG-INFO +82 -0
- ctos_meval-1.1.0/README.md +63 -0
- ctos_meval-1.1.0/ctos_meval.egg-info/PKG-INFO +82 -0
- ctos_meval-1.1.0/ctos_meval.egg-info/SOURCES.txt +15 -0
- ctos_meval-1.1.0/ctos_meval.egg-info/dependency_links.txt +1 -0
- ctos_meval-1.1.0/ctos_meval.egg-info/requires.txt +6 -0
- ctos_meval-1.1.0/ctos_meval.egg-info/top_level.txt +1 -0
- ctos_meval-1.1.0/meval/__init__.py +7 -0
- ctos_meval-1.1.0/meval/loader.py +1492 -0
- ctos_meval-1.1.0/meval/parser.py +360 -0
- ctos_meval-1.1.0/meval/utils.py +188 -0
- ctos_meval-1.1.0/meval/validator.py +1268 -0
- ctos_meval-1.1.0/pyproject.toml +30 -0
- ctos_meval-1.1.0/setup.cfg +4 -0
- ctos_meval-1.1.0/tests/test_loader.py +269 -0
- ctos_meval-1.1.0/tests/test_validator.py +385 -0
ctos_meval-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Center for Biomedical Informatics and Information Technology (CBIIT)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ctos-meval
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: MDF Enforced Validator and Loader
|
|
5
|
+
Author-email: Qiong Liu <qiong.liu@nih.gov>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/CBIIT/MEVAL
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/CBIIT/MEVAL/issues
|
|
9
|
+
Requires-Python: <4.0,>=3.13
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: bento-mdf>=0.13.1
|
|
13
|
+
Requires-Dist: boto3<2.0,>=1.36.11
|
|
14
|
+
Requires-Dist: pandas<3.0,>=2.3.3
|
|
15
|
+
Requires-Dist: neo4j-viz<2.0,>=1.0.0
|
|
16
|
+
Requires-Dist: neo4j<7.0,>=6.2.0
|
|
17
|
+
Requires-Dist: tabulate<1.0,>=0.9.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# MDF Enforced Validator and Loader (MEVAL)
|
|
21
|
+
MDF Enforced Validator and Loader is a lightweight and modular framework designed to ensure data integrity through MDF enforced validation and seamless data ingestion into the graph database. This repository serves as the source code for MEVAL, providing tools, scripts, and workflows to validate and load data to graph database using Graph Model Description Format (MDF) as the source of accessing model features.
|
|
22
|
+
|
|
23
|
+
## Core Modules
|
|
24
|
+
|
|
25
|
+
MEVAL includes three core classes under the `meval` package that work together to support model-aware validation and graph loading workflows:
|
|
26
|
+
|
|
27
|
+
### `ModelParser` (`meval/parser.py`)
|
|
28
|
+
`ModelParser` wraps `bento_mdf.MDFReader` and provides easy access to MDF model metadata.(`bento_mdf` repository: https://github.com/CBIIT/bento-mdf)
|
|
29
|
+
|
|
30
|
+
It is used to inspect node definitions, key properties, required fields, parent-child relationships, property types, and permissible values.
|
|
31
|
+
This class is the model introspection layer used by both validation and loading logic.
|
|
32
|
+
|
|
33
|
+
### `Loader` (`meval/loader.py`)
|
|
34
|
+
`Loader` handles graph database ingestion for TSV data files.
|
|
35
|
+
It reads files in chunks, prepares node properties and relationships from each chunk, and performs upsert operations (MERGE semantics) for nodes and edges.
|
|
36
|
+
It also includes helper methods for index creation, duplicate cleanup, and graph maintenance tasks such as finding floating/orphan nodes (nodes without a path to a root node, such as study/program node).
|
|
37
|
+
|
|
38
|
+
### `Validator` (`meval/validator.py`)
|
|
39
|
+
`Validator` enforces MDF-based data quality checks before loading.
|
|
40
|
+
It validates TSV file format, validates record-level values against model constraints, checks relationship consistency across files, and supports unique-entry checks.
|
|
41
|
+
It also provides utilities such as deterministic UUID generation and adding UUID columns to TSV files.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### Prerequisites
|
|
46
|
+
- Python 3.13
|
|
47
|
+
|
|
48
|
+
### Install from source
|
|
49
|
+
1. Clone this repository.
|
|
50
|
+
2. Create and activate a virtual environment.
|
|
51
|
+
3. Install dependencies:
|
|
52
|
+
- `pip install -r requirements_python3.13.txt`
|
|
53
|
+
4. Install the package:
|
|
54
|
+
- `pip install .`
|
|
55
|
+
|
|
56
|
+
## Example Usage (Imports and Instances)
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from neo4j import GraphDatabase
|
|
60
|
+
from meval.loader import Loader
|
|
61
|
+
from meval.parser import ModelParser
|
|
62
|
+
from meval.validator import Validator
|
|
63
|
+
|
|
64
|
+
# Create ModelParser
|
|
65
|
+
model_parser = ModelParser(
|
|
66
|
+
model_file="tests/test_files/ccdi-dcc-model-test.yml",
|
|
67
|
+
props_file="tests/test_files/ccdi-dcc-model-props-test.yml",
|
|
68
|
+
handle="ccdi_dcc",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Create Validator (uses MDF object from ModelParser)
|
|
72
|
+
validator = Validator(mdf=model_parser.mdf)
|
|
73
|
+
|
|
74
|
+
# Create Loader
|
|
75
|
+
driver = GraphDatabase.driver(
|
|
76
|
+
"bolt://localhost:7687",
|
|
77
|
+
auth=("neo4j", "your_password"),
|
|
78
|
+
)
|
|
79
|
+
loader = Loader(driver=driver)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# MDF Enforced Validator and Loader (MEVAL)
|
|
2
|
+
MDF Enforced Validator and Loader is a lightweight and modular framework designed to ensure data integrity through MDF enforced validation and seamless data ingestion into the graph database. This repository serves as the source code for MEVAL, providing tools, scripts, and workflows to validate and load data to graph database using Graph Model Description Format (MDF) as the source of accessing model features.
|
|
3
|
+
|
|
4
|
+
## Core Modules
|
|
5
|
+
|
|
6
|
+
MEVAL includes three core classes under the `meval` package that work together to support model-aware validation and graph loading workflows:
|
|
7
|
+
|
|
8
|
+
### `ModelParser` (`meval/parser.py`)
|
|
9
|
+
`ModelParser` wraps `bento_mdf.MDFReader` and provides easy access to MDF model metadata.(`bento_mdf` repository: https://github.com/CBIIT/bento-mdf)
|
|
10
|
+
|
|
11
|
+
It is used to inspect node definitions, key properties, required fields, parent-child relationships, property types, and permissible values.
|
|
12
|
+
This class is the model introspection layer used by both validation and loading logic.
|
|
13
|
+
|
|
14
|
+
### `Loader` (`meval/loader.py`)
|
|
15
|
+
`Loader` handles graph database ingestion for TSV data files.
|
|
16
|
+
It reads files in chunks, prepares node properties and relationships from each chunk, and performs upsert operations (MERGE semantics) for nodes and edges.
|
|
17
|
+
It also includes helper methods for index creation, duplicate cleanup, and graph maintenance tasks such as finding floating/orphan nodes (nodes without a path to a root node, such as study/program node).
|
|
18
|
+
|
|
19
|
+
### `Validator` (`meval/validator.py`)
|
|
20
|
+
`Validator` enforces MDF-based data quality checks before loading.
|
|
21
|
+
It validates TSV file format, validates record-level values against model constraints, checks relationship consistency across files, and supports unique-entry checks.
|
|
22
|
+
It also provides utilities such as deterministic UUID generation and adding UUID columns to TSV files.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Prerequisites
|
|
27
|
+
- Python 3.13
|
|
28
|
+
|
|
29
|
+
### Install from source
|
|
30
|
+
1. Clone this repository.
|
|
31
|
+
2. Create and activate a virtual environment.
|
|
32
|
+
3. Install dependencies:
|
|
33
|
+
- `pip install -r requirements_python3.13.txt`
|
|
34
|
+
4. Install the package:
|
|
35
|
+
- `pip install .`
|
|
36
|
+
|
|
37
|
+
## Example Usage (Imports and Instances)
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from neo4j import GraphDatabase
|
|
41
|
+
from meval.loader import Loader
|
|
42
|
+
from meval.parser import ModelParser
|
|
43
|
+
from meval.validator import Validator
|
|
44
|
+
|
|
45
|
+
# Create ModelParser
|
|
46
|
+
model_parser = ModelParser(
|
|
47
|
+
model_file="tests/test_files/ccdi-dcc-model-test.yml",
|
|
48
|
+
props_file="tests/test_files/ccdi-dcc-model-props-test.yml",
|
|
49
|
+
handle="ccdi_dcc",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Create Validator (uses MDF object from ModelParser)
|
|
53
|
+
validator = Validator(mdf=model_parser.mdf)
|
|
54
|
+
|
|
55
|
+
# Create Loader
|
|
56
|
+
driver = GraphDatabase.driver(
|
|
57
|
+
"bolt://localhost:7687",
|
|
58
|
+
auth=("neo4j", "your_password"),
|
|
59
|
+
)
|
|
60
|
+
loader = Loader(driver=driver)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ctos-meval
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: MDF Enforced Validator and Loader
|
|
5
|
+
Author-email: Qiong Liu <qiong.liu@nih.gov>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/CBIIT/MEVAL
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/CBIIT/MEVAL/issues
|
|
9
|
+
Requires-Python: <4.0,>=3.13
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: bento-mdf>=0.13.1
|
|
13
|
+
Requires-Dist: boto3<2.0,>=1.36.11
|
|
14
|
+
Requires-Dist: pandas<3.0,>=2.3.3
|
|
15
|
+
Requires-Dist: neo4j-viz<2.0,>=1.0.0
|
|
16
|
+
Requires-Dist: neo4j<7.0,>=6.2.0
|
|
17
|
+
Requires-Dist: tabulate<1.0,>=0.9.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# MDF Enforced Validator and Loader (MEVAL)
|
|
21
|
+
MDF Enforced Validator and Loader is a lightweight and modular framework designed to ensure data integrity through MDF enforced validation and seamless data ingestion into the graph database. This repository serves as the source code for MEVAL, providing tools, scripts, and workflows to validate and load data to graph database using Graph Model Description Format (MDF) as the source of accessing model features.
|
|
22
|
+
|
|
23
|
+
## Core Modules
|
|
24
|
+
|
|
25
|
+
MEVAL includes three core classes under the `meval` package that work together to support model-aware validation and graph loading workflows:
|
|
26
|
+
|
|
27
|
+
### `ModelParser` (`meval/parser.py`)
|
|
28
|
+
`ModelParser` wraps `bento_mdf.MDFReader` and provides easy access to MDF model metadata.(`bento_mdf` repository: https://github.com/CBIIT/bento-mdf)
|
|
29
|
+
|
|
30
|
+
It is used to inspect node definitions, key properties, required fields, parent-child relationships, property types, and permissible values.
|
|
31
|
+
This class is the model introspection layer used by both validation and loading logic.
|
|
32
|
+
|
|
33
|
+
### `Loader` (`meval/loader.py`)
|
|
34
|
+
`Loader` handles graph database ingestion for TSV data files.
|
|
35
|
+
It reads files in chunks, prepares node properties and relationships from each chunk, and performs upsert operations (MERGE semantics) for nodes and edges.
|
|
36
|
+
It also includes helper methods for index creation, duplicate cleanup, and graph maintenance tasks such as finding floating/orphan nodes (nodes without a path to a root node, such as study/program node).
|
|
37
|
+
|
|
38
|
+
### `Validator` (`meval/validator.py`)
|
|
39
|
+
`Validator` enforces MDF-based data quality checks before loading.
|
|
40
|
+
It validates TSV file format, validates record-level values against model constraints, checks relationship consistency across files, and supports unique-entry checks.
|
|
41
|
+
It also provides utilities such as deterministic UUID generation and adding UUID columns to TSV files.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### Prerequisites
|
|
46
|
+
- Python 3.13
|
|
47
|
+
|
|
48
|
+
### Install from source
|
|
49
|
+
1. Clone this repository.
|
|
50
|
+
2. Create and activate a virtual environment.
|
|
51
|
+
3. Install dependencies:
|
|
52
|
+
- `pip install -r requirements_python3.13.txt`
|
|
53
|
+
4. Install the package:
|
|
54
|
+
- `pip install .`
|
|
55
|
+
|
|
56
|
+
## Example Usage (Imports and Instances)
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from neo4j import GraphDatabase
|
|
60
|
+
from meval.loader import Loader
|
|
61
|
+
from meval.parser import ModelParser
|
|
62
|
+
from meval.validator import Validator
|
|
63
|
+
|
|
64
|
+
# Create ModelParser
|
|
65
|
+
model_parser = ModelParser(
|
|
66
|
+
model_file="tests/test_files/ccdi-dcc-model-test.yml",
|
|
67
|
+
props_file="tests/test_files/ccdi-dcc-model-props-test.yml",
|
|
68
|
+
handle="ccdi_dcc",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Create Validator (uses MDF object from ModelParser)
|
|
72
|
+
validator = Validator(mdf=model_parser.mdf)
|
|
73
|
+
|
|
74
|
+
# Create Loader
|
|
75
|
+
driver = GraphDatabase.driver(
|
|
76
|
+
"bolt://localhost:7687",
|
|
77
|
+
auth=("neo4j", "your_password"),
|
|
78
|
+
)
|
|
79
|
+
loader = Loader(driver=driver)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
ctos_meval.egg-info/PKG-INFO
|
|
5
|
+
ctos_meval.egg-info/SOURCES.txt
|
|
6
|
+
ctos_meval.egg-info/dependency_links.txt
|
|
7
|
+
ctos_meval.egg-info/requires.txt
|
|
8
|
+
ctos_meval.egg-info/top_level.txt
|
|
9
|
+
meval/__init__.py
|
|
10
|
+
meval/loader.py
|
|
11
|
+
meval/parser.py
|
|
12
|
+
meval/utils.py
|
|
13
|
+
meval/validator.py
|
|
14
|
+
tests/test_loader.py
|
|
15
|
+
tests/test_validator.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
meval
|