-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactorisation et harmonisation des points d'entrée (#82)
* first commit argo * cross_product * crossproduct ok en local * ok print crossproduct in first function * crossproduct json * fix json format (json.dumps) * json dump * try raw string * try to change items to item.format * try json simple array * try json simple array * try seconds * remplace dag by tasks in withParams * crossproduct change sys to print * silent output bash &> /dev/null * silent pip install output --quiet * item & notes * item & notes * one parameter for each json key * utilise image cartiflette * plus besoin du pip install requirements.txt * test * update test * pyopen * docker * update * update * change extension * sudo * argo workflow * pipeline step * docker prod * still pending * update * update * update * update * complete * test * arg * link * argo pipeline * update * update * update * temp * update * docker * update * update volume * adapting pipeline * split tiles * update * add script * update * update * print * change local path * script COMMUNE_ARRONDISSEMENT * add log * logger * restriction to one field * test subset * simplification * update * simplfie * pipeline using environment variables * updatre * add region and bassin_vie * split * modularise * Full pipeline * Full pipeline * README * temp * Localdata path * mount * update * force * Refactorisation * update * download * depreciation warning * preprod * clean * update * refactor and first draft API --------- Co-authored-by: qchicherybercy <quentin.chichery@finances.gouv.fr>
- Loading branch information
1 parent
f0a3594
commit 9a0b970
Showing
28 changed files
with
257 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""A simple API to expose cartiflette files""" | ||
import typing | ||
from fastapi import FastAPI, Response | ||
from fastapi.responses import FileResponse | ||
from cartiflette.api import download_from_cartiflette_inner | ||
|
||
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\">" | ||
) | ||
|
||
|
||
@app.get("/", tags=["Welcome"]) | ||
def show_welcome_page(): | ||
""" | ||
Show welcome page with model name and version. | ||
""" | ||
|
||
return { | ||
"Message": "API cartiflette", | ||
"Documentation": 'https://github.com/InseeFrLab/cartiflette' | ||
} | ||
|
||
|
||
@app.get("/json", tags=["Output a JSON object"]) | ||
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 | ||
) -> str: | ||
""" | ||
""" | ||
|
||
geojsons = download_from_cartiflette_inner( | ||
values=values, | ||
borders=borders, | ||
filter_by=filter_by, | ||
territory="metropole", | ||
vectorfile_format="topojson", | ||
year=2022, | ||
crs=4326, | ||
simplification=simplification, | ||
provider="IGN", | ||
dataset_family="ADMINEXPRESS", | ||
source="EXPRESS-COG-CARTO-TERRITOIRE", | ||
return_as_json=False, | ||
path_within_bucket="test/preprod", | ||
) | ||
|
||
geojson_dict = geojsons.to_json() | ||
|
||
return Response( | ||
geojson_dict, | ||
media_type="application/json" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
from cartiflette.config import ( | ||
BUCKET, | ||
PATH_WITHIN_BUCKET, | ||
ENDPOINT_URL, | ||
FS, | ||
THREADS_DOWNLOAD, | ||
LEAVE_TQDM, | ||
) | ||
from cartiflette.constants import REFERENCES, DOWNLOAD_PIPELINE_ARGS | ||
from cartiflette.utils import * | ||
from cartiflette.download import * | ||
from cartiflette.s3 import * | ||
from cartiflette.api import download_from_cartiflette_inner | ||
|
||
carti_download = download_from_cartiflette_inner | ||
|
||
__all__ = ["carti_download"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .output import download_from_cartiflette_inner | ||
|
||
__all__ = ["download_from_cartiflette_inner"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.