diff --git a/VERSION b/VERSION index 57cf282e..338a5b5d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.5 +2.6.6 diff --git a/src/app.py b/src/app.py index 130b37a3..3a9dafe3 100644 --- a/src/app.py +++ b/src/app.py @@ -508,7 +508,7 @@ def get_ancestor_organs(id): # Skip executing the trigger method to get Sample.direct_ancestor properties_to_skip = ['direct_ancestor'] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, organs, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, organs, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -613,7 +613,7 @@ def get_entity_visibility(id): # Otherwise re-generate on the fly. To verify if a Collection is public, it is # necessary to have its Datasets, which are populated as triggered data, so # pull back the complete entity - complete_dict = schema_manager.get_complete_entity_result(request, token, entity_dict) + complete_dict = schema_manager.get_complete_entity_result(request.args, token, entity_dict) # Determine if the entity is publicly visible base on its data, only. entity_scope = _get_entity_visibility(normalized_entity_type=normalized_entity_type, entity_dict=complete_dict) @@ -673,7 +673,7 @@ def get_provenance_metadata_by_id_for_auth_level(id): # Get the generated complete entity result from cache if exists # Otherwise re-generate on the fly - complete_dict = schema_manager.get_complete_entity_result(request=request + complete_dict = schema_manager.get_complete_entity_result(request_args=request.args , token=token , entity_dict=dataset_dict) @@ -830,7 +830,7 @@ def get_entity_by_id(id): # rather than within it. However, it leverages the existing `exclude_properties_from_response()` # function for simplicity and maintainability. - Zhou 10/1/2025 try: - all_props_to_exclude = schema_manager.get_excluded_query_props(request) + all_props_to_exclude = schema_manager.get_excluded_query_props(request.args) # Determine which top-level properties to exclude from triggers and which to exclude directly from the resulting Neo4j `entity_dict` # Also get nested properties that are directly returned from Neo4j, which will be handled differently @@ -844,7 +844,7 @@ def get_entity_by_id(id): # Otherwise re-generate on the fly # NOTE: top-level properties in `triggered_top_props_to_skip` will skip the trigger methods # Nested properties like `direct_ancestors.files` will be handled by the trigger method - Zhou 10/1/2025 - complete_dict = schema_manager.get_complete_entity_result(request, token, entity_dict, triggered_top_props_to_skip) + complete_dict = schema_manager.get_complete_entity_result(request.args, token, entity_dict, triggered_top_props_to_skip) # Determine if the entity is publicly visible base on its data, only. # To verify if a Collection is public, it is necessary to have its Datasets, which @@ -1096,7 +1096,7 @@ def get_entities_by_type(entity_type): # Get back a list of entity dicts for the given entity type entities_list = app_neo4j_queries.get_entities_by_type(neo4j_driver_instance, normalized_entity_type) - complete_entities_list = schema_manager.get_complete_entities_list(request, token, entities_list, generated_properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, entities_list, generated_properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -1177,7 +1177,7 @@ def create_entity(entity_type): # # Check if re-indexing is to be suppressed after entity creation. try: - supress_reindex = schema_manager.suppress_reindex(request) + supress_reindex = schema_manager.suppress_reindex(request.args) except Exception as e: bad_request_error(e) @@ -1297,7 +1297,7 @@ def create_entity(entity_type): properties_to_skip = [] # Generate the filtered or complete entity dict to send back - complete_dict = schema_manager.get_complete_entity_result(request, user_token, merged_dict, properties_to_skip) + complete_dict = schema_manager.get_complete_entity_result(request.args, user_token, merged_dict, properties_to_skip) # Will also filter the result based on schema normalized_complete_dict = schema_manager.normalize_entity_result_for_response(complete_dict) @@ -1486,7 +1486,7 @@ def update_entity(id): # # Check if re-indexing is to be suppressed after entity creation. try: - suppress_reindex = schema_manager.suppress_reindex(request) + suppress_reindex = schema_manager.suppress_reindex(request.args) except Exception as e: bad_request_error(e) @@ -1692,7 +1692,7 @@ def get_ancestors(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, ancestors_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, ancestors_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -1777,7 +1777,7 @@ def get_descendants(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, user_token, descendants_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, user_token, descendants_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -1900,7 +1900,7 @@ def get_parents(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, parents_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, parents_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -1984,7 +1984,7 @@ def get_children(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, user_token, children_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, user_token, children_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -2101,7 +2101,7 @@ def get_siblings(id): 'local_directory_rel_path' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, sibling_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, sibling_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) filtered_final_result = [] @@ -2216,7 +2216,7 @@ def get_tuplets(id): 'local_directory_rel_path' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, tuplet_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, tuplet_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) filtered_final_result = [] @@ -2288,7 +2288,7 @@ def get_previous_revisions(id): 'direct_ancestors' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, user_token, descendants_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, user_token, descendants_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -2352,7 +2352,7 @@ def get_next_revisions(id): 'direct_ancestors' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, user_token, descendants_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, user_token, descendants_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -2444,7 +2444,7 @@ def get_collections(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, collection_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, collection_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -2551,7 +2551,7 @@ def get_uploads(id): 'previous_revision_uuid' ] - complete_entities_list = schema_manager.get_complete_entities_list(request, token, uploads_list, properties_to_skip) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, uploads_list, properties_to_skip) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -2902,7 +2902,7 @@ def get_dataset_latest_revision(id): ] # On entity retrieval, the 'on_read_trigger' doesn't really need a token - complete_dict = schema_manager.get_complete_entity_result(request, token, latest_revision_dict, properties_to_skip) + complete_dict = schema_manager.get_complete_entity_result(request.args, token, latest_revision_dict, properties_to_skip) # Also normalize the result based on schema final_result = schema_manager.normalize_entity_result_for_response(complete_dict) @@ -3037,7 +3037,7 @@ def get_dataset_revision_number(id): # # if property_key is None: # for revision in sorted_revisions_list_merged: -# complete_revision_list = schema_manager.get_complete_entities_list(request, token, revision, properties_to_skip) +# complete_revision_list = schema_manager.get_complete_entities_list(request.args, token, revision, properties_to_skip) # normal = schema_manager.normalize_entities_list_for_response(complete_revision_list) # normalized_revisions_list.append(normal) # else: @@ -3141,7 +3141,7 @@ def retract_dataset(id): # No need to call after_update() afterwards because retraction doesn't call any after_update_trigger methods merged_updated_dict = update_entity_details(request, normalized_entity_type, token, json_data_dict, entity_dict) - complete_dict = schema_manager.get_complete_entity_result(request, token, merged_updated_dict) + complete_dict = schema_manager.get_complete_entity_result(request.args, token, merged_updated_dict) # Will also filter the result based on schema normalized_complete_dict = schema_manager.normalize_entity_result_for_response(complete_dict) @@ -3217,7 +3217,7 @@ def get_revisions_list(id): 'upload', 'title' ] - complete_revisions_list = schema_manager.get_complete_entities_list(request, token, sorted_revisions_list, properties_to_skip) + complete_revisions_list = schema_manager.get_complete_entities_list(request.args, token, sorted_revisions_list, properties_to_skip) normalized_revisions_list = schema_manager.normalize_entities_list_for_response(complete_revisions_list) fields_to_exclude = schema_manager.get_fields_to_exclude(normalized_entity_type) # Only check the very last revision (the first revision dict since normalized_revisions_list is already sorted DESC) @@ -3300,7 +3300,7 @@ def get_associated_organs_from_dataset(id): if len(associated_organs) < 1: not_found_error("the dataset does not have any associated organs") - complete_entities_list = schema_manager.get_complete_entities_list(request, token, associated_organs) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, associated_organs) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -3360,7 +3360,7 @@ def get_associated_samples_from_dataset(id): if len(associated_samples) < 1: not_found_error("the dataset does not have any associated samples") - complete_entities_list = schema_manager.get_complete_entities_list(request, token, associated_samples) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, associated_samples) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -3420,7 +3420,7 @@ def get_associated_donors_from_dataset(id): if len(associated_donors) < 1: not_found_error("the dataset does not have any associated donors") - complete_entities_list = schema_manager.get_complete_entities_list(request, token, associated_donors) + complete_entities_list = schema_manager.get_complete_entities_list(request.args, token, associated_donors) # Final result after normalization final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list) @@ -4122,7 +4122,7 @@ def multiple_components(): # # Check if re-indexing is to be suppressed after entity creation. try: - suppress_reindex = schema_manager.suppress_reindex(request) + suppress_reindex = schema_manager.suppress_reindex(request.args) except Exception as e: bad_request_error(e) @@ -4154,7 +4154,7 @@ def multiple_components(): # Remove dataset_link_abs_dir once more before entity creation dataset_link_abs_dir = dataset.pop('dataset_link_abs_dir', None) # Generate the filtered or complete entity dict to send back - complete_dict = schema_manager.get_complete_entity_result(request, user_token, dataset, properties_to_skip) + complete_dict = schema_manager.get_complete_entity_result(request.args, user_token, dataset, properties_to_skip) # Will also filter the result based on schema normalized_complete_dict = schema_manager.normalize_entity_result_for_response(complete_dict) @@ -4616,7 +4616,7 @@ def _get_dataset_associated_metadata(dataset_dict, dataset_visibility, valid_use # Use the internal token to query the target entity to assure it is returned. This way public # entities can be accessed even if valid_user_token is None. internal_token = auth_helper_instance.getProcessSecret() - complete_entities_list = schema_manager.get_complete_entities_list( request=request + complete_entities_list = schema_manager.get_complete_entities_list( request_args=request.args , token=internal_token , entities_list=associated_entities) # Final result after normalization @@ -4706,7 +4706,7 @@ def create_entity_details(request, normalized_entity_type, user_token, json_data # Use {} since no existing dict generated_before_create_trigger_data_dict = schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.BEFORE_CREATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict={} , new_data_dict=new_data_dict) @@ -4865,7 +4865,7 @@ def create_multiple_samples_details(request, normalized_entity_type, user_token, # Use {} since no existing dict generated_before_create_trigger_data_dict = schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.BEFORE_CREATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict={} , new_data_dict=new_data_dict) @@ -4920,7 +4920,7 @@ def create_multiple_samples_details(request, normalized_entity_type, user_token, samples_dict_list.append(sample_dict) # Generate property values for the only one Activity node - activity_data_dict = schema_manager.generate_activity_data(normalized_entity_type, request, user_token, user_info_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_entity_type, request.args, user_token, user_info_dict) # Create new sample nodes and needed relationships as well as activity node in one transaction try: @@ -4995,7 +4995,7 @@ def create_multiple_component_details(request, normalized_entity_type, user_toke # Use {} since no existing dict generated_before_create_trigger_data_dict = schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.BEFORE_CREATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict={} , new_data_dict=new_data_dict) @@ -5042,7 +5042,7 @@ def create_multiple_component_details(request, normalized_entity_type, user_toke dataset_dict['dataset_link_abs_dir'] = dataset_link_abs_dir datasets_dict_list.append(dataset_dict) - activity_data_dict = schema_manager.generate_activity_data(normalized_entity_type, request, user_token, user_info_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_entity_type, request.args, user_token, user_info_dict) activity_data_dict['creation_action'] = creation_action try: created_datasets = app_neo4j_queries.create_multiple_datasets(neo4j_driver_instance, datasets_dict_list, activity_data_dict, direct_ancestor) @@ -5080,7 +5080,7 @@ def after_create(normalized_entity_type, request, user_token, merged_data_dict, # Use {} since no new dict schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.AFTER_CREATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict=merged_data_dict , new_data_dict=json_data_dict) @@ -5125,7 +5125,7 @@ def update_entity_details(request, normalized_entity_type, user_token, json_data try: generated_before_update_trigger_data_dict = schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.BEFORE_UPDATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict=existing_entity_dict , new_data_dict=new_data_dict) @@ -5201,7 +5201,7 @@ def after_update(normalized_entity_type, request, user_token, merged_updated_dic try: schema_manager.generate_triggered_data( trigger_type=TriggerTypeEnum.AFTER_UPDATE , normalized_class=normalized_entity_type - , request=request + , request_args=request.args , user_token=user_token , existing_data_dict=merged_updated_dict , new_data_dict=json_data_dict) @@ -5570,7 +5570,7 @@ def _get_metadata_by_id(entity_id:str=None, metadata_scope:MetadataScopeEnum=Met # Get the entity result of the indexable dictionary from cache if exists, otherwise regenerate and cache metadata_dict = schema_manager.get_index_metadata(request, token, entity_dict) \ if metadata_scope==MetadataScopeEnum.INDEX \ - else schema_manager.get_complete_entity_result(request, token, entity_dict) + else schema_manager.get_complete_entity_result(request.args, token, entity_dict) # Determine if the entity is publicly visible base on its data, only. # To verify if a Collection is public, it is necessary to have its Datasets, which diff --git a/src/schema/schema_manager.py b/src/schema/schema_manager.py index 2fcf025a..5808c468 100644 --- a/src/schema/schema_manager.py +++ b/src/schema/schema_manager.py @@ -357,8 +357,8 @@ def delete_nested_field(data, nested_path): Parameters ---------- -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request Returns ------- @@ -366,12 +366,12 @@ def delete_nested_field(data, nested_path): A flat list of strings containing top-level and/or nested dot-notated properties Example: ['a.b', 'a.c', 'x'] """ -def get_excluded_query_props(request): +def get_excluded_query_props(request_args): all_props_to_exclude = [] - if 'exclude' in request.args: + if 'exclude' in request_args: # The query string values are case-sensitive as the property keys in schema yaml are case-sensitive - props_to_exclude_str = request.args.get('exclude') + props_to_exclude_str = request_args.get('exclude') if not validate_comma_separated_exclude_str(props_to_exclude_str): raise ValueError( @@ -556,8 +556,8 @@ def get_exclusion_types(normalized_entity_type, flat_list): One of the trigger types: on_create_trigger, on_update_trigger, on_read_trigger normalized_class : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token, 'on_read_trigger' doesn't really need this existing_data_dict : dict @@ -572,7 +572,7 @@ def get_exclusion_types(normalized_entity_type, flat_list): dict A dictionary of trigger event methods generated data """ -def generate_triggered_data(trigger_type: TriggerTypeEnum, normalized_class, request, user_token, existing_data_dict +def generate_triggered_data(trigger_type: TriggerTypeEnum, normalized_class, request_args, user_token, existing_data_dict , new_data_dict, properties_to_skip = []): global _schema @@ -623,7 +623,7 @@ def generate_triggered_data(trigger_type: TriggerTypeEnum, normalized_class, req # No return values for 'after_create_trigger' and 'after_update_trigger' # because the property value is already set and stored in neo4j # Normally it's building linkages between entity nodes - trigger_method_to_call(key, normalized_class, request, user_token, existing_data_dict, new_data_dict) + trigger_method_to_call(key, normalized_class, request_args, user_token, existing_data_dict, new_data_dict) except Exception: msg = f"Failed to call the {trigger_type.value} method: {trigger_method_name}" # Log the full stack trace, prepend a line with our message @@ -658,9 +658,9 @@ def generate_triggered_data(trigger_type: TriggerTypeEnum, normalized_class, req #within this dictionary and return it so it can be saved in the scope of this loop and #passed to other 'updated_peripherally' triggers if 'updated_peripherally' in properties[key] and properties[key]['updated_peripherally']: - trigger_generated_data_dict = trigger_method_to_call(key, normalized_class, request, user_token, existing_data_dict, new_data_dict, trigger_generated_data_dict) + trigger_generated_data_dict = trigger_method_to_call(key, normalized_class, request_args, user_token, existing_data_dict, new_data_dict, trigger_generated_data_dict) else: - target_key, target_value = trigger_method_to_call(key, normalized_class, request, user_token, existing_data_dict, new_data_dict) + target_key, target_value = trigger_method_to_call(key, normalized_class, request_args, user_token, existing_data_dict, new_data_dict) trigger_generated_data_dict[target_key] = target_value # Meanwhile, set the original property as None if target_key is different @@ -707,9 +707,9 @@ def generate_triggered_data(trigger_type: TriggerTypeEnum, normalized_class, req # passed to other 'updated_peripherally' triggers if 'updated_peripherally' in properties[key] and properties[key]['updated_peripherally']: # Such trigger methods get executed but really do nothing internally - trigger_generated_data_dict = trigger_method_to_call(key, normalized_class, request, user_token, existing_data_dict, new_data_dict, trigger_generated_data_dict) + trigger_generated_data_dict = trigger_method_to_call(key, normalized_class, request_args, user_token, existing_data_dict, new_data_dict, trigger_generated_data_dict) else: - target_key, target_value = trigger_method_to_call(key, normalized_class, request, user_token, existing_data_dict, new_data_dict) + target_key, target_value = trigger_method_to_call(key, normalized_class, request_args, user_token, existing_data_dict, new_data_dict) trigger_generated_data_dict[target_key] = target_value # Meanwhile, set the original property as None if target_key is different @@ -818,8 +818,8 @@ def remove_transient_and_none_values(merged_dict, normalized_entity_type): Parameters ---------- -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request token: str Either the user's globus nexus token or the internal token entity_dict : dict @@ -832,7 +832,7 @@ def remove_transient_and_none_values(merged_dict, normalized_entity_type): dict A dictionary of complete entity with all the generated 'on_read_trigger' data """ -def get_complete_entity_result(request, token, entity_dict, properties_to_skip = []): +def get_complete_entity_result(request_args, token, entity_dict, properties_to_skip = []): global _memcached_client global _memcached_prefix @@ -853,7 +853,7 @@ def get_complete_entity_result(request, token, entity_dict, properties_to_skip = # As long as `properties_to_skip` is specified or when`?exclude` is used in query parameter # Do not return the cached data and store the new cache regardless of it's available or not - Zhou 10/10/2025 - if properties_to_skip or get_excluded_query_props(request): + if properties_to_skip or get_excluded_query_props(request_args): logger.info(f'Skipped/excluded properties specified for {entity_type} {entity_uuid}. Always generate the {TriggerTypeEnum.ON_READ} data and do not cache the result.') # No error handling here since if a 'on_read_trigger' method fails, @@ -861,7 +861,7 @@ def get_complete_entity_result(request, token, entity_dict, properties_to_skip = # Pass {} since no new_data_dict for 'on_read_trigger' generated_on_read_trigger_data_dict = generate_triggered_data( trigger_type=TriggerTypeEnum.ON_READ , normalized_class=entity_type - , request=request + , request_args=request_args , user_token=token , existing_data_dict=entity_dict , new_data_dict={} @@ -886,7 +886,7 @@ def get_complete_entity_result(request, token, entity_dict, properties_to_skip = # Pass {} since no new_data_dict for 'on_read_trigger' generated_on_read_trigger_data_dict = generate_triggered_data( trigger_type=TriggerTypeEnum.ON_READ , normalized_class=entity_type - , request=request + , request_args=request_args , user_token=token , existing_data_dict=entity_dict , new_data_dict={} @@ -955,8 +955,8 @@ def get_index_metadata(request, token, entity_dict, properties_to_skip=[]): Parameters ---------- -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request token: str Either the user's globus nexus token or the internal token entities_list : list @@ -969,13 +969,13 @@ def get_index_metadata(request, token, entity_dict, properties_to_skip=[]): list A list a complete entity dictionaries with all the normalized information """ -def get_complete_entities_list(request, token, entities_list, properties_to_skip = []): +def get_complete_entities_list(request_args, token, entities_list, properties_to_skip = []): complete_entities_list = [] # Use a pool of threads to execute the time-consuming iteration asynchronously to avoid timeout - Zhou 2/6/2025 with concurrent.futures.ThreadPoolExecutor() as executor: helper_func = lambda args: get_complete_entity_result(args[0], args[1], args[2], args[3]) - args_list = [(request, token, entity_dict, properties_to_skip) for entity_dict in entities_list] + args_list = [(request_args, token, entity_dict, properties_to_skip) for entity_dict in entities_list] # The order of donors/organs/samples lists are not gurenteed with using `executor.submit()` # `executor.map()` maintains the same order of results as the original submitted tasks @@ -2068,8 +2068,8 @@ def get_entity_group_name(group_uuid): ---------- normalized_entity_type : str One of the entity types defined in the schema yaml: Donor, Sample, Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token user_info_dict : dict @@ -2081,7 +2081,7 @@ def get_entity_group_name(group_uuid): ------- dict: A dict of gnerated Activity data """ -def generate_activity_data(normalized_entity_type, request, user_token, user_info_dict): +def generate_activity_data(normalized_entity_type, request_args, user_token, user_info_dict): # Activity is not an Entity normalized_activity_type = 'Activity' @@ -2097,7 +2097,7 @@ def generate_activity_data(normalized_entity_type, request, user_token, user_inf # Generate property values for Activity node generated_activity_data_dict = generate_triggered_data( trigger_type=TriggerTypeEnum.BEFORE_CREATE , normalized_class=normalized_activity_type - , request=request + , request_args=request_args , user_token=user_token , existing_data_dict={} , new_data_dict=data_dict_for_activity) @@ -2363,28 +2363,28 @@ def get_organ_types(): """ -Use the Flask request.args MultiDict to see if 'reindex' is a URL parameter passed in with the -request and if it indicates reindexing should be supressed. Default to reindexing in all other cases. +See if 'reindex' is a URL parameter passed in with the request and +if it indicates reindexing should be supressed. Default to reindexing in all other cases. Parameters ---------- -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request Returns ------- bool """ -def suppress_reindex(request) -> bool: - if 'reindex' not in request.args: +def suppress_reindex(request_args) -> bool: + if 'reindex' not in request_args: return False - reindex_str = request.args.get('reindex').lower() + reindex_str = request_args.get('reindex').lower() if reindex_str == 'false': return True elif reindex_str == 'true': return False raise Exception(f"The value of the 'reindex' parameter must be True or False (case-insensitive)." - f" '{request.args.get('reindex')}' is not recognized.") + f" '{request_args.get('reindex')}' is not recognized.") #################################################################################################### @@ -2446,7 +2446,7 @@ def _get_metadata_result(request, token, entity_dict, metadata_scope:MetadataSco # Pass {} since no new_data_dict for 'on_read_trigger' generated_on_read_trigger_data_dict = generate_triggered_data( trigger_type=TriggerTypeEnum.ON_READ , normalized_class=entity_type - , request=request + , request_args=request.args , user_token=token , existing_data_dict=entity_dict , new_data_dict={} @@ -2463,7 +2463,7 @@ def _get_metadata_result(request, token, entity_dict, metadata_scope:MetadataSco # Pass {} since no new_data_dict for 'on_index_trigger' generated_on_index_trigger_data_dict = generate_triggered_data( trigger_type=TriggerTypeEnum.ON_INDEX , normalized_class=entity_type - , request=request + , request_args=request.args , user_token=token , existing_data_dict=entity_dict , new_data_dict={} diff --git a/src/schema/schema_triggers.py b/src/schema/schema_triggers.py index 9185d260..a23321f9 100644 --- a/src/schema/schema_triggers.py +++ b/src/schema/schema_triggers.py @@ -36,8 +36,8 @@ The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -50,7 +50,7 @@ str: The target property key str: The neo4j TIMESTAMP() function as string """ -def set_timestamp(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_timestamp(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): # Use the neo4j TIMESTAMP() function during entity creation # Will be proessed in app_neo4j_queries._build_properties_map() # and schema_neo4j_queries._build_properties_map() @@ -68,8 +68,8 @@ def set_timestamp(property_key, normalized_type, request, user_token, existing_d The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -82,7 +82,7 @@ def set_timestamp(property_key, normalized_type, request, user_token, existing_d str: The target property key str: The string of normalized entity type """ -def set_entity_type(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_entity_type(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): return property_key, normalized_type @@ -97,8 +97,8 @@ def set_entity_type(property_key, normalized_type, request, user_token, existing The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -111,7 +111,7 @@ def set_entity_type(property_key, normalized_type, request, user_token, existing str: The target property key str: The 'sub' string """ -def set_user_sub(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_user_sub(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'sub' not in new_data_dict: raise KeyError("Missing 'sub' key in 'new_data_dict' during calling 'set_user_sub()' trigger method.") @@ -129,8 +129,8 @@ def set_user_sub(property_key, normalized_type, request, user_token, existing_da The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -143,7 +143,7 @@ def set_user_sub(property_key, normalized_type, request, user_token, existing_da str: The target property key str: The 'email' string """ -def set_user_email(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_user_email(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'email' not in new_data_dict: raise KeyError("Missing 'email' key in 'new_data_dict' during calling 'set_user_email()' trigger method.") @@ -161,8 +161,8 @@ def set_user_email(property_key, normalized_type, request, user_token, existing_ The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -175,7 +175,7 @@ def set_user_email(property_key, normalized_type, request, user_token, existing_ str: The target property key str: The 'name' string """ -def set_user_displayname(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_user_displayname(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'name' not in new_data_dict: raise KeyError("Missing 'name' key in 'new_data_dict' during calling 'set_user_displayname()' trigger method.") @@ -193,8 +193,8 @@ def set_user_displayname(property_key, normalized_type, request, user_token, exi The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -207,7 +207,7 @@ def set_user_displayname(property_key, normalized_type, request, user_token, exi str: The target property key str: The uuid created via uuid-api """ -def set_uuid(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_uuid(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in new_data_dict: raise KeyError("Missing 'uuid' key in 'new_data_dict' during calling 'set_uuid()' trigger method.") @@ -225,8 +225,8 @@ def set_uuid(property_key, normalized_type, request, user_token, existing_data_d The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -239,7 +239,7 @@ def set_uuid(property_key, normalized_type, request, user_token, existing_data_d str: The target property key str: The hubmap_id created via uuid-api """ -def set_hubmap_id(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_hubmap_id(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'hubmap_id' not in new_data_dict: raise KeyError("Missing 'hubmap_id' key in 'new_data_dict' during calling 'set_hubmap_id()' trigger method.") @@ -262,8 +262,8 @@ def set_hubmap_id(property_key, normalized_type, request, user_token, existing_d The target property key of the value to be generated normalized_type : str One of the entity types defined in the schema yaml: Donor, Sample, Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -276,7 +276,7 @@ def set_hubmap_id(property_key, normalized_type, request, user_token, existing_d str: The target property key str: The data access level string """ -def set_data_access_level(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_data_access_level(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in new_data_dict: raise KeyError("Missing 'uuid' key in 'new_data_dict' during calling 'set_data_access_level()' trigger method.") @@ -321,8 +321,8 @@ def set_data_access_level(property_key, normalized_type, request, user_token, ex The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Donor, Sample, Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -335,7 +335,7 @@ def set_data_access_level(property_key, normalized_type, request, user_token, ex str: The target property key str: The group uuid """ -def set_group_uuid(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_group_uuid(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): group_uuid = None # Look for membership in a single "data provider" group and sets to that. @@ -385,8 +385,8 @@ def set_group_uuid(property_key, normalized_type, request, user_token, existing_ The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Donor, Sample, Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -399,7 +399,7 @@ def set_group_uuid(property_key, normalized_type, request, user_token, existing_ str: The target property key str: The group name """ -def set_group_name(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_group_name(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): group_name = None # If `group_uuid` is not already set, looks for membership in a single "data provider" group and sets to that. @@ -440,8 +440,8 @@ def set_group_name(property_key, normalized_type, request, user_token, existing_ The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -454,7 +454,7 @@ def set_group_name(property_key, normalized_type, request, user_token, existing_ str: The target property key str: The submission_id """ -def set_submission_id(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_submission_id(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'submission_id' not in new_data_dict: raise KeyError("Missing 'submission_id' key in 'new_data_dict' during calling 'set_submission_id()' trigger method.") @@ -494,8 +494,8 @@ def set_submission_id(property_key, normalized_type, request, user_token, existi The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -508,8 +508,8 @@ def set_submission_id(property_key, normalized_type, request, user_token, existi str: The target property key list: The file info dicts in a list """ -def commit_image_files(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): - return _commit_files('image_files', property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict) +def commit_image_files(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): + return _commit_files('image_files', property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict) """ @@ -529,8 +529,8 @@ def commit_image_files(property_key, normalized_type, request, user_token, exist The target property key normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -547,8 +547,8 @@ def commit_image_files(property_key, normalized_type, request, user_token, exist str: The target property key list: The file info dicts in a list """ -def delete_image_files(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): - return _delete_files('image_files', property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict) +def delete_image_files(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): + return _delete_files('image_files', property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict) """ @@ -562,8 +562,8 @@ def delete_image_files(property_key, normalized_type, request, user_token, exist The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -576,7 +576,7 @@ def delete_image_files(property_key, normalized_type, request, user_token, exist str: The target property key list: The file info dicts (with updated descriptions) in a list """ -def update_file_descriptions(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): +def update_file_descriptions(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): if property_key not in new_data_dict: raise KeyError(f"Missing '{property_key}' key in 'new_data_dict' during calling 'update_file_descriptions()' trigger method.") @@ -635,8 +635,8 @@ def update_file_descriptions(property_key, normalized_type, request, user_token, The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -644,7 +644,7 @@ def update_file_descriptions(property_key, normalized_type, request, user_token, new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def set_status_history(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_status_history(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): new_status_history = [] status_entry = {} @@ -689,8 +689,8 @@ def set_status_history(property_key, normalized_type, request, user_token, exist The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Collection -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -703,13 +703,13 @@ def set_status_history(property_key, normalized_type, request, user_token, exist str: The target property key list: A list of associated dataset dicts with all the normalized information """ -def get_collection_datasets(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_collection_datasets(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_collection_datasets()' trigger method.") logger.info(f"Executing 'get_collection_datasets()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) datasets_list = schema_neo4j_queries.get_collection_datasets(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], properties_to_exclude = neo4j_props_to_exclude) @@ -733,8 +733,8 @@ def get_collection_datasets(property_key, normalized_type, request, user_token, The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -747,7 +747,7 @@ def get_collection_datasets(property_key, normalized_type, request, user_token, str: The target property key str: Initial status of "New" """ -def set_dataset_status_new(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_dataset_status_new(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): # Always 'New' on dataset creation return property_key, 'New' @@ -763,8 +763,8 @@ def set_dataset_status_new(property_key, normalized_type, request, user_token, e The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -777,13 +777,13 @@ def set_dataset_status_new(property_key, normalized_type, request, user_token, e str: The target property key list: A list of associated collections with all the normalized information """ -def get_dataset_collections(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_dataset_collections(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_dataset_collections()' trigger method.") logger.info(f"Executing 'get_dataset_collections()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) collections_list = schema_neo4j_queries.get_dataset_collections(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], property_key = None, properties_to_exclude = neo4j_props_to_exclude) @@ -803,8 +803,8 @@ def get_dataset_collections(property_key, normalized_type, request, user_token, The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -817,7 +817,7 @@ def get_dataset_collections(property_key, normalized_type, request, user_token, str: The target property key dict: A dictionary representation of the associated collection with all the normalized information """ -def get_publication_associated_collection(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_publication_associated_collection(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_publication_associated_collection()' trigger method.") @@ -841,8 +841,8 @@ def get_publication_associated_collection(property_key, normalized_type, request The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -855,7 +855,7 @@ def get_publication_associated_collection(property_key, normalized_type, request str: The target property key dict: A dict of associated Upload detail with all the normalized information """ -def get_dataset_upload(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_dataset_upload(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): return_dict = None if 'uuid' not in existing_data_dict: @@ -863,7 +863,7 @@ def get_dataset_upload(property_key, normalized_type, request, user_token, exist logger.info(f"Executing 'get_dataset_upload()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) upload_dict = schema_neo4j_queries.get_dataset_upload(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], properties_to_exclude = neo4j_props_to_exclude) @@ -883,8 +883,8 @@ def get_dataset_upload(property_key, normalized_type, request, user_token, exist The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -892,7 +892,7 @@ def get_dataset_upload(property_key, normalized_type, request, user_token, exist new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_dataset_to_direct_ancestors(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_dataset_to_direct_ancestors(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_dataset_to_direct_ancestors()' trigger method.") @@ -909,7 +909,7 @@ def link_dataset_to_direct_ancestors(property_key, normalized_type, request, use activity_uuid = schema_neo4j_queries.get_parent_activity_uuid_from_entity(schema_manager.get_neo4j_driver_instance(), dataset_uuid) if not activity_uuid: - activity_data_dict = schema_manager.generate_activity_data(normalized_type, request, user_token, existing_data_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_type, request_args, user_token, existing_data_dict) activity_uuid = activity_data_dict['uuid'] create_activity = True @@ -942,8 +942,8 @@ def link_dataset_to_direct_ancestors(property_key, normalized_type, request, use The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -951,7 +951,7 @@ def link_dataset_to_direct_ancestors(property_key, normalized_type, request, use new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_collection_to_datasets(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_collection_to_datasets(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_collection_to_datasets()' trigger method.") @@ -987,8 +987,8 @@ def link_collection_to_datasets(property_key, normalized_type, request, user_tok The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Dataset/Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1001,13 +1001,13 @@ def link_collection_to_datasets(property_key, normalized_type, request, user_tok str: The target property key list: A list of associated direct ancestors with all the normalized information """ -def get_dataset_direct_ancestors(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_dataset_direct_ancestors(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_dataset_direct_ancestors()' trigger method.") logger.info(f"Executing 'get_dataset_direct_ancestors()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) direct_ancestors_list = schema_neo4j_queries.get_dataset_direct_ancestors(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], property_key = None, properties_to_exclude = neo4j_props_to_exclude) @@ -1027,8 +1027,8 @@ def get_dataset_direct_ancestors(property_key, normalized_type, request, user_to The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1041,7 +1041,7 @@ def get_dataset_direct_ancestors(property_key, normalized_type, request, user_to str: The target property key str: The relative directory path """ -def get_local_directory_rel_path(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_local_directory_rel_path(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_local_directory_rel_path()' trigger method.") @@ -1080,8 +1080,8 @@ def get_local_directory_rel_path(property_key, normalized_type, request, user_to The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1089,7 +1089,7 @@ def get_local_directory_rel_path(property_key, normalized_type, request, user_to new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_to_previous_revision(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_to_previous_revision(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): try: if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_to_previous_revision()' trigger method.") @@ -1133,8 +1133,8 @@ def link_to_previous_revision(property_key, normalized_type, request, user_token The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1147,7 +1147,7 @@ def link_to_previous_revision(property_key, normalized_type, request, user_token str: The target property key str: The generated dataset title """ -def get_dataset_title(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_dataset_title(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): MAX_ENTITY_LIST_LENGTH = 5 @@ -1326,8 +1326,8 @@ def get_dataset_title(property_key, normalized_type, request, user_token, existi The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1340,7 +1340,7 @@ def get_dataset_title(property_key, normalized_type, request, user_token, existi str: The target property key str: The uuid string of previous revision entity or None if not found """ -def get_previous_revision_uuid(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_previous_revision_uuid(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_previous_revision_uuid()' trigger method.") @@ -1362,8 +1362,8 @@ def get_previous_revision_uuid(property_key, normalized_type, request, user_toke The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1376,7 +1376,7 @@ def get_previous_revision_uuid(property_key, normalized_type, request, user_toke str: The target property key str: A list of the uuid strings of previous revision entity or an empty list if not found """ -def get_previous_revision_uuids(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_previous_revision_uuids(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError( "Missing 'uuid' key in 'existing_data_dict' during calling 'get_previous_revision_uuid()' trigger method.") @@ -1400,8 +1400,8 @@ def get_previous_revision_uuids(property_key, normalized_type, request, user_tok The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1414,7 +1414,7 @@ def get_previous_revision_uuids(property_key, normalized_type, request, user_tok str: The target property key str: The uuid string of next version entity or None if not found """ -def get_next_revision_uuid(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_next_revision_uuid(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_next_revision_uuid()' trigger method.") @@ -1436,8 +1436,8 @@ def get_next_revision_uuid(property_key, normalized_type, request, user_token, e The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity, Collection, Donor, Sample, Dataset, Upload, Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1450,7 +1450,7 @@ def get_next_revision_uuid(property_key, normalized_type, request, user_token, e str: The target property key str: The `creation_action` as string """ -def get_creation_action_activity(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_creation_action_activity(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_creation_action_activity()' trigger method.") @@ -1475,8 +1475,8 @@ def get_creation_action_activity(property_key, normalized_type, request, user_to The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1489,7 +1489,7 @@ def get_creation_action_activity(property_key, normalized_type, request, user_to str: The target property key str: The list of uuid strings of next version entity or empty string if not found """ -def get_next_revision_uuids(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_next_revision_uuids(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError( "Missing 'uuid' key in 'existing_data_dict' during calling 'get_next_revision_uuid()' trigger method.") @@ -1521,8 +1521,8 @@ def get_next_revision_uuids(property_key, normalized_type, request, user_token, The property key for which the original trigger method is defined normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1536,7 +1536,7 @@ def get_next_revision_uuids(property_key, normalized_type, request, user_token, ------- dict: The updated generated dict """ -def commit_thumbnail_file(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): +def commit_thumbnail_file(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): # The name of the property where the file information is stored target_property_key = 'thumbnail_file' @@ -1609,8 +1609,8 @@ def commit_thumbnail_file(property_key, normalized_type, request, user_token, ex The property key for which the original trigger method is defined normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1624,7 +1624,7 @@ def commit_thumbnail_file(property_key, normalized_type, request, user_token, ex ------- dict: The updated generated dict """ -def delete_thumbnail_file(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): +def delete_thumbnail_file(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): # The name of the property where the file information is stored target_property_key = 'thumbnail_file' @@ -1706,8 +1706,8 @@ def delete_thumbnail_file(property_key, normalized_type, request, user_token, ex The target property key normalized_type : str One of the types defined in the schema yaml: Dataset -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1715,7 +1715,7 @@ def delete_thumbnail_file(property_key, normalized_type, request, user_token, ex new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def update_status(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def update_status(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'update_status()' trigger method.") uuid = existing_data_dict['uuid'] @@ -1724,7 +1724,7 @@ def update_status(property_key, normalized_type, request, user_token, existing_d raise KeyError("Missing 'status' key in 'existing_data_dict' during calling 'update_status()' trigger method.") status = existing_data_dict['status'] - set_status_history(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict) + set_status_history(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict) # Only apply to non-published parent datasets if status.lower() != 'published': @@ -1737,7 +1737,7 @@ def update_status(property_key, normalized_type, request, user_token, existing_d # When the parent dataset status update disables reindex via query string '?reindex=false' # We'll also disable the reindex call to search-api upon each subsequent child component dataset update reindex = 'followed' - if schema_manager.suppress_reindex(request): + if schema_manager.suppress_reindex(request_args): url += '?reindex=false' reindex = 'suppressed' @@ -1774,8 +1774,8 @@ def update_status(property_key, normalized_type, request, user_token, existing_d The target property key normalized_type : str One of the types defined in the schema yaml: Donor -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1783,7 +1783,7 @@ def update_status(property_key, normalized_type, request, user_token, existing_d new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_donor_to_lab(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_donor_to_lab(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_donor_to_lab()' trigger method.") @@ -1796,7 +1796,7 @@ def link_donor_to_lab(property_key, normalized_type, request, user_token, existi direct_ancestor_uuids = [existing_data_dict['group_uuid']] # Generate property values for Activity node - activity_data_dict = schema_manager.generate_activity_data(normalized_type, request, user_token, existing_data_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_type, request_args, user_token, existing_data_dict) try: # Create a linkage (via Activity node) @@ -1847,8 +1847,8 @@ def link_donor_to_lab(property_key, normalized_type, request, user_token, existi The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1861,8 +1861,8 @@ def link_donor_to_lab(property_key, normalized_type, request, user_token, existi str: The target property key list: The file info dicts in a list """ -def commit_metadata_files(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): - return _commit_files('metadata_files', property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict) +def commit_metadata_files(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): + return _commit_files('metadata_files', property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict) """ @@ -1882,8 +1882,8 @@ def commit_metadata_files(property_key, normalized_type, request, user_token, ex The target property key normalized_type : str One of the types defined in the schema yaml: Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1900,8 +1900,8 @@ def commit_metadata_files(property_key, normalized_type, request, user_token, ex str: The target property key list: The file info dicts in a list """ -def delete_metadata_files(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): - return _delete_files('metadata_files', property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict) +def delete_metadata_files(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): + return _delete_files('metadata_files', property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict) """ @@ -1915,8 +1915,8 @@ def delete_metadata_files(property_key, normalized_type, request, user_token, ex The target property key normalized_type : str One of the types defined in the schema yaml: Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1924,7 +1924,7 @@ def delete_metadata_files(property_key, normalized_type, request, user_token, ex new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_sample_to_direct_ancestor(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_sample_to_direct_ancestor(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_sample_to_direct_ancestor()' trigger method.") if 'direct_ancestor_uuid' not in new_data_dict: @@ -1944,7 +1944,7 @@ def link_sample_to_direct_ancestor(property_key, normalized_type, request, user_ activity_uuid = schema_neo4j_queries.get_parent_activity_uuid_from_entity(schema_manager.get_neo4j_driver_instance(), sample_uuid) if not activity_uuid: - activity_data_dict = schema_manager.generate_activity_data(normalized_type, request, user_token, existing_data_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_type, request_args, user_token, existing_data_dict) activity_uuid = activity_data_dict['uuid'] create_activity = True if new_ancestors: @@ -1979,8 +1979,8 @@ def link_sample_to_direct_ancestor(property_key, normalized_type, request, user_ The target property key normalized_type : str One of the types defined in the schema yaml: Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -1988,7 +1988,7 @@ def link_sample_to_direct_ancestor(property_key, normalized_type, request, user_ new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_publication_to_associated_collection(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_publication_to_associated_collection(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_publication_to_associated_collection()' trigger method.") @@ -2021,8 +2021,8 @@ def link_publication_to_associated_collection(property_key, normalized_type, req The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2035,13 +2035,13 @@ def link_publication_to_associated_collection(property_key, normalized_type, req str: The target property key dict: The direct ancestor entity (either another Sample or a Donor) with all the normalized information """ -def get_sample_direct_ancestor(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_sample_direct_ancestor(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_sample_direct_ancestor()' trigger method.") logger.info(f"Executing 'get_sample_direct_ancestor()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) direct_ancestor_dict = schema_neo4j_queries.get_sample_direct_ancestor(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], property_key = None, properties_to_exclude = neo4j_props_to_exclude) @@ -2066,8 +2066,8 @@ def get_sample_direct_ancestor(property_key, normalized_type, request, user_toke The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2079,7 +2079,7 @@ def get_sample_direct_ancestor(property_key, normalized_type, request, user_toke ------- str: The date part YYYY-MM-DD of ISO 8601 """ -def set_publication_date(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_publication_date(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): # We only store the date part 'YYYY-MM-DD', base on the ISO 8601 format, it's fine if the user entered the time part date_obj = datetime.fromisoformat(new_data_dict[property_key]) @@ -2097,8 +2097,8 @@ def set_publication_date(property_key, normalized_type, request, user_token, exi The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Publication -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2111,7 +2111,7 @@ def set_publication_date(property_key, normalized_type, request, user_token, exi str: The target property key str: Immutable dataset_type of "Publication" """ -def set_publication_dataset_type(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_publication_dataset_type(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): # Count upon the dataset_type generated: true property in provenance_schema.yaml to assure the # request does not contain a value which will be overwritten. return property_key, 'Publication' @@ -2131,8 +2131,8 @@ def set_publication_dataset_type(property_key, normalized_type, request, user_to The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Upload -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2145,7 +2145,7 @@ def set_publication_dataset_type(property_key, normalized_type, request, user_to str: The target property key str: The "New" status """ -def set_upload_status_new(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_upload_status_new(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): return property_key, 'New' @@ -2159,8 +2159,8 @@ def set_upload_status_new(property_key, normalized_type, request, user_token, ex The target property key normalized_type : str One of the types defined in the schema yaml: Upload -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2168,7 +2168,7 @@ def set_upload_status_new(property_key, normalized_type, request, user_token, ex new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_upload_to_lab(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_upload_to_lab(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_upload_to_lab()' trigger method.") @@ -2181,7 +2181,7 @@ def link_upload_to_lab(property_key, normalized_type, request, user_token, exist direct_ancestor_uuids = [existing_data_dict['group_uuid']] # Generate property values for Activity node - activity_data_dict = schema_manager.generate_activity_data(normalized_type, request, user_token, existing_data_dict) + activity_data_dict = schema_manager.generate_activity_data(normalized_type, request_args, user_token, existing_data_dict) try: # Create a linkage (via Activity node) @@ -2205,8 +2205,8 @@ def link_upload_to_lab(property_key, normalized_type, request, user_token, exist The target property key normalized_type : str One of the types defined in the schema yaml: Upload -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2214,7 +2214,7 @@ def link_upload_to_lab(property_key, normalized_type, request, user_token, exist new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def link_datasets_to_upload(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def link_datasets_to_upload(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'link_datasets_to_upload()' trigger method.") @@ -2248,8 +2248,8 @@ def link_datasets_to_upload(property_key, normalized_type, request, user_token, The target property key normalized_type : str One of the types defined in the schema yaml: Upload -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2257,7 +2257,7 @@ def link_datasets_to_upload(property_key, normalized_type, request, user_token, new_data_dict : dict A merged dictionary that contains all possible input data to be used """ -def unlink_datasets_from_upload(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def unlink_datasets_from_upload(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'unlink_datasets_from_upload()' trigger method.") @@ -2291,8 +2291,8 @@ def unlink_datasets_from_upload(property_key, normalized_type, request, user_tok The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Upload -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2304,13 +2304,13 @@ def unlink_datasets_from_upload(property_key, normalized_type, request, user_tok str: The target property key list: A list of associated dataset dicts with all the normalized information """ -def get_upload_datasets(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def get_upload_datasets(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'uuid' not in existing_data_dict: raise KeyError("Missing 'uuid' key in 'existing_data_dict' during calling 'get_upload_datasets()' trigger method.") logger.info(f"Executing 'get_upload_datasets()' trigger method on uuid: {existing_data_dict['uuid']}") - neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request) + neo4j_props_to_exclude = _get_excluded_neo4j_props(property_key, request_args) datasets_list = schema_neo4j_queries.get_upload_datasets(schema_manager.get_neo4j_driver_instance(), existing_data_dict['uuid'], property_key = None, properties_to_exclude = neo4j_props_to_exclude) @@ -2341,8 +2341,8 @@ def get_upload_datasets(property_key, normalized_type, request, user_token, exis The target property key of the value to be generated normalized_type : str One of the types defined in the schema yaml: Activity -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2355,7 +2355,7 @@ def get_upload_datasets(property_key, normalized_type, request, user_token, exis str: The target property key str: The creation_action string """ -def set_activity_creation_action(property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict): +def set_activity_creation_action(property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict): if 'normalized_entity_type' not in new_data_dict: raise KeyError("Missing 'normalized_entity_type' key in 'existing_data_dict' during calling 'set_activity_creation_action()' trigger method.") if new_data_dict and new_data_dict.get('creation_action'): @@ -2400,8 +2400,8 @@ def set_activity_creation_action(property_key, normalized_type, request, user_to The property key for which the original trigger method is defined normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2415,7 +2415,7 @@ def set_activity_creation_action(property_key, normalized_type, request, user_to ------- dict: The updated generated dict """ -def _commit_files(target_property_key, property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): +def _commit_files(target_property_key, property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): # Do nothing if no files to add are provided (missing or empty property) # For image files the property name is "image_files_to_add" # For metadata files the property name is "metadata_files_to_add" @@ -2516,8 +2516,8 @@ def _commit_files(target_property_key, property_key, normalized_type, request, u The property key for which the original trigger method is defined normalized_type : str One of the types defined in the schema yaml: Donor, Sample -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request user_token: str The user's globus nexus token existing_data_dict : dict @@ -2531,7 +2531,7 @@ def _commit_files(target_property_key, property_key, normalized_type, request, u ------- dict: The updated generated dict """ -def _delete_files(target_property_key, property_key, normalized_type, request, user_token, existing_data_dict, new_data_dict, generated_dict): +def _delete_files(target_property_key, property_key, normalized_type, request_args, user_token, existing_data_dict, new_data_dict, generated_dict): #do nothing if no files to delete are provided in the field specified by property_key if (not property_key in new_data_dict) or (not new_data_dict[property_key]): return generated_dict @@ -2718,19 +2718,19 @@ def _get_age_age_units_race_sex_phrase(age:str=None, age_units:str='units', race ---------- property_key : str The target property key of the value to be generated -request: Flask request object - The instance of Flask request passed in from application request +request_args: ImmutableMultiDict + The Flask request.args passed in from application request Returns ------- list: A list containing Neo4j node properties to exclude """ -def _get_excluded_neo4j_props(property_key, request): +def _get_excluded_neo4j_props(property_key, request_args): neo4j_props_to_exclude = [] # Get all the user specified fields either top-level or nested from the original query string in request URL try: - all_props_to_exclude = schema_manager.get_excluded_query_props(request) + all_props_to_exclude = schema_manager.get_excluded_query_props(request_args) except ValueError as e: raise ValueError(e) except Exception as e: