diff --git a/lib/location/subdivision.ex b/lib/location/subdivision.ex index 0a35597..a7803b1 100644 --- a/lib/location/subdivision.ex +++ b/lib/location/subdivision.ex @@ -16,6 +16,13 @@ defmodule Location.Subdivision do :ets.insert(ets, {entry["code"], to_struct(entry)}) end) + File.read!(restore_source_file()) + |> Jason.decode!() + |> Enum.each(fn entry -> + entry = translate_entry(translations, entry) + :ets.insert(ets, {entry["code"], to_struct(entry)}) + end) + File.read!(override_source_file()) |> Jason.decode!() |> Enum.each(fn entry -> @@ -72,6 +79,10 @@ defmodule Location.Subdivision do Application.app_dir(:location, "priv/iso_3166-2.json") end + defp restore_source_file() do + Application.app_dir(:location, "priv/restore/iso_3166-2.json") + end + defp translations_file() do Application.app_dir(:location, "priv/iso_3166-2.en-translations.json") end diff --git a/mix_tasks/update_iso_data.ex b/mix_tasks/update_iso_data.ex index babbb0a..7657fb1 100644 --- a/mix_tasks/update_iso_data.ex +++ b/mix_tasks/update_iso_data.ex @@ -12,10 +12,47 @@ defmodule Mix.Tasks.UpdateIsoData do %HTTPoison.Response{status_code: 200, body: countries} = HTTPoison.get!(@countries_src) File.write!(@countries_dest, countries) - %HTTPoison.Response{status_code: 200, body: subdivisions} = HTTPoison.get!(@subdivisions_src) - %{"3166-2" => subdivisions} = Jason.decode!(subdivisions) - subdivisions = Enum.map(fn subdivision -> Map.delete(subdivision, "parent") end) - subdivisions = Jason.encode_to_iodata!(%{"3166-2" => subdivisions}) - File.write!(@subdivisions_dest, subdivisions) + %HTTPoison.Response{status_code: 200, body: new_subdivisions} = + HTTPoison.get!(@subdivisions_src) + + %{"3166-2" => new_subdivisions} = Jason.decode!(new_subdivisions) + + new_subdivisions = + Enum.map(new_subdivisions, fn subdivision -> Map.delete(subdivision, "parent") end) + + new_subdivisions_codes = MapSet.new(new_subdivisions, fn %{"code" => code} -> code end) + + # ensures no codes are deleted + # if a code no longer exists in new subdivisions, we put it in restore folder + restored_subdivisions_path = Application.app_dir(:location, "/priv/restore/iso_3166-2.json") + + new_restored_subdivisions = + if File.exists?(@subdivisions_dest) do + File.read!(@subdivisions_dest) + |> Jason.decode!() + |> Map.fetch!("3166-2") + |> Enum.reject(fn %{"code" => code} -> MapSet.member?(new_subdivisions_codes, code) end) + end + + prev_restored_subdivisions = + if File.exists?(restored_subdivisions_path) do + Jason.decode!(File.read!(restored_subdivisions_path)) + end + + restored_subdivisions = + (new_restored_subdivisions || []) ++ (prev_restored_subdivisions || []) + + restored_subdivisions = + restored_subdivisions + |> Enum.uniq_by(fn %{"code" => code} -> code end) + |> Enum.sort_by(fn %{"code" => code} -> code end) + + File.write!( + restored_subdivisions_path, + Jason.encode_to_iodata!(restored_subdivisions, pretty: true) + ) + + new_subdivisions = Jason.encode_to_iodata!(%{"3166-2" => new_subdivisions}, pretty: true) + File.write!(@subdivisions_dest, new_subdivisions) end end diff --git a/priv/iso_3166-1.json b/priv/iso_3166-1.json index 7ec1b0f..ee48a43 100644 --- a/priv/iso_3166-1.json +++ b/priv/iso_3166-1.json @@ -821,6 +821,7 @@ { "alpha_2": "IR", "alpha_3": "IRN", + "common_name": "Iran", "flag": "🇮🇷", "name": "Iran, Islamic Republic of", "numeric": "364", @@ -953,6 +954,7 @@ { "alpha_2": "LA", "alpha_3": "LAO", + "common_name": "Laos", "flag": "🇱🇦", "name": "Lao People's Democratic Republic", "numeric": "418" @@ -1653,6 +1655,7 @@ { "alpha_2": "SY", "alpha_3": "SYR", + "common_name": "Syria", "flag": "🇸🇾", "name": "Syrian Arab Republic", "numeric": "760" @@ -1746,9 +1749,9 @@ "alpha_2": "TR", "alpha_3": "TUR", "flag": "🇹🇷", - "name": "Turkey", + "name": "Türkiye", "numeric": "792", - "official_name": "Republic of Turkey" + "official_name": "Republic of Türkiye" }, { "alpha_2": "TV", diff --git a/priv/iso_3166-2.json b/priv/iso_3166-2.json index 0d3443c..bdd2ac7 100644 --- a/priv/iso_3166-2.json +++ b/priv/iso_3166-2.json @@ -1512,7 +1512,7 @@ }, { "code": "BE-BRU", - "name": "Brussels Hoofdstedelijk Gewest", + "name": "Bruxelles-Capitale, Région de", "type": "Region" }, { @@ -3032,7 +3032,7 @@ }, { "code": "CF-KG", - "name": "Kemö-Gïrïbïngï", + "name": "Kémo-Gribingui", "type": "Prefecture" }, { @@ -3152,7 +3152,7 @@ }, { "code": "CH-BE", - "name": "Bern", + "name": "Berne", "type": "Canton" }, { @@ -3167,7 +3167,7 @@ }, { "code": "CH-FR", - "name": "Freiburg", + "name": "Fribourg", "type": "Canton" }, { @@ -3572,7 +3572,7 @@ }, { "code": "CN-NX", - "name": "Ningxia Huizi Zizhiqu", + "name": "Ningxia Huizu Zizhiqu", "type": "Autonomous region" }, { @@ -4617,7 +4617,7 @@ }, { "code": "DJ-OB", - "name": "Awbūk", + "name": "Obock", "type": "Region" }, { @@ -5150,6 +5150,56 @@ "name": "Relizane", "type": "Province" }, + { + "code": "DZ-49", + "name": "Timimoun", + "type": "Province" + }, + { + "code": "DZ-50", + "name": "Bordj Badji Mokhtar", + "type": "Province" + }, + { + "code": "DZ-51", + "name": "Ouled Djellal", + "type": "Province" + }, + { + "code": "DZ-52", + "name": "Béni Abbès", + "type": "Province" + }, + { + "code": "DZ-53", + "name": "In Salah", + "type": "Province" + }, + { + "code": "DZ-54", + "name": "In Guezzam", + "type": "Province" + }, + { + "code": "DZ-55", + "name": "Touggourt", + "type": "Province" + }, + { + "code": "DZ-56", + "name": "Djanet", + "type": "Province" + }, + { + "code": "DZ-57", + "name": "El Meghaier", + "type": "Province" + }, + { + "code": "DZ-58", + "name": "El Meniaa", + "type": "Province" + }, { "code": "EC-A", "name": "Azuay", @@ -6290,6 +6340,11 @@ "name": "Oromia", "type": "Regional state" }, + { + "code": "ET-SI", + "name": "Sidama", + "type": "Regional state" + }, { "code": "ET-SN", "name": "Southern Nations, Nationalities and Peoples", @@ -6300,6 +6355,11 @@ "name": "Somali", "type": "Regional state" }, + { + "code": "ET-SW", + "name": "Southwest Ethiopia Peoples", + "type": "Regional state" + }, { "code": "ET-TI", "name": "Tigrai", @@ -6307,7 +6367,7 @@ }, { "code": "FI-01", - "name": "Ahvenanmaan maakunta", + "name": "Landskapet Åland", "type": "Region" }, { @@ -6332,7 +6392,7 @@ }, { "code": "FI-06", - "name": "Egentliga Tavastland", + "name": "Kanta-Häme", "type": "Region" }, { @@ -6357,7 +6417,7 @@ }, { "code": "FI-11", - "name": "Birkaland", + "name": "Pirkanmaa", "type": "Region" }, { @@ -6367,37 +6427,37 @@ }, { "code": "FI-13", - "name": "Norra Karelen", + "name": "Pohjois-Karjala", "type": "Region" }, { "code": "FI-14", - "name": "Norra Österbotten", + "name": "Pohjois-Pohjanmaa", "type": "Region" }, { "code": "FI-15", - "name": "Norra Savolax", + "name": "Pohjois-Savo", "type": "Region" }, { "code": "FI-16", - "name": "Päijänne-Tavastland", + "name": "Päijät-Häme", "type": "Region" }, { "code": "FI-17", - "name": "Satakunda", + "name": "Satakunta", "type": "Region" }, { "code": "FI-18", - "name": "Nyland", + "name": "Uusimaa", "type": "Region" }, { "code": "FI-19", - "name": "Egentliga Finland", + "name": "Varsinais-Suomi", "type": "Region" }, { @@ -6870,6 +6930,16 @@ "name": "Rhône", "type": "Metropolitan department" }, + { + "code": "FR-69M", + "name": "Métropole de Lyon", + "type": "Metropolitan collectivity with special status" + }, + { + "code": "FR-6AE", + "name": "Alsace", + "type": "European collectivity" + }, { "code": "FR-70", "name": "Haute-Saône", @@ -6896,9 +6966,9 @@ "type": "Metropolitan department" }, { - "code": "FR-75", + "code": "FR-75C", "name": "Paris", - "type": "Metropolitan department" + "type": "Metropolitan collectivity with special status" }, { "code": "FR-76", @@ -7003,27 +7073,27 @@ { "code": "FR-971", "name": "Guadeloupe", - "type": "Overseas department" + "type": "Overseas departmental collectivity" }, { "code": "FR-972", "name": "Martinique", - "type": "Overseas department" + "type": "Overseas unique territorial collectivity" }, { "code": "FR-973", "name": "Guyane (française)", - "type": "Overseas department" + "type": "Overseas unique territorial collectivity" }, { "code": "FR-974", "name": "La Réunion", - "type": "Overseas department" + "type": "Overseas departmental collectivity" }, { "code": "FR-976", "name": "Mayotte", - "type": "Overseas department" + "type": "Overseas departmental collectivity" }, { "code": "FR-ARA", @@ -7060,16 +7130,6 @@ "name": "Grand-Est", "type": "Metropolitan region" }, - { - "code": "FR-GF", - "name": "Guyane (française)", - "type": "Overseas region" - }, - { - "code": "FR-GP", - "name": "Guadeloupe", - "type": "Overseas region" - }, { "code": "FR-HDF", "name": "Hauts-de-France", @@ -7085,11 +7145,6 @@ "name": "Saint-Martin", "type": "Overseas collectivity" }, - { - "code": "FR-MQ", - "name": "Martinique", - "type": "Overseas region" - }, { "code": "FR-NAQ", "name": "Nouvelle-Aquitaine", @@ -7130,11 +7185,6 @@ "name": "Saint-Pierre-et-Miquelon", "type": "Overseas collectivity" }, - { - "code": "FR-RE", - "name": "La Réunion", - "type": "Overseas region" - }, { "code": "FR-TF", "name": "Terres australes françaises", @@ -7145,11 +7195,6 @@ "name": "Wallis-et-Futuna", "type": "Overseas collectivity" }, - { - "code": "FR-YT", - "name": "Mayotte", - "type": "Overseas region" - }, { "code": "GA-1", "name": "Estuaire", @@ -7293,7 +7338,7 @@ { "code": "GB-BKM", "name": "Buckinghamshire", - "type": "Two-tier county" + "type": "Unitary authority" }, { "code": "GB-BNE", @@ -7525,6 +7570,11 @@ "name": "Enfield", "type": "London borough" }, + { + "code": "GB-ENG", + "name": "England", + "type": "Country" + }, { "code": "GB-ERW", "name": "East Renfrewshire", @@ -7845,6 +7895,11 @@ "name": "Nottingham", "type": "Unitary authority" }, + { + "code": "GB-NIR", + "name": "Northern Ireland", + "type": "Province" + }, { "code": "GB-NLK", "name": "North Lanarkshire", @@ -7861,14 +7916,14 @@ "type": "District" }, { - "code": "GB-NSM", - "name": "North Somerset", + "code": "GB-NNH", + "name": "North Northamptonshire", "type": "Unitary authority" }, { - "code": "GB-NTH", - "name": "Northamptonshire", - "type": "Two-tier county" + "code": "GB-NSM", + "name": "North Somerset", + "type": "Unitary authority" }, { "code": "GB-NTL", @@ -8005,6 +8060,11 @@ "name": "Scottish Borders", "type": "Council area" }, + { + "code": "GB-SCT", + "name": "Scotland", + "type": "Country" + }, { "code": "GB-SFK", "name": "Suffolk", @@ -8215,6 +8275,11 @@ "name": "West Lothian", "type": "Council area" }, + { + "code": "GB-WLS", + "name": "Wales [Cymru GB-CYM]", + "type": "Country" + }, { "code": "GB-WLV", "name": "Wolverhampton", @@ -8225,6 +8290,11 @@ "name": "Wandsworth", "type": "London borough" }, + { + "code": "GB-WNH", + "name": "West Northamptonshire", + "type": "Unitary authority" + }, { "code": "GB-WNM", "name": "Windsor and Maidenhead", @@ -8727,7 +8797,7 @@ }, { "code": "GQ-C", - "name": "Região Continental", + "name": "Région Continentale", "type": "Region" }, { @@ -8742,7 +8812,7 @@ }, { "code": "GQ-I", - "name": "Região Insular", + "name": "Région Insulaire", "type": "Region" }, { @@ -8752,7 +8822,7 @@ }, { "code": "GQ-LI", - "name": "Litoral", + "name": "Littoral", "type": "Province" }, { @@ -8831,113 +8901,113 @@ "type": "Administrative region" }, { - "code": "GT-AV", - "name": "Alta Verapaz", + "code": "GT-01", + "name": "Guatemala", "type": "Department" }, { - "code": "GT-BV", - "name": "Baja Verapaz", + "code": "GT-02", + "name": "El Progreso", "type": "Department" }, { - "code": "GT-CM", - "name": "Chimaltenango", + "code": "GT-03", + "name": "Sacatepéquez", "type": "Department" }, { - "code": "GT-CQ", - "name": "Chiquimula", + "code": "GT-04", + "name": "Chimaltenango", "type": "Department" }, { - "code": "GT-ES", + "code": "GT-05", "name": "Escuintla", "type": "Department" }, { - "code": "GT-GU", - "name": "Guatemala", + "code": "GT-06", + "name": "Santa Rosa", "type": "Department" }, { - "code": "GT-HU", - "name": "Huehuetenango", + "code": "GT-07", + "name": "Sololá", "type": "Department" }, { - "code": "GT-IZ", - "name": "Izabal", + "code": "GT-08", + "name": "Totonicapán", "type": "Department" }, { - "code": "GT-JA", - "name": "Jalapa", + "code": "GT-09", + "name": "Quetzaltenango", "type": "Department" }, { - "code": "GT-JU", - "name": "Jutiapa", + "code": "GT-10", + "name": "Suchitepéquez", "type": "Department" }, { - "code": "GT-PE", - "name": "Petén", + "code": "GT-11", + "name": "Retalhuleu", "type": "Department" }, { - "code": "GT-PR", - "name": "El Progreso", + "code": "GT-12", + "name": "San Marcos", "type": "Department" }, { - "code": "GT-QC", - "name": "Quiché", + "code": "GT-13", + "name": "Huehuetenango", "type": "Department" }, { - "code": "GT-QZ", - "name": "Quetzaltenango", + "code": "GT-14", + "name": "Quiché", "type": "Department" }, { - "code": "GT-RE", - "name": "Retalhuleu", + "code": "GT-15", + "name": "Baja Verapaz", "type": "Department" }, { - "code": "GT-SA", - "name": "Sacatepéquez", + "code": "GT-16", + "name": "Alta Verapaz", "type": "Department" }, { - "code": "GT-SM", - "name": "San Marcos", + "code": "GT-17", + "name": "Petén", "type": "Department" }, { - "code": "GT-SO", - "name": "Sololá", + "code": "GT-18", + "name": "Izabal", "type": "Department" }, { - "code": "GT-SR", - "name": "Santa Rosa", + "code": "GT-19", + "name": "Zacapa", "type": "Department" }, { - "code": "GT-SU", - "name": "Suchitepéquez", + "code": "GT-20", + "name": "Chiquimula", "type": "Department" }, { - "code": "GT-TO", - "name": "Totonicapán", + "code": "GT-21", + "name": "Jalapa", "type": "Department" }, { - "code": "GT-ZA", - "name": "Zacapa", + "code": "GT-22", + "name": "Jutiapa", "type": "Department" }, { @@ -9257,7 +9327,7 @@ }, { "code": "HT-GA", - "name": "Grandans", + "name": "Grande’Anse", "type": "Department" }, { @@ -9272,7 +9342,7 @@ }, { "code": "HT-NI", - "name": "Nip", + "name": "Nippes", "type": "Department" }, { @@ -9282,17 +9352,17 @@ }, { "code": "HT-OU", - "name": "Lwès", + "name": "Ouest", "type": "Department" }, { "code": "HT-SD", - "name": "Sid", + "name": "Sud", "type": "Department" }, { "code": "HT-SE", - "name": "Sidès", + "name": "Sud-Est", "type": "Department" }, { @@ -9327,7 +9397,7 @@ }, { "code": "HU-CS", - "name": "Csongrád", + "name": "Csongrád-Csanád", "type": "County" }, { @@ -9650,11 +9720,31 @@ "name": "Papua Barat", "type": "Province" }, + { + "code": "ID-PD", + "name": "Papua Barat Daya", + "type": "Province" + }, + { + "code": "ID-PE", + "name": "Papua Pengunungan", + "type": "Province" + }, { "code": "ID-PP", "name": "Papua", "type": "Geographical unit" }, + { + "code": "ID-PS", + "name": "Papua Selatan", + "type": "Province" + }, + { + "code": "ID-PT", + "name": "Papua Tengah", + "type": "Province" + }, { "code": "ID-RI", "name": "Riau", @@ -9920,16 +10010,16 @@ "name": "Bihār", "type": "State" }, + { + "code": "IN-CG", + "name": "Chhattīsgarh", + "type": "State" + }, { "code": "IN-CH", "name": "Chandīgarh", "type": "Union territory" }, - { - "code": "IN-CT", - "name": "Chhattīsgarh", - "type": "State" - }, { "code": "IN-DH", "name": "Dādra and Nagar Haveli and Damān and Diu", @@ -10021,7 +10111,7 @@ "type": "State" }, { - "code": "IN-OR", + "code": "IN-OD", "name": "Odisha", "type": "State" }, @@ -10045,11 +10135,6 @@ "name": "Sikkim", "type": "State" }, - { - "code": "IN-TG", - "name": "Telangāna", - "type": "State" - }, { "code": "IN-TN", "name": "Tamil Nādu", @@ -10061,15 +10146,20 @@ "type": "State" }, { - "code": "IN-UP", - "name": "Uttar Pradesh", + "code": "IN-TS", + "name": "Telangāna", "type": "State" }, { - "code": "IN-UT", + "code": "IN-UK", "name": "Uttarākhand", "type": "State" }, + { + "code": "IN-UP", + "name": "Uttar Pradesh", + "type": "State" + }, { "code": "IN-WB", "name": "West Bengal", @@ -10125,6 +10215,11 @@ "name": "Kirkūk", "type": "Governorate" }, + { + "code": "IQ-KR", + "name": "Herêm-î Kurdistan", + "type": "Region" + }, { "code": "IQ-MA", "name": "Maysān", @@ -10360,11 +10455,6 @@ "name": "Suðurland", "type": "Region" }, - { - "code": "IS-AKH", - "name": "Akrahreppur", - "type": "Municipality" - }, { "code": "IS-AKN", "name": "Akraneskaupstaður", @@ -10385,21 +10475,11 @@ "name": "Ásahreppur", "type": "Municipality" }, - { - "code": "IS-BFJ", - "name": "Borgarfjarðarhreppur", - "type": "Municipality" - }, { "code": "IS-BLA", "name": "Bláskógabyggð", "type": "Municipality" }, - { - "code": "IS-BLO", - "name": "Blönduósbær", - "type": "Municipality" - }, { "code": "IS-BOG", "name": "Borgarbyggð", @@ -10420,11 +10500,6 @@ "name": "Dalvíkurbyggð", "type": "Municipality" }, - { - "code": "IS-DJU", - "name": "Djúpavogshreppur", - "type": "Municipality" - }, { "code": "IS-EOM", "name": "Eyja- og Miklaholtshreppur", @@ -10450,11 +10525,6 @@ "name": "Flóahreppur", "type": "Municipality" }, - { - "code": "IS-FLD", - "name": "Fljótsdalshérað", - "type": "Municipality" - }, { "code": "IS-FLR", "name": "Fljótsdalshreppur", @@ -10490,11 +10560,6 @@ "name": "Hafnarfjarðarkaupstaður", "type": "Municipality" }, - { - "code": "IS-HEL", - "name": "Helgafellssveit", - "type": "Municipality" - }, { "code": "IS-HRG", "name": "Hörgársveit", @@ -10506,8 +10571,8 @@ "type": "Municipality" }, { - "code": "IS-HUT", - "name": "Húnavatnshreppur", + "code": "IS-HUG", + "name": "Húnabyggð", "type": "Municipality" }, { @@ -10555,6 +10620,11 @@ "name": "Mosfellsbær", "type": "Municipality" }, + { + "code": "IS-MUL", + "name": "Múlaþing", + "type": "Municipality" + }, { "code": "IS-MYR", "name": "Mýrdalshreppur", @@ -10590,11 +10660,6 @@ "name": "Reykjavíkurborg", "type": "Municipality" }, - { - "code": "IS-SBH", - "name": "Svalbarðshreppur", - "type": "Municipality" - }, { "code": "IS-SBT", "name": "Svalbarðsstrandarhreppur", @@ -10615,11 +10680,6 @@ "name": "Seltjarnarnesbær", "type": "Municipality" }, - { - "code": "IS-SEY", - "name": "Seyðisfjarðarkaupstaður", - "type": "Municipality" - }, { "code": "IS-SFA", "name": "Sveitarfélagið Árborg", @@ -10646,8 +10706,8 @@ "type": "Municipality" }, { - "code": "IS-SKU", - "name": "Skútustaðahreppur", + "code": "IS-SKR", + "name": "Skagafjörður", "type": "Municipality" }, { @@ -10665,11 +10725,6 @@ "name": "Sveitarfélagið Ölfus", "type": "Municipality" }, - { - "code": "IS-SSF", - "name": "Sveitarfélagið Skagafjörður", - "type": "Municipality" - }, { "code": "IS-SSS", "name": "Sveitarfélagið Skagaströnd", @@ -12137,12 +12192,12 @@ }, { "code": "KM-A", - "name": "Andjouân", + "name": "Anjouan", "type": "Island" }, { "code": "KM-G", - "name": "Andjazîdja", + "name": "Grande Comore", "type": "Island" }, { @@ -12290,6 +12345,11 @@ "name": "Nampho", "type": "Metropolitan city" }, + { + "code": "KP-15", + "name": "Kaeseong", + "type": "Metropolitan city" + }, { "code": "KR-11", "name": "Seoul-teukbyeolsi", @@ -12332,8 +12392,8 @@ }, { "code": "KR-42", - "name": "Gangwon-do", - "type": "Province" + "name": "Gangwon-teukbyeoljachido", + "type": "Special self-governing province" }, { "code": "KR-43", @@ -12406,89 +12466,104 @@ "type": "Governorate" }, { - "code": "KZ-AKM", + "code": "KZ-10", + "name": "Abajskaja oblast’", + "type": "Region" + }, + { + "code": "KZ-11", "name": "Akmolinskaja oblast'", "type": "Region" }, { - "code": "KZ-AKT", + "code": "KZ-15", "name": "Aktjubinskaja oblast'", "type": "Region" }, { - "code": "KZ-ALA", - "name": "Almaty", - "type": "City" + "code": "KZ-19", + "name": "Almatinskaja oblast'", + "type": "Region" }, { - "code": "KZ-ALM", - "name": "Almatinskaja oblast'", + "code": "KZ-23", + "name": "Atyrauskaja oblast'", "type": "Region" }, { - "code": "KZ-AST", - "name": "Nur-Sultan", - "type": "City" + "code": "KZ-27", + "name": "Batys Qazaqstan oblysy", + "type": "Region" }, { - "code": "KZ-ATY", - "name": "Atyrauskaja oblast'", + "code": "KZ-31", + "name": "Zhambyl oblysy", "type": "Region" }, { - "code": "KZ-KAR", + "code": "KZ-33", + "name": "Zhetisū oblysy", + "type": "Region" + }, + { + "code": "KZ-35", "name": "Karagandinskaja oblast'", "type": "Region" }, { - "code": "KZ-KUS", + "code": "KZ-39", "name": "Kostanajskaja oblast'", "type": "Region" }, { - "code": "KZ-KZY", + "code": "KZ-43", "name": "Kyzylordinskaja oblast'", "type": "Region" }, { - "code": "KZ-MAN", + "code": "KZ-47", "name": "Mangghystaū oblysy", "type": "Region" }, { - "code": "KZ-PAV", + "code": "KZ-55", "name": "Pavlodar oblysy", "type": "Region" }, { - "code": "KZ-SEV", + "code": "KZ-59", "name": "Severo-Kazahstanskaja oblast'", "type": "Region" }, { - "code": "KZ-SHY", - "name": "Shymkent", - "type": "City" + "code": "KZ-61", + "name": "Turkestankaya oblast'", + "type": "Region" }, { - "code": "KZ-VOS", - "name": "Shyghys Qazaqstan oblysy", + "code": "KZ-62", + "name": "Ulytauskaja oblast’", "type": "Region" }, { - "code": "KZ-YUZ", - "name": "Turkestankaya oblast'", + "code": "KZ-63", + "name": "Shyghys Qazaqstan oblysy", "type": "Region" }, { - "code": "KZ-ZAP", - "name": "Batys Qazaqstan oblysy", - "type": "Region" + "code": "KZ-71", + "name": "Astana", + "type": "City" }, { - "code": "KZ-ZHA", - "name": "Zhambyl oblysy", - "type": "Region" + "code": "KZ-75", + "name": "Almaty", + "type": "City" + }, + { + "code": "KZ-79", + "name": "Shymkent", + "type": "City" }, { "code": "LA-AT", @@ -13042,7 +13117,7 @@ }, { "code": "LT-05", - "name": "Birštono", + "name": "Birštonas", "type": "Municipality" }, { @@ -13087,7 +13162,7 @@ }, { "code": "LT-14", - "name": "Kalvarijos", + "name": "Kalvarija", "type": "Municipality" }, { @@ -13212,7 +13287,7 @@ }, { "code": "LT-39", - "name": "Rietavo", + "name": "Rietavas", "type": "Municipality" }, { @@ -13377,7 +13452,7 @@ }, { "code": "LU-CL", - "name": "Clerf", + "name": "Clervaux", "type": "Canton" }, { @@ -13392,7 +13467,7 @@ }, { "code": "LU-ES", - "name": "Esch an der Alzette", + "name": "Esch-sur-Alzette", "type": "Canton" }, { @@ -13422,7 +13497,7 @@ }, { "code": "LU-VD", - "name": "Veianen", + "name": "Vianden", "type": "Canton" }, { @@ -13430,249 +13505,59 @@ "name": "Wiltz", "type": "Canton" }, - { - "code": "LV-001", - "name": "Aglonas novads", - "type": "Municipality" - }, { "code": "LV-002", "name": "Aizkraukles novads", "type": "Municipality" }, { - "code": "LV-003", - "name": "Aizputes novads", + "code": "LV-007", + "name": "Alūksnes novads", "type": "Municipality" }, { - "code": "LV-004", - "name": "Aknīstes novads", + "code": "LV-011", + "name": "Ādažu novads", "type": "Municipality" }, { - "code": "LV-005", - "name": "Alojas novads", + "code": "LV-015", + "name": "Balvu novads", "type": "Municipality" }, { - "code": "LV-006", - "name": "Alsungas novads", + "code": "LV-016", + "name": "Bauskas novads", "type": "Municipality" }, { - "code": "LV-007", - "name": "Alūksnes novads", + "code": "LV-022", + "name": "Cēsu novads", "type": "Municipality" }, { - "code": "LV-008", - "name": "Amatas novads", + "code": "LV-026", + "name": "Dobeles novads", "type": "Municipality" }, { - "code": "LV-009", - "name": "Apes novads", + "code": "LV-033", + "name": "Gulbenes novads", "type": "Municipality" }, { - "code": "LV-010", - "name": "Auces novads", + "code": "LV-041", + "name": "Jelgavas novads", "type": "Municipality" }, { - "code": "LV-011", - "name": "Ādažu novads", + "code": "LV-042", + "name": "Jēkabpils novads", "type": "Municipality" }, { - "code": "LV-012", - "name": "Babītes novads", - "type": "Municipality" - }, - { - "code": "LV-013", - "name": "Baldones novads", - "type": "Municipality" - }, - { - "code": "LV-014", - "name": "Baltinavas novads", - "type": "Municipality" - }, - { - "code": "LV-015", - "name": "Balvu novads", - "type": "Municipality" - }, - { - "code": "LV-016", - "name": "Bauskas novads", - "type": "Municipality" - }, - { - "code": "LV-017", - "name": "Beverīnas novads", - "type": "Municipality" - }, - { - "code": "LV-018", - "name": "Brocēnu novads", - "type": "Municipality" - }, - { - "code": "LV-019", - "name": "Burtnieku novads", - "type": "Municipality" - }, - { - "code": "LV-020", - "name": "Carnikavas novads", - "type": "Municipality" - }, - { - "code": "LV-021", - "name": "Cesvaines novads", - "type": "Municipality" - }, - { - "code": "LV-022", - "name": "Cēsu novads", - "type": "Municipality" - }, - { - "code": "LV-023", - "name": "Ciblas novads", - "type": "Municipality" - }, - { - "code": "LV-024", - "name": "Dagdas novads", - "type": "Municipality" - }, - { - "code": "LV-025", - "name": "Daugavpils novads", - "type": "Municipality" - }, - { - "code": "LV-026", - "name": "Dobeles novads", - "type": "Municipality" - }, - { - "code": "LV-027", - "name": "Dundagas novads", - "type": "Municipality" - }, - { - "code": "LV-028", - "name": "Durbes novads", - "type": "Municipality" - }, - { - "code": "LV-029", - "name": "Engures novads", - "type": "Municipality" - }, - { - "code": "LV-030", - "name": "Ērgļu novads", - "type": "Municipality" - }, - { - "code": "LV-031", - "name": "Garkalnes novads", - "type": "Municipality" - }, - { - "code": "LV-032", - "name": "Grobiņas novads", - "type": "Municipality" - }, - { - "code": "LV-033", - "name": "Gulbenes novads", - "type": "Municipality" - }, - { - "code": "LV-034", - "name": "Iecavas novads", - "type": "Municipality" - }, - { - "code": "LV-035", - "name": "Ikšķiles novads", - "type": "Municipality" - }, - { - "code": "LV-036", - "name": "Ilūkstes novads", - "type": "Municipality" - }, - { - "code": "LV-037", - "name": "Inčukalna novads", - "type": "Municipality" - }, - { - "code": "LV-038", - "name": "Jaunjelgavas novads", - "type": "Municipality" - }, - { - "code": "LV-039", - "name": "Jaunpiebalgas novads", - "type": "Municipality" - }, - { - "code": "LV-040", - "name": "Jaunpils novads", - "type": "Municipality" - }, - { - "code": "LV-041", - "name": "Jelgavas novads", - "type": "Municipality" - }, - { - "code": "LV-042", - "name": "Jēkabpils novads", - "type": "Municipality" - }, - { - "code": "LV-043", - "name": "Kandavas novads", - "type": "Municipality" - }, - { - "code": "LV-044", - "name": "Kārsavas novads", - "type": "Municipality" - }, - { - "code": "LV-045", - "name": "Kocēnu novads", - "type": "Municipality" - }, - { - "code": "LV-046", - "name": "Kokneses novads", - "type": "Municipality" - }, - { - "code": "LV-047", - "name": "Krāslavas novads", - "type": "Municipality" - }, - { - "code": "LV-048", - "name": "Krimuldas novads", - "type": "Municipality" - }, - { - "code": "LV-049", - "name": "Krustpils novads", + "code": "LV-047", + "name": "Krāslavas novads", "type": "Municipality" }, { @@ -13680,41 +13565,21 @@ "name": "Kuldīgas novads", "type": "Municipality" }, - { - "code": "LV-051", - "name": "Ķeguma novads", - "type": "Municipality" - }, { "code": "LV-052", "name": "Ķekavas novads", "type": "Municipality" }, - { - "code": "LV-053", - "name": "Lielvārdes novads", - "type": "Municipality" - }, { "code": "LV-054", "name": "Limbažu novads", "type": "Municipality" }, - { - "code": "LV-055", - "name": "Līgatnes novads", - "type": "Municipality" - }, { "code": "LV-056", "name": "Līvānu novads", "type": "Municipality" }, - { - "code": "LV-057", - "name": "Lubānas novads", - "type": "Municipality" - }, { "code": "LV-058", "name": "Ludzas novads", @@ -13725,41 +13590,11 @@ "name": "Madonas novads", "type": "Municipality" }, - { - "code": "LV-060", - "name": "Mazsalacas novads", - "type": "Municipality" - }, - { - "code": "LV-061", - "name": "Mālpils novads", - "type": "Municipality" - }, { "code": "LV-062", "name": "Mārupes novads", "type": "Municipality" }, - { - "code": "LV-063", - "name": "Mērsraga novads", - "type": "Municipality" - }, - { - "code": "LV-064", - "name": "Naukšēnu novads", - "type": "Municipality" - }, - { - "code": "LV-065", - "name": "Neretas novads", - "type": "Municipality" - }, - { - "code": "LV-066", - "name": "Nīcas novads", - "type": "Municipality" - }, { "code": "LV-067", "name": "Ogres novads", @@ -13770,96 +13605,21 @@ "name": "Olaines novads", "type": "Municipality" }, - { - "code": "LV-069", - "name": "Ozolnieku novads", - "type": "Municipality" - }, - { - "code": "LV-070", - "name": "Pārgaujas novads", - "type": "Municipality" - }, - { - "code": "LV-071", - "name": "Pāvilostas novads", - "type": "Municipality" - }, - { - "code": "LV-072", - "name": "Pļaviņu novads", - "type": "Municipality" - }, { "code": "LV-073", "name": "Preiļu novads", "type": "Municipality" }, - { - "code": "LV-074", - "name": "Priekules novads", - "type": "Municipality" - }, - { - "code": "LV-075", - "name": "Priekuļu novads", - "type": "Municipality" - }, - { - "code": "LV-076", - "name": "Raunas novads", - "type": "Municipality" - }, { "code": "LV-077", "name": "Rēzeknes novads", "type": "Municipality" }, - { - "code": "LV-078", - "name": "Riebiņu novads", - "type": "Municipality" - }, - { - "code": "LV-079", - "name": "Rojas novads", - "type": "Municipality" - }, { "code": "LV-080", "name": "Ropažu novads", "type": "Municipality" }, - { - "code": "LV-081", - "name": "Rucavas novads", - "type": "Municipality" - }, - { - "code": "LV-082", - "name": "Rugāju novads", - "type": "Municipality" - }, - { - "code": "LV-083", - "name": "Rundāles novads", - "type": "Municipality" - }, - { - "code": "LV-084", - "name": "Rūjienas novads", - "type": "Municipality" - }, - { - "code": "LV-085", - "name": "Salas novads", - "type": "Municipality" - }, - { - "code": "LV-086", - "name": "Salacgrīvas novads", - "type": "Municipality" - }, { "code": "LV-087", "name": "Salaspils novads", @@ -13875,61 +13635,26 @@ "name": "Saulkrastu novads", "type": "Municipality" }, - { - "code": "LV-090", - "name": "Sējas novads", - "type": "Municipality" - }, { "code": "LV-091", "name": "Siguldas novads", "type": "Municipality" }, - { - "code": "LV-092", - "name": "Skrīveru novads", - "type": "Municipality" - }, - { - "code": "LV-093", - "name": "Skrundas novads", - "type": "Municipality" - }, { "code": "LV-094", "name": "Smiltenes novads", "type": "Municipality" }, - { - "code": "LV-095", - "name": "Stopiņu novads", - "type": "Municipality" - }, - { - "code": "LV-096", - "name": "Strenču novads", - "type": "Municipality" - }, { "code": "LV-097", "name": "Talsu novads", "type": "Municipality" }, - { - "code": "LV-098", - "name": "Tērvetes novads", - "type": "Municipality" - }, { "code": "LV-099", "name": "Tukuma novads", "type": "Municipality" }, - { - "code": "LV-100", - "name": "Vaiņodes novads", - "type": "Municipality" - }, { "code": "LV-101", "name": "Valkas novads", @@ -13940,90 +13665,60 @@ "name": "Varakļānu novads", "type": "Municipality" }, - { - "code": "LV-103", - "name": "Vārkavas novads", - "type": "Municipality" - }, - { - "code": "LV-104", - "name": "Vecpiebalgas novads", - "type": "Municipality" - }, - { - "code": "LV-105", - "name": "Vecumnieku novads", - "type": "Municipality" - }, { "code": "LV-106", "name": "Ventspils novads", "type": "Municipality" }, { - "code": "LV-107", - "name": "Viesītes novads", + "code": "LV-111", + "name": "Augšdaugavas novads", "type": "Municipality" }, { - "code": "LV-108", - "name": "Viļakas novads", + "code": "LV-112", + "name": "Dienvidkurzemes Novads", "type": "Municipality" }, { - "code": "LV-109", - "name": "Viļānu novads", - "type": "Municipality" - }, - { - "code": "LV-110", - "name": "Zilupes novads", + "code": "LV-113", + "name": "Valmieras Novads", "type": "Municipality" }, { "code": "LV-DGV", "name": "Daugavpils", - "type": "Republican city" + "type": "State city" }, { "code": "LV-JEL", "name": "Jelgava", - "type": "Republican city" - }, - { - "code": "LV-JKB", - "name": "Jēkabpils", - "type": "Republican city" + "type": "State city" }, { "code": "LV-JUR", "name": "Jūrmala", - "type": "Republican city" + "type": "State city" }, { "code": "LV-LPX", "name": "Liepāja", - "type": "Republican city" + "type": "State city" }, { "code": "LV-REZ", "name": "Rēzekne", - "type": "Republican city" + "type": "State city" }, { "code": "LV-RIX", "name": "Rīga", - "type": "Republican city" + "type": "State city" }, { "code": "LV-VEN", "name": "Ventspils", - "type": "Republican city" - }, - { - "code": "LV-VMR", - "name": "Valmiera", - "type": "Republican city" + "type": "State city" }, { "code": "LY-BA", @@ -14960,6 +14655,11 @@ "name": "Tuzi", "type": "Municipality" }, + { + "code": "ME-25", + "name": "Zeta", + "type": "Municipality" + }, { "code": "MG-A", "name": "Toamasina", @@ -16528,7 +16228,7 @@ { "code": "MX-CMX", "name": "Ciudad de México", - "type": "Federal district" + "type": "Federal entity" }, { "code": "MX-COA", @@ -17325,99 +17025,19 @@ "name": "Romssa ja Finnmárkku", "type": "County" }, - { - "code": "NP-1", - "name": "Central", - "type": "Development region" - }, - { - "code": "NP-2", - "name": "Mid Western", - "type": "Development region" - }, - { - "code": "NP-3", - "name": "Western", - "type": "Development region" - }, - { - "code": "NP-4", - "name": "Eastern", - "type": "Development region" - }, - { - "code": "NP-5", - "name": "Far Western", - "type": "Development region" - }, - { - "code": "NP-BA", - "name": "Bagmati", - "type": "Zone" - }, - { - "code": "NP-BH", - "name": "Bheri", - "type": "Zone" - }, - { - "code": "NP-DH", - "name": "Dhawalagiri", - "type": "Zone" - }, - { - "code": "NP-GA", - "name": "Gandaki", - "type": "Zone" - }, - { - "code": "NP-JA", - "name": "Janakpur", - "type": "Zone" - }, - { - "code": "NP-KA", - "name": "Karnali", - "type": "Zone" - }, - { - "code": "NP-KO", - "name": "Kosi", - "type": "Zone" - }, - { - "code": "NP-LU", - "name": "Lumbini", - "type": "Zone" - }, - { - "code": "NP-MA", - "name": "Mahakali", - "type": "Zone" - }, - { - "code": "NP-ME", - "name": "Mechi", - "type": "Zone" - }, - { - "code": "NP-NA", - "name": "Narayani", - "type": "Zone" - }, { "code": "NP-P1", - "name": "Province 1", + "name": "Koshi", "type": "Province" }, { "code": "NP-P2", - "name": "Province 2", + "name": "Madhesh", "type": "Province" }, { "code": "NP-P3", - "name": "Bāgmatī", + "name": "Bagmati", "type": "Province" }, { @@ -17427,7 +17047,7 @@ }, { "code": "NP-P5", - "name": "Province 5", + "name": "Lumbini", "type": "Province" }, { @@ -17437,24 +17057,9 @@ }, { "code": "NP-P7", - "name": "Sudūr Pashchim", + "name": "Sudurpashchim", "type": "Province" }, - { - "code": "NP-RA", - "name": "Rapti", - "type": "Zone" - }, - { - "code": "NP-SA", - "name": "Sagarmatha", - "type": "Zone" - }, - { - "code": "NP-SE", - "name": "Seti", - "type": "Zone" - }, { "code": "NR-01", "name": "Aiwo", @@ -17562,7 +17167,7 @@ }, { "code": "NZ-MWT", - "name": "Manawatu-Wanganui", + "name": "Manawatū-Whanganui", "type": "Region" }, { @@ -17597,7 +17202,7 @@ }, { "code": "NZ-WGN", - "name": "Wellington", + "name": "Greater Wellington", "type": "Region" }, { @@ -17727,7 +17332,12 @@ }, { "code": "PA-NB", - "name": "Ngöbe-Buglé", + "name": "Ngäbe-Buglé", + "type": "Indigenous region" + }, + { + "code": "PA-NT", + "name": "Naso Tjër Di", "type": "Indigenous region" }, { @@ -18280,11 +17890,6 @@ "name": "Marinduque", "type": "Province" }, - { - "code": "PH-MAG", - "name": "Maguindanao", - "type": "Province" - }, { "code": "PH-MAS", "name": "Masbate", @@ -18300,6 +17905,16 @@ "name": "Mindoro Oriental", "type": "Province" }, + { + "code": "PH-MGN", + "name": "Maguindanao del Norte", + "type": "Province" + }, + { + "code": "PH-MGS", + "name": "Maguindanao del Sur", + "type": "Province" + }, { "code": "PH-MOU", "name": "Mountain Province", @@ -18502,7 +18117,7 @@ }, { "code": "PL-04", - "name": "Kujawsko-pomorskie", + "name": "Kujawsko-Pomorskie", "type": "Voivodship" }, { @@ -18562,7 +18177,7 @@ }, { "code": "PL-28", - "name": "Warmińsko-mazurskie", + "name": "Warmińsko-Mazurskie", "type": "Voivodship" }, { @@ -20313,7 +19928,7 @@ { "code": "SI-011", "name": "Celje", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-012", @@ -20477,7 +20092,7 @@ }, { "code": "SI-044", - "name": "Kanal", + "name": "Kanal ob Soči", "type": "Municipality" }, { @@ -20508,7 +20123,7 @@ { "code": "SI-050", "name": "Koper", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-051", @@ -20518,7 +20133,7 @@ { "code": "SI-052", "name": "Kranj", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-053", @@ -20528,7 +20143,7 @@ { "code": "SI-054", "name": "Krško", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-055", @@ -20563,7 +20178,7 @@ { "code": "SI-061", "name": "Ljubljana", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-062", @@ -20608,7 +20223,7 @@ { "code": "SI-070", "name": "Maribor", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-071", @@ -20658,7 +20273,7 @@ { "code": "SI-080", "name": "Murska Sobota", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-081", @@ -20678,12 +20293,12 @@ { "code": "SI-084", "name": "Nova Gorica", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-085", "name": "Novo Mesto", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-086", @@ -20738,7 +20353,7 @@ { "code": "SI-096", "name": "Ptuj", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-097", @@ -20818,7 +20433,7 @@ { "code": "SI-112", "name": "Slovenj Gradec", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-113", @@ -20923,7 +20538,7 @@ { "code": "SI-133", "name": "Velenje", - "type": "Municipality" + "type": "Urban municipality" }, { "code": "SI-134", @@ -21237,7 +20852,7 @@ }, { "code": "SI-197", - "name": "Kosanjevica na Krki", + "name": "Kostanjevica na Krki", "type": "Municipality" }, { @@ -21887,7 +21502,7 @@ }, { "code": "TD-BA", - "name": "Al Baţḩā’", + "name": "Batha", "type": "Province" }, { @@ -21932,7 +21547,7 @@ }, { "code": "TD-LC", - "name": "Al Buḩayrah", + "name": "Lac", "type": "Province" }, { @@ -21967,7 +21582,7 @@ }, { "code": "TD-ND", - "name": "Madīnat Injamīnā", + "name": "Ville de Ndjamena", "type": "Province" }, { @@ -21992,7 +21607,7 @@ }, { "code": "TD-TI", - "name": "Tibastī", + "name": "Tibesti", "type": "Province" }, { diff --git a/priv/override/iso_3166-1.json b/priv/override/iso_3166-1.json index c0df704..b5a29cf 100644 --- a/priv/override/iso_3166-1.json +++ b/priv/override/iso_3166-1.json @@ -9,5 +9,14 @@ "alpha_2": "A1", "flag": "🏳️", "name": "Anonymous VPN Service" + }, + { + "alpha_2": "TR", + "alpha_3": "TUR", + "flag": "🇹🇷", + "name": "Türkiye", + "common_name": "Turkey", + "numeric": "792", + "official_name": "Republic of Türkiye" } ] diff --git a/priv/restore/iso_3166-2.json b/priv/restore/iso_3166-2.json new file mode 100644 index 0000000..966b835 --- /dev/null +++ b/priv/restore/iso_3166-2.json @@ -0,0 +1,802 @@ +[ + { + "code": "FR-75", + "name": "Paris", + "type": "Metropolitan department" + }, + { + "code": "FR-GF", + "name": "Guyane (française)", + "type": "Overseas region" + }, + { + "code": "FR-GP", + "name": "Guadeloupe", + "type": "Overseas region" + }, + { + "code": "FR-MQ", + "name": "Martinique", + "type": "Overseas region" + }, + { + "code": "FR-RE", + "name": "La Réunion", + "type": "Overseas region" + }, + { + "code": "FR-YT", + "name": "Mayotte", + "type": "Overseas region" + }, + { + "code": "GB-NTH", + "name": "Northamptonshire", + "type": "Two-tier county" + }, + { + "code": "GT-AV", + "name": "Alta Verapaz", + "type": "Department" + }, + { + "code": "GT-BV", + "name": "Baja Verapaz", + "type": "Department" + }, + { + "code": "GT-CM", + "name": "Chimaltenango", + "type": "Department" + }, + { + "code": "GT-CQ", + "name": "Chiquimula", + "type": "Department" + }, + { + "code": "GT-ES", + "name": "Escuintla", + "type": "Department" + }, + { + "code": "GT-GU", + "name": "Guatemala", + "type": "Department" + }, + { + "code": "GT-HU", + "name": "Huehuetenango", + "type": "Department" + }, + { + "code": "GT-IZ", + "name": "Izabal", + "type": "Department" + }, + { + "code": "GT-JA", + "name": "Jalapa", + "type": "Department" + }, + { + "code": "GT-JU", + "name": "Jutiapa", + "type": "Department" + }, + { + "code": "GT-PE", + "name": "Petén", + "type": "Department" + }, + { + "code": "GT-PR", + "name": "El Progreso", + "type": "Department" + }, + { + "code": "GT-QC", + "name": "Quiché", + "type": "Department" + }, + { + "code": "GT-QZ", + "name": "Quetzaltenango", + "type": "Department" + }, + { + "code": "GT-RE", + "name": "Retalhuleu", + "type": "Department" + }, + { + "code": "GT-SA", + "name": "Sacatepéquez", + "type": "Department" + }, + { + "code": "GT-SM", + "name": "San Marcos", + "type": "Department" + }, + { + "code": "GT-SO", + "name": "Sololá", + "type": "Department" + }, + { + "code": "GT-SR", + "name": "Santa Rosa", + "type": "Department" + }, + { + "code": "GT-SU", + "name": "Suchitepéquez", + "type": "Department" + }, + { + "code": "GT-TO", + "name": "Totonicapán", + "type": "Department" + }, + { + "code": "GT-ZA", + "name": "Zacapa", + "type": "Department" + }, + { + "code": "IN-CT", + "name": "Chhattīsgarh", + "type": "State" + }, + { + "code": "IN-OR", + "name": "Odisha", + "type": "State" + }, + { + "code": "IN-TG", + "name": "Telangāna", + "type": "State" + }, + { + "code": "IN-UT", + "name": "Uttarākhand", + "type": "State" + }, + { + "code": "IS-AKH", + "name": "Akrahreppur", + "type": "Municipality" + }, + { + "code": "IS-BFJ", + "name": "Borgarfjarðarhreppur", + "type": "Municipality" + }, + { + "code": "IS-BLO", + "name": "Blönduósbær", + "type": "Municipality" + }, + { + "code": "IS-DJU", + "name": "Djúpavogshreppur", + "type": "Municipality" + }, + { + "code": "IS-FLD", + "name": "Fljótsdalshérað", + "type": "Municipality" + }, + { + "code": "IS-HEL", + "name": "Helgafellssveit", + "type": "Municipality" + }, + { + "code": "IS-HUT", + "name": "Húnavatnshreppur", + "type": "Municipality" + }, + { + "code": "IS-SBH", + "name": "Svalbarðshreppur", + "type": "Municipality" + }, + { + "code": "IS-SEY", + "name": "Seyðisfjarðarkaupstaður", + "type": "Municipality" + }, + { + "code": "IS-SKU", + "name": "Skútustaðahreppur", + "type": "Municipality" + }, + { + "code": "IS-SSF", + "name": "Sveitarfélagið Skagafjörður", + "type": "Municipality" + }, + { + "code": "KZ-AKM", + "name": "Akmolinskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-AKT", + "name": "Aktjubinskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-ALA", + "name": "Almaty", + "type": "City" + }, + { + "code": "KZ-ALM", + "name": "Almatinskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-AST", + "name": "Nur-Sultan", + "type": "City" + }, + { + "code": "KZ-ATY", + "name": "Atyrauskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-KAR", + "name": "Karagandinskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-KUS", + "name": "Kostanajskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-KZY", + "name": "Kyzylordinskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-MAN", + "name": "Mangghystaū oblysy", + "type": "Region" + }, + { + "code": "KZ-PAV", + "name": "Pavlodar oblysy", + "type": "Region" + }, + { + "code": "KZ-SEV", + "name": "Severo-Kazahstanskaja oblast'", + "type": "Region" + }, + { + "code": "KZ-SHY", + "name": "Shymkent", + "type": "City" + }, + { + "code": "KZ-VOS", + "name": "Shyghys Qazaqstan oblysy", + "type": "Region" + }, + { + "code": "KZ-YUZ", + "name": "Turkestankaya oblast'", + "type": "Region" + }, + { + "code": "KZ-ZAP", + "name": "Batys Qazaqstan oblysy", + "type": "Region" + }, + { + "code": "KZ-ZHA", + "name": "Zhambyl oblysy", + "type": "Region" + }, + { + "code": "LV-001", + "name": "Aglonas novads", + "type": "Municipality" + }, + { + "code": "LV-003", + "name": "Aizputes novads", + "type": "Municipality" + }, + { + "code": "LV-004", + "name": "Aknīstes novads", + "type": "Municipality" + }, + { + "code": "LV-005", + "name": "Alojas novads", + "type": "Municipality" + }, + { + "code": "LV-006", + "name": "Alsungas novads", + "type": "Municipality" + }, + { + "code": "LV-008", + "name": "Amatas novads", + "type": "Municipality" + }, + { + "code": "LV-009", + "name": "Apes novads", + "type": "Municipality" + }, + { + "code": "LV-010", + "name": "Auces novads", + "type": "Municipality" + }, + { + "code": "LV-012", + "name": "Babītes novads", + "type": "Municipality" + }, + { + "code": "LV-013", + "name": "Baldones novads", + "type": "Municipality" + }, + { + "code": "LV-014", + "name": "Baltinavas novads", + "type": "Municipality" + }, + { + "code": "LV-017", + "name": "Beverīnas novads", + "type": "Municipality" + }, + { + "code": "LV-018", + "name": "Brocēnu novads", + "type": "Municipality" + }, + { + "code": "LV-019", + "name": "Burtnieku novads", + "type": "Municipality" + }, + { + "code": "LV-020", + "name": "Carnikavas novads", + "type": "Municipality" + }, + { + "code": "LV-021", + "name": "Cesvaines novads", + "type": "Municipality" + }, + { + "code": "LV-023", + "name": "Ciblas novads", + "type": "Municipality" + }, + { + "code": "LV-024", + "name": "Dagdas novads", + "type": "Municipality" + }, + { + "code": "LV-025", + "name": "Daugavpils novads", + "type": "Municipality" + }, + { + "code": "LV-027", + "name": "Dundagas novads", + "type": "Municipality" + }, + { + "code": "LV-028", + "name": "Durbes novads", + "type": "Municipality" + }, + { + "code": "LV-029", + "name": "Engures novads", + "type": "Municipality" + }, + { + "code": "LV-030", + "name": "Ērgļu novads", + "type": "Municipality" + }, + { + "code": "LV-031", + "name": "Garkalnes novads", + "type": "Municipality" + }, + { + "code": "LV-032", + "name": "Grobiņas novads", + "type": "Municipality" + }, + { + "code": "LV-034", + "name": "Iecavas novads", + "type": "Municipality" + }, + { + "code": "LV-035", + "name": "Ikšķiles novads", + "type": "Municipality" + }, + { + "code": "LV-036", + "name": "Ilūkstes novads", + "type": "Municipality" + }, + { + "code": "LV-037", + "name": "Inčukalna novads", + "type": "Municipality" + }, + { + "code": "LV-038", + "name": "Jaunjelgavas novads", + "type": "Municipality" + }, + { + "code": "LV-039", + "name": "Jaunpiebalgas novads", + "type": "Municipality" + }, + { + "code": "LV-040", + "name": "Jaunpils novads", + "type": "Municipality" + }, + { + "code": "LV-043", + "name": "Kandavas novads", + "type": "Municipality" + }, + { + "code": "LV-044", + "name": "Kārsavas novads", + "type": "Municipality" + }, + { + "code": "LV-045", + "name": "Kocēnu novads", + "type": "Municipality" + }, + { + "code": "LV-046", + "name": "Kokneses novads", + "type": "Municipality" + }, + { + "code": "LV-048", + "name": "Krimuldas novads", + "type": "Municipality" + }, + { + "code": "LV-049", + "name": "Krustpils novads", + "type": "Municipality" + }, + { + "code": "LV-051", + "name": "Ķeguma novads", + "type": "Municipality" + }, + { + "code": "LV-053", + "name": "Lielvārdes novads", + "type": "Municipality" + }, + { + "code": "LV-055", + "name": "Līgatnes novads", + "type": "Municipality" + }, + { + "code": "LV-057", + "name": "Lubānas novads", + "type": "Municipality" + }, + { + "code": "LV-060", + "name": "Mazsalacas novads", + "type": "Municipality" + }, + { + "code": "LV-061", + "name": "Mālpils novads", + "type": "Municipality" + }, + { + "code": "LV-063", + "name": "Mērsraga novads", + "type": "Municipality" + }, + { + "code": "LV-064", + "name": "Naukšēnu novads", + "type": "Municipality" + }, + { + "code": "LV-065", + "name": "Neretas novads", + "type": "Municipality" + }, + { + "code": "LV-066", + "name": "Nīcas novads", + "type": "Municipality" + }, + { + "code": "LV-069", + "name": "Ozolnieku novads", + "type": "Municipality" + }, + { + "code": "LV-070", + "name": "Pārgaujas novads", + "type": "Municipality" + }, + { + "code": "LV-071", + "name": "Pāvilostas novads", + "type": "Municipality" + }, + { + "code": "LV-072", + "name": "Pļaviņu novads", + "type": "Municipality" + }, + { + "code": "LV-074", + "name": "Priekules novads", + "type": "Municipality" + }, + { + "code": "LV-075", + "name": "Priekuļu novads", + "type": "Municipality" + }, + { + "code": "LV-076", + "name": "Raunas novads", + "type": "Municipality" + }, + { + "code": "LV-078", + "name": "Riebiņu novads", + "type": "Municipality" + }, + { + "code": "LV-079", + "name": "Rojas novads", + "type": "Municipality" + }, + { + "code": "LV-081", + "name": "Rucavas novads", + "type": "Municipality" + }, + { + "code": "LV-082", + "name": "Rugāju novads", + "type": "Municipality" + }, + { + "code": "LV-083", + "name": "Rundāles novads", + "type": "Municipality" + }, + { + "code": "LV-084", + "name": "Rūjienas novads", + "type": "Municipality" + }, + { + "code": "LV-085", + "name": "Salas novads", + "type": "Municipality" + }, + { + "code": "LV-086", + "name": "Salacgrīvas novads", + "type": "Municipality" + }, + { + "code": "LV-090", + "name": "Sējas novads", + "type": "Municipality" + }, + { + "code": "LV-092", + "name": "Skrīveru novads", + "type": "Municipality" + }, + { + "code": "LV-093", + "name": "Skrundas novads", + "type": "Municipality" + }, + { + "code": "LV-095", + "name": "Stopiņu novads", + "type": "Municipality" + }, + { + "code": "LV-096", + "name": "Strenču novads", + "type": "Municipality" + }, + { + "code": "LV-098", + "name": "Tērvetes novads", + "type": "Municipality" + }, + { + "code": "LV-100", + "name": "Vaiņodes novads", + "type": "Municipality" + }, + { + "code": "LV-103", + "name": "Vārkavas novads", + "type": "Municipality" + }, + { + "code": "LV-104", + "name": "Vecpiebalgas novads", + "type": "Municipality" + }, + { + "code": "LV-105", + "name": "Vecumnieku novads", + "type": "Municipality" + }, + { + "code": "LV-107", + "name": "Viesītes novads", + "type": "Municipality" + }, + { + "code": "LV-108", + "name": "Viļakas novads", + "type": "Municipality" + }, + { + "code": "LV-109", + "name": "Viļānu novads", + "type": "Municipality" + }, + { + "code": "LV-110", + "name": "Zilupes novads", + "type": "Municipality" + }, + { + "code": "LV-JKB", + "name": "Jēkabpils", + "type": "Republican city" + }, + { + "code": "LV-VMR", + "name": "Valmiera", + "type": "Republican city" + }, + { + "code": "NP-1", + "name": "Central", + "type": "Development region" + }, + { + "code": "NP-2", + "name": "Mid Western", + "type": "Development region" + }, + { + "code": "NP-3", + "name": "Western", + "type": "Development region" + }, + { + "code": "NP-4", + "name": "Eastern", + "type": "Development region" + }, + { + "code": "NP-5", + "name": "Far Western", + "type": "Development region" + }, + { + "code": "NP-BA", + "name": "Bagmati", + "type": "Zone" + }, + { + "code": "NP-BH", + "name": "Bheri", + "type": "Zone" + }, + { + "code": "NP-DH", + "name": "Dhawalagiri", + "type": "Zone" + }, + { + "code": "NP-GA", + "name": "Gandaki", + "type": "Zone" + }, + { + "code": "NP-JA", + "name": "Janakpur", + "type": "Zone" + }, + { + "code": "NP-KA", + "name": "Karnali", + "type": "Zone" + }, + { + "code": "NP-KO", + "name": "Kosi", + "type": "Zone" + }, + { + "code": "NP-LU", + "name": "Lumbini", + "type": "Zone" + }, + { + "code": "NP-MA", + "name": "Mahakali", + "type": "Zone" + }, + { + "code": "NP-ME", + "name": "Mechi", + "type": "Zone" + }, + { + "code": "NP-NA", + "name": "Narayani", + "type": "Zone" + }, + { + "code": "NP-RA", + "name": "Rapti", + "type": "Zone" + }, + { + "code": "NP-SA", + "name": "Sagarmatha", + "type": "Zone" + }, + { + "code": "NP-SE", + "name": "Seti", + "type": "Zone" + }, + { + "code": "PH-MAG", + "name": "Maguindanao", + "type": "Province" + } +] \ No newline at end of file diff --git a/test/location_test.exs b/test/location_test.exs index 16f9df0..71968b3 100644 --- a/test/location_test.exs +++ b/test/location_test.exs @@ -38,6 +38,38 @@ defmodule LocationTest do assert match.code == "EE-79" assert match.name == "Tartumaa" end + + test "can lookup former subdivisions" do + # changed to FR-75C in 2021-11-25: https://en.wikipedia.org/wiki/ISO_3166-2:FR#Changes + assert Location.get_subdivision("FR-75").name == "Paris" + + # FR-GF and some other codes were removed in 2021-11-25: https://en.wikipedia.org/wiki/ISO_3166-2:FR#Changes + assert Location.get_subdivision("FR-GF").name == "Guyane (française)" + + # GT-AV and some other codes were changed in 2021-11-25: https://en.wikipedia.org/wiki/ISO_3166-2:GT#Changes + assert Location.get_subdivision("GT-AV").name == "Alta Verapaz" + + # IN-CT and some other codes were changed in 2023-11-23: https://en.wikipedia.org/wiki/ISO_3166-2:IN#Changes + assert Location.get_subdivision("IN-CT").name == "Chhattīsgarh" + + # IS-BFJ and some other codes were removed in 2021-11-25: https://en.wikipedia.org/wiki/ISO_3166-2:IS#Changes + assert Location.get_subdivision("IS-BFJ").name == "Borgarfjarðarhreppur" + + # IS-AKH and some other codes were removed in 2022-11-29: https://en.wikipedia.org/wiki/ISO_3166-2:IS#Changes + assert Location.get_subdivision("IS-AKH").name == "Akrahreppur" + + # KZ-ALA and some other codes were changed in 2022-11-29: https://en.wikipedia.org/wiki/ISO_3166-2:KZ#Changes + assert Location.get_subdivision("KZ-ALA").name == "Almaty" + + # LV-001 and some other codes were removed in 2021-11-25: https://en.wikipedia.org/wiki/ISO_3166-2:LV#Changes + assert Location.get_subdivision("LV-001").name == "Aglonas novads" + + # NP-1 and some other codes were removed in 2022-11-29: https://en.wikipedia.org/wiki/ISO_3166-2:NP#Changes + assert Location.get_subdivision("NP-1").name == "Central" + + # PH-MAG was split in two in 2023-11-23: https://en.wikipedia.org/wiki/ISO_3166-2:PH#Changes + assert Location.get_subdivision("PH-MAG").name == "Maguindanao" + end end describe "city" do