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

Use Ontology API dataset_type support, like ingest-ui. #757

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
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
Loading