diff --git a/src/app.py b/src/app.py index 3bf2db55..dc27e324 100644 --- a/src/app.py +++ b/src/app.py @@ -1327,12 +1327,12 @@ def update_entity(id): # Get target entity and return as a dict if exists entity_dict = query_target_entity(id, user_token) - json_data_dict = check_for_metadata(entity_dict.get('entity_type'), user_token) - verify_ubkg_properties(json_data_dict) - # Normalize user provided entity_type normalized_entity_type = schema_manager.normalize_entity_type(entity_dict['entity_type']) + json_data_dict = check_for_metadata(normalized_entity_type, user_token) + verify_ubkg_properties(json_data_dict) + # Note, we don't support entity level validators on entity update via PUT # Only entity create via POST is supported at the entity level @@ -1389,7 +1389,7 @@ def update_entity(id): # Generate 'before_update_trigger' data and update the entity details in Neo4j merged_updated_dict = update_object_details('ENTITIES', request, normalized_entity_type, user_token, json_data_dict, entity_dict) - # Handle linkages update via `after_update_trigger` methods + # Handle linkages update via `after_update_trigger` methods if has_direct_ancestor_uuids: after_update(normalized_entity_type, user_token, merged_updated_dict) elif normalized_entity_type == 'Upload': diff --git a/src/schema/provenance_schema.yaml b/src/schema/provenance_schema.yaml index 2ec438a0..5855aa2c 100644 --- a/src/schema/provenance_schema.yaml +++ b/src/schema/provenance_schema.yaml @@ -125,6 +125,12 @@ ACTIVITIES: description: "The information describing how this dataset was processed (e.g. the DAG provenance list describing the various tools used during an ingest-pipeline run to generate a derived dataset)" before_create_trigger: set_processing_information before_update_trigger: set_processing_information + # Allows us to set processing_information when metadata is passed in the payload + metadata: + type: json_string # dict + description: "The metadata returned from the processing at data submission time." + transient: true + before_update_trigger: set_processing_information #TODO: We will possibly create additional activity types with different attributes #################################################################################################### diff --git a/src/schema/schema_triggers.py b/src/schema/schema_triggers.py index bd1413b4..9ab9b45b 100644 --- a/src/schema/schema_triggers.py +++ b/src/schema/schema_triggers.py @@ -2194,7 +2194,8 @@ def set_processing_information(property_key, normalized_type, user_token, existi metadata_to_return = {} metadata = schema_manager.convert_str_to_data(new_data_dict['metadata']) metadata_to_return['dag_provenance_list'] = metadata['dag_provenance_list'] - return property_key, metadata_to_return + # Need to hard set `processing_information` as this gets called when `metadata` is passed in the payload + return 'processing_information', metadata_to_return except requests.exceptions.RequestException as e: raise requests.exceptions.RequestException(e)