1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
2
|
|
|
|
3
|
|
|
try: |
4
|
|
|
import traceback |
5
|
|
|
import logging |
6
|
|
|
import sys |
7
|
|
|
import os |
8
|
|
|
import pandas as pd |
9
|
|
|
from osm_poi_matchmaker.libs.pandas import save_downloaded_pd |
|
|
|
|
10
|
|
|
from osm_poi_matchmaker.libs.address import extract_street_housenumber_better_2, clean_city, clean_phone_to_str |
|
|
|
|
11
|
|
|
from osm_poi_matchmaker.libs.geo import check_hu_boundary |
12
|
|
|
from osm_poi_matchmaker.utils import config |
13
|
|
|
from osm_poi_matchmaker.libs.osm_tag_sets import POS_HU_GEN, PAY_CASH |
|
|
|
|
14
|
|
|
from osm_poi_matchmaker.utils.data_provider import DataProvider |
15
|
|
|
from osm_poi_matchmaker.utils.enums import FileType |
16
|
|
|
except ImportError as err: |
17
|
|
|
logging.error('Error %s import module: %s', __name__, err) |
18
|
|
|
logging.error(traceback.print_exc()) |
|
|
|
|
19
|
|
|
sys.exit(128) |
20
|
|
|
|
21
|
|
|
|
22
|
|
View Code Duplication |
class hu_emobi_ev(DataProvider): |
|
|
|
|
23
|
|
|
|
24
|
|
|
def constains(self): |
25
|
|
|
self.link = os.path.join(config.get_directory_cache_url(), 'hu_e-mobi_ev.csv') |
26
|
|
|
self.POI_COMMON_TAGS = "" |
27
|
|
|
self.filetype = FileType.csv |
28
|
|
|
self.filename = '{}.{}'.format(self.__class__.__name__, self.filetype.name) |
29
|
|
|
|
30
|
|
|
def types(self): |
31
|
|
|
self.__types = [{'poi_code': 'huemobichs', 'poi_name': 'e-töltőpont', 'poi_type': 'charging_station', |
|
|
|
|
32
|
|
|
'poi_tags': "{'amenity': 'charging_station', 'authentication:app': 'yes'," |
33
|
|
|
"'authentication:none': 'yes', 'authentication:membership_card': 'yes', " |
|
|
|
|
34
|
|
|
"'operator': 'e-Mobi Elektromobilitás Nonprofit Kft.', " |
35
|
|
|
"'operator:addr': '1037 Budapest, Montevideo utca 2/C', 'fee': 'yes'," |
|
|
|
|
36
|
|
|
"'parking:fee': 'no', 'opening_hours': '24/7', 'ref:vatin': 'HU25539431', " |
|
|
|
|
37
|
|
|
"'ref:vatin:hu': ' 25539431-2-41', 'ref:HU:company': '01 09 281052', " |
|
|
|
|
38
|
|
|
"'alt_name': 'e-mobi', 'contact:website': 'https://e-mobi.hu/hu'," |
|
|
|
|
39
|
|
|
"'contact:email': '[email protected]', 'contact:phone': '+36 80 210 012', " |
|
|
|
|
40
|
|
|
"'contact:facebook': 'https://www.facebook.com/elektromobilitas' }", |
|
|
|
|
41
|
|
|
'poi_url_base': 'https://www.mobiliti.hu', 'poi_search_name': '(e-mobi|emobi|e-töltőpont)', |
|
|
|
|
42
|
|
|
'osm_search_distance_perfect': 50, 'osm_search_distance_safe': 30, |
43
|
|
|
'osm_search_distance_unsafe': 10}, |
44
|
|
|
] |
45
|
|
|
return self.__types |
46
|
|
|
|
47
|
|
|
def process(self): |
48
|
|
|
try: |
49
|
|
|
csv = pd.read_csv(self.link, encoding='UTF-8', sep=';', skiprows=1) |
50
|
|
|
if csv is not None: |
51
|
|
|
poi_dict = csv.to_dict('records') |
52
|
|
|
for poi_data in poi_dict: |
53
|
|
|
self.data.name = 'e-töltőpont' |
54
|
|
|
self.data.code = 'huemobichs' |
55
|
|
|
self.data.ref = poi_data.get('Mobiliti azonosító') |
56
|
|
|
self.data.branch = poi_data.get('Töltőpont neve') |
57
|
|
|
self.data.postcode = poi_data.get('Irányító szám') |
58
|
|
|
self.data.city = clean_city(poi_data.get('Település')) |
59
|
|
|
self.data.street, self.data.housenumber, self.data.conscriptionnumber = \ |
60
|
|
|
extract_street_housenumber_better_2(poi_data.get('Cím')) |
61
|
|
|
self.data.original = poi_data.get('Cím') |
62
|
|
|
temp = poi_data.get('GPS koordináták') |
63
|
|
|
if temp is None: |
|
|
|
|
64
|
|
|
continue |
65
|
|
|
else: |
66
|
|
|
self.data.lat, self.data.lon = temp.split(',') |
67
|
|
|
self.data.lat, self.data.lon = check_hu_boundary(self.data.lat, self.data.lon) |
68
|
|
|
self.data.socket_chademo = poi_data.get('Darab (CHAdeMO)') |
69
|
|
|
self.data.socket_chademo_output = poi_data.get('Teljesítmény (CHAdeMO)') |
70
|
|
|
self.data.socket_type2_combo = poi_data.get('Darab (CCS)') |
71
|
|
|
self.data.socket_type2_combo_output = poi_data.get('Teljesítmény (CCS)') |
72
|
|
|
self.data.socket_type2_cable = poi_data.get('Darab (Type 2)') |
73
|
|
|
self.data.socket_type2_cable_output = poi_data.get('Teljesítmény (Type 2)') |
74
|
|
|
self.data.manufacturer = poi_data.get('Töltő típusa') |
75
|
|
|
self.data.model = None |
76
|
|
|
self.data.capacity = poi_data.get('Kapacitás') |
77
|
|
|
self.data.add() |
78
|
|
|
except Exception as e: |
|
|
|
|
79
|
|
|
logging.error(traceback.print_exc()) |
80
|
|
|
logging.error(e) |
81
|
|
|
|
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.