Skip to content

Commit

Permalink
handle fixes in csv for any open data field
Browse files Browse the repository at this point in the history
  • Loading branch information
nlehuby committed Oct 8, 2024
1 parent 06fef3b commit 1e289dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ En complément du regroupement par station, le retraitement suivant effectue div
* vérification sommaire de la validité des coordonnées géographiques
* vérification sommaire de la validité de l'identifiant d'itinérance (`id_station_itinerance`) qui est ajouté dans OSM dans la clef `ref:EU:EVSE`
* vérification sommaire de la validité du numéro de téléphone
* correction du nom de l'opérateur et du réseau à partir d'une liste de référence (modifiable [ici](https://github.com/Jungle-Bus/ref-EU-EVSE/blob/master/fixes_networks.csv))
* correction de plusieurs attributs tels que les noms de l'opérateur, de l'aménageur et du réseau à partir d'une liste de référence (modifiable [ici](https://github.com/Jungle-Bus/ref-EU-EVSE/blob/master/fixes_networks.csv))
* vérification des doublons (une même station listée plusieurs fois)
* vérifications diverses de cohérence entre les informations des points de recharge et de la station
* etc
Expand Down
1 change: 1 addition & 0 deletions fixes_networks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,4 @@
"VOLVO Épinal - Everline SAS","Volvo"
"WIIIZ","WiiiZ"
"ZENPARK","Zenpark"
"[email protected]","[email protected]"
16 changes: 8 additions & 8 deletions group_opendata_by_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ def transformRef(refIti, refLoc):
continue

if not cleanRef in station_list:
station_prop = {key: row[key] if row[key] != "null" else "" for key in station_attributes}
station_prop = {}
for key in station_attributes :
station_prop[key] = row[key]
if row[key] == "null":
station_prop[key] = ""
elif row[key] in wrong_ortho.keys():
station_prop[key] = wrong_ortho[row[key]]

station_prop['Xlongitude'] = float(row['consolidated_longitude'])
station_prop['Ylatitude'] = float(row['consolidated_latitude'])
phone = cleanPhoneNumber(row['telephone_operateur'])
Expand Down Expand Up @@ -142,13 +149,6 @@ def transformRef(refIti, refLoc):
# ~ all_prises_types = set()

for station_id, station in station_list.items() :
if station['attributes']['nom_amenageur'] in wrong_ortho.keys():
station['attributes']['nom_amenageur'] = wrong_ortho[station['attributes']['nom_amenageur']]
if station['attributes']['nom_enseigne'] in wrong_ortho.keys():
station['attributes']['nom_enseigne'] = wrong_ortho[station['attributes']['nom_enseigne']]
if station['attributes']['nom_operateur'] in wrong_ortho.keys():
station['attributes']['nom_operateur'] = wrong_ortho[station['attributes']['nom_operateur']]

station['attributes']['id_station_itinerance'] = station_id
sources = set([elem['datagouv_organization_or_owner'] for elem in station['pdc_list']])
if len(sources) !=1 :
Expand Down

0 comments on commit 1e289dd

Please sign in to comment.