Skip to content

Commit 3bc3100

Browse files
committed
fix volgistic address rollback
1 parent 5b29fbb commit 3bc3100

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/server/datasource_manager.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ def __clean_csv_headers(header):
7070
}
7171

7272

73-
def volgistics_address(index, street):
73+
def volgistics_address(street, index):
7474
result = ""
7575

76-
for item in street:
77-
if isinstance(item, str):
78-
if " " in item:
79-
result = item.split()[index]
76+
if isinstance(street, str):
77+
if " " in street:
78+
if index == 1:
79+
result = " ".join(street.split()[1:])
80+
else:
81+
result = street.split()[index]
8082

8183
return result
8284

@@ -142,8 +144,8 @@ def normalize_phone_number(number):
142144
"last_name": "last_name",
143145
"email": "email",
144146
"mobile": lambda df: df["cell"].combine_first(df["home"]).apply(normalize_phone_number),
145-
"street_and_number": lambda df: volgistics_address(1, df["street_1"]),
146-
"apartment": lambda df: volgistics_address(0, df["street_1"]),
147+
"street_and_number": lambda df: df["street_1"].apply(volgistics_address, index=1),
148+
"apartment": lambda df: df["street_1"].apply(volgistics_address, index=0),
147149
"city": "city",
148150
"state": "state",
149151
"zip": "zip",

0 commit comments

Comments
 (0)