fix: deduplicate imported event ids for open data sources
This commit is contained in:
parent
a50d51b3b1
commit
9b3fe95683
2 changed files with 4 additions and 1 deletions
|
|
@ -160,10 +160,14 @@ def import_event_rows(rows: list[dict], source_name: str, notes: str) -> dict:
|
||||||
imported_at = now_iso()
|
imported_at = now_iso()
|
||||||
|
|
||||||
db_rows = []
|
db_rows = []
|
||||||
|
seen_ids = set()
|
||||||
for item in rows:
|
for item in rows:
|
||||||
event_type = item.get("event_type")
|
event_type = item.get("event_type")
|
||||||
if event_type not in VALID_TYPES:
|
if event_type not in VALID_TYPES:
|
||||||
continue
|
continue
|
||||||
|
if item["id"] in seen_ids:
|
||||||
|
continue
|
||||||
|
seen_ids.add(item["id"])
|
||||||
|
|
||||||
db_rows.append(
|
db_rows.append(
|
||||||
(
|
(
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
"source_name": "koeln_baustellen_notfall",
|
"source_name": "koeln_baustellen_notfall",
|
||||||
"coord_crs": "EPSG:25832",
|
"coord_crs": "EPSG:25832",
|
||||||
"field_map": {
|
"field_map": {
|
||||||
"external_id": "properties.Aktenzeichen",
|
|
||||||
"lat": "geometry.coordinates.1",
|
"lat": "geometry.coordinates.1",
|
||||||
"lon": "geometry.coordinates.0",
|
"lon": "geometry.coordinates.0",
|
||||||
"event_type": "properties.Kategorie",
|
"event_type": "properties.Kategorie",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue