Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyQuARC/code/schema_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@ def _build_errors(error_log, paths):
# For DIF, because the namespace is specified in the metadata file, lxml library
# provides field name concatenated with the namespace,
# the following 3 lines of code removes the namespace

namespaces = re.findall(r"(\{http[^}]*\})", line)
for namespace in namespaces:
line = line.replace(namespace, "")
field_name = re.search(r"Element\s'(.*)':", line)[1]
field_name = re.search(r"Element\s'(.*)':", line)[1]
field_paths = [abs_path for abs_path in paths if field_name in abs_path]
field_name = field_paths[0] if len(field_paths) == 1 else field_name
message = re.search(r"Element\s'.+':\s(\[.*\])?(.*)", line)[2].strip()
Expand Down
11 changes: 11 additions & 0 deletions pyQuARC/code/url_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,14 @@ def doi_link_update(value, bad_urls):
validity = False

return {"valid": validity, "value": value}

@staticmethod
@if_arg
def url_update_email_check(url, bad_urls):
validity = True
# Check if the URL matches '[email protected]'
if url in bad_urls or url == "[email protected]":
# Update the URL
url = "[email protected]"
validity = False # Mark as invalid if the URL was updated
return {"valid": validity, "value": url}
8 changes: 8 additions & 0 deletions pyQuARC/schemas/check_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
},
"remediation": "This often indicates a broken link. If the URL is broken, recommend revising."
},
"url_update_email_check": {
"failure": "The listed email contact information must be updated.",
"help": {
"message": "Recommend providing the updated contact information as per the data product.",
"url": "https://wiki.earthdata.nasa.gov/display/CMR/Data+Center"
},
"remediation": "Recommend changing the contact information to '[email protected]'. "
},
"shortname_uniqueness": {
"failure": "The EntryTitle/DataSetId `{}` is identical to the ShortName `{}`.",
"help": {
Expand Down
5 changes: 5 additions & 0 deletions pyQuARC/schemas/checks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"check_function": "health_and_status_check",
"available": true
},
"url_update_email_check": {
"data_type": "url",
"check_function": "url_update_email_check",
"available": true
},
"string_compare": {
"data_type": "string",
"check_function": "compare",
Expand Down
17 changes: 16 additions & 1 deletion pyQuARC/schemas/rule_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5564,5 +5564,20 @@
},
"severity": "warning",
"check_id": "one_item_presence_check"
}
},
"url_update_email_check": {
"rule_name": "URL Email address check",
"fields_to_apply": {
"umm-c": [
{
"fields": [
"DataCenters/ContactGroups/ContactInformation/ContactMechanisms/Value",
"DataCenters/ContactGroups/ContactInformation/ContactInstruction"
]
}
]
},
"severity": "info",
"check_id": "url_update_email_check"
}
}
4 changes: 2 additions & 2 deletions tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class TestDownloader:
def setup_method(self):
self.concept_ids = {
"collection": {
"real": "C1000000010-CDDIS",
"real": "C1000000042-CDDIS",
"dummy": "C123456-LPDAAC_ECS",
},
"granule": {
"real": "G1001434969-CDDIS",
"real": "G1018577631-CDDIS",
"dummy": "G1000000002-CMR_PROV",
},
"invalid": "asdfasdf",
Expand Down