From c12088c3b9cebe5b6d018a9c3f912e512552f9d7 Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Wed, 15 Nov 2023 10:19:23 +0100 Subject: [PATCH] fix: Path in docs (#208) --- backend/app/api/api_v1/api.py | 15 +++++++-- backend/app/api/internal/api.py | 14 +++++++-- backend/app/api/internal/endpoints/proxy.py | 15 ++++++++- backend/app/api/internal/endpoints/remote.py | 32 ++++++++++++++++++-- docs/api_api_v1.rst | 10 +++--- docs/api_internal.rst | 2 +- docs/api_models.rst | 8 ++--- 7 files changed, 78 insertions(+), 18 deletions(-) diff --git a/backend/app/api/api_v1/api.py b/backend/app/api/api_v1/api.py index 718b383d..59f07c9c 100644 --- a/backend/app/api/api_v1/api.py +++ b/backend/app/api/api_v1/api.py @@ -48,9 +48,20 @@ class OrcidOpenId(OpenID): - """Custom OrcID OpenID client that fetches the user's email from the OrcID API. - + """ + Custom OrcID OpenID client that fetches the user's email from the OrcID API. Note that users must have given access to their email address for "trusted parties". + + :param client_id: client ID + :type client_id: str + :param client_secret: client secret + :type client_secret: str + :param openid_configuration_endpoint: OpenID configuration endpoint + :type openid_configuration_endpoint: str + :param name: name of the provider + :type name: str + :param base_scopes: base scopes + :type base_scopes: list, optional """ def __init__( diff --git a/backend/app/api/internal/api.py b/backend/app/api/internal/api.py index 23e2a5b5..6d58f0d6 100644 --- a/backend/app/api/internal/api.py +++ b/backend/app/api/internal/api.py @@ -15,7 +15,12 @@ @api_router.get("/version") @api_router.post("/version") async def version(): - """Return REEV software version""" + """ + Return reev version. + + :return: reev version + :rtype: str + """ if settings.REEV_VERSION: version = settings.REEV_VERSION else: @@ -26,7 +31,12 @@ async def version(): @api_router.get("/frontend-settings") @api_router.post("/frontend-settings") async def matomo(): - """Return Frontend settings""" + """ + Return frontend settings. + + :return: frontend settings + :rtype: dict + """ frontend_settings = { "matomo_host": settings.MATOMO_HOST, "matomo_site_id": settings.MATOMO_SITE_ID, diff --git a/backend/app/api/internal/endpoints/proxy.py b/backend/app/api/internal/endpoints/proxy.py index ab61c275..184ccf6c 100644 --- a/backend/app/api/internal/endpoints/proxy.py +++ b/backend/app/api/internal/endpoints/proxy.py @@ -13,7 +13,20 @@ @router.get("/{path:path}") @router.post("/{path:path}") async def reverse_proxy(request: Request) -> Response: - """Implement reverse proxy for internal backend services.""" + """ + Reverse proxy to internal services. + Supported services: + - AnnoNARS + - MeHARI + - Viguno + - NGINX + - Dotty + + :param request: request + :type request: :class:`fastapi.Request` + :return: response + :rtype: :class:`fastapi.Response` + """ url = request.url backend_url = None diff --git a/backend/app/api/internal/endpoints/remote.py b/backend/app/api/internal/endpoints/remote.py index 390fe00e..918cae4f 100644 --- a/backend/app/api/internal/endpoints/remote.py +++ b/backend/app/api/internal/endpoints/remote.py @@ -72,7 +72,17 @@ def get_legacy_session(): @router.get("/variantvalidator/{path:path}") async def variantvalidator(request: Request, path: str): - """Implement reverse proxy for variantvalidator.org.""" + """ + Implement VariantValidator API. Proxy requests to the + `VariantValidator `_ backend. + + :param request: request + :type request: :class:`fastapi.Request` + :param path: path to append to the backend URL + :type path: str + :return: response + :rtype: :class:`fastapi.responses.StreamingResponse` + """ url = request.url # change grch to GRCh and strip "chr" prefixes @@ -97,7 +107,15 @@ async def variantvalidator(request: Request, path: str): @router.get("/acmg/{path:path}") async def acmg(request: Request): - """Implement searching for ACMG classification.""" + """ + Implement searching for ACMG classification for SNVs and indels. + Proxy requests to the `WinterVar `_ backend. + + :param request: request + :type request: :class:`fastapi.Request` + :return: ACMG classification + :rtype: dict + """ query_params = request.query_params chromosome = query_params.get("chromosome") position = query_params.get("position") @@ -128,7 +146,15 @@ async def acmg(request: Request): @router.get("/cnv/acmg/{path:path}") async def cnv_acmg(request: Request): - """Implement searching for ACMG classification for CNVs.""" + """ + Implement searching for ACMG classification for CNVs. + Proxy requests to the `WinterVar `_ backend. + + :param request: request + :type request: :class:`fastapi.Request` + :return: ACMG classification + :rtype: dict + """ query_params = request.query_params chromosome = query_params.get("chromosome") start = query_params.get("start") diff --git a/docs/api_api_v1.rst b/docs/api_api_v1.rst index 4c5e39d0..fcac616a 100644 --- a/docs/api_api_v1.rst +++ b/docs/api_api_v1.rst @@ -10,7 +10,7 @@ app.api.api_v1 app.api.api_v1.endpoints.adminmsgs ---------------------------------- -.. automodule:: backend.app.api.api_v1.endpoints.adminmsgs +.. automodule:: app.api.api_v1.endpoints.adminmsgs :members: :undoc-members: :show-inheritance: @@ -20,7 +20,7 @@ app.api.api_v1.endpoints.adminmsgs app.api.api_v1.endpoints.auth ----------------------------- -.. automodule:: backend.app.api.api_v1.endpoints.auth +.. automodule:: app.api.api_v1.endpoints.auth :members: :undoc-members: :show-inheritance: @@ -30,7 +30,7 @@ app.api.api_v1.endpoints.auth app.api.api_v1.endpoints.bookmarks ---------------------------------- -.. automodule:: backend.app.api.api_v1.endpoints.bookmarks +.. automodule:: app.api.api_v1.endpoints.bookmarks :members: :undoc-members: :show-inheritance: @@ -40,7 +40,7 @@ app.api.api_v1.endpoints.bookmarks app.api.api_v1.endpoints.caseinfo --------------------------------- -.. automodule:: backend.app.api.api_v1.endpoints.caseinfo +.. automodule:: app.api.api_v1.endpoints.caseinfo :members: :undoc-members: :show-inheritance: @@ -50,7 +50,7 @@ app.api.api_v1.endpoints.caseinfo app.api.api_v1.endpoints.utils ------------------------------ -.. automodule:: backend.app.api.api_v1.endpoints.utils +.. automodule:: app.api.api_v1.endpoints.utils :members: :undoc-members: :show-inheritance: diff --git a/docs/api_internal.rst b/docs/api_internal.rst index 33dd8211..0a880672 100644 --- a/docs/api_internal.rst +++ b/docs/api_internal.rst @@ -10,7 +10,7 @@ app.api.internal app.api.internal.endpoints.remote --------------------------------- -.. automodule:: backend.app.api.internal.endpoints.remote +.. automodule:: app.api.internal.endpoints.remote :members: :undoc-members: :show-inheritance: diff --git a/docs/api_models.rst b/docs/api_models.rst index 1c8fa378..7ebe3938 100644 --- a/docs/api_models.rst +++ b/docs/api_models.rst @@ -10,26 +10,26 @@ app.models app.models.adminmsg ------------------- -.. automodule:: backend.app.models.adminmsg +.. automodule:: app.models.adminmsg :members: ------------------- app.models.bookmark ------------------- -.. automodule:: backend.app.models.bookmark +.. automodule:: app.models.bookmark :members: --------------- app.models.user --------------- -.. automodule:: backend.app.models.user +.. automodule:: app.models.user :members: ------------------- app.models.caseinfo ------------------- -.. automodule:: backend.app.models.caseinfo +.. automodule:: app.models.caseinfo :members: