Skip to content

Commit

Permalink
additional ref caching related change
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Mar 9, 2024
1 parent 068570a commit 1354c3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions dcicutils/structured_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,20 @@ def ref_exists(self, type_name: str, value: Optional[str] = None) -> List[dict]:
# Cached resolved reference is empty ([]).
# It might NOW be found internally, since the portal self._data
# can change, as the data (e.g. spreadsheet sheets) are parsed.
ref_lookup_strategy, _ = self._ref_lookup_strategy(type_name, self.get_schema(type_name), value)
# TODO: Consolidate this with the below similar usage.
ref_lookup_strategy, incorrect_identifying_property = (
self._ref_lookup_strategy(type_name, self.get_schema(type_name), value))
is_ref_lookup_subtypes = StructuredDataSet._is_ref_lookup_subtypes(ref_lookup_strategy)
subtype_names = self._get_schema_subtypes(type_name) if is_ref_lookup_subtypes else None
is_resolved, identifying_property, resolved_uuid = (
self._ref_exists_internally(type_name, value, subtype_names))
self._ref_exists_internally(type_name, value, subtype_names,
incorrect_identifying_property=incorrect_identifying_property))
if is_resolved:
if identifying_property == incorrect_identifying_property:
# Not REALLY resolved as it resolved to a property which is NOT an identifying
# property, but may be commonly mistaken for one (e.g. UnalignedReads.filename).
self._ref_incorrect_identifying_property_count += 1
return []
resolved = [{"type": type_name, "uuid": resolved_uuid}]
self._cache_ref(type_name, value, resolved, subtype_names)
return resolved
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.8.0.1b10" # TODO: To become 8.8.1
version = "8.8.0.1b11" # TODO: To become 8.8.1
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down

0 comments on commit 1354c3b

Please sign in to comment.