Skip to content

[WIP] Update UK countries to include states and cities#1138

Merged
dr5hn merged 4 commits into
masterfrom
copilot/update-uk-countries-structure
Oct 14, 2025
Merged

[WIP] Update UK countries to include states and cities#1138
dr5hn merged 4 commits into
masterfrom
copilot/update-uk-countries-structure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 13, 2025

  • Analyze current UK data structure (cities, states, parent relationships)
  • Create a mapping strategy to reassign UK cities from constituent countries to their proper counties/regions
  • Update GB.json cities file to use correct state_id values (counties instead of England/Wales/Scotland/Northern Ireland)
  • Update state_code values in cities to match their county's iso2 code
  • Validate the changes ensure all cities have valid state_id references
  • Test the changes by checking sample cities (e.g., Carmarthen should be in Carmarthenshire)
  • Document the changes

Summary

Successfully restructured UK cities data to properly map cities to their administrative subdivisions instead of constituent countries.

Key Changes

  • 3,866 UK cities reassigned from constituent countries to their proper counties/regions
  • All cities now use correct state_id and state_code values
  • Geographic proximity matching (Haversine distance) used for accurate assignments
  • Comprehensive documentation added

Validation Results

βœ… All 3,879 UK cities have valid state_id references
βœ… No cities remain assigned to constituent countries
βœ… All state_codes match subdivision ISO2 codes
βœ… Proper hierarchical structure maintained via parent_id
βœ… 0 validation errors, 0 warnings

Examples

  • Carmarthen β†’ Carmarthenshire (was: Wales)
  • London β†’ Westminster (was: England)
  • Edinburgh β†’ Edinburgh council area (was: Scotland)
  • Belfast β†’ Belfast district (was: Northern Ireland)

Distribution

  • England: 2,931 cities across 151 subdivisions
  • Scotland: 526 cities across 33 subdivisions
  • Wales: 302 cities across 22 subdivisions
  • Northern Ireland: 120 cities across 11 subdivisions

This aligns UK data with international standards and enables proper administrative hierarchy queries.

Documentation: See UK_CITIES_RESTRUCTURING.md and PR_SUMMARY.md for complete details.

Original prompt

This section details on the original issue you should resolve

<issue_title>UK Countries </issue_title>
<issue_description>First I want to thank you for your nice work here! This is very useful.

I lived in Wales for 2 years near Carmarthen, maybe I can help.
The issue with the UK is that it is a kingdom that has countries (which are England, Wales, Scotland, and Northern Irland) and it is not divided as other countries generally are. Each of those countries are more or less independent in many aspects, for example, Wales has a different language that is called Welsh (very different than English), but most of the people speak English most of the time. Each country has a different Government and Scotland has even different currency notes.

the solution will be to have each country with their own states and cities as it should (like Country: Wales, state: Carmarthenshire, city: Carmarthen - everything ending in "shire" is a different state).
Currently, you have: Country UK, State: Wales, city: Carmarthen, but you have Carmarthenshire in the states and cities as well.

Country: Scotland
Capital: Edinburg
States in Scotland: http://www.gomapper.com/travel/list-of-states-and-regions-in/scotland.html

Country: Wales
Capital: Cardiff
states in Wales: http://www.gomapper.com/travel/list-of-states-and-regions-in/wales.html

Country: England
Capital: London
states in England: http://www.gomapper.com/travel/list-of-states-and-regions-in/england.html

Country: Northern Irland
Capital: Belfast
States in Northern Irland: http://www.gomapper.com/travel/list-of-states-and-regions-in/northern-ireland.html

Be aware of the following facts:

  • Many states have a city called the same like Glasgow or Edinburg in Scotland; or London and others in England; or Swansea and Cardiff in Wales; of Belfast and many more in Northern Irland. I know that can be confusing :)
  • Forget about The United Kingdom and Great Britain as it is more or less a way of describing the kingdom (one includes Northern Ireland and some ilands and the other doesn't). The other option is to delete England, Wales, Scotland and Northern Irland from States and say that all states belong to the UK. UK -> States -> Cities, instead of, UK -> Countries & States -> Cities connected to a country as it is now.

I hope this helps you!
This DB that you are creating will be very useful as it is quite difficult to find all the information put together.</issue_description>

Comments on the Issue (you are @copilot in this section)

@dr5hn @gustavoburbano Thanks for the brief.

However, this topic is already is in Discussion
#168
#227</comment_new>

Fixes #290


πŸ’‘ You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 13, 2025 13:37
Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com>
Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com>
Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com>
@dr5hn
Copy link
Copy Markdown
Owner

dr5hn commented Oct 14, 2025

@copilot Retry A82A:17506:1918B3:1CABF2:68ED03AE

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 14, 2025

@copilot Retry A82A:17506:1918B3:1CABF2:68ED03AE

I received your retry request with code A82A:17506:1918B3:1CABF2:68ED03AE. Could you clarify what needs to be retried?

If there are specific changes needed to the UK cities restructuring or if a CI/CD workflow failed, please let me know and I'll address it.

@dr5hn
Copy link
Copy Markdown
Owner

dr5hn commented Oct 14, 2025

@copilot Continue, Re review the issue and if the solution is in place.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 14, 2025

@dr5hn Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 125fa68d-24a4-4a18-83cc-601618fea460

Sorry for the inconvenience!

@dr5hn
Copy link
Copy Markdown
Owner

dr5hn commented Oct 14, 2025

@copilot Could you please review this issue #290 and check is solution is in place within this PR?

@dr5hn dr5hn marked this pull request as ready for review October 14, 2025 08:08
@dr5hn dr5hn requested a review from Copilot October 14, 2025 08:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restructures UK cities data to map cities to their proper administrative subdivisions (counties, unitary authorities, council areas) instead of directly to the four constituent countries (England, Wales, Scotland, Northern Ireland). This addresses issue #290 and aligns the UK data structure with international standards.

  • Reassigned 3,866 UK cities from constituent countries to their proper administrative subdivisions using geographic proximity matching
  • Updated state_id and state_code values to reference specific counties/regions rather than England/Wales/Scotland/Northern Ireland
  • Added comprehensive documentation explaining the changes and new hierarchical structure

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
UK_CITIES_RESTRUCTURING.md New documentation file explaining the problem, solution, and technical details of the restructuring
PR_SUMMARY.md New summary document providing overview, statistics, validation results, and migration guidance

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 14, 2025
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 14, 2025

@copilot Could you please review this issue #290 and check is solution is in place within this PR?

Yes, the solution for issue #290 is fully implemented in this PR.

Issue Requirement:

  • "Have each country with their own states and cities"
  • Example: Wales β†’ Carmarthenshire β†’ Carmarthen

Verification:
βœ… Carmarthen is now in Carmarthenshire (state_id: 2484, state_code: CMN)
βœ… Carmarthenshire links to Wales via parent_id (2338)
βœ… All 3,879 UK cities reassigned to proper subdivisions (0 remain in constituent countries)
βœ… 217 subdivisions properly linked to constituent countries via parent_id
βœ… Structure: UK β†’ England/Wales/Scotland/N.Ireland β†’ Counties/Regions β†’ Cities

The exact example from the issue works as requested:

  • City: Carmarthen β†’ County: Carmarthenshire β†’ Country: Wales

@dosubot dosubot Bot added the fixed Issue has been fixed label Oct 14, 2025
@dr5hn dr5hn merged commit 3520039 into master Oct 14, 2025
2 checks passed
@dr5hn dr5hn deleted the copilot/update-uk-countries-structure branch October 14, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixed Issue has been fixed size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UK Countries

3 participants