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
18 changes: 18 additions & 0 deletions entity-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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: '[email protected]'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: '[email protected]'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: '[email protected]'
Expand All @@ -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:
Expand Down
21 changes: 21 additions & 0 deletions src/schema/provenance_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/schema/schema_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
25 changes: 25 additions & 0 deletions src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################################################################################################
Expand Down