ADD corr_street
This commit is contained in:
parent
e77006bf76
commit
f435f32bba
@ -1,3 +1,4 @@
|
|||||||
|
2221 Groß Schweinbarth|Matzner Straße 31#Groß-Schweinbarth#Matznerstraße 31
|
||||||
2345 Brunn/Gebirge#Brunn am Gebirge
|
2345 Brunn/Gebirge#Brunn am Gebirge
|
||||||
2431 Kleinneusiedl
|
2431 Kleinneusiedl
|
||||||
2560 Berndorf
|
2560 Berndorf
|
||||||
@ -5,14 +6,17 @@
|
|||||||
4020 Linz|Humboldtstraße
|
4020 Linz|Humboldtstraße
|
||||||
4871 Pfaffing|Tiefenbach 6
|
4871 Pfaffing|Tiefenbach 6
|
||||||
5023 Salzburg|Langmoosweg 5
|
5023 Salzburg|Langmoosweg 5
|
||||||
|
5082 Groedig#Grödig
|
||||||
|
5101 Bergheim
|
||||||
5300 Hallwang|Bäckerweg 7
|
5300 Hallwang|Bäckerweg 7
|
||||||
|
5582 St.Michael Lun|Nr.94#Sankt Michael im Lungau#Markt 94
|
||||||
6393 St Ulrich|Dorfstr 13#St. Ulrich am Pillersee#Dorfstraße 13%JN67gm86ut
|
6393 St Ulrich|Dorfstr 13#St. Ulrich am Pillersee#Dorfstraße 13%JN67gm86ut
|
||||||
7323 Ritzing
|
7323 Ritzing
|
||||||
8051 Graz|Wienerstrasse 256/41
|
8051 Graz|Wienerstrasse 256/41
|
||||||
8054 Graz|Dr.Lemisch-Strasse 19#Graz#Doktor-Lemisch-Straße 19
|
8054 Graz|Dr.Lemisch-Strasse 19#Graz#Doktor-Lemisch-Straße 19
|
||||||
8430 Leibnitz|Kittenberg 7
|
8430 Leibnitz|Kittenberg 7
|
||||||
8438 Mayrhofen|Hochsteeg 589#Mayrhofen#Hochsteg 589
|
8438 Mayrhofen|Hochsteeg 589#Mayrhofen#Hochsteg 589
|
||||||
8453 St.Johann I.S.
|
8453 St.Johann I.S.#Sankt Johann im Saggautal
|
||||||
8561 Söding|Steinstraße 10
|
8561 Söding|Steinstraße 10
|
||||||
8682 Muerzzuschlag|Gutenbrunngasse 7#Mürzzuschlag
|
8682 Muerzzuschlag|Gutenbrunngasse 7#Mürzzuschlag
|
||||||
8682 Muerzzuschlag|Gutenbrunngasse 10#Mürzzuschlag
|
8682 Muerzzuschlag|Gutenbrunngasse 10#Mürzzuschlag
|
||||||
|
112
afu/callbook.py
112
afu/callbook.py
@ -370,35 +370,119 @@ def call_change_city(location, address, verbose):
|
|||||||
city = citypart[0]
|
city = citypart[0]
|
||||||
print(f'PLZ: {postal_code}, City: {city}')
|
print(f'PLZ: {postal_code}, City: {city}')
|
||||||
if len(citypart) > 0:
|
if len(citypart) > 0:
|
||||||
street = citypart[1]
|
street = citypart[1].rstrip()
|
||||||
exchange = citypart[1].split('#')
|
exchange = citypart[1].split('#')
|
||||||
city = exchange[0]
|
#city = exchange[0]
|
||||||
|
if exchange[0].rstrip() != address:
|
||||||
|
continue
|
||||||
if len(exchange) > 1:
|
if len(exchange) > 1:
|
||||||
city = exchange[1]
|
city = exchange[1].rstrip()
|
||||||
if len(exchange) > 2:
|
if len(exchange) > 2:
|
||||||
street = exchange[2]
|
street = exchange[2].rstrip()
|
||||||
|
break
|
||||||
print(f'postal_code: {postal_code}, city: {city}, street: {street}')
|
print(f'postal_code: {postal_code}, city: {city}, street: {street}')
|
||||||
return postal_code, city, street
|
return postal_code, city, street
|
||||||
|
|
||||||
call_change_city.lines = None
|
call_change_city.lines = None
|
||||||
|
|
||||||
|
def corr_street(street):
|
||||||
|
street = street.replace('strasse','straße')
|
||||||
|
street = street.replace('Strasse','Straße')
|
||||||
|
street = street.replace('str ','straße ')
|
||||||
|
street = street.replace('Str ','Straße ') # Brünner Str 221/4/5
|
||||||
|
street = street.replace('str.','straße')
|
||||||
|
street = street.replace('Str.','Straße') # Brünner Str. 106/43
|
||||||
|
street = street.replace('Stg. ','Stiege ')
|
||||||
|
street = street.replace('g. ','gasse ')
|
||||||
|
street = street.replace('-G ','-Gasse ')
|
||||||
|
street = street.replace('Stiege ','Stg. ')
|
||||||
|
street = street.replace('Dr. ','Dr.-')
|
||||||
|
# Special, stupid fixes
|
||||||
|
street = street.replace('Str.1','Straße 1') # Peter-Berner-Str.10/1/10
|
||||||
|
street = street.replace('Str.5','Straße 5') # Wagramer Str.59/14/2
|
||||||
|
street = street.replace('Str7','Straße 7') # Hetzendorfer Str79/2/14
|
||||||
|
street = street.replace('Str8','Straße 8') # Theodor-Kramer-Str8/274
|
||||||
|
street = street.replace('Markhofg.13-15/','Markhofgasse 13-15/5/14') # Mautner-Markhofg.13-15/ (OE1JJB)
|
||||||
|
street = street.replace('g.2','gasse 2') # Spittelbreiteng.23/7/2/
|
||||||
|
street = street.replace('g.4','gasse 4') # Siebenbrunneng.42/1/18
|
||||||
|
street = street.replace('Absbergg ','Absberggasse ')
|
||||||
|
street = street.replace('Altmannsdfstraße ','Altmannsdorfer Straße ') # Altmannsdfstr 170 23/7
|
||||||
|
street = street.replace('Bucheng ','Buchengasse ')
|
||||||
|
street = street.replace('Denglerg ','Denglergasse ')
|
||||||
|
street = street.replace('Endemanng ','Endemanngasse ')
|
||||||
|
street = street.replace('Flachg ','Flachgasse ')
|
||||||
|
street = street.replace('Gatterburgg ','Gatterburggasse ')
|
||||||
|
street = street.replace('Goldegg ','Goldeggasse ')
|
||||||
|
street = street.replace('Gregoryg ','Gregorygasse ')
|
||||||
|
street = street.replace('Grundlg ','Grundlgasse ')
|
||||||
|
street = street.replace('Gusenleithnerg ','Gusenleithnergasse ')
|
||||||
|
street = street.replace('Hermanng ','Hermanngasse ') # 7, Neubau, Wien
|
||||||
|
street = street.replace('Hutteng ','Huttengasse ')
|
||||||
|
street = street.replace('Isbaryg ','Isbarygasse ')
|
||||||
|
street = street.replace('Kaunitzg ','Kaunitzgasse ')
|
||||||
|
street = street.replace('Keferg ','Kefergasse ')
|
||||||
|
street = street.replace('Khekg ','Khekgasse ')
|
||||||
|
street = street.replace('Lacknerg ','Lacknergasse ')
|
||||||
|
street = street.replace('Langsulzg ','Langsulzgasse ')
|
||||||
|
street = street.replace('Lavantg ','Lavantgasse')
|
||||||
|
street = street.replace('Leiteng ','Leitengasse ')
|
||||||
|
street = street.replace('Othellog ','Othellogasse ')
|
||||||
|
street = street.replace('Pehamg ','Pehamgasse ')
|
||||||
|
street = street.replace('Pfeilg ','Pfeilgasse ')
|
||||||
|
street = street.replace('Pfenniggeldg ','Pfenniggeldgasse ')
|
||||||
|
street = street.replace('Pohlg ','Pohlgasse ')
|
||||||
|
street = street.replace('Rötzerg ','Rötzergasse ')
|
||||||
|
street = street.replace('Schützpl ','Schützplatz ')
|
||||||
|
street = street.replace('Schiffmühlenst ','Schiffmühlenstraße ')
|
||||||
|
street = street.replace('Schirrmanng ','Schirrmanngasse ')
|
||||||
|
street = street.replace('Sillerg ','Sillergasse ')
|
||||||
|
street = street.replace('aße2','aße 2') #Ziegelhofstrasse29/16
|
||||||
|
street = street.replace('aße5','aße 5') #Josefstädterstraße56/2
|
||||||
|
street = street.replace(' (Klg Am Am', ' (Klg Am Ameisbach)')
|
||||||
|
# Typos
|
||||||
|
street = street.replace('A. Baumgartnerstraße ','Anton-Baumgartner-Straße ')
|
||||||
|
street = street.replace('Achtungvierzigerplatz ','Achtundvierzigerplatz ')
|
||||||
|
street = street.replace('Arsenal Objet ','Arsenal Objekt ')
|
||||||
|
street = street.replace('Brigitt.-L148-154/12/17','Brigittenauer Lände 148-154/12/17')
|
||||||
|
street = street.replace('Schliessmanngasse ','Schließmanngasse ')
|
||||||
|
street = street.replace('Hernalser Hptstraße2','Hernalser Hauptstraße 2') # Hernalser Hptstr.230/14
|
||||||
|
# Spelling
|
||||||
|
street = street.replace('Alser-Straße','Alser Straße')
|
||||||
|
street = street.replace('Andreas Urteil Weg','Andreas-Urteil-Weg')
|
||||||
|
street = street.replace('Atzgersdorferstraße','Atzgersdorfer Straße')
|
||||||
|
street = street.replace('Breitenleerstraße','Breitenleer Straße')
|
||||||
|
street = street.replace('F-Asenbauer-Gasse','Franz-Asenbauer-Gasse')
|
||||||
|
street = street.replace('Friedr.Kaiser-Gasse','Friedrich-Kaiser-Gasse')
|
||||||
|
street = street.replace('Friedrich Schmidt Platz','Friedrich-Schmidt-Platz')
|
||||||
|
street = street.replace('Heiligenstaedter Straße','Heiligenstädter Straße')
|
||||||
|
street = street.replace('Herzmanovsky Orlandogasse','Herzmanovsky-Orlando-Gasse')
|
||||||
|
street = street.replace('Kaiserebersdorferstraße','Kaiserebersdorfer Straße')
|
||||||
|
street = street.replace('Laaer Berg Straße','Laaer-Berg-Straße')
|
||||||
|
street = street.replace('Langenzersdorferstraße','Langenzersdorfer Straße')
|
||||||
|
street = street.replace('Nußdorferstraße','Nußdorfer Straße')
|
||||||
|
street = street.replace('Ottakringerstraße','Ottakringer Straße')
|
||||||
|
street = street.replace('Peter Altenberg-Gasse','Peter-Altenberg-Gasse')
|
||||||
|
street = street.replace('Schuettelstraße','Schüttelstraße')
|
||||||
|
street = street.replace('Tuerkenstraße','Türkenstraße')
|
||||||
|
street = street.replace('Vösendorferstraße','Vösendorfer Straße')
|
||||||
|
street = street.replace('Weissgerberlände','Weißgerberlände')
|
||||||
|
return street
|
||||||
|
|
||||||
def call_postal_code(location, address, verbose):
|
def call_postal_code(location, address, verbose):
|
||||||
|
street = address
|
||||||
if location == '' or location[0] == '*':
|
if location == '' or location[0] == '*':
|
||||||
return ''
|
return '', '', street
|
||||||
p = location.split(' ',1)
|
p = location.split(' ',1)
|
||||||
if isinteger(p[0]) and int(p[0]) > 1000 and int(p[0]) < 10000:
|
if isinteger(p[0]) and int(p[0]) > 1000 and int(p[0]) < 10000:
|
||||||
postal_code = p[0]
|
postal_code = p[0]
|
||||||
city = p[1]
|
city = p[1]
|
||||||
|
street = address
|
||||||
else:
|
else:
|
||||||
postal_code, city, street = call_change_city(location, address, verbose)
|
postal_code, city, street = call_change_city(location, address, verbose)
|
||||||
|
|
||||||
|
street = corr_street(street)
|
||||||
return postal_code
|
# add city and street to the database
|
||||||
|
return postal_code, city, street
|
||||||
|
|
||||||
def call_data_record(line, mod_date, verbose, cur):
|
def call_data_record(line, mod_date, verbose, cur):
|
||||||
|
|
||||||
@ -462,9 +546,9 @@ def call_data_record(line, mod_date, verbose, cur):
|
|||||||
cur.execute(statement)
|
cur.execute(statement)
|
||||||
result = cur.fetchall()
|
result = cur.fetchall()
|
||||||
if not result:
|
if not result:
|
||||||
postal_code = call_postal_code(location, address, verbose)
|
postal_code,city,street = call_postal_code(location, address, verbose)
|
||||||
statement = "INSERT INTO `callbook_address`(`location`,`address`,`postal_code`) VALUES (%s,%s,%s)"
|
statement = "INSERT INTO `callbook_address`(`location`,`address`,`postal_code`,`city`,`street`) VALUES (%s,%s,%s,%s,%s)"
|
||||||
data = (location,address,postal_code)
|
data = (location,address,postal_code,city,street)
|
||||||
try: cur.execute(statement, data)
|
try: cur.execute(statement, data)
|
||||||
except mariadb.Error as e:
|
except mariadb.Error as e:
|
||||||
print(f'\n[WARN] MySQLError during execute statement\n\tArgs: {e.args}')
|
print(f'\n[WARN] MySQLError during execute statement\n\tArgs: {e.args}')
|
||||||
|
Loading…
Reference in New Issue
Block a user