diff --git a/app/api/crud.py b/app/api/crud.py index 6970fe4..2c0adc8 100644 --- a/app/api/crud.py +++ b/app/api/crud.py @@ -188,11 +188,15 @@ async def get_terms( ---------- data_element_URI : str Controlled term of neurobagel class for which all the available terms should be retrieved. + term_labels_path : Path + Path to JSON file containing term-label mappings for the vocabulary of the data element URI. Returns ------- dict - Dictionary where the key is the Neurobagel class and values correspond to all the terms representing available (i.e. used) instances of that class in the graph. + Dictionary where the key is the Neurobagel class and the value is a list of dictionaries + corresponding to the available (i.e. used) instances of that class in the graph. Each instance dictionary + has two items: the 'TermURL' and the human-readable 'Label' for the term. """ term_url_results = post_query_to_graph( util.create_terms_query(data_element_URI) diff --git a/app/api/routers/attributes.py b/app/api/routers/attributes.py index 2bc226e..6462311 100644 --- a/app/api/routers/attributes.py +++ b/app/api/routers/attributes.py @@ -22,7 +22,10 @@ async def get_term_labels_for_vocab( async def get_terms( data_element_URI: constr(regex=CONTROLLED_TERM_REGEX), request: Request ): - """When a GET request is sent, return a dict with the only key corresponding to controlled term of a neurobagel class and value corresponding to all the available terms.""" + """ + When a GET request is sent, return a dict with the only key corresponding to the controlled term of a neurobagel class, + and the value being a list of dictionaries each corresponding to an available class instance term from the graph. + """ term_labels_path = None if data_element_URI == DataElementURI.assessment: diff --git a/app/api/utility.py b/app/api/utility.py index cc39e71..162bf2c 100644 --- a/app/api/utility.py +++ b/app/api/utility.py @@ -257,7 +257,7 @@ def is_term_namespace_in_context(term_url: str) -> bool: Parameters ---------- - url : str + term_url : str A controlled term URI. Returns @@ -277,8 +277,10 @@ def strip_namespace_from_term_uri(term: str, has_prefix: bool = False) -> str: Parameters ---------- - uri : str + term : str A controlled term URI. + has_prefix : bool, optional + Whether the term URI includes a namespace prefix (as opposed to the full namespace URI), by default False. Returns -------