Skip to content

Commit

Permalink
Changes requested following Joe's PR review. Disable Publication usag…
Browse files Browse the repository at this point in the history
…e of Multi-Assay attributes, and verify attribute UUIDs exist, as a minimum.
  • Loading branch information
kburke committed Mar 13, 2024
1 parent a4b8b1c commit 8964787
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/schema/provenance_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ ENTITIES:
after_update_trigger: link_publication_to_associated_collection
assigned_to_group_name: null # This assigned_to_group_name is Dataset specific, Publication doesn't have it
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

############################################# Donor #############################################
Donor:
Expand Down
17 changes: 17 additions & 0 deletions src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,23 @@ def verify_multi_assay_dataset_components(property_key, normalized_type, user_to
f" existing Dataset {existing_data_dict['uuid']} because it is a Multi-Assay Dataset"
f" with {len(supersededComponentDatasets)}"
f" component Datasets it supersedes.")
# If no contradictions above have caused a ValueError, check if new data contains UUIDs for valid entities.
if 'new_associated_multi_assay_uuid' in new_data_dict:
proposedMultiAssayDataset = schema_neo4j_queries.get_entity(schema_manager.get_neo4j_driver_instance()
, new_data_dict['new_associated_multi_assay_uuid'])
if len(proposedMultiAssayDataset) < 1:
raise ValueError( f"'new_associated_multi_assay_uuid' value"
f" {new_data_dict['new_associated_multi_assay_uuid']}"
f" does not exist.")
if 'superseded_associated_processed_component_uuids' in new_data_dict:
proposedComponentsList = schema_manager.convert_str_literal(new_data_dict['superseded_associated_processed_component_uuids'])
for uuid in proposedComponentsList:
proposedComponentDataset = schema_neo4j_queries.get_entity( schema_manager.get_neo4j_driver_instance()
, uuid)
if len(proposedComponentDataset) < 1:
raise ValueError(f"'superseded_associated_processed_component_uuids' entry with value"
f" {uuid} does not exist.")

# fall out successfully if no raise() occurred.
return

Expand Down

0 comments on commit 8964787

Please sign in to comment.