diff --git a/dcicutils/structured_data.py b/dcicutils/structured_data.py index 59b9cc7d6..ebf164bfb 100644 --- a/dcicutils/structured_data.py +++ b/dcicutils/structured_data.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 294a6b70c..d8e16ff22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "MIT"