check for wrong or misspelled divisions added in database adjustment (parse_metadata)
@@ -618,10 +618,10 @@ def adjust_to_database(data): #TODO: temporary solution, needs reworking
continue
# location given, but with wrong division - adjust to correct division
- #if location in location_to_arrondissement and division != location_to_arrondissement[location]:
- #print("Wrong division " + bold(division) + " given for location " + bold(location))
- #print("Suggestion: add [" + "\t".join([region, country, division, location, region, country, location_to_arrondissement[location], location]) + "] to manual_adjustments.txt")
- #continue
+ if clean_string(location) in location_to_arrondissement and division != location_to_arrondissement[clean_string(location)]:
+ print("Wrong division " + bold(division) + " given for location " + bold(location))
+ print("Suggestion: add [" + "/".join([region, country, division, location]) + "\t" + "/".join([region, country, location_to_arrondissement[clean_string(location)], location]) + "] to manual_adjustments.txt")
+ continue
# location given, but with wrong spelling. Division is correct - adjust to correct location
if location in variants and clean_string(variants[location]) in location_to_arrondissement and division == location_to_arrondissement[clean_string(variants[location])]:
@@ -630,10 +630,10 @@ def adjust_to_database(data): #TODO: temporary solution, needs reworking
continue
# location given, but with wrong spelling. Division false - adjust both location and division
- #if location in variants and variants[location] in location_to_arrondissement and division != location_to_arrondissement[variants[location]]:
- #print("Location " + bold(location) + " should be adjusted to " + bold(variants[location]) + ". Wrong division " + bold(division) + " given for location " + bold(variants[location]))
- #print("Suggestion: add [" + "\t".join( [region, country, division, location, region, country, location_to_arrondissement[variants[location]], variants[location]]) + "] to manual_adjustments.txt")
- #continue
+ if location in variants and clean_string(variants[location]) in location_to_arrondissement and division != location_to_arrondissement[clean_string(variants[location])]:
+ print("Location " + bold(location) + " should be adjusted to " + bold(variants[location]) + ". Wrong division " + bold(division) + " given for location " + bold(variants[location]))
+ print("Suggestion: add [" + "/".join([region, country, division, location]) + "\t" + "/".join([region, country, location_to_arrondissement[clean_string(variants[location])], variants[location]]) + "] to manual_adjustments.txt")
+ continue
### location empty
