From 5f0bcbe26c59803d0d433cdf7a62500c8d424d4a Mon Sep 17 00:00:00 2001 From: cs-dieter-kling Date: Fri, 1 Dec 2023 13:47:37 +0100 Subject: [PATCH] Fixing BNA station ID collision --- charging_stations_pipelines/pipelines/de/bna_mapper.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/charging_stations_pipelines/pipelines/de/bna_mapper.py b/charging_stations_pipelines/pipelines/de/bna_mapper.py index b641231..1567ac8 100644 --- a/charging_stations_pipelines/pipelines/de/bna_mapper.py +++ b/charging_stations_pipelines/pipelines/de/bna_mapper.py @@ -43,7 +43,16 @@ def map_station_bna(row): new_station = Station() datasource = "BNA" new_station.country_code = "DE" + + # FIXME Currently the source_id value for BNA's charging stations is filled with the has value over lat/long. + # This leads to the situation that some charging stations have the same hash value, + # because they have the same lat/long values set (most likely by error) and this in turn leads + # to the fact that some stations cannot be imported because of a unique key constraint + # error (source_id has to be unique). I think we should generate the hash over all attributes of + # the BNA's charging station to avoid the described situation + # see https://github.com/comsysto/eCharm/issues/30 new_station.source_id = lat_long_hash(lat, long, datasource) + new_station.operator = row["Betreiber"] new_station.data_source = datasource new_station.point = from_shape(Point(float(long), float(lat)))