The pyQuARC tool reads and evaluates metadata records with a focus on the consistency and robustness of the metadata. pyQuARC flags opportunities to improve or add to contextual metadata information in order to help the user connect to relevant data products. pyQuARC also ensures that information common to both the data product and the file-level metadata are consistent and compatible. pyQuARC frees up human evaluators to make more sophisticated assessments such as whether an abstract accurately describes the data and provides the correct contextual information. The base pyQuARC package assesses descriptive metadata used to catalog Earth observation data products and files. As open source software, pyQuARC can be adapted and customized by data providers to allow for quality checks that evolve with their needs, including checking metadata not covered in base package.
Apache License 2.0
19
stars
0
forks
source link
Fix null pointer checking ends_at_present_flag while validating echo10 metadata #164
Describe the bug
Our test framework is trying to validate an ECHO10 record and getting a null pointer when checking ends_at_present_flag, see diff below:
diff --git a/pyQuARC/code/custom_validator.py b/pyQuARC/code/custom_validator.py
index 3171bcd..08e3add 100644
--- a/pyQuARC/code/custom_validator.py
+++ b/pyQuARC/code/custom_validator.py
@@ -130,8 +130,8 @@ class CustomValidator(BaseValidator):
def user_services_check(first_name, middle_name, last_name):
return {
"valid": not (
(not middle_name or (middle_name.lower() == 'null'))
),
"value": f'{first_name} {middle_name} {last_name}'
@@ -159,9 +159,9 @@ class CustomValidator(BaseValidator):
# Logic: https://github.com/NASA-IMPACT/pyQuARC/issues/61
validity = True
if collection_state.upper() in ["ACTIVE", "IN WORK"]:
- validity = (not bool(ending_date_time)) and ends_at_present_flag.lower() == "true"
+ validity = (not bool(ending_date_time)) and (ends_at_present_
[failed_test.txt](https://github.com/NASA-IMPACT/pyQuARC/files/8116047/failed_test.txt)
flag and ends_at_present_flag.lower() == "true")
elif collection_state.upper() == "COMPLETE":
- validity = bool(ending_date_time) and (not bool(ends_at_present_flag) or ends_at_present_flag.lower() == "false")
+ validity = bool(ending_date_time) and (not bool(ends_at_present_flag) or (ends_at_present_flag and ends_at_present_flag.lower() == "false"))
else:
validity = False
return {
Describe the bug Our test framework is trying to validate an ECHO10 record and getting a null pointer when checking ends_at_present_flag, see diff below: