Skip to content

fix(connector): London as a whole asks which of its councils - #234

Merged
billlyzhaoyh merged 1 commit into
mainfrom
fix/connector-london
Dec 2, 2026
Merged

billlyzhaoyh merged 1 commit into
mainfrom
fix/connector-london

Conversation

@billlyzhaoyh

@billlyzhaoyh billlyzhaoyh commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #233.

The problem

The connector's describe_place, which the chat assistant uses, answered "London" with the City of London, as if it were found: 6 neighbourhoods and 11,457 residents. When no council's name matches in full, the connector tries part of a name, and "london" is part of only one: "City of London". "Greater London" was not found.

The fix

"London" and "Greater London" now answer choose and list all 33 of London's councils: its 32 boroughs and the City. The message says the tool describes one council at a time, and asks which one is meant. The same thing happens when several councils match a name.

  • Where the list comes from. It is built from the shipped list of every UK council (London's are the only codes that begin E09), not from the deprivation index. So it is complete, needs no download, and isn't cut to the usual 10 matches.
  • Kept as a table. These names sit in a small table of areas larger than one council, so another area can be added the same way (see below).
  • Unchanged. "City of London" is still found by its own name. A borough is still found by its name or its "London Borough of" name. The other choose answers ("Newcastle") are unchanged.

The choose answer is now built in one place, _choose, which both kinds of answer use. Nothing public changes.

Tests

  • New: test_london_as_a_whole_asks_which_of_its_councils covers "London" and "Greater London".
    • I saw it fail on main's connector code for the two reasons in the issue: "London" came back found (the City), and "Greater London" came back not found.
    • For that, the small England in the test data gained a City of London neighbourhood. It has no residents, so the shares of England's residents that other tests check are unchanged.
    • Domain ranks in the test data are now capped at the number of neighbourhoods, not at 10, so the new row's ranks stay consistent.
  • Checks run locally, on top of main 3db0540 (after feat(analyses): police recorded crime as needs, counted in offences #237). All passed:
    • ruff check
    • ruff format --check
    • ast-grep scan
    • ty check src
    • pytest (1,295 passed)
    • mkdocs build --strict
  • Run on real data:
    • "London" and "Greater London" list 33 councils, from Barking and Dagenham to Westminster.
    • "City of London" and "Hackney" are found.
    • Westminster's code, E09000033, is found.
    • "Newcastle" still gives a choice of 2.
  • I did not run the live source checks (-m live). Nothing here reads a new source.

Found in review, not changed here

  • English counties fall into the same trap.

    • "Gloucestershire" is found as South Gloucestershire, which is a different council.
    • "Hampshire" is found as East Hampshire, and "Surrey" as Surrey Heath.
    • "Kent" is not found.

    Now filed as connector: a county's name is answered with one of its districts, or a council outside it #236.

  • "London City" and "London, City of" now get the London list (the City is in it), where they used to find the City.

  • "Inner London" and the region code E12000007 are still not found.

  • Already on main:

    • A choose answer is cut to 10 with nothing saying so ("North" matches 14).
    • "City of London Corporation" is not found.

AI tools

Claude Code wrote the change, the test and this description, and ran the code review and simplify passes.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://KindTechUK.github.io/uk-open-data/pr-preview/pr-234/

Built to branch gh-pages at 2026-12-01 16:46 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

"London" was answered with the City of London, the one council whose name
holds the word, as if it were found: 11,457 residents. "Greater London"
was not found. Both now answer `choose`, listing all 33 of London's
councils (its 32 boroughs and the City), whose codes alone begin E09, so
the person says which one they mean. The list comes from the shipped
council list, so it is complete whatever the index holds, and is not cut
to the usual ten matches.

The names are kept in a small table of areas larger than one council, so
another such area can be added the same way. The City of London is still
found by its own name, and a London borough by its name or its "London
Borough of" name.

Signed-off-by: billlyzhaoyh <billlyzhaoyh@users.noreply.github.com>
Github-Issue: #233
@billlyzhaoyh
billlyzhaoyh marked this pull request as ready for review December 2, 2026 17:44
@billlyzhaoyh
billlyzhaoyh requested a review from lucharo as a code owner December 2, 2026 17:44
@billlyzhaoyh
billlyzhaoyh merged commit f8c11ad into main Dec 2, 2026
8 checks passed
@billlyzhaoyh
billlyzhaoyh deleted the fix/connector-london branch December 2, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connector: "London" is answered with the City of London

1 participant