Spaces:
Running
Running
Commit
·
8c163ee
1
Parent(s):
5beaded
Now don't have to have join column in reference df. Can remove input files without error message.
Browse files- tools/helper_functions.py +3 -0
- tools/matcher_funcs.py +4 -2
- tools/preparation.py +1 -1
tools/helper_functions.py
CHANGED
@@ -50,6 +50,9 @@ def initial_data_load(in_file):
|
|
50 |
output_message = ""
|
51 |
results_df = pd.DataFrame()
|
52 |
df = pd.DataFrame()
|
|
|
|
|
|
|
53 |
|
54 |
file_list = [string.name for string in in_file]
|
55 |
|
|
|
50 |
output_message = ""
|
51 |
results_df = pd.DataFrame()
|
52 |
df = pd.DataFrame()
|
53 |
+
|
54 |
+
if not in_file:
|
55 |
+
return "No files provided.", gr.Dropdown(choices=[]), gr.Dropdown(choices=[]), df, results_df
|
56 |
|
57 |
file_list = [string.name for string in in_file]
|
58 |
|
tools/matcher_funcs.py
CHANGED
@@ -355,10 +355,12 @@ def query_addressbase_api(in_api_key:str, Matcher:MatcherClass, query_type:str,
|
|
355 |
# Matcher.ref_df = Matcher.ref_df.loc[Matcher.ref_df["LOCAL_CUSTODIAN_CODE"] != 7655,:]
|
356 |
|
357 |
if save_file:
|
358 |
-
|
|
|
359 |
print("Saving reference file to: " + api_ref_save_loc[:-5] + ".parquet")
|
360 |
Matcher.ref_df.to_parquet(output_folder + api_ref_save_loc + ".parquet", index=False) # Save checkpoint as well
|
361 |
-
Matcher.ref_df.to_parquet(
|
|
|
362 |
|
363 |
if Matcher.ref_df.empty:
|
364 |
print ("No reference data found with API")
|
|
|
355 |
# Matcher.ref_df = Matcher.ref_df.loc[Matcher.ref_df["LOCAL_CUSTODIAN_CODE"] != 7655,:]
|
356 |
|
357 |
if save_file:
|
358 |
+
final_api_output_file_name_pq = output_folder + api_ref_save_loc[:-5] + ".parquet"
|
359 |
+
final_api_output_file_name = output_folder + api_ref_save_loc[:-5] + ".csv"
|
360 |
print("Saving reference file to: " + api_ref_save_loc[:-5] + ".parquet")
|
361 |
Matcher.ref_df.to_parquet(output_folder + api_ref_save_loc + ".parquet", index=False) # Save checkpoint as well
|
362 |
+
Matcher.ref_df.to_parquet(final_api_output_file_name_pq, index=False)
|
363 |
+
Matcher.ref_df.to_csv(final_api_output_file_name)
|
364 |
|
365 |
if Matcher.ref_df.empty:
|
366 |
print ("No reference data found with API")
|
tools/preparation.py
CHANGED
@@ -162,7 +162,7 @@ def create_full_address(df):
|
|
162 |
|
163 |
return df["full_address"]
|
164 |
|
165 |
-
def prepare_ref_address(ref_df, ref_address_cols, new_join_col = [
|
166 |
|
167 |
if ('SaoText' in ref_df.columns) | ("Secondary_Name_LPI" in ref_df.columns): standard_cols = True
|
168 |
else: standard_cols = False
|
|
|
162 |
|
163 |
return df["full_address"]
|
164 |
|
165 |
+
def prepare_ref_address(ref_df, ref_address_cols, new_join_col = [], standard_cols = True):
|
166 |
|
167 |
if ('SaoText' in ref_df.columns) | ("Secondary_Name_LPI" in ref_df.columns): standard_cols = True
|
168 |
else: standard_cols = False
|