From b94f3fa49419c212e62d6bfa8966a8a962ae98c4 Mon Sep 17 00:00:00 2001 From: Daniel Mannarino Date: Tue, 17 Dec 2024 15:59:54 -0500 Subject: [PATCH] Initial attempt at stub route for geoencoder --- app/main.py | 8 +++++++ app/routes/thematic/__init__.py | 2 ++ app/routes/thematic/geoencoder.py | 38 +++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 app/routes/thematic/__init__.py create mode 100644 app/routes/thematic/geoencoder.py diff --git a/app/main.py b/app/main.py index ef1a5004..214b8934 100644 --- a/app/main.py +++ b/app/main.py @@ -20,6 +20,7 @@ from .routes.analysis import analysis from .routes.assets import asset, assets from .routes.authentication import authentication +from .routes.thematic import geoencoder from .routes.datasets import asset as version_asset from .routes.datasets import ( dataset, @@ -128,6 +129,13 @@ async def rve_error_handler( app.include_router(r, prefix="/dataset") +################ +# THEMATIC API # +################ + +app.include_router(geoencoder.router, prefix="/thematic") + + ############### # ASSET API ############### diff --git a/app/routes/thematic/__init__.py b/app/routes/thematic/__init__.py new file mode 100644 index 00000000..5a4829a0 --- /dev/null +++ b/app/routes/thematic/__init__.py @@ -0,0 +1,2 @@ +""" +""" \ No newline at end of file diff --git a/app/routes/thematic/geoencoder.py b/app/routes/thematic/geoencoder.py new file mode 100644 index 00000000..7446d05f --- /dev/null +++ b/app/routes/thematic/geoencoder.py @@ -0,0 +1,38 @@ +from fastapi import APIRouter, Request as FastApiRequest + + +router = APIRouter() + + +@router.get( + "/geoencoder/{country}/{region}/{subregion}", + # response_class=RedirectResponse, + status_code=200, +) +async def geoencoder( + *, + # dataset_version: Tuple[str, str] = Depends(dataset_version_dependency), + request: FastApiRequest, +): + """ + + """ + return { + "adminVersion": "4.1", + "matches": [ + { + "country": { + "id": "HND", + "name": "Honduras" + }, + "region": { + "id": 1, + "name": "Atlántida" + }, + "subregion": { + "id": 4, + "name": "Jutiapa" + } + } + ] + } \ No newline at end of file