Skip to content

Commit

Permalink
Use matching identifider to get index
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogabrielsson committed Jan 6, 2024
1 parent 81ef256 commit 5f24109
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wsidicom/metadata/schema/dicom/sample/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def get_previous_specimen_identifier(
Optional[SpecimenIdentifier]
Identifier of previous specimen, if any.
"""
this_specimen_index = list(self._steps_by_identifier.keys()).index(identifier)
matching_identifier = self._get_identifier(
identifier, self._steps_by_identifier
)
if matching_identifier is None:
return None
this_specimen_index = list(self._steps_by_identifier.keys()).index(
matching_identifier
)
if this_specimen_index == 0:
return None
return list(self._steps_by_identifier.keys())[this_specimen_index - 1]
Expand Down

0 comments on commit 5f24109

Please sign in to comment.