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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.6
2.5.7
11 changes: 6 additions & 5 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5330,12 +5330,13 @@ def delete_cache(id):
entity_dict = query_target_entity(id, get_internal_token())
entity_uuid = entity_dict['uuid']

# If the target entity is Sample (`direct_ancestor`) or Dataset/Publication (`direct_ancestors`)
# Delete the cache of all the direct descendants (children)
child_uuids = schema_neo4j_queries.get_children(neo4j_driver_instance, entity_uuid , 'uuid')
# Delete the cache of all the descendants
descendant_uuids = schema_neo4j_queries.get_descendants(neo4j_driver_instance, entity_uuid , 'uuid')

# If the target entity is Collection, delete the cache for each of its associated
# Datasets and Publications (via [:IN_COLLECTION] relationship) as well as just Publications (via [:USES_DATA] relationship)
# Datasets and Publications (via [:IN_COLLECTION]) as well as just Publications (via [:USES_DATA])
# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
collection_dataset_uuids = schema_neo4j_queries.get_collection_associated_datasets(neo4j_driver_instance, entity_uuid , 'uuid')

# If the target entity is Upload, delete the cache for each of its associated Datasets (via [:IN_UPLOAD] relationship)
Expand All @@ -5347,7 +5348,7 @@ def delete_cache(id):
upload_dict = schema_neo4j_queries.get_dataset_upload(neo4j_driver_instance, entity_uuid)

# We only use uuid in the cache key acorss all the cache types
uuids_list = [entity_uuid] + child_uuids + collection_dataset_uuids + upload_dataset_uuids + collection_uuids
uuids_list = [entity_uuid] + descendant_uuids + collection_dataset_uuids + upload_dataset_uuids + collection_uuids

# It's possible no linked collection or upload
if collection_dict:
Expand Down
4 changes: 4 additions & 0 deletions src/schema/provenance_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ ENTITIES:
type: string
indexed: true
description: 'A DOI pointing to an Organ Mapping Antibody Panel relevant to this publication'

# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
associated_collection:
type: json_string # dict
generated: true
Expand All @@ -802,6 +805,7 @@ ENTITIES:
description: "The uuid of the associated collection for a given publication"
after_create_trigger: link_publication_to_associated_collection
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
Expand Down
8 changes: 8 additions & 0 deletions src/schema/schema_neo4j_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ def link_entity_to_direct_ancestors(neo4j_driver, entity_uuid, direct_ancestor_u
the uuid of the associated collection
"""
def link_publication_to_associated_collection(neo4j_driver, entity_uuid, associated_collection_uuid):
# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
try:
with neo4j_driver.session() as session:
tx = session.begin_transaction()
Expand Down Expand Up @@ -1008,6 +1010,8 @@ def get_next_revision_uuids(neo4j_driver, uuid):
def get_collection_associated_datasets(neo4j_driver, uuid, property_key = None):
results = []

# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
if property_key:
query = (f"MATCH (e:Entity)-[:IN_COLLECTION|:USES_DATA]->(c:Collection) "
f"WHERE c.uuid = '{uuid}' "
Expand Down Expand Up @@ -1099,6 +1103,8 @@ def get_dataset_collections(neo4j_driver, uuid, property_key = None):
def get_publication_associated_collection(neo4j_driver, uuid):
result = {}

# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
query = (f"MATCH (p:Publication)-[:USES_DATA]->(c:Collection) "
f"WHERE p.uuid = '{uuid}' "
f"RETURN c as {record_field_name}")
Expand Down Expand Up @@ -1802,6 +1808,8 @@ def _delete_activity_node_and_linkages_tx(tx, uuid):
The uuid to target publication
"""
def _delete_publication_associated_collection_linkages_tx(tx, uuid):
# NOTE: As of 5/30/2025, the [:USES_DATA] workaround has been deprecated.
# Still keep it in the code until further decision - Zhou
query = (f"MATCH (p:Publication)-[r:USES_DATA]->(c:Collection) "
f"WHERE p.uuid = '{uuid}' "
f"DELETE r")
Expand Down