COUNTRY_NAME_TO_ISO_NUMERIC = { "argentina": 32, "australia": 36, "belgium": 56, "brazil": 76, "bulgaria": 100, "canada": 124, "china": 156, "czech republic": 203, "denmark": 208, "finland": 246, "france": 250, "germany": 276, "hong kong": 344, "hungary": 348, "india": 356, "iran": 364, "ireland": 372, "italy": 380, "japan": 392, "luxembourg": 442, "netherlands": 528, "new zealand": 554, "norway": 578, "northern ireland": 826, "russia": 643, "soviet union": 643, "spain": 724, "south africa": 710, "south korea": 410, "korea, south": 410, "republic of korea": 410, "sweden": 752, "taiwan": 158, "thailand": 764, "united arab emirates": 784, "united kingdom": 826, "uk": 826, "great britain": 826, "england": 826, "scotland": 826, "united states": 840, "united states of america": 840, "usa": 840, } ISO_NUMERIC_TO_COUNTRY_NAME = { value: key.title() for key, value in COUNTRY_NAME_TO_ISO_NUMERIC.items() } ISO_NUMERIC_TO_COUNTRY_NAME[410] = "South Korea" ISO_NUMERIC_TO_COUNTRY_NAME[643] = "Russia" ISO_NUMERIC_TO_COUNTRY_NAME[826] = "United Kingdom" ISO_NUMERIC_TO_COUNTRY_NAME[840] = "United States of America" def split_country_names(value: str | None) -> list[str]: if not value: return [] normalized = value.replace(";", ",") return [item.strip() for item in normalized.split(",") if item.strip()] def country_name_to_iso_numeric(value: str | None) -> int | None: if not value: return None return COUNTRY_NAME_TO_ISO_NUMERIC.get(value.casefold().strip())