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:
1 parent
904287c23f
commit
a97ea85093
29 files changed
+54
-34
No files matched your search
@@ -96,7 +96,7 @@ url = "https://www.longtrailswiki.net/wiki/Big_SEKI_Loop"
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "track"
|
||||
km = 251.1
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ source = "https://www.hellscanyon.org/_files/ugd/998edb_7376feee1007475eb1c92f8e
|
||||
|
||||
[[place]]
|
||||
kind = "wilderness"
|
||||
slug = "hells-canyon-wilderness-id"
|
||||
slug = "hells-canyon-wilderness"
|
||||
basis = "stated"
|
||||
source = "https://www.hellscanyon.org/_files/ugd/998edb_7376feee1007475eb1c92f8e651796ba.pdf"
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ facts = ["permit"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.fs.usda.gov/r05/sequoia/recreation/jerkey-meadow-trailhead"
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ facts = ["permit"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://fastestknowntime.com/route/circle-solitude"
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ url = "https://www.longtrailswiki.net/wiki/Continental_Divide_National_Scenic_Tr
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "track"
|
||||
km = 175.4
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ facts = ["start_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://shop.adventurewithkeen.com/product/sierra-south-2/"
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ facts = ["shape"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.nps.gov/seki/planyourvisit/high-sierra-trail.htm"
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ facts = ["start_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "stated"
|
||||
source = "https://andrewskurka.com/adventures/great-western-loop/route-description/"
|
||||
|
||||
@@ -139,7 +139,7 @@ source = "https://andrewskurka.com/adventures/great-western-loop/route-descripti
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://andrewskurka.com/adventures/great-western-loop/route-description/"
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ url = "https://www.longtrailswiki.net/wiki/High_Sierra_Trail"
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "track"
|
||||
km = 92.9
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ url = "https://www.longtrailswiki.net/wiki/John_Muir_Trail"
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "track"
|
||||
km = 159.0
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://andrewskurka.com/adventures/kings-canyon-high-basin-route/"
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ source = "http://simblissity.net/L2H.shtml"
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "http://simblissity.net/L2H.shtml"
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.unpress.nevada.edu/9780874179712/best-backpacking-trips-in-california-and-nevada/"
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://shop.adventurewithkeen.com/product/sierra-south-2/"
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "stated"
|
||||
source = "https://montanatrail.org/faq/"
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ km = 23.3
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "track"
|
||||
km = 169.0
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ url = "https://www.longtrailswiki.net/wiki/Pacific_Northwest_National_Scenic_Tra
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "track"
|
||||
km = 82.7
|
||||
|
||||
|
||||
+3
-3
@@ -315,7 +315,7 @@ source_version = "2026-11-20"
|
||||
box = [-157.0, 66.65, -149.53, 68.66]
|
||||
|
||||
[[place]]
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
kind = "park"
|
||||
name = "Glacier National Park"
|
||||
where = ["MT"]
|
||||
@@ -815,7 +815,7 @@ source_version = "2026-11-20"
|
||||
box = [-126.36, 50.14, -126.13, 50.23]
|
||||
|
||||
[[place]]
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
kind = "park"
|
||||
name = "Sequoia and Kings Canyon National Parks"
|
||||
where = ["CA"]
|
||||
@@ -2190,7 +2190,7 @@ source_version = "2026-11-20"
|
||||
box = [-107.87, 38.57, -107.76, 38.76]
|
||||
|
||||
[[place]]
|
||||
slug = "hells-canyon-wilderness-id"
|
||||
slug = "hells-canyon-wilderness"
|
||||
kind = "wilderness"
|
||||
name = "Hells Canyon Wilderness"
|
||||
where = ["ID", "OR"]
|
||||
|
||||
@@ -117,7 +117,7 @@ facts = ["start_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "track"
|
||||
km = 83.4
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ facts = ["start_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "track"
|
||||
km = 57.3
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ facts = ["summary", "official_url", "shape", "unfinished"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "glacier"
|
||||
slug = "glacier-national-park"
|
||||
basis = "stated"
|
||||
source = "https://www.nps.gov/noca/planyourvisit/pacific-northwest-trail.htm"
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ facts = ["season", "months", "days"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.mountaineers.org/books/books/sierra-grand-traverse-an-epic-route-across-the-range-of-light"
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ url = "https://www.longtrailswiki.net/wiki/Sierra_High_Route"
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.mountaineers.org/books/books/sierra-high-route-2nd-edition-traversing-timberline-country"
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://shop.adventurewithkeen.com/product/sierra-south-2/"
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ facts = ["end_lonlat"]
|
||||
|
||||
[[place]]
|
||||
kind = "park"
|
||||
slug = "sequoia-and-kings-canyon"
|
||||
slug = "sequoia-and-kings-canyon-national-parks"
|
||||
basis = "stated"
|
||||
source = "https://www.adventurealan.com/southern-sierra-high-route-soshr-guide/"
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ def load(repo_root):
|
||||
|
||||
|
||||
def path(kind, slug):
|
||||
"""The page of a place: /parks/glacier/, /ranges/wind-river-range/, /wilderness/<slug>/."""
|
||||
"""The page of a place: /parks/glacier-national-park/, /ranges/wind-river-range/, /wilderness/<slug>/."""
|
||||
return f"/{KINDS[kind].segment}/{slug}/"
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user