Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vshand11 committed Oct 24, 2024
1 parent dd6cd43 commit 579adaf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
6 changes: 0 additions & 6 deletions models/invalidprogram.tsv

This file was deleted.

2 changes: 0 additions & 2 deletions src/metadata_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ def sort_columns(self, cols, node_type):
columns.insert(0, columns.pop(old_index))
old_index = columns.index(self.model.get_node_id(node_type))
columns.insert(1, columns.pop(old_index))
old_index = columns.index(CRDC_ID.lower())
columns.insert(2, columns.pop(old_index))
return columns

def transfer_release_metadata(self):
Expand Down
11 changes: 7 additions & 4 deletions src/metadata_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def metadataValidate(configs, job_queue, mongo_dao):
submission_id = data.get(SUBMISSION_ID)
if data.get(SQS_TYPE) == TYPE_METADATA_VALIDATE and submission_id and data.get(SCOPE) and data.get(VALIDATION_ID):
scope = data[SCOPE]
validator = MetaDataValidator(mongo_dao, model_store)
validator = MetaDataValidator(mongo_dao, model_store, configs)
status = validator.validate(submission_id, scope)
validation_id = data[VALIDATION_ID]
validation_end_at = current_datetime()
Expand Down Expand Up @@ -98,17 +98,19 @@ def metadataValidate(configs, job_queue, mongo_dao):
"""
class MetaDataValidator:

def __init__(self, mongo_dao, model_store):
def __init__(self, mongo_dao, model_store, config):
self.log = get_logger('MetaData Validator')
self.mongo_dao = mongo_dao
self.model_store = model_store
self.config = config
self.model = None
self.submission_id = None
self.scope = None
self.submission = None
self.isError = None
self.isWarning = None


def validate(self, submission_id, scope):
#1. # get data common from submission
submission = self.mongo_dao.get_submission(submission_id)
Expand All @@ -124,6 +126,7 @@ def validate(self, submission_id, scope):
self.scope = scope
self.submission = submission
datacommon = submission.get(DATA_COMMON_NAME)
self.datacommon = datacommon
model_version = submission.get(MODEL_VERSION)
#2 get data model based on datacommon and version
self.model = self.model_store.get_model_by_data_common_version(datacommon, model_version)
Expand All @@ -141,7 +144,7 @@ def validate(self, submission_id, scope):
self.log.error(msg)
return FAILED

count = len(data_records)
count = len(data_records)
validated_count += self.validate_nodes(data_records)
if count < BATCH_SIZE:
self.log.info(f"{submission_id}: {validated_count} out of {count + start_index} nodes are validated.")
Expand Down Expand Up @@ -524,7 +527,7 @@ def get_permissive_value(self, prop_def):
permissive_vals = cde[CDE_PERMISSIVE_VALUES]
else:
# call pv_puller to get permissible values from caDSR
cde = get_pv_by_code_version(self.config, cde_code, cde_version)
cde, msg = get_pv_by_code_version(self.config, self.log, self.datacommon, prop_def["name"], cde_code, cde_version)
if cde:
if cde.get(CDE_PERMISSIVE_VALUES):
if len(cde[CDE_PERMISSIVE_VALUES]) > 0:
Expand Down
2 changes: 1 addition & 1 deletion src/pv_puller.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def pull_pv(self):
self.log.exception(msg)
return False

def get_pv_by_code_version(configs, log, data_common, prop_name,cde_code, cde_version):
def get_pv_by_code_version(configs, log, data_common, prop_name, cde_code, cde_version):
"""
get permissive values by cde code and version
:param cde_code: cde code
Expand Down

0 comments on commit 579adaf

Please sign in to comment.