Skip to content

Commit

Permalink
Fix PATH_WITHIN_BUCKET
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrandje committed Apr 16, 2024
1 parent cd0e6cc commit bb59699
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
22 changes: 9 additions & 13 deletions argo-pipeline/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import typing
from fastapi import FastAPI, Response
from fastapi.responses import FileResponse

from cartiflette.api import download_from_cartiflette_inner
from cartiflette.config import PATH_WITHIN_BUCKET

app = FastAPI(
title="API de récupération des fonds de carte avec <code>cartiflette</code>",
description="<br><br><img src=\"https://github.com/InseeFrLab/cartiflette/raw/main/cartiflette.png\" width=\"200\">"
)
description='<br><br><img src="https://github.com/InseeFrLab/cartiflette/raw/main/cartiflette.png" width="200">',
)


@app.get("/", tags=["Welcome"])
Expand All @@ -18,7 +20,7 @@ def show_welcome_page():

return {
"Message": "API cartiflette",
"Documentation": 'https://github.com/InseeFrLab/cartiflette'
"Documentation": "https://github.com/InseeFrLab/cartiflette",
}


Expand All @@ -27,10 +29,9 @@ def download_from_cartiflette_api(
values: typing.List[typing.Union[str, int, float]] = "11",
borders: str = "DEPARTEMENT",
filter_by: str = "REGION",
simplification: typing.Union[str, int, float] = None
simplification: typing.Union[str, int, float] = None,
) -> str:
"""
"""
""" """

geojsons = download_from_cartiflette_inner(
values=values,
Expand All @@ -45,14 +46,9 @@ def download_from_cartiflette_api(
dataset_family="ADMINEXPRESS",
source="EXPRESS-COG-CARTO-TERRITOIRE",
return_as_json=False,
path_within_bucket="test/preprod",
path_within_bucket=PATH_WITHIN_BUCKET,
)

geojson_dict = geojsons.to_json()

return Response(
geojson_dict,
media_type="application/json"
)


return Response(geojson_dict, media_type="application/json")
10 changes: 5 additions & 5 deletions tests/test_download_from_cartiflette.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from cartiflette import carti_download

path_test = "test/preprod"
from cartiflette import carti_download
from cartiflette.config import PATH_WITHIN_BUCKET


class TestDownloadFromCartiflette(unittest.TestCase):
Expand All @@ -15,7 +15,7 @@ def test_carti_download_single_value(self):
filter_by="REGION",
source="EXPRESS-COG-CARTO-TERRITOIRE",
year=2022,
path_within_bucket=path_test,
path_within_bucket=PATH_WITHIN_BUCKET,
)

print(ile_de_france)
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_carti_download_multi_values(self):
filter_by="REGION",
source="EXPRESS-COG-CARTO-TERRITOIRE",
year=2022,
path_within_bucket=path_test,
path_within_bucket=PATH_WITHIN_BUCKET,
)

# Check the properties of the resulting GeoPandas DataFrame for multiple values
Expand All @@ -69,7 +69,7 @@ def test_carti_download_commune_arrondissement(self):
filter_by="DEPARTEMENT",
source="EXPRESS-COG-CARTO-TERRITOIRE",
year=2022,
path_within_bucket=path_test,
path_within_bucket=PATH_WITHIN_BUCKET,
)

# Check the properties of the resulting GeoPandas DataFrame for commune arrondissement
Expand Down

0 comments on commit bb59699

Please sign in to comment.