refscan 0.3.0__tar.gz → 0.3.2__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.3.0 → refscan-0.3.2}/PKG-INFO +1 -1
- {refscan-0.3.0 → refscan-0.3.2}/pyproject.toml +1 -1
- {refscan-0.3.0 → refscan-0.3.2}/refscan/scanner.py +17 -2
- {refscan-0.3.0 → refscan-0.3.2}/LICENSE +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/README.md +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/__init__.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/cli/cli.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/cli/graph.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/cli/scan.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/cli/version.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/grapher.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/Finder.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/Reference.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/ReferenceList.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/Violation.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/ViolationList.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/constants.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/lib/helpers.py +0 -0
- {refscan-0.3.0 → refscan-0.3.2}/refscan/templates/graph.template.html +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: refscan
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Command-line program that scans the NMDC MongoDB database for referential integrity violations
|
|
5
5
|
Keywords: mongodb,mongo,relationships,reference,database,data,referential integrity,scan
|
|
6
6
|
Requires-Python: >=3.9,<4.0
|
|
@@ -52,6 +52,10 @@ def identify_referring_documents(
|
|
|
52
52
|
# Initialize a list of descriptors of documents that reference the specified document.
|
|
53
53
|
referring_document_descriptors = []
|
|
54
54
|
|
|
55
|
+
# If the specified document does not have an `id` field, we know it cannot be referenced.
|
|
56
|
+
if "id" not in document:
|
|
57
|
+
return referring_document_descriptors
|
|
58
|
+
|
|
55
59
|
# Get the specified document's `id` and derive its schema class name.
|
|
56
60
|
document_id = document["id"]
|
|
57
61
|
document_class_name = derive_schema_class_name_from_document(schema_view, document)
|
|
@@ -93,6 +97,17 @@ def identify_referring_documents(
|
|
|
93
97
|
|
|
94
98
|
# For each referring document, store a descriptor of it.
|
|
95
99
|
for referring_document in referring_documents:
|
|
100
|
+
|
|
101
|
+
# Handle the case where the source document does not have an `id`.
|
|
102
|
+
#
|
|
103
|
+
# Note: As a reminder, according to the NMDC Schema (as of version v11.8.0), documents in the
|
|
104
|
+
# `functional_annotation_agg` collection do not have an `id` field.
|
|
105
|
+
# Reference: https://microbiomedata.github.io/nmdc-schema/FunctionalAnnotationAggMember/
|
|
106
|
+
#
|
|
107
|
+
source_document_id = referring_document.get("id", None)
|
|
108
|
+
if not isinstance(source_document_id, str):
|
|
109
|
+
source_document_id = ""
|
|
110
|
+
|
|
96
111
|
source_class_name = translate_class_uri_into_schema_class_name(
|
|
97
112
|
schema_view=schema_view,
|
|
98
113
|
class_uri=referring_document["type"],
|
|
@@ -101,7 +116,7 @@ def identify_referring_documents(
|
|
|
101
116
|
source_collection_name=collection_name,
|
|
102
117
|
source_class_name=source_class_name,
|
|
103
118
|
source_document_object_id=referring_document["_id"],
|
|
104
|
-
source_document_id=
|
|
119
|
+
source_document_id=source_document_id,
|
|
105
120
|
)
|
|
106
121
|
referring_document_descriptors.append(document_descriptor)
|
|
107
122
|
|
|
@@ -195,7 +210,7 @@ def scan_outgoing_references(
|
|
|
195
210
|
|
|
196
211
|
# Handle the case where the source document does not have an `id`.
|
|
197
212
|
#
|
|
198
|
-
# Note: As a reminder, according to the NMDC Schema (as of version v11.
|
|
213
|
+
# Note: As a reminder, according to the NMDC Schema (as of version v11.8.0), documents in the
|
|
199
214
|
# `functional_annotation_agg` collection do not have an `id` field.
|
|
200
215
|
# Reference: https://microbiomedata.github.io/nmdc-schema/FunctionalAnnotationAggMember/
|
|
201
216
|
#
|
|
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
|