Skip to content

Fix TICON station names and regions - #247

Merged
clarkbw merged 3 commits into
mainfrom
fix/ticon-names
Oct 7, 2026
Merged

clarkbw merged 3 commits into
mainfrom
fix/ticon-names

Conversation

@clarkbw

@clarkbw clarkbw commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

This re-imports TICON with the current naming code and fixes the regressions listed in #242, so the re-import can ship. Harmonics and datums come from the cached station files, so only name and region change.

The TICON importer passed cleanName the CSV's ISO code (FRA, USA), so none of the country rules ran. cleanName now resolves an ISO code to the country name. That brings back the French hyphens and also turns on the US rules for TICON's US gauges.

Name fixes:

  • 28 French names get their hyphens back (Fort-de-France, Boulogne-sur-Mer).
  • Québec names from MEDS get their hyphens back (Coteau-du-Lac). The importer now passes the nearest place's subdivision, and cleanName hyphenates a Québec name only when its source joined every word with underscores. CHS names such as Pont de Québec keep their own spelling.
  • Haiti hyphenates like France: St Louis-du-Sud.
  • UNC Center Marine Science Dock keeps its acronym.
  • USGS's 03 Miles reads as 0.3 miles: Merrimack R 0.3 nm US Rt 125 at Haverhill Ma.
  • s_Gravendeel becomes 's-Gravendeel and 's-Gravendeel Haven.

Data:

Change Stations
US name's trailing state code moves to region (… near Savannah Ga → … near Savannah, region GA) 810
Numeric region becomes a name (02 → British Columbia) 284
Region gains its native spelling (Skane → Skåne) 238
Region comes from the name's own code, not the nearest place across a border (SC → GA, 08 → NY, WA → British Columbia) 24
Region added where there was none 20
All-caps name title-cased (ANDRATX → Andratx) 11
Non-French name loses an invented hyphen (Rio-de-Janeiro → Rio de Janeiro) 7

GeoNames writes some apostrophes as ’ or ʼ. The geocoder now makes them ASCII, so the Bermuda gauges read Saint George's, the GeoNames parish name without "Parish". In the built catalogue, five Bahamas, Jamaica, Bangladesh and Newfoundland localities get the same ASCII apostrophe.

In the built catalogue, 27 names and 14 region codes change, and every one is in the table above. The route lock moves those 14 stations to their correct state, and their old paths stay as former_paths. The three Haida Gwaii gauges (Carpenter Bay, Copper Islands, Rose Harbour) have no place within reach. The build now takes their province from the stored region, so they keep CA-BC.

Not in this PR: the source files still put 11 Ontario gauges in a US state (Sault Ste Marie Ontario is in MI), because the nearest place is across the border and the name spells out the province instead of using a code. The built catalogue places all 11 in Ontario (CA-ON), so the published data is unaffected.

  • npm test (including the station tests), npm run validate:database, npm run lint, npm run test -w swift
  • Tests for each name case in name-cleanup.test.ts
  • Release the database

Closes #242

🤖 Generated with Claude Code

clarkbw and others added 2 commits October 7, 2026 12:17
The TICON importer passed cleanName the CSV's ISO code ("FRA"), so no
country rule matched: French names lost their hyphens and US names kept
their trailing state codes. cleanName now resolves an ISO code to the
country name, and the importer passes the nearest place's subdivision
so GESLA's underscore-joined Québec names ("Coteau_Du_Lac") get their
hyphens back. A source that writes spaces keeps its own spelling, so
CHS names like "Pont de Québec" are unchanged.

Also: Haiti hyphenates like France; UNC stays an acronym; USGS "03
Miles" is 0.3; Dutch "s_Gravendeel" is 's-Gravendeel; GeoNames' curly
and modifier-letter apostrophes become ASCII; a Canadian province named
by the provider supplies the region code where no place is in reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-run of sources/ticon/import with the current naming code. Harmonics
and datums are reused from the cached station files, so only name and
region fields change. The route lock follows the 14 stations whose
region moves; their old paths stay as former_paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@slackwater/database@247

commit: 798285a

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The leading-zero correction incorrectly alters already-nautical distances, and two new metadata paths lack regression coverage.

3 open findings
What changed in this PR

Re-imports TICON metadata with corrected station naming and regional attribution.

Changes:

  • Improves country-aware name cleanup and geocoding.
  • Regenerates 1,268 TICON station records and route aliases.
  • Adds naming regression tests.
File Description
data/​ticon/​*.json (1,268 files) Updates generated station names and regions.
metadata/​routes.lock.json Moves affected routes while retaining former paths.
packages/​stations/​geocode.ts Normalizes apostrophes.
packages/​stations/​metadata.ts Adds Canadian-region fallback.
packages/​stations/​name-cleanup.ts Adds country and naming rules.
packages/​stations/​test/​name-cleanup.test.ts Tests new cleanup cases.
sources/​ticon/​import.ts Supplies subdivision context during import.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return name.replace(DISTANCE, (_, digits: string, unit: string) => {
// USGS drops the decimal point from a distance under a mile: "03 Miles"
// is 0.3, not 3.
const value = /^0\d+$/.test(digits) ? `0.${digits.slice(1)}` : digits;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 798285a. The dropped-decimal reading now applies to statute miles only, and a nautical distance keeps its number as written ("03 nm" stays "03 nm"). The test covers both.

Comment on lines +43 to +45
for (const place of places) {
place.name = place.name.replace(/[’ʼ]/g, "'");
place.admin1 = place.admin1.replace(/[’ʼ]/g, "'");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in 798285a. The new test checks St George's, Bermuda (U+02BC in GeoNames' admin1) and Cox's Bazar (U+2019 in the place name) against the committed snapshot. Both come back with ASCII apostrophes.

Comment thread packages/stations/metadata.ts
The dropped-decimal reading ("03 Miles" is 0.3) applies to statute
miles only; a nautical distance keeps its number as written. Also cover
the geocoder's ASCII apostrophes and the Canadian province fallback in
resolveMetadata with tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clarkbw
clarkbw merged commit 4faab5b into main Oct 7, 2026
5 checks passed
@clarkbw
clarkbw deleted the fix/ticon-names branch October 7, 2026 22:13
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.

TICON station names and regions are out of date

2 participants