feat: update extractIsoCode function to include additional ISO3166 levels for improved region matching

This commit is contained in:
Sean Morley
2026-01-04 15:32:29 -05:00
parent 8cff832621
commit db89c4e2b7

View File

@@ -159,6 +159,9 @@ def extractIsoCode(user, data):
# France gets lvl4 (regions) first for city matching, then lvl6 (departments) as a fallback.
preferred_iso_keys = (
[
"ISO3166-2-lvl10",
"ISO3166-2-lvl9",
"ISO3166-2-lvl8",
"ISO3166-2-lvl4",
"ISO3166-2-lvl6",
"ISO3166-2-lvl7",
@@ -170,10 +173,13 @@ def extractIsoCode(user, data):
]
if country_code == "FR"
else [
"ISO3166-2-lvl10",
"ISO3166-2-lvl9",
"ISO3166-2-lvl8",
"ISO3166-2-lvl4",
"ISO3166-2-lvl7",
"ISO3166-2-lvl6",
"ISO3166-2-lvl5",
"ISO3166-2-lvl4",
"ISO3166-2-lvl3",
"ISO3166-2-lvl2",
"ISO3166-2-lvl1",