Skip to content

Commit

Permalink
Merge pull request #628 from hubmapconsortium/Derek-Furst/hubma_id_in…
Browse files Browse the repository at this point in the history
…_instanceof

Derek furst/hubma id in instanceof
  • Loading branch information
yuanzhou authored Mar 5, 2024
2 parents 854f340 + b5a8813 commit b99b6d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,16 @@ def get_ancestor_organs(id):
@app.route('/entities/<id>/instanceof/<type>', methods=['GET'])
def get_entities_instanceof(id, type):
try:
instanceof: bool = schema_manager.entity_instanceof(id, type)
uuid = schema_manager.get_hubmap_ids(id.strip())['uuid']
instanceof: bool = schema_manager.entity_instanceof(uuid, type)
except requests.exceptions.RequestException as e:
status_code = e.response.status_code
if status_code == 400:
bad_request_error(e.response.text)
if status_code == 404:
not_found_error(e.response.text)
else:
internal_server_error(e.response.text)
except:
bad_request_error("Unable to process request")
return make_response(jsonify({'instanceof': instanceof}), 200)
Expand Down

0 comments on commit b99b6d6

Please sign in to comment.