Rename three place slugs to the slug of their display name, before the addresses go live

glacier is now glacier-national-park, sequoia-and-kings-canyon is now
sequoia-and-kings-canyon-national-parks and hells-canyon-wilderness-id is now
hells-canyon-wilderness. The registry, the allow-list and every record that names them are
updated, and the tool keeps the plain slug for the one Hells Canyon outline that has trails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 12:26:01 -07:00
1 parent 904287c23f
commit a97ea85093
29 files changed
+54 -34

No files matched your search

+3 -3
View File
@@ -341,14 +341,14 @@ where = ["CA"]
# Sequoia and Kings Canyon are one national park to hikers and one page here.
[[park]]
source_id = ["SEQU", "KICA"]
slug = "sequoia-and-kings-canyon"
slug = "sequoia-and-kings-canyon-national-parks"
name = "Sequoia and Kings Canyon National Parks"
# The two parks called Glacier (Montana and British Columbia) need different slugs; the
# Montana one is the one hikers mean by /parks/glacier/.
# Montana one is the one hikers mean by /parks/glacier-national-park/.
[[park]]
source_id = "GLAC"
slug = "glacier"
slug = "glacier-national-park"
name = "Glacier National Park"
# National Park Service units that are not national parks. A park page means any National
+13 -1
View File
@@ -485,8 +485,18 @@ def default_allowlist_path():
return os.path.join(ROOT, "tools", "place_allowlist.toml")
# A slug is the slug of the display name. Where two outlines of one name collide the tool
# suffixes the state code; an entry here names the one that keeps the plain slug, by
# (kind, source, source id), because the other has no trail and no page. Page addresses are
# permanent, so this is a decision made once.
SLUG_KEEPS_PLAIN = {
("wilderness", "wilderness-connect", "239"), # Hells Canyon Wilderness, Idaho and Oregon
}
def assign_slugs(outlines):
"""Slugs from names, unique within a kind; a collision gets its state code."""
"""Slugs from names, unique within a kind; a collision gets its state code, except
for the outline SLUG_KEEPS_PLAIN names, which keeps the plain slug."""
by_kind = {}
for o in outlines:
if not o.slug:
@@ -495,6 +505,8 @@ def assign_slugs(outlines):
for group in by_kind.values():
if len(group) > 1:
for o in group:
if (o.kind, o.source, str(o.source_id)) in SLUG_KEEPS_PLAIN:
continue
hint = (o.state_codes_hint or ["x"])[0].lower()
o.slug = f"{o.slug}-{hint}"
return outlines
+9 -1
View File
@@ -207,6 +207,14 @@ class ProposalTest(unittest.TestCase):
self.assertEqual([o.slug for o in P.merge_same_name([a, b])],
["white-mountains", "white-mountains-arizona"])
def test_a_collision_suffixes_the_state_except_for_the_outline_that_keeps_the_plain_slug(self):
a = outline("wilderness", "239", "Hells Canyon Wilderness", self.park.geometry, slug="", hint=["ID"])
b = outline("wilderness", "240", "Hells Canyon Wilderness", self.range.geometry, slug="", hint=["OR"])
a.slug = b.slug = ""
a.source = b.source = "wilderness-connect"
P.assign_slugs([a, b])
self.assertEqual((a.slug, b.slug), ("hells-canyon-wilderness", "hells-canyon-wilderness-or"))
def test_the_same_name_from_two_sources_or_kinds_is_not_merged(self):
a = outline("park", "1", "Glacier", self.park.geometry, hint=["MT"])
b = outline("park", "2", "Glacier", self.range.geometry, hint=["BC"])
@@ -401,7 +409,7 @@ class AllowlistTest(unittest.TestCase):
def test_a_park_entry_carries_no_where_it_was_not_given(self):
glacier = [p for p in self.al["park"] if p["source_id"] == "GLAC"][0]
self.assertNotIn("where", glacier) # the source's own state field says MT
self.assertEqual(glacier["slug"], "glacier")
self.assertEqual(glacier["slug"], "glacier-national-park")
def test_every_range_has_its_states_where_a_hand_value_is_given_and_codes_are_known(self):
known = set(P.state_boxes())