From 8da26e5c1db8f6b03d5fd7f093a852f55352c255 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 20 Nov 2026 10:48:45 -0700 Subject: [PATCH] Replace the draft range allow-list with the reviewed one The 25 ranges the first run's digest kept, plus the named ranges whatever their tracked count (trails with no track will be added to them by hand): Wind River, Teton, Uinta, Wasatch, San Juan, Sawtooth, Beartooth, Absaroka, Bitterroot, Great Smoky Mountains, Canadian Rockies, Olympic, White Mountains, Bighorn, Sangre de Cristo, Wallowa, Ruby, Trinity Alps, Selkirk, Brooks, Alaska Range, Ouachita and Catskill. The source has no Ozark Mountains (only the Ozark Plateau), so that one is left out. A range's within names its great system only, so at most two kept levels apply to a trail. Sequoia and Kings Canyon are joined again and Glacier gets the slug glacier. Co-Authored-By: Claude Sonnet 5.5 --- tools/place_allowlist.toml | 337 ++++++++++++++++++++++++++++++- tools/place_trails.py | 2 +- tools/tests/test_place_trails.py | 47 +++++ 3 files changed, 379 insertions(+), 7 deletions(-) diff --git a/tools/place_allowlist.toml b/tools/place_allowlist.toml index 873611d..d7ce647 100644 --- a/tools/place_allowlist.toml +++ b/tools/place_allowlist.toml @@ -3,11 +3,336 @@ # [[park]] entries name extra park units beyond the ones their source marks as national # parks, and joined pages: one entry whose source_id is a list joins those units into one # place (as Sequoia and Kings Canyon are joined). Fields: source_id (a string, or a list -# to join units), slug, name. +# to join units), slug, name, where (optional, see below). # # [[range]] entries are the mountain ranges that get measured at all. The GMBA inventory -# nests ranges up to ten levels, so no single level holds the useful names; instead this -# list starts from the ranges the owner named and every range that 3 or more tracks cross -# (place_trails.py candidates prints those), and a person reviews it before records are -# written. Fields: gmba_id (GMBA_V2_ID), slug, name (the display name, without the -# inventory's country qualifier), within (parent range slugs from this list). +# nests ranges up to ten levels, so no single level holds the useful names. This list was +# reviewed by the owner's reviewer on 2026-11-20: the 25 ranges the first run's digest +# kept (hiker-searchable names, no "Area", "Region" or "Group" names, no hyphen compounds), +# plus the named ranges below whatever their tracked count, because trails with no track +# will be added to them by hand. Fields: gmba_id (GMBA_V2_ID), slug, name (the display name +# as a hiker writes it, without the inventory's qualifier such as "(USA)"), within (the +# great system, where it has one: at most two kept levels apply to any one trail, a named +# range and its system, so a range's within never names another named range), where +# (optional state or province codes that replace the tool's own reading, which comes from +# web/place-bounds.toml and overlaps along borders). +# +# The `where` lines are set by hand where the boxes overlap a neighbour along a border. +# +# Two ids with one name are one place (the source lists the Palisades twice). +# +# Named but not in the source: "Ozark Mountains". GMBA v2 has the Ozark Plateau (16920) +# only, which is a plateau and not what hikers call the Ozark Mountains, so it is left out. + +[[range]] +gmba_id = "12105" +slug = "rocky-mountains" +name = "Rocky Mountains" +where = ["AB", "BC", "CO", "ID", "MT", "NM", "UT", "WY"] + +[[range]] +gmba_id = "11134" +slug = "appalachian-mountains" +name = "Appalachian Mountains" +where = ["AL", "CT", "GA", "MA", "MD", "ME", "NB", "NC", "NH", "NJ", "NL", "NS", "NY", "PA", "QC", "SC", "TN", "VA", "VT", "WV"] + +[[range]] +gmba_id = "11202" +slug = "cascade-range" +name = "Cascade Range" +where = ["BC", "CA", "OR", "WA"] + +[[range]] +gmba_id = "11928" +slug = "sierra-nevada" +name = "Sierra Nevada" + +[[range]] +gmba_id = "12340" +slug = "blue-ridge-mountains" +name = "Blue Ridge Mountains" +within = ["appalachian-mountains"] +where = ["GA", "MD", "NC", "PA", "SC", "TN", "VA", "WV"] + +[[range]] +gmba_id = "15905" +slug = "allegheny-plateau" +name = "Allegheny Plateau" +within = ["appalachian-mountains"] + +[[range]] +gmba_id = "12337" +slug = "allegheny-mountains" +name = "Allegheny Mountains" +within = ["appalachian-mountains"] +where = ["MD", "PA", "VA", "WV"] + +[[range]] +gmba_id = "12332" +slug = "green-mountains" +name = "Green Mountains" +within = ["appalachian-mountains"] +where = ["VT"] + +[[range]] +gmba_id = "12330" +slug = "longfellow-mountains" +name = "Longfellow Mountains" +within = ["appalachian-mountains"] +where = ["ME"] + +[[range]] +gmba_id = "15906" +slug = "finger-lakes" +name = "Finger Lakes" +where = ["NY"] + +[[range]] +gmba_id = "12552" +slug = "adirondack-mountains" +name = "Adirondack Mountains" +where = ["NY"] + +[[range]] +gmba_id = "12104" +slug = "colorado-plateau" +name = "Colorado Plateau" +where = ["AZ", "CO", "NM", "UT"] + +[[range]] +gmba_id = "11633" +slug = "mogollon-rim" +name = "Mogollon Rim" + +[[range]] +gmba_id = "12445" +slug = "transverse-ranges" +name = "Transverse Ranges" + +[[range]] +gmba_id = "12444" +slug = "california-coast-ranges" +name = "California Coast Ranges" + +[[range]] +gmba_id = "12443" +slug = "klamath-mountains" +name = "Klamath Mountains" + +[[range]] +gmba_id = "11234" +slug = "coast-mountains" +name = "Coast Mountains" +where = ["AK", "BC", "YT"] + +[[range]] +gmba_id = "15510" +slug = "north-cascades" +name = "North Cascades" +within = ["cascade-range"] + +[[range]] +gmba_id = "17002" +slug = "oregon-cascades" +name = "Oregon Cascades" +within = ["cascade-range"] + +[[range]] +gmba_id = "11818" +slug = "sawatch-range" +name = "Sawatch Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11337" +slug = "front-range" +name = "Front Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "17612" +slug = "mosquito-range" +name = "Mosquito Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11356" +slug = "gore-range" +name = "Gore Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "17222" +slug = "palisades" +name = "Palisades" +within = ["sierra-nevada"] +where = ["CA"] + +[[range]] +gmba_id = "17240" +slug = "great-western-divide" +name = "Great Western Divide" +within = ["sierra-nevada"] +where = ["CA"] + +[[range]] +gmba_id = "12060" +slug = "wind-river-range" +name = "Wind River Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11991" +slug = "teton-range" +name = "Teton Range" +within = ["rocky-mountains"] +where = ["ID", "WY"] + +[[range]] +gmba_id = "12026" +slug = "uinta-mountains" +name = "Uinta Mountains" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "12048" +slug = "wasatch-range" +name = "Wasatch Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11800" +slug = "san-juan-mountains" +name = "San Juan Mountains" +within = ["rocky-mountains"] +where = ["CO", "NM"] + +[[range]] +gmba_id = "17606" +slug = "sawtooth-range" +name = "Sawtooth Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "17502" +slug = "beartooth-mountains" +name = "Beartooth Mountains" +within = ["rocky-mountains"] +where = ["MT", "WY"] + +[[range]] +gmba_id = "11102" +slug = "absaroka-range" +name = "Absaroka Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11174" +slug = "bitterroot-range" +name = "Bitterroot Range" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "12342" +slug = "great-smoky-mountains" +name = "Great Smoky Mountains" +within = ["appalachian-mountains"] + +[[range]] +gmba_id = "12199" +slug = "canadian-rockies" +name = "Canadian Rockies" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11688" +slug = "olympic-mountains" +name = "Olympic Mountains" + +[[range]] +gmba_id = "12331" +slug = "white-mountains" +name = "White Mountains" +within = ["appalachian-mountains"] +where = ["ME", "NH"] + +[[range]] +gmba_id = "11169" +slug = "bighorn-mountains" +name = "Bighorn Mountains" +within = ["rocky-mountains"] + +[[range]] +gmba_id = "11803" +slug = "sangre-de-cristo-mountains" +name = "Sangre de Cristo Mountains" +within = ["rocky-mountains"] +where = ["CO", "NM"] + +[[range]] +gmba_id = "12046" +slug = "wallowa-mountains" +name = "Wallowa Mountains" +where = ["OR"] + +[[range]] +gmba_id = "11782" +slug = "ruby-mountains" +name = "Ruby Mountains" +where = ["NV"] + +[[range]] +gmba_id = "12929" +slug = "trinity-alps" +name = "Trinity Alps" +within = ["klamath-mountains"] + +[[range]] +gmba_id = "11830" +slug = "selkirk-mountains" +name = "Selkirk Mountains" +where = ["BC", "ID", "WA"] + +[[range]] +gmba_id = "11191" +slug = "brooks-range" +name = "Brooks Range" + +[[range]] +gmba_id = "11113" +slug = "alaska-range" +name = "Alaska Range" + +[[range]] +gmba_id = "12560" +slug = "ouachita-mountains" +name = "Ouachita Mountains" +where = ["AR", "OK"] + +[[range]] +gmba_id = "15911" +slug = "catskill-mountains" +name = "Catskill Mountains" +within = ["appalachian-mountains"] +where = ["NY"] + +# The source lists the Palisades twice under two ids; they are one place (see merge_same_name). +[[range]] +gmba_id = "19588" +slug = "palisades" +name = "Palisades" +within = ["sierra-nevada"] +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" +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/. +[[park]] +source_id = "GLAC" +slug = "glacier" +name = "Glacier National Park" diff --git a/tools/place_trails.py b/tools/place_trails.py index b07cbe2..3bbf844 100644 --- a/tools/place_trails.py +++ b/tools/place_trails.py @@ -699,7 +699,7 @@ def propose(records, outlines): return p -_NAME_FILLER = {"national", "park", "wilderness", "area", "preserve", "and", "the", "of"} +_NAME_FILLER = {"national", "park", "parks", "wilderness", "area", "preserve", "and", "the", "of"} def _core_name(name): diff --git a/tools/tests/test_place_trails.py b/tools/tests/test_place_trails.py index 1cf3e0d..ab3ce08 100644 --- a/tools/tests/test_place_trails.py +++ b/tools/tests/test_place_trails.py @@ -302,6 +302,53 @@ import re as _re import tomllib as _tomllib +@unittest.skipUnless(HAVE, "shapely (the .venv-places venv) is not installed") +class AllowlistTest(unittest.TestCase): + def setUp(self): + self.al = P.load_allowlist(P.default_allowlist_path()) + self.by_slug = {} + for r in self.al["range"]: + self.by_slug.setdefault(r["slug"], []).append(r) + + def test_the_reviewed_list_has_the_kept_and_the_named_ranges(self): + slugs = set(self.by_slug) + for must in ("rocky-mountains", "appalachian-mountains", "palisades", "great-western-divide", + "wind-river-range", "teton-range", "uinta-mountains", "wasatch-range", + "san-juan-mountains", "sawtooth-range", "beartooth-mountains", "absaroka-range", + "bitterroot-range", "great-smoky-mountains", "canadian-rockies", + "olympic-mountains", "white-mountains", "bighorn-mountains", + "sangre-de-cristo-mountains", "wallowa-mountains", "ruby-mountains", "trinity-alps", + "selkirk-mountains", "brooks-range", "alaska-range", "ouachita-mountains", + "catskill-mountains"): + self.assertIn(must, slugs) + self.assertNotIn("ozark-mountains", slugs) # the source has only the Ozark Plateau + self.assertEqual(self.by_slug["white-mountains"][0]["gmba_id"], "12331") + + def test_at_most_two_kept_levels_apply_to_a_trail(self): + for r in self.al["range"]: + for parent in r.get("within") or []: + self.assertIn(parent, self.by_slug, f"{r['slug']} names an unknown parent") + for grand in self.by_slug[parent][0].get("within") or []: + self.fail(f"{r['slug']} > {parent} > {grand} is three levels") + + def test_a_slug_is_on_one_name_and_display_names_carry_no_source_qualifier(self): + for slug, rows in self.by_slug.items(): + self.assertEqual(len({r["name"] for r in rows}), 1, slug) + for r in self.al["range"]: + self.assertNotIn("(", r["name"], r["slug"]) + + 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") + + def test_every_range_has_its_states_where_a_hand_value_is_given_and_codes_are_known(self): + known = set(P.state_boxes()) + for r in self.al["range"]: + for c in r.get("where") or []: + self.assertIn(c, known, r["slug"]) + + def make_repo(root): """Three tracked records and one trackless, minimal trail.toml files.""" for rid, line in (("aa", True), ("bb", True), ("cc", True), ("zz", False)):