Skip to content

Commit a84643d

Browse files
committed
Fix Document issue for UK
Add None and "" checking on ingest_ns_document
1 parent 949e4cd commit a84643d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

api/management/commands/ingest_ns_document.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ def handle_error(self, response):
5858
def extract_country_data(self, data):
5959
country_list = []
6060
for country_data in data:
61+
if not country_data["Don_Code"] or not country_data["CON_country"]:
62+
continue
6163
country_code = [country_data["Don_Code"].strip(), country_data["CON_country"]]
6264
country_list.append(country_code)
6365

6466
country_table = pd.DataFrame(country_list, columns=["Country Code", "Country"]).drop_duplicates(
6567
subset=["Country Code"], keep="last"
6668
)
67-
country_table = country_table.replace(to_replace="None", value=np.nan).dropna()
69+
country_table = country_table.replace(to_replace=["None", ""], value=np.nan).dropna()
6870
return country_table
6971

7072
def fetch_country_documents(self, api_key, country_ns_code):

0 commit comments

Comments
 (0)