Skip to content

Commit

Permalink
Merge pull request #759 from hubmapconsortium/karlburke/FlipOntQueryT…
Browse files Browse the repository at this point in the history
…oDatasetType

Use Ontology API dataset_type support, like ingest-ui.
  • Loading branch information
yuanzhou authored Oct 30, 2024
2 parents 9312cc8 + a10a386 commit e58fbff
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/schema/schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1589,11 +1589,9 @@ def get_hubmap_ids(id):
"""
def get_dataset_type_valueset_list():
# Use the Ontology API to get JSON for allowed terms.
ubkg_valueset = get_valueset(parent_vocabulary_sab='HUBMAP'
,parent_vocabulary_valueset_code='C003041'
,value_preferred_vocabulary_sab='HUBMAP')
ubkg_valueset = get_valueset(ontology_app_context='HUBMAP')
# Extract the term elements from the JSON into a list to be returned.
return [v['term'] for v in ubkg_valueset]
return [v['dataset_type'] for v in ubkg_valueset]

"""
Use the Ontology API valueset endpoint to retrieve the UBKG valueset for a particular
Expand All @@ -1619,13 +1617,11 @@ def get_dataset_type_valueset_list():
...
]
"""
def get_valueset(parent_vocabulary_sab, parent_vocabulary_valueset_code, value_preferred_vocabulary_sab):
def get_valueset(ontology_app_context):
global _ontology_api_url

target_url = f"{_ontology_api_url}/valueset" \
f"?parent_sab={parent_vocabulary_sab}" \
f"&parent_code={parent_vocabulary_valueset_code}" \
f"&child_sabs={value_preferred_vocabulary_sab}"
target_url = f"{_ontology_api_url}/dataset-types" \
f"?application_context={ontology_app_context}"

# Use Memcached to improve performance
response = make_request_get(target_url, internal_token_used = True)
Expand Down

0 comments on commit e58fbff

Please sign in to comment.