From a10a3863bb074f3e0c13859292d4a2864d25981a Mon Sep 17 00:00:00 2001 From: kburke Date: Fri, 25 Oct 2024 17:32:56 -0400 Subject: [PATCH] Use Ontology API dataset_type support, like ingest-ui. --- src/schema/schema_manager.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/schema/schema_manager.py b/src/schema/schema_manager.py index 8b412412..5738d6cf 100644 --- a/src/schema/schema_manager.py +++ b/src/schema/schema_manager.py @@ -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 @@ -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)