From 154c298bb3f2fe56c5b2566b6f1c41bd55cac789 Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Thu, 17 Oct 2024 12:04:10 -0400 Subject: [PATCH] update docstring --- app/api/routers/route_factory.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/api/routers/route_factory.py b/app/api/routers/route_factory.py index cf1a7cc..c47e87e 100644 --- a/app/api/routers/route_factory.py +++ b/app/api/routers/route_factory.py @@ -6,12 +6,13 @@ def create_get_instances_handler( data_element_uri: str, external_vocab: str | None ): - """ - 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. - """ + """Create the handler function (path function) for the root `/` path of an attribute router.""" async def get_instances(request: Request): + """ + 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 = ( request.app.state.vocab_lookup_paths[external_vocab] if external_vocab is not None @@ -23,9 +24,13 @@ async def get_instances(request: Request): def create_get_vocab_handler(external_vocab: str, vocab_name: str): - """When a GET request is sent, return a dict containing the name, namespace info, and all term ID-label mappings for the vocabulary of the specified variable.""" + """Create the handler function (path function) for the `/vocab` endpoint of an attribute router.""" async def get_vocab(request: Request): + """ + When a GET request is sent, return a dict containing the name, namespace info, + and all term ID-label mappings for the vocabulary of the specified variable. + """ return await crud.get_term_labels_for_vocab( term_labels_path=request.app.state.vocab_lookup_paths[ external_vocab