Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Collections are regular entities during reindex-all #48

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,29 +1243,6 @@ def get_target_index(self, request, index_without_prefix):
else:
return target_index

# Get a list of entity uuids via entity-api for a given entity type:
# Collection, Donor, Sample, Dataset, Submission. Case-insensitive.
def get_uuids_by_entity_type(self, entity_type, token):
entity_type = entity_type.lower()

request_headers = self.create_request_headers_for_auth(token)

# Use different entity-api endpoint for Collection
if entity_type == 'collection':
url = self.DEFAULT_ENTITY_API_URL + "/collections?property=uuid"
else:
url = self.DEFAULT_ENTITY_API_URL + "/" + entity_type + "/entities?property=uuid"

response = requests.get(url, headers=request_headers, verify=False)

if response.status_code != 200:
internal_server_error(
"get_uuids_by_entity_type() failed to make a request to entity-api for entity type: " + entity_type)

uuids_list = response.json()

return uuids_list

# Create a dict with HTTP Authorization header with Bearer token
def create_request_headers_for_auth(self, token):
auth_header_name = 'Authorization'
Expand Down
2 changes: 1 addition & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ PyYAML>=5.3.1
# Use the branch name of commons from github for testing new changes made in commons from different branch
# Default is main branch
#git+https://github.com/hubmapconsortium/commons.git@main#egg=hubmap-commons
hubmap-commons==2.1.11
hubmap-commons==2.1.12
9 changes: 2 additions & 7 deletions src/translator/tranlation_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@
def get_uuids_by_entity_type(entity_type, request_headers, entity_api_url):
entity_type = entity_type.lower()

# Use different entity-api endpoint for Collection
if entity_type == 'collection':
# url = app.config['ENTITY_API_URL'] + "/collections?property=uuid"
url = entity_api_url + "/collections?property=uuid"
else:
# url = app.config['ENTITY_API_URL'] + "/" + entity_type + "/entities?property=uuid"
url = entity_api_url + "/" + entity_type + "/entities?property=uuid"
# url = app.config['ENTITY_API_URL'] + "/" + entity_type + "/entities?property=uuid"
url = entity_api_url + "/" + entity_type + "/entities?property=uuid"

response = requests.get(url, headers=request_headers, verify=False)

Expand Down