add check for missing country before checking for missing divisions and locations
@@ -543,6 +543,9 @@ def check_for_missing(data):
name0 = check_similar(ordering["division"], division)
if division not in ordering["division"] and division in lat_longs["division"]:
s = s + " (only missing in ordering => auto-added to color_ordering.tsv)"
+ if country not in data_clean[region]:
+ print("Conflict: division " + division + " should be added to color_ordering.tsv, but country " + country + " is missing from dataset")
+ else:
data_clean[region][country][division] = []
else: #only check for additional hints like "similar name" or "present as location" if not auto-added to color_ordering
if name0 != "":
@@ -559,7 +562,7 @@ def check_for_missing(data):
else:
if country not in data_clean[region]:
- print("WARNING: country "+country+" seems to be missing. Possibly also division "+division+"\n")
+ print("Conflict: division " + division + " should be added to color_ordering.tsv, but country " + country + " is missing from dataset")
else:
data_clean[region][country][division] = []
@@ -572,6 +575,9 @@ def check_for_missing(data):
name0 = check_similar(ordering["location"], location)
if location not in ordering["location"] and location in lat_longs["location"]:
s = s + " (only missing in ordering => auto-added to color_ordering.tsv)"
+ if country not in data_clean[region]:
+ print("Conflict: location " + location + " should be added to color_ordering.tsv, but country " + country + " is missing from dataset")
+ else:
if division not in data_clean[region][country]:
if not any(x in location for x in cruise_abbrev) and not any(x in division for x in cruise_abbrev):
print("Conflict: location " + location + " should be added to color_ordering.tsv, but division " + division + " is missing from dataset")
@@ -600,6 +606,9 @@ def check_for_missing(data):
else:
print("Cruise-associated location ignored ("+location+")")
+ else:
+ if country not in data_clean[region]:
+ print("Conflict: location " + location + " should be added to color_ordering.tsv, but country " + country + " is missing from dataset")
else:
if division not in data_clean[region][country]:
if not any(x in location for x in cruise_abbrev) and not any(x in division for x in cruise_abbrev):
