Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssadai committed Nov 9, 2023
1 parent 292e511 commit 19b67c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/api/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion app/api/routers/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions app/api/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
-------
Expand Down

0 comments on commit 19b67c3

Please sign in to comment.