Skip to content

Commit

Permalink
[AMP] fix flow d'import des amp depuis l'OFB (#1392)
Browse files Browse the repository at this point in the history
fix un probl猫me de conversion + renommage des flows plus explicite
  • Loading branch information
thoomasbro committed May 23, 2024
2 parents 0aab234 + fe1aa8b commit 57514fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datascience/src/pipeline/flows/amp_cacem.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def load_new_amp(new_amp: pd.DataFrame):
)


with Flow("amp") as flow:
with Flow("import amp cacem") as flow:

local_hashes = extract_local_hashes()
remote_hashes = extract_remote_hashes()
Expand Down
8 changes: 7 additions & 1 deletion datascience/src/pipeline/flows/amp_ofb.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ def load_amp_areas(amp_areas: gpd.GeoDataFrame):
df = amp_areas,
logger = logger,
nullable_integer_columns = [
"gid",
"mpa_id",
"mpa_pid",
"des_id",
"mpa_statusyr",
"mpa_wdpaid",
"mpa_marine"
]
)
Expand Down Expand Up @@ -251,7 +257,7 @@ def load_amp_areas(amp_areas: gpd.GeoDataFrame):
)


with Flow("AMP areas") as flow:
with Flow("update amp from ofb") as flow:
amp_areas = extract_amp_areas(url=AMP_AREAS_URL, proxies=PROXIES)
amp_areas = transform_amp_areas(amp_areas)
load_amp_areas(amp_areas)
Expand Down
14 changes: 7 additions & 7 deletions datascience/tests/test_pipeline/test_flows/test_amp_ofb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
def amp_areas_from_ofb() -> gpd.GeoDataFrame:
return gpd.GeoDataFrame(
{
"mpa_id": [ 3, 4, 7, 92, 735],
"mpa_pid": [1, 2, 3, 4, 7],
"gid": [1, 2, 3, 4, 7],
"des_id": [1, 2, 3, 4, 7],
"mpa_id": [ 3.0, 4, 7, 92, 735],
"mpa_pid": [1.0, 2, 3, 4, 7],
"gid": [1.0, 2, 3, 4, 7],
"des_id": [1.0, 2, 3, 4, 7],
"mpa_status": ["designated", "designated", "proposed", "proposed", "proposed"],
"mpa_name": [
"AMP 1 updated",
Expand Down Expand Up @@ -51,11 +51,11 @@ def amp_areas_from_ofb() -> gpd.GeoDataFrame:
"2003-01-01",
"2004-01-01",
],
"mpa_statusyr": [2024, 2001, 2002, 2003, 2004],
"mpa_wdpaid": [106767, 555526886, 555526887, 555526888, 555526889],
"mpa_statusyr": [2024.0, 2001, 2002, 2003, 2004],
"mpa_wdpaid": [106767.0, 555526886, 555526887, 555526888, 555526889],
"mpa_wdpapid": ["WDPA 1", "WDPA 2", "WDPA 3", "WDPA 4", "WDPA 5"],
"mpa_mnhnid": ["FR3600138", "FR1100014", None, "FR11014", "FR11330014"],
"mpa_marine": [1, 0, 1, None, 1],
"mpa_marine": [1.0, 0, 1, None, 1],
"mpa_url": ["URL 1", "URL 2", "URL 3", "URL 4", None],
"mpa_calcarea": [100.1, 200, 300, 400, 500],
"mpa_calcmarea": [100.1, 200, 300, 400, 500],
Expand Down

0 comments on commit 57514fb

Please sign in to comment.