diff --git a/entity-api-spec.yaml b/entity-api-spec.yaml index ac1e09fe..d609184b 100644 --- a/entity-api-spec.yaml +++ b/entity-api-spec.yaml @@ -542,6 +542,9 @@ components: type: string format: uuid description: 'List of image files previously uploaded to delete. Provide as a json array of the file_uuids of the file like: ["232934234234234234234270c0ea6c51d604a850558ef2247d0b4", "230948203482234234234a57bfe9c056d08a0f8e6cd612baa3bfa"]' + rui_exemption: + type: boolean + description: 'Identifies Sample Blocks that are exempt from spatial registration via RUI.' Dataset: type: object properties: @@ -809,6 +812,9 @@ components: intended_organ: type: string description: 'The organ code representing the organ type that the data contained in the upload will be registered/associated with.' + priority_project_list: + type: array + description: 'The list of priority projects that this Dataset data will be used For' Upload: type: object properties: @@ -909,6 +915,9 @@ components: anticipated_dataset_count: type: integer description: 'The total number of datasets that this Upload will eventually contain.' + priority_project_list: + type: array + description: 'The list of priority projects that this Upload data will be used For' Collection: type: object properties: @@ -1403,6 +1412,7 @@ components: group_name: 'University TMC' visit: 'abc123' rui_location: object + rui_exemption: False DatasetExample: summary: 'An example of a Dataset response' value: @@ -1456,6 +1466,7 @@ components: intended_organ: 'AO' group_uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' group_name: 'University TMC' + priority_project_list: ['MOSDAP'] UploadExample: summary: 'An example of an upload response' value: @@ -1479,6 +1490,7 @@ components: dataset_uuids_to_link: ['abcd1234-ef56-gh78-ij90-klmnop123456'] dataset_uuids_to_unlink: ['abcd1234-ef56-gh78-ij90-klmnop123456'] datasets: [dataset objects] + priority_project_list: ['MOSDAP'] CollectionExample: summary: 'An example of a collection response' value: @@ -1633,6 +1645,7 @@ components: intended_organ: 'AO' group_uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' group_name: 'University TMC' + priority_project_list: ['MOSDAP'] - created_timestamp: 1710243867000 created_by_user_displayname: 'JaneDoe1' created_by_user_email: 'janedoe@example.com' @@ -1683,6 +1696,7 @@ components: intended_organ: 'AO' group_uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' group_name: 'University TMC' + priority_project_list:: ['MOSDAP'] SampleArrayExample: summary: 'An example of an array of sample objects' value: @@ -1719,6 +1733,7 @@ components: group_name: 'University TMC' visit: 'abc123' rui_location: object + rui_exemption: False - created_timestamp: 1710243867000 created_by_user_displayname: 'JaneDoe1' created_by_user_email: 'janedoe@example.com' @@ -1752,6 +1767,7 @@ components: group_name: 'University TMC' visit: 'abc123' rui_location: object + rui_exemption: False CollectionArrayExample: summary: 'An example of an array of collection objects' value: @@ -1814,6 +1830,7 @@ components: dataset_uuids_to_link: ['abcd1234-ef56-gh78-ij90-klmnop123456'] dataset_uuids_to_unlink: ['abcd1234-ef56-gh78-ij90-klmnop123456'] datasets: [dataset objects] + priority_project_list: ['MOSDAP'] - created_timestamp: 1710243867000 created_by_user_displayname: 'JaneDoe1' created_by_user_email: 'janedoe@example.com' @@ -1834,6 +1851,7 @@ components: dataset_uuids_to_link: ['abcd1234-ef56-gh78-ij90-klmnop123456'] dataset_uuids_to_unlink: ['abcd1234-ef56-gh78-ij90-klmnop123456'] datasets: [dataset objects] + priority_project_list: ['MOSDAP'] DatasetProvMetadata: summary: 'An example of a dataset prov metadata response' value: diff --git a/src/schema/provenance_schema.yaml b/src/schema/provenance_schema.yaml index cb30a34d..4e3d151a 100644 --- a/src/schema/provenance_schema.yaml +++ b/src/schema/provenance_schema.yaml @@ -659,6 +659,16 @@ ENTITIES: - validate_in_admin_group before_property_update_validators: - validate_in_admin_group + priority_project_list: + type: list + required: false + indexted: false + description: The list of priority projects that this Dataset data will be used For + immutable: false + before_property_update_validators: + - validate_priority_project + before_property_create_validators: + - validate_priority_project ############################################# Publication ############################################# Publication: @@ -762,6 +772,7 @@ ENTITIES: ingest_task: null # This ingest_task is Dataset specific, Publication doesn't have it new_associated_multi_assay_uuid: null # Dataset-only attribute of Multi-Assay Dataset relationships superseded_associated_processed_component_uuids: null # Dataset-only attribute of Multi-Assay Dataset relationships + priority_project_list: null # Dataset-only attribute ############################################# Donor ############################################# Donor: @@ -1282,6 +1293,16 @@ ENTITIES: - validate_anticipated_dataset_count before_property_update_validators: - validate_anticipated_dataset_count + priority_project_list: + type: list + required: false + indexted: false + description: The list of priority projects that this Uploaded data will be used For + immutable: false + before_property_update_validators: + - validate_priority_project + before_property_create_validators: + - validate_priority_project ############################################# EPICollection ############################################# Epicollection: diff --git a/src/schema/schema_constants.py b/src/schema/schema_constants.py index acd160fc..957b5d06 100644 --- a/src/schema/schema_constants.py +++ b/src/schema/schema_constants.py @@ -26,6 +26,8 @@ class SchemaConstants(object): OMITTED_FIELDS = ['ingest_metadata', 'files'] + ALLOWED_PRIORITY_PROJECTS = ['SWAT (Integration Paper)', 'MOSDAP'] + # Define an enumeration to classify an entity's visibility, which can be combined with # authorization info when verify operations on a request. class DataVisibilityEnum(Enum): diff --git a/src/schema/schema_validators.py b/src/schema/schema_validators.py index 802a47d9..899bae67 100644 --- a/src/schema/schema_validators.py +++ b/src/schema/schema_validators.py @@ -887,6 +887,31 @@ def verify_multi_assay_dataset_components(property_key, normalized_type, user_to # fall out successfully if no raise() occurred. return + +""" +Validate the specified value for an Upload's priority_project_list is in a recognized value + +Parameters +---------- +property_key : str + The target property key +normalized_type : str + Submission +request: Flask request object + The instance of Flask request passed in from application request +existing_data_dict : dict + A dictionary that contains all existing entity properties +new_data_dict : dict + The json data in request body, already after the regular validations +""" +def validate_priority_project(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict): + allowed_priority_projects = SchemaConstants.ALLOWED_PRIORITY_PROJECTS + for priority_project in new_data_dict.get('priority_project_list'): + if priority_project not in allowed_priority_projects: + raise ValueError(f"Provided priority_project_list contains unrecognized value: {priority_project}. Allowed values are {', '.join(allowed_priority_projects)}. These are case-sensitive values.") + new_data_dict['priority_project_list'] = [project.upper() for project in new_data_dict['priority_project_list']] + + #################################################################################################### ## Internal Functions ####################################################################################################