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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/schema/provenance_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,13 @@ ENTITIES:
on_read_trigger: get_collection_associated_publication
on_index_trigger: get_collection_associated_publication
description: "The publication which uses this collection's data"
status:
type: string
generated: true
transient: true
description: "One of: New|Published"
on_read_trigger: get_collection_status
on_index_trigger: get_collection_status

############################################# Dataset #############################################
Dataset:
Expand Down
31 changes: 31 additions & 0 deletions src/schema/schema_triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,13 @@ def set_dataset_status_new(
return property_key, "New"


def set_collection_status_new(
property_key, normalized_type, user_token, existing_data_dict, new_data_dict
):
## Same as dataset unless otherwise stated
return set_dataset_status_new(property_key, normalized_type, user_token, existing_data_dict, new_data_dict)


def get_entity_collections(
property_key, normalized_type, user_token, existing_data_dict, new_data_dict
):
Expand Down Expand Up @@ -2870,6 +2877,30 @@ def set_was_derived_from(
# No need to log
raise

def get_collection_status(property_key, normalized_type, user_token, existing_data_dict, new_data_dict):
"""Trigger event method that calls related functions involved with updating the status value.

Parameters
----------
property_key : str
The target property key
normalized_type : str
One of the types defined in the schema yaml: Dataset
user_token: str
The user's globus nexus token
existing_data_dict : dict
A dictionary that contains all existing entity properties
new_data_dict : dict
A merged dictionary that contains all possible input data to be used
"""
doi_url = existing_data_dict.get("doi_url")

if doi_url is not None:
return property_key, "Published"
else:
return set_collection_status_new(property_key, normalized_type, user_token, existing_data_dict, new_data_dict)



def update_status(property_key, normalized_type, user_token, existing_data_dict, new_data_dict):
"""Trigger event method that calls related functions involved with updating the status value.
Expand Down
Loading