Skip to content

Commit

Permalink
add SKIP_EXISTING_UUID and change requirement of occhab import
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Jul 26, 2024
1 parent fd5e3e2 commit 486c54e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/geonature/core/imports/checks/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class ImportCodeError:
A uuid value is duplicated
EXISTING_UUID: str
A uuid value already exists in the destination table
SKIP_EXISTING_UUID: str
A uuid value already exists in the destination table and should be skipped
MISSING_VALUE : str
A required value is missing (see `mandatory` column in `gn_imports.bib_fields` table)
MISSING_GEOM : str
Expand Down Expand Up @@ -151,6 +153,7 @@ class ImportCodeError:
DUPLICATE_ROWS = "DUPLICATE_ROWS"
DUPLICATE_UUID = "DUPLICATE_UUID"
EXISTING_UUID = "EXISTING_UUID"
SKIP_EXISTING_UUID = "SKIP_EXISTING_UUID"

# Missing value when required
MISSING_VALUE = "MISSING_VALUE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ def upgrade():
"description": "Le champ doit être renseigné avec une valeur numérique (entier, flottant).",
"error_level": "ERROR",
},
{
"error_type": "Ignorer les données existantes",
"name": "SKIP_EXISTING_UUID",
"description": "Les entitiés existantes selon UUID sont ignorees.",
"error_level": "WARNING",
},
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ def upgrade():
["id_station_source", dict(optional_conditions=["unique_id_sinp_station"], mandatory=True)],
["unique_id_sinp_station", dict(optional_conditions=["id_station_source"], mandatory=True)],
["WKT", dict(optional_conditions=["longitude", "latitude"], mandatory=True)],
[
"latitude",
dict(mandatory_conditions=["longitude"], optional_conditions=["WKT"], mandatory=True),
],
[
"longitude",
dict(mandatory_conditions=["latitude"], optional_conditions=["WKT"], mandatory=True),
],
]
for name_field, update_values in inter_fields_conditions:
op.execute(
Expand Down

0 comments on commit 486c54e

Please sign in to comment.