Skip to content

Commit

Permalink
Fix (I think) in structured_data.Portal.ref_exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Jan 14, 2024
1 parent e5f4f9b commit 195a33c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dcicutils/structured_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,22 @@ def ref_exists(self, type_name: str, value: str) -> List[str]:
resolved = []
if self._ref_exists_single(type_name, value):
resolved.append(type_name)
# TODO: Added this return on 2024-01-14 (dmichaels).
# Why did I orginally check for multiple existing values?
# Why not just return right away if I find that the ref exists?
# Getting multiple values because, for example, we find
# both this /Sample/UW_CELL-CULTURE-SAMPLE_COLO-829BL_HI-C_1
# and /CellSample/UW_CELL-CULTURE-SAMPLE_COLO-829BL_HI-C_1
# Why does that matter at all? Same thing.
return resolved
# Check for the given ref in all sub-types of the given type.
if (schemas_super_type_map := self.get_schemas_super_type_map()):
if (sub_type_names := schemas_super_type_map.get(type_name)):
for sub_type_name in sub_type_names:
if self._ref_exists_single(sub_type_name, value):
resolved.append(type_name)
# TODO: Added this return on 2024-01-14 (dmichaels). See above TODO.
return resolved
return resolved

def _ref_exists_single(self, type_name: str, value: str) -> bool:
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.7.0.1b25" # TODO: To become 8.7.1
version = "8.7.0.1b26" # TODO: To become 8.7.1
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 195a33c

Please sign in to comment.