Skip to content

Commit

Permalink
Update database files
Browse files Browse the repository at this point in the history
The Belgian bpost bank no longer has a registration and a few bank
account numbers in the tests that used that bank were removed.

Also updates the update/gs1_ai.py script to handle the new format of the
data published by GS1. Also update the GS1-128 module to handle some
different date formats.

The Pakistan entry was kept in the stdnum/iban.dat file because the PDF
version of the IBAN Registry still contains the country.

fix db
  • Loading branch information
arthurdejong committed Mar 17, 2024
1 parent 97dbced commit b454d3a
Show file tree
Hide file tree
Showing 13 changed files with 4,606 additions and 617 deletions.
16 changes: 10 additions & 6 deletions stdnum/at/postleitzahl.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generated from https://data.rtr.at/api/v1/tables/plz.json
# version 37355 published 2023-08-07T22:11:00+02:00
# version 41011 published 2024-03-07T17:01:00+01:00
1010 location="Wien" region="Wien"
1020 location="Wien" region="Wien"
1030 location="Wien" region="Wien"
Expand All @@ -15,6 +15,7 @@
1130 location="Wien" region="Wien"
1140 location="Wien" region="Wien"
1140 location="Wien" region="Wien"
1140 location="Wien" region="Wien"
1150 location="Wien" region="Wien"
1160 location="Wien" region="Wien"
1170 location="Wien" region="Wien"
Expand Down Expand Up @@ -316,6 +317,7 @@
2724 location="Hohe Wand-Stollhof" region="Niederösterreich"
2724 location="Hohe Wand-Stollhof" region="Niederösterreich"
2731 location="St. Egyden am Steinfeld" region="Niederösterreich"
2731 location="St. Egyden am Steinfeld" region="Niederösterreich"
2732 location="Willendorf" region="Niederösterreich"
2733 location="Grünbach am Schneeberg" region="Niederösterreich"
2734 location="Puchberg am Schneeberg" region="Niederösterreich"
Expand Down Expand Up @@ -386,6 +388,7 @@
3034 location="Maria Anzbach" region="Niederösterreich"
3040 location="Neulengbach" region="Niederösterreich"
3041 location="Asperhofen" region="Niederösterreich"
3041 location="Asperhofen" region="Niederösterreich"
3042 location="Würmla" region="Niederösterreich"
3051 location="St. Christophen" region="Niederösterreich"
3052 location="Innermanzing" region="Niederösterreich"
Expand Down Expand Up @@ -543,8 +546,9 @@
3385 location="Prinzersdorf" region="Niederösterreich"
3385 location="Prinzersdorf" region="Niederösterreich"
3386 location="Hafnerbach" region="Niederösterreich"
3388 location="Markersdorf-Haindorf" region="Niederösterreich"
3390 location="Melk" region="Niederösterreich"
3392 location="Schönbühel an der Donau" region="Niederösterreich"
3392 location="Dunkelsteinerwald" region="Niederösterreich"
3393 location="Matzleinsdorf" region="Niederösterreich"
3394 location="Schönbühel-Aggsbach" region="Niederösterreich"
3400 location="Klosterneuburg" region="Niederösterreich"
Expand Down Expand Up @@ -640,7 +644,6 @@
3633 location="Schönbach" region="Niederösterreich"
3641 location="Aggsbach Markt" region="Niederösterreich"
3642 location="Aggsbach Dorf" region="Niederösterreich"
3642 location="Aggsbach Dorf" region="Niederösterreich"
3643 location="Maria Laach am Jauerling" region="Niederösterreich"
3644 location="Emmersdorf an der Donau" region="Niederösterreich"
3650 location="Pöggstall" region="Niederösterreich"
Expand Down Expand Up @@ -1236,6 +1239,7 @@
5121 location="Ostermiething" region="Oberösterreich"
5122 location="Ach" region="Oberösterreich"
5123 location="Überackern" region="Oberösterreich"
5124 location="Haigermoos" region="Oberösterreich"
5131 location="Franking" region="Oberösterreich"
5132 location="Geretsberg" region="Oberösterreich"
5133 location="Gilgenberg am Weilhart" region="Oberösterreich"
Expand Down Expand Up @@ -1809,6 +1813,7 @@
7410 location="Loipersdorf-Kitzladen" region="Burgenland"
7411 location="Markt Allhau" region="Burgenland"
7412 location="Wolfau" region="Burgenland"
7420 location="Neustift an der Lafnitz" region="Burgenland"
7421 location="Tauchen-Schaueregg" region="Steiermark"
7422 location="Riedlingsdorf" region="Burgenland"
7423 location="Pinkafeld" region="Burgenland"
Expand Down Expand Up @@ -2121,11 +2126,8 @@
8561 location="Söding" region="Steiermark"
8561 location="Söding" region="Steiermark"
8562 location="Mooskirchen" region="Steiermark"
8562 location="Mooskirchen" region="Steiermark"
8563 location="Ligist" region="Steiermark"
8563 location="Ligist" region="Steiermark"
8564 location="Krottendorf-Gaisfeld" region="Steiermark"
8565 location="St. Johann ob Hohenburg" region="Steiermark"
8570 location="Voitsberg" region="Steiermark"
8572 location="Bärnbach" region="Steiermark"
8573 location="Kainach bei Voitsberg" region="Steiermark"
Expand Down Expand Up @@ -2318,6 +2320,7 @@
9102 location="Mittertrixen" region="Kärnten"
9102 location="Mittertrixen" region="Kärnten"
9103 location="Diex" region="Kärnten"
9103 location="Diex" region="Kärnten"
9111 location="Haimburg" region="Kärnten"
9112 location="Griffen" region="Kärnten"
9112 location="Griffen" region="Kärnten"
Expand Down Expand Up @@ -2523,6 +2526,7 @@
9871 location="Seeboden" region="Kärnten"
9872 location="Millstatt am See" region="Kärnten"
9873 location="Döbriach" region="Kärnten"
9873 location="Döbriach" region="Kärnten"
9900 location="Lienz" region="Tirol"
9903 location="Oberlienz" region="Tirol"
9904 location="Thurn" region="Tirol"
Expand Down
14 changes: 6 additions & 8 deletions stdnum/be/banks.dat
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# generated from current_codes.xls downloaded from
# https://www.nbb.be/doc/be/be/protocol/current_codes.xls
# version 01/07/2023
000-000 bic="BPOTBEB1" bank="bpost bank"
001-049 bic="GEBABEBB" bank="BNP Paribas Fortis"
# Version 22/01/2024
000-049 bic="GEBABEBB" bank="BNP Paribas Fortis"
050-099 bic="GKCCBEBB" bank="BELFIUS BANK"
100-100 bic="NBBEBEBB203" bank="Nationale Bank van België"
101-101 bic="NBBEBEBBHCC" bank="Nationale Bank van België (Hoofdkas)"
Expand All @@ -25,13 +24,11 @@
171-171 bic="CPHBBE75" bank="Banque CPH"
175-175 bank="Systèmes Technologiques d'Echange et de Traitement - STET"
176-176 bic="BSCHBEBBRET" bank="Santander Consumer Finance – Succursale en Belgique/Bijkantoor in België"
183-183 bic="BARBBEBB" bank="Bank of Baroda"
185-185 bic="BBRUBEBB" bank="ING België"
189-189 bic="SMBCBEBB" bank="Sumitomo Mitsui Banking Corporation (SMBC)"
190-199 bic="CREGBEBB" bank="CBC Banque et Assurances"
200-214 bic="GEBABEBB" bank="BNP Paribas Fortis"
220-298 bic="GEBABEBB" bank="BNP Paribas Fortis"
299-299 bic="BPOTBEB1" bank="bpost bank"
220-299 bic="GEBABEBB" bank="BNP Paribas Fortis"
300-399 bic="BBRUBEBB" bank="ING België"
400-499 bic="KREDBEBB" bank="KBC Bank"
500-500 bic="MTPSBEBB" bank="Moneytrans Payment Services"
Expand All @@ -50,7 +47,6 @@
523-523 bic="TRIOBEBB" bank="Triodos Bank"
524-524 bic="WAFABEBB" bank="Attijariwafa bank Europe"
525-525 bic="FVLBBE22" bank="F. van Lanschot Bankiers"
530-530 bic="SHIZBEBB" bank="Shizuoka Bank (Europe)"
538-538 bank="Hoist Finance AB"
541-541 bic="BKIDBE22" bank="BANK OF INDIA"
546-546 bic="WAFABEBB" bank="Attijariwafa bank Europe"
Expand Down Expand Up @@ -150,13 +146,15 @@
883-884 bic="BBRUBEBB" bank="ING België"
887-888 bic="BBRUBEBB" bank="ING België"
890-899 bic="VDSPBE91" bank="vdk bank"
905-905 bic="TRWIBEB1" bank="Wise Europe SA"
906-906 bic="CEKVBE88" bank="Centrale Kredietverlening (C.K.V.)"
907-907 bank="Mollie B.V."
908-908 bic="CEKVBE88" bank="Centrale Kredietverlening (C.K.V.)"
910-910 bic="BBRUBEBB" bank="ING België"
911-911 bic="TUNZBEB1" bank="Worldline Financial Solutions nv/SA"
913-913 bic="EPBFBEBB" bank="EPBF"
914-914 bic="FXBBBEBB" bank="FX4BIZ"
915-915 bic="OONXBEBB" bank="Oonex"
915-915 bic="OONXBEBB" bank="Equals Money Europe SA"
916-916 bic="GOCFBEB1" bank="GOLD COMMODITIES FOREX (G.C.F.)"
917-917 bank="Buy Way Personal Finance"
920-920 bic="BBRUBEBB" bank="ING België"
Expand Down
2 changes: 1 addition & 1 deletion stdnum/cn/loc.dat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated from National Bureau of Statistics of the People's
# Republic of China, downloaded from https://github.com/cn/GB2260
# 2023-08-20 10:20:58.056166
# 2024-03-17 17:15:26.034784
110101 county="东城区" prefecture="市辖区" province="北京市"
110102 county="西城区" prefecture="市辖区" province="北京市"
110103 county="崇文区" prefecture="市辖区" province="北京市"
Expand Down
10 changes: 5 additions & 5 deletions stdnum/gs1_128.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# gs1_128.py - functions for handling GS1-128 codes
#
# Copyright (C) 2019 Sergi Almacellas Abellana
# Copyright (C) 2020-2023 Arthur de Jong
# Copyright (C) 2020-2024 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -98,16 +98,16 @@ def _encode_value(fmt, _type, value):
digits = digits[:9]
return str(len(digits)) + (number + digits).rjust(length, '0')
elif _type == 'date':
if isinstance(value, (list, tuple)) and fmt == 'N6..12':
if isinstance(value, (list, tuple)) and fmt in ('N6..12', 'N6[+N6]'):
return '%s%s' % (
_encode_value('N6', _type, value[0]),
_encode_value('N6', _type, value[1]))
elif isinstance(value, datetime.date):
if fmt in ('N6', 'N6..12'):
if fmt in ('N6', 'N6..12', 'N6[+N6]'):
return value.strftime('%y%m%d')
elif fmt == 'N10':
return value.strftime('%y%m%d%H%M')
elif fmt in ('N6+N..4', 'N6[+N..4]'):
elif fmt in ('N6+N..4', 'N6[+N..4]', 'N6[+N4]'):
value = value.strftime('%y%m%d%H%M')
if value.endswith('00'):
value = value[:-2]
Expand Down Expand Up @@ -163,7 +163,7 @@ def _decode_value(fmt, _type, value):
return date.date()
else:
return datetime.datetime.strptime(value, '%y%m%d').date()
elif len(value) == 12 and fmt in ('N12', 'N6..12'):
elif len(value) == 12 and fmt in ('N12', 'N6..12', 'N6[+N6]'):
return (_decode_value('N6', _type, value[:6]), _decode_value('N6', _type, value[6:]))
else:
# other lengths are interpreted as variable-length datetime values
Expand Down
Loading

0 comments on commit b454d3a

Please sign in to comment.