Skip to content

Commit

Permalink
Merge pull request #789 from hubmapconsortium/karlburke/IndexingEffic…
Browse files Browse the repository at this point in the history
…ienciesRound3

Assign all parent entities to source_samples if one is a Sample
  • Loading branch information
yuanzhou authored Apr 30, 2024
2 parents 2caf337 + 94a9005 commit a3a1013
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/hubmap_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,12 +924,9 @@ def generate_doc(self, entity, return_type):

try:
if parents[0]['entity_type'] == 'Sample':
# Inside of this method, only the form of an entity suitable for indexing is supported.
# So use the uuid of the parent Sample to retrieve an indexable document for the Sample.
parent_sample_dict = self.call_entity_api(entity_id=parents[0]['uuid']
,endpoint='documents')

entity['source_samples'] = [parent_sample_dict]
# If one parent entity of this Dataset is a Sample, then all parent entities
# of this Dataset must be Samples.
entity['source_samples'] = parents
e = parents[0]
except IndexError:
entity['source_samples'] = []
Expand Down

0 comments on commit a3a1013

Please sign in to comment.