refscan 0.1.2__tar.gz → 0.1.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.
- {refscan-0.1.2 → refscan-0.1.4}/PKG-INFO +1 -1
- {refscan-0.1.2 → refscan-0.1.4}/pyproject.toml +1 -1
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/helpers.py +13 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/refscan.py +7 -4
- {refscan-0.1.2 → refscan-0.1.4}/README.md +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/__init__.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/Finder.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/Reference.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/ReferenceList.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/Violation.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/ViolationList.py +0 -0
- {refscan-0.1.2 → refscan-0.1.4}/refscan/lib/constants.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: refscan
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Command-line program that scans the NMDC MongoDB database for referential integrity violations
|
|
5
5
|
Home-page: https://github.com/microbiomedata/refscan
|
|
6
6
|
Keywords: mongodb,mongo,relationships,reference,database,data,referential integrity,scan
|
|
@@ -3,6 +3,7 @@ from functools import cache
|
|
|
3
3
|
|
|
4
4
|
from pymongo import MongoClient, timeout
|
|
5
5
|
from linkml_runtime import SchemaView
|
|
6
|
+
from rich.console import Console
|
|
6
7
|
from rich.progress import (
|
|
7
8
|
Progress,
|
|
8
9
|
TextColumn,
|
|
@@ -121,3 +122,15 @@ def init_progress_bar() -> Progress:
|
|
|
121
122
|
def get_lowercase_key(key_value_pair: tuple) -> str:
|
|
122
123
|
r"""Returns the key from a `(key, value)` tuple, in lowercase."""
|
|
123
124
|
return key_value_pair[0].lower()
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def print_section_header(console: Console, text: str) -> None:
|
|
128
|
+
r"""
|
|
129
|
+
Helper function that prints a vertically-padded,
|
|
130
|
+
labeled, horizontal rule to the specified console.
|
|
131
|
+
|
|
132
|
+
Reference: https://rich.readthedocs.io/en/stable/console.html#rules
|
|
133
|
+
"""
|
|
134
|
+
console.print("")
|
|
135
|
+
console.rule(f"[bold]{text}[/bold]")
|
|
136
|
+
console.print("")
|
|
@@ -4,6 +4,7 @@ from typing_extensions import Annotated
|
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
6
|
import linkml_runtime
|
|
7
|
+
from rich import padding
|
|
7
8
|
|
|
8
9
|
from refscan.lib.Finder import Finder
|
|
9
10
|
from refscan.lib.constants import DATABASE_CLASS_NAME, console
|
|
@@ -13,6 +14,7 @@ from refscan.lib.helpers import (
|
|
|
13
14
|
derive_schema_class_name_from_document,
|
|
14
15
|
init_progress_bar,
|
|
15
16
|
get_lowercase_key,
|
|
17
|
+
print_section_header,
|
|
16
18
|
)
|
|
17
19
|
from refscan.lib.Reference import Reference
|
|
18
20
|
from refscan.lib.ReferenceList import ReferenceList
|
|
@@ -108,7 +110,8 @@ def scan(
|
|
|
108
110
|
console.print(f"refscan version: {app_version}")
|
|
109
111
|
console.print(f"Schema version: {schema_view.schema.version}")
|
|
110
112
|
|
|
111
|
-
console.
|
|
113
|
+
# Show a header on the console, to tell the user which stage of execution we're entering.
|
|
114
|
+
print_section_header(console, text="Identifying references")
|
|
112
115
|
|
|
113
116
|
# Make a more self-documenting alias for the CLI option that can be specified multiple times.
|
|
114
117
|
names_of_source_collections_to_skip: list[str] = [] if skip_source_collection is None else skip_source_collection
|
|
@@ -174,7 +177,7 @@ def scan(
|
|
|
174
177
|
target_class_name=name_of_eligible_target_class)
|
|
175
178
|
references.append(reference)
|
|
176
179
|
|
|
177
|
-
console.print(f"
|
|
180
|
+
console.print(f"References described by schema: {len(references)}")
|
|
178
181
|
|
|
179
182
|
# Create a reference report in TSV format.
|
|
180
183
|
console.print(f"Writing reference report: {reference_report_file_path}")
|
|
@@ -184,7 +187,7 @@ def scan(
|
|
|
184
187
|
if verbose:
|
|
185
188
|
console.print(references.as_table())
|
|
186
189
|
|
|
187
|
-
console
|
|
190
|
+
print_section_header(console, text="Scanning for violations")
|
|
188
191
|
|
|
189
192
|
# Get a dictionary that maps source class names to the names of their fields that can contain references.
|
|
190
193
|
reference_field_names_by_source_class_name = references.get_reference_field_names_by_source_class_name()
|
|
@@ -319,7 +322,7 @@ def scan(
|
|
|
319
322
|
# Close the connection to the MongoDB server.
|
|
320
323
|
mongo_client.close()
|
|
321
324
|
|
|
322
|
-
console
|
|
325
|
+
print_section_header(console, text="Summarizing results")
|
|
323
326
|
|
|
324
327
|
# Create a violation report in TSV format — for all collections combined.
|
|
325
328
|
all_violations = ViolationList()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|