Repository navigation
Fix TICON station names and regions - #247
Conversation
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>
commit: |
There was a problem hiding this comment.
🟡 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; |
There was a problem hiding this comment.
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.
| for (const place of places) { | ||
| place.name = place.name.replace(/[’ʼ]/g, "'"); | ||
| place.admin1 = place.admin1.replace(/[’ʼ]/g, "'"); |
There was a problem hiding this comment.
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.
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>


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
nameandregionchange.The TICON importer passed
cleanNamethe CSV's ISO code (FRA,USA), so none of the country rules ran.cleanNamenow 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:
Fort-de-France,Boulogne-sur-Mer).Coteau-du-Lac). The importer now passes the nearest place's subdivision, andcleanNamehyphenates a Québec name only when its source joined every word with underscores. CHS names such asPont de Québeckeep their own spelling.St Louis-du-Sud.UNC Center Marine Science Dockkeeps its acronym.03 Milesreads as 0.3 miles:Merrimack R 0.3 nm US Rt 125 at Haverhill Ma.s_Gravendeelbecomes's-Gravendeeland's-Gravendeel Haven.Data:
region(… near Savannah Ga→… near Savannah, regionGA)02→British Columbia)Skane→Skåne)SC→GA,08→NY,WA→British Columbia)ANDRATX→Andratx)Rio-de-Janeiro→Rio de Janeiro)GeoNames writes some apostrophes as
’orʼ. The geocoder now makes them ASCII, so the Bermuda gauges readSaint 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 keepCA-BC.Not in this PR: the source files still put 11 Ontario gauges in a US state (
Sault Ste Marie Ontariois inMI), 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 swiftname-cleanup.test.tsCloses #242
🤖 Generated with Claude Code