diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d0eb7..3f60b77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ ## 2026-11-20 - Every trail now has a season - All 223 trails now have a season. 148 come from a page that states one. 3 were set by judgement from pages of at least two publishers that disagree, none of them the trail's own, its association's or its route author's. The other 72 are estimates, because no page states a season for them; three of those (the Finger Lakes Trail, the Ice Age Trail and the Ozark Trail) have a page that contradicts itself or two pages from one publisher that differ, and the note says so. -- An estimate never reads as a fact. A trail's page shows it as "About April to October", with a short note: no page states a season, it was estimated from the climate at the trail's elevation and from similar trails, what sets the season there, how confident the estimate is, and that people do walk the trail outside those months. Lists and tables mark an estimate, and it is left out of the data that search engines read. The 3 set from pages that disagree read the same way, and their note says the pages differ. +- An estimate never reads as a fact. A trail's page shows it as "About April to October", with a short note: no page states a season, it was estimated from the climate at the trail's elevation and from similar trails, what sets the season there, how confident the estimate is, and that these are the usual months, not a closure. Lists and tables mark an estimate, and it is left out of the data that search engines read. The 3 set from pages that disagree read the same way, and their note says the pages differ. - How an estimate is made: a reviewer is given the trail's location and elevation, its monthly climate (CHELSA, public domain, with NOAA elevation), a climate model's own estimate, and the ten most similar trails whose season a page states, and sets the months. The climate model alone matched 67.6 percent of the known seasons within a month at each end, under the 75 percent the owner asked for, so it is one input and not the answer. -- How it was tested: the same reviewers estimated the 148 trails whose season a page does state, from packets with that season hidden. Two measures, given together: 114 of 148 (77 percent) had their first and last months within a month of the page's; 105 (71 percent) also had no wrong gap in the middle. By confidence, first and last months: 48 of 52 where they were highly confident, 55 of 76 at medium confidence, and 11 of 20 at low; with no wrong gap as well: 48 of 52, 46 of 76 and 11 of 20. The 75 percent bar was set on the first and last months, and the method clears it there but not on the stricter measure. The owner decided the estimates ship with both figures stated. The reference page and the glossary give these figures, read from a data file. +- How it was tested: the same reviewers estimated the 148 trails whose season a page does state, from packets with that season hidden. Two measures, given together: 114 of 148 (77 percent) had their first and last months within a month of the page's; 105 (71 percent) also had no wrong gap in the middle. By confidence, first and last months: 48 of 52 where they were highly confident, 55 of 76 at medium confidence, and 11 of 20 at low; with no wrong gap as well: 48 of 52, 46 of 76 and 11 of 20. The 75 percent bar was set on the first and last months, and the method clears it there but not on the stricter measure. The owner decided the estimates ship with both figures stated. The reference page gives these figures, read from a data file. - The "By month" lists now include every trail and mark the estimated seasons, and the note that only some trails have a season is gone. The month filter has a box to leave estimated seasons out. - An estimate is replaced when a page that states a season is found. The monthly audit searches again for every one, and a monthly check reruns the climate model for each estimate and flags any whose inputs have changed. - For contributors: `hike.season_basis` may now be `estimate`, with a `hike.season_method` that ends "Confidence: high.", "Confidence: medium." or "Confidence: low." and one source that cites the climate data; a season is required on every trail, and the validator refuses an estimate that cites an ordinary page. The packet builder and the blind scorer are `tools/season_judge.py`, the reviewers' instruction is `docs/season-judging.md`, and the audit steps are in `docs/audit.md`. diff --git a/docs/superpowers/plans/2026-11-20-season-on-every-trail.md b/docs/superpowers/plans/2026-11-20-season-on-every-trail.md index 86bccfd..b91b365 100644 --- a/docs/superpowers/plans/2026-11-20-season-on-every-trail.md +++ b/docs/superpowers/plans/2026-11-20-season-on-every-trail.md @@ -435,7 +435,7 @@ The workflow: triggers `schedule` (monthly: `cron: "17 6 1 * *"`) and `workflow_ - Test: `web/tests/test_facets.py` (add), `web/tests/test_hike.py` **Interfaces:** -- Produces in `facets.py`: `season_estimated(rec) -> bool` (true when `hike.season_basis == "estimate"`); `season_text(rec)` returns `"About " + phrase` for an estimate (phrase left as it is after "About", so "About June to September"), unchanged for others; `season_note(rec) -> str` (`""` unless estimated; else "Estimated from climate at the trail's elevation. No source states a season. People do walk it outside these months."); `SEASON_STATED_NOTE` not needed. +- Produces in `facets.py`: `season_estimated(rec) -> bool` (true when `hike.season_basis == "estimate"`); `season_text(rec)` returns `"About " + phrase` for an estimate (phrase left as it is after "About", so "About June to September"), unchanged for others; `season_note(rec) -> str` (`""` unless estimated; else "Estimated from climate at the trail's elevation. No source states a season. This is the usual window, not a closure."); `SEASON_STATED_NOTE` not needed. - [ ] **Step 1: Write failing tests** (fixtures built like `fake(...)` in `web/tests/test_views.py`): `test_an_estimated_season_reads_about_and_has_a_note`; `test_a_stated_season_is_unchanged_and_has_no_note`; `test_an_estimated_all_year_season_reads_about_all_year`; `test_season_estimated_is_false_without_a_basis`. - [ ] **Step 2: Run** `python3 -m unittest discover -s web/tests -p "test_facets.py" -v`. Expected: the new tests fail. diff --git a/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md b/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md index 67e724e..235f9b9 100644 --- a/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md +++ b/docs/superpowers/specs/2026-11-20-season-on-every-trail-design.md @@ -146,8 +146,8 @@ What the tool does: - Trail page: an estimated season reads "About June to September" with a note, as estimated time does today: "Estimated from climate at the trail's - elevation. No source states a season. People do walk it outside these - months." Sourced seasons show their basis in "About this data". + elevation. No source states a season. This is the usual window, not a + closure." Sourced seasons show their basis in "About this data". - Rows, summary lines and month lists include every trail. Estimated seasons are marked in the row. - The "By month" blurb becomes "Trails normally hiked in the month. Estimated @@ -203,7 +203,7 @@ The plan above chose a rule over climate normals for Step 3. It was built and te - **An estimate is stricter.** `season_basis = "estimate"` means no page states a season. `season` is built from `months`; `season_method` is one or two plain sentences saying how it was set and what sets the season there, ending "Confidence: high.", "medium." or "low."; and its one `[[hike.source]]` names `season` and `months` and cites the climate data. The validator refuses an estimate with any ordinary page naming the season, or with no method, and requires a season on every trail. - **Pages that disagree.** Three trails (the Sierra High Route, the Cohos Trail and the Ouachita Trail) have pages from at least two different publishers that disagree, where none is the managing body, association or route author. Their season is set by judgement from all the pages and the estimate: basis `sources`, the pages cited as sources naming the season, and a `season_method` saying the pages differ and how it was settled, ending with a confidence; the validator requires two publishers and the confidence. Three more (the Finger Lakes Trail, whose one page contradicts itself, and the Ice Age Trail and the Ozark Trail, each with two pages from one publisher that differ) have no two publishers, so they are estimates: the pages are not cited as stating the season, and the method says a page was found but differs, so the season was estimated from the climate and similar trails. A season with a method is shown as an estimate (it reads "About" with a note), left out of structured data, and not counted among the seasons a page states. - **The monthly check** (`estimate_season.py check`) reruns the machine estimate for every estimate and flags any whose inputs have changed since `tools/season_inputs.json` recorded them. It does not rewrite anything. The audit (`docs/audit.md`) also searches afresh for a page for every estimate. -- **On the site**, a trail's page reads "About April to October" with a note (no page states a season; estimated from the climate at the trail's elevation and from similar trails; what sets it there; the confidence; that people walk it outside these months). Rows, tables and month lists mark estimates, the month filter can leave them out, and the reference page and glossary give the counts and the blind-test result. +- **On the site**, a trail's page reads "About April to October" with a note (no page states a season; estimated from the climate at the trail's elevation and from similar trails; what sets it there; the confidence; that these are the usual months, not a closure). Rows, tables and month lists mark estimates, the month filter can leave them out, and the reference page and glossary give the counts and the blind-test result. ## Open risks diff --git a/glossary.toml b/glossary.toml index a89aef0..f8d8d81 100644 --- a/glossary.toml +++ b/glossary.toml @@ -116,7 +116,7 @@ see = ["/lists/weekend/", "/lists/one-to-two-weeks/", "/lists/a-month-or-more/", [[term]] id = "season" term = "Season" -definition = "The months in which the whole trail is usually walked. Where a page states them, that is shown. Otherwise they are estimated from the climate at the trail's elevation and from similar trails, and the page says so: an estimated season reads “About” with a note. It is not the dates a park or a hut is open." +definition = "The months in which the whole trail is usually walked. Where a page states them, that is shown. Otherwise they are estimated from the climate at the trail's elevation and from similar trails or, where pages disagree and none is the trail's own, set by judgement from all of them, and the page says which: either reads “About” with a note. It is not the dates a park or a hut is open." see = ["/lists/"] [[term]] diff --git a/web/olt/browse.py b/web/olt/browse.py index d2398f9..56e5ba7 100644 --- a/web/olt/browse.py +++ b/web/olt/browse.py @@ -126,14 +126,21 @@ def _month_list(m): def month_note(name): def note(recs, records): - est = sum(1 for r in recs if facets.season_estimated(r)) + unstated = [r for r in recs if facets.season_estimated(r)] + est = len(unstated) stated = len(recs) - est if not est: return f"A source states the season for all {stated}." + kinds = {facets.season_kind(r) for r in unstated} + one = ("estimated from the climate and similar trails" if kinds == {"estimated"} + else "set by judgement from pages that differ" if kinds == {"judged"} else "") if not stated: - return "No source states the season for these, so each is estimated from climate." - return (f"A source states the season for {stated} of these. For the other {est} it is " - f"estimated from climate, and marked.") + return (f"No source states the season for these, so each is {one}." if one + else f"No source states the season for these: {facets.season_unstated_clause(unstated)}.") + if one: + return f"A source states the season for {stated} of these. For the other {est} it is {one}, and marked." + return (f"A source states the season for {stated} of these. For the other {est}, " + f"{facets.season_unstated_clause(unstated)}, and marked.") return note diff --git a/web/olt/facets.py b/web/olt/facets.py index 44723c0..cde15cd 100644 --- a/web/olt/facets.py +++ b/web/olt/facets.py @@ -239,6 +239,27 @@ def season_pages_differ(rec): return season_estimated(rec) and season_basis(rec) == "sources" +SEASON_USUAL = "This is the usual window, not a closure." + + +def _plural(n, one, many): + return f"{n} {one if n == 1 else many}" + + +def season_unstated_clause(recs): + """What is true of the seasons among recs that no page states, kind by kind and counted exactly: + "2 are estimated from the climate and similar trails and 1 is set by judgement from pages that + differ"; "" when there are none.""" + kinds = [season_kind(r) for r in recs] + est, judged = kinds.count("estimated"), kinds.count("judged") + parts = [] + if est: + parts.append(f"{est} {'is' if est == 1 else 'are'} estimated from the climate and similar trails") + if judged: + parts.append(f"{judged} {'is' if judged == 1 else 'are'} set by judgement from pages that differ") + return " and ".join(parts) + + def season_note(rec): """Says an estimated season is not a page's statement, how it was worked out, what sets it there and how far to trust it; "" when a page states the season.""" @@ -247,6 +268,8 @@ def season_note(rec): reason = season_reason(rec) if season_pages_differ(rec): lead = "No one page states this season." + elif "estimated from the climate" in reason: + lead = "No page states a season." # the method says how it was estimated; not said twice else: lead = ("No page states a season. This is estimated from the climate at the trail's " "elevation and from similar trails.") @@ -256,7 +279,7 @@ def season_note(rec): conf = season_confidence(rec) if conf: parts.append(f"Confidence: {conf}.") - parts.append("People do walk it outside these months.") + parts.append(SEASON_USUAL) return " ".join(parts) diff --git a/web/olt/reference.py b/web/olt/reference.py index 5cb59ee..d7bc539 100644 --- a/web/olt/reference.py +++ b/web/olt/reference.py @@ -110,9 +110,9 @@ def season_section(records, blind): ["Two or more pages from different publishers that agree", str(basis["sources"])], ["One page", str(basis["source"])], ["Pages that differ, so set by judgement from all of them", str(kinds["judged"])], - ["No page states one, so estimated from climate", str(kinds["estimated"])], + ["No page states one, so estimated from the climate and similar trails", str(kinds["estimated"])], ["All trails", str(n)]] - out = [f"""

Every trail has a season. Where a page states one, the season is that page’s. Where the pages that state one differ and none is the trail’s holder, its association or its route’s author, the season is set by judgement from all of them and the climate, and the page says so. Where no page states one, the season is estimated from the climate at the trail’s elevation and from similar trails: it reads “About” with a note, is marked in lists and is left out of the data search engines read. People do walk many trails outside their estimated months, and an estimate is replaced when a page that states a season is found.

+ out = [f"""

Every trail has a season. Where a page states one, the season is that page’s. Where the pages that state one differ and none is the trail’s holder, its association or its route’s author, the season is set by judgement from all of them and the climate, and the page says so. Where no page states one, the season is estimated from the climate at the trail’s elevation and from similar trails: it reads “About” with a note, is marked in lists and is left out of the data search engines read. An estimated season is the usual window, not a closure, and an estimate is replaced when a page that states a season is found.

{pagekit.table(["Where a trail's season comes from", "Trails"], rows, caption="Where the seasons come from", numeric=(1,))}"""] if blind: by = blind["by_confidence"] @@ -149,7 +149,7 @@ def method_page(records, site, repo_root): for label, fn in (("A usual time stated by a source", lambda r: not facets.time_days(r)[2]), ("A season a page states", lambda r: facets.season_kind(r) == "stated"), ("A season set from pages that differ", lambda r: facets.season_kind(r) == "judged"), - ("A season estimated from climate", lambda r: facets.season_kind(r) == "estimated"), ("A high point", lambda r: bool(hike.table(r).get("high_point_m"))), + ("A season estimated from the climate and similar trails", lambda r: facets.season_kind(r) == "estimated"), ("A high point", lambda r: bool(hike.table(r).get("high_point_m"))), ("Terrain", lambda r: bool(facets.terrain(r))), ("What the walking is", lambda r: bool(facets.walking(r))), ("A computed climb that covers the whole trail", lambda r: facets.row_climb_m(r) is not None), ("A track included here", common.has_line)): diff --git a/web/olt/standing.py b/web/olt/standing.py index de0f2e5..5d48b02 100644 --- a/web/olt/standing.py +++ b/web/olt/standing.py @@ -51,10 +51,11 @@ def season_cell(rec): def figures_note(recs): """What the times and climbs of these trails mean, with the caveats the records state.""" est = sum(1 for r in recs if facets.time_days(r)[2]) - unstated = sum(1 for r in recs if facets.season_estimated(r)) + unstated = [r for r in recs if facets.season_estimated(r)] parts = [f"Times that start with “About” are estimated from the length ({est} of these). " "Otherwise a source states the time.", - f"Seasons that start with “About” are estimated from climate ({unstated} of these)." if unstated else "", + (f"Seasons that start with “About” are not stated by a page ({len(unstated)} of these): " + f"{facets.season_unstated_clause(unstated)}." if unstated else ""), climb_caveat(recs)] return " ".join(p for p in parts if p) diff --git a/web/olt/summary.py b/web/olt/summary.py index 9a41fe4..d903a76 100644 --- a/web/olt/summary.py +++ b/web/olt/summary.py @@ -149,7 +149,7 @@ def detail(rec): season = facets.season_text(rec) if season: how = (", judged from pages that differ" if facets.season_pages_differ(rec) - else ", estimated from climate" if facets.season_estimated(rec) else "") + else ", estimated from the climate and similar trails" if facets.season_estimated(rec) else "") out.append(f"Season: {esc(season)}{how}.") rest = _rest_of_summary(rec) if rest: diff --git a/web/tests/test_facets.py b/web/tests/test_facets.py index 5e1fc85..a904f2a 100644 --- a/web/tests/test_facets.py +++ b/web/tests/test_facets.py @@ -189,10 +189,30 @@ class SeasonTextTest(unittest.TestCase): note = facets.season_note(rec) for want in ("No page states a season", "estimated from the climate at the trail's elevation and from " "similar trails", "Snow keeps the high passes closed until June.", "Confidence: medium.", - "People do walk it outside these months."): + "This is the usual window, not a closure."): self.assertIn(want, note) + self.assertNotIn("walk it outside", note) self.assertNotIn("Judged from", note) # the standard lead is said once, in the note's own words + def test_a_page_that_contradicts_itself_is_said_once_not_twice(self): + rec = fake(1, hike=est_hike(season_method=( + "A page was found but it contradicts itself, so no page is relied on. The season was estimated " + "from the climate and similar trails: snow lies until June. Confidence: medium."))) + note = facets.season_note(rec) + self.assertTrue(note.startswith("No page states a season. A page was found but it contradicts itself"), note) + self.assertEqual(note.count("estimated from the climate"), 1) + self.assertTrue(note.endswith("This is the usual window, not a closure.")) + + def test_a_season_judged_from_pages_is_not_called_estimated_from_climate(self): + judged = fake(1, hike=est_hike(season_basis="sources", season_method="The pages differ. Confidence: low.")) + est = fake(2, hike=est_hike()) + self.assertEqual(facets.season_unstated_clause([est, est, judged]), + "2 are estimated from the climate and similar trails and 1 is set by judgement from " + "pages that differ") + self.assertEqual(facets.season_unstated_clause([judged]), "1 is set by judgement from pages that differ") + self.assertEqual(facets.season_unstated_clause([est]), "1 is estimated from the climate and similar trails") + self.assertEqual(facets.season_unstated_clause([]), "") + def test_a_stated_season_is_unchanged_and_has_no_note(self): rec = fake(1, hike={"season": "June to September", "months": [6, 7, 8, 9], "season_basis": "primary"}) self.assertFalse(facets.season_estimated(rec)) @@ -365,9 +385,10 @@ class BuiltVocabularyTest(unittest.TestCase): for rec in est[:10]: doc = self.read(f"trails/{rec['id']}/index.html") self.assertIn(facets.season_text(rec), html.unescape(doc), rec["id"]) - self.assertIn("People do walk it outside these months.", html.unescape(doc), rec["id"]) + self.assertIn("This is the usual window, not a closure.", html.unescape(doc), rec["id"]) + self.assertNotIn("outside these months", html.unescape(doc), rec["id"]) for rec in stated[:10]: - self.assertNotIn("People do walk it outside these months.", html.unescape(self.read(f"trails/{rec['id']}/index.html"))) + self.assertNotIn("This is the usual window", html.unescape(self.read(f"trails/{rec['id']}/index.html"))) def test_navigation_has_four_sections_and_saved(self): doc = self.read("index.html") diff --git a/web/tests/test_hike.py b/web/tests/test_hike.py index 10d5d10..2497e72 100644 --- a/web/tests/test_hike.py +++ b/web/tests/test_hike.py @@ -147,7 +147,8 @@ class TrailPageTest(unittest.TestCase): self.assertIn("Season About April to October", t) self.assertIn("No page states a season.", t) self.assertIn("Confidence: high.", t) - self.assertIn("People do walk it outside these months.", t) + self.assertIn("This is the usual window, not a closure.", t) + self.assertNotIn("People do walk", t) self.assertIn("No source gives a season; the climate suggests about April to October.", t) self.assertNotIn("The usual season is", t) block = html.unescape(trail.hike_sources_block(rec)) diff --git a/web/tests/test_views.py b/web/tests/test_views.py index 6676aed..0fcfbfc 100644 --- a/web/tests/test_views.py +++ b/web/tests/test_views.py @@ -138,7 +138,20 @@ class MonthListTest(unittest.TestCase): + [self.est(20 + i) for i in range(5)] note = july.note(browse.members(july, recs), recs) self.assertEqual(note, "A source states the season for 10 of these. For the other 5 it is estimated " - "from climate, and marked.") + "from the climate and similar trails, and marked.") + + def test_a_month_note_tells_estimated_from_judged_from_pages_that_differ(self): + july = browse.by_key("hike-in-july") + judged = fake(90, hike={"months": [7], "season": "July", "season_basis": "sources", + "season_method": "The pages differ. Confidence: low."}) + stated = fake(91, hike={"months": [7], "season": "July", "season_basis": "primary"}) + recs = [stated, judged] + [self.est(20 + i) for i in range(3)] + self.assertEqual(july.note(browse.members(july, recs), recs), + "A source states the season for 1 of these. For the other 4, 3 are estimated from the climate " + "and similar trails and 1 is set by judgement from pages that differ, and marked.") + recs = [judged, judged] + self.assertEqual(july.note(browse.members(july, recs), recs), + "No source states the season for these, so each is set by judgement from pages that differ.") def test_a_month_list_with_no_estimates_says_so(self): july = browse.by_key("hike-in-july") @@ -146,7 +159,7 @@ class MonthListTest(unittest.TestCase): self.assertEqual(july.note(browse.members(july, recs), recs), "A source states the season for all 10.") recs = [self.est(i) for i in range(3)] self.assertEqual(july.note(browse.members(july, recs), recs), - "No source states the season for these, so each is estimated from climate.") + "No source states the season for these, so each is estimated from the climate and similar trails.") def test_the_month_blurb_no_longer_says_only_some_trails(self): group = {key: blurb for key, _title, blurb in browse.GROUPS}["month"] @@ -681,7 +694,7 @@ class RealDataTest(unittest.TestCase): kinds = {k: sum(1 for r in self.records if facets.season_kind(r) == k) for k in ("stated", "judged", "estimated")} self.assertEqual(sum(kinds.values()), len(self.records)) self.assertIn(f"A season a page states Records with it {kinds['stated']} Records without {len(self.records) - kinds['stated']}", text) - self.assertIn(f"A season estimated from climate Records with it {kinds['estimated']} Records without {len(self.records) - kinds['estimated']}", text) + self.assertIn(f"A season estimated from the climate and similar trails Records with it {kinds['estimated']} Records without {len(self.records) - kinds['estimated']}", text) self.assertIn(f"A season set from pages that differ Records with it {kinds['judged']} Records without {len(self.records) - kinds['judged']}", text) self.assertIn(f"All trails Trails {len(self.records)}", text)