Paths of all riders: one Google Sheet layer, deaths as line styles; silhouettes with their interior lines
CI / test (pull_request) Successful in 44s
CI / test (pull_request) Successful in 44s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7ef8a58a0e
commit
57839fcc87
@@ -90,18 +90,15 @@ route_thresholds: [5, 10, 20, 30]
|
||||
rare_goals: [Blue, Black, Blue or Black]
|
||||
|
||||
# "Show the paths of all riders" on the valley map (site/atlas/explorer.js): one layer per source that records a
|
||||
# route, and two layers of deaths. Unlike everything above, the layers use every source of runs_clean.csv. A layer
|
||||
# takes runs by source (and, for the spreadsheet, by its row label `entry`); the death layers take every death from
|
||||
# the route-recording sources: "deliberate" = burned at an encounter the rider did not genuinely attempt (the route
|
||||
# model's rule), "failed" = every other death. Discord has no runs yet: its layer is ready for when it is imported.
|
||||
# route, each with its own switch. Unlike everything above, the layers use every source of runs_clean.csv. Within a
|
||||
# layer the runs are split by how they ended, drawn as line styles in the layer's colour: solid (did not die), dashed
|
||||
# (chose to die: burned at an encounter the rider did not genuinely attempt, the route model's rule) and dotted
|
||||
# (failed: every other death). Discord has no runs yet: its layer is ready for when it is imported.
|
||||
path_layers:
|
||||
- { key: form, label: "Google Sheet: form posts", sources: [reddit spreadsheet], entry: [Form] }
|
||||
- { key: bulk, label: "Google Sheet: bulk logs", sources: [reddit spreadsheet], entry_not: [Form] }
|
||||
- { key: sheet, label: "Google Sheet", sources: [reddit spreadsheet] }
|
||||
- { key: reported, label: "Reported on the Atlas", sources: [reported] }
|
||||
- { key: reddit, label: "Reddit megathread comments", sources: [reddit comment] }
|
||||
- { key: bot, label: "DragonKind bot", sources: [bot] }
|
||||
- { key: discord, label: "Discord", sources: [discord] }
|
||||
- { key: died_deliberate, label: "Deaths: chose to die", death: deliberate }
|
||||
- { key: died_failed, label: "Deaths: failed runs", death: failed }
|
||||
# sources that record which dragon bonded but not the route: counted on the map, not drawn
|
||||
path_unrouted: [reddit thread, register]
|
||||
|
||||
@@ -468,30 +468,27 @@ def deliberate(r):
|
||||
|
||||
|
||||
def path_layers(runs):
|
||||
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers, how many runs
|
||||
went from each place to the next (like valley()), plus where the death layers' runs ended. Every source is used
|
||||
here, not only the statistics' sources. Sources that record no route are counted only (path_unrouted)."""
|
||||
cfg = M["path_layers"]
|
||||
routed = sorted({s for layer in cfg for s in layer.get("sources", [])})
|
||||
"""'Show the paths of all riders' on the valley map: for every layer in measures.yaml path_layers (one source or
|
||||
more), how many runs went from each place to the next (like valley()), split by how the runs ended: `lived` (did
|
||||
not die), `chose` (a deliberate death) and `failed` (every other death), plus where the deaths happened. Every
|
||||
source is used here, not only the statistics' sources. Sources that record no route are counted only."""
|
||||
out = []
|
||||
for layer in cfg:
|
||||
if "death" in layer:
|
||||
sel = [r for r in runs if r["source"] in routed and r["outcome"] in DEATHS
|
||||
and deliberate(r) == (layer["death"] == "deliberate")]
|
||||
else:
|
||||
sel = [r for r in runs if r["source"] in layer["sources"]
|
||||
and (not layer.get("entry") or r.get("entry") in layer["entry"])
|
||||
and (not layer.get("entry_not") or r.get("entry") not in layer["entry_not"])]
|
||||
v = valley(sel)
|
||||
item = {"key": layer["key"], "label": layer["label"], "runs": len(sel), "edges": v["edges"]}
|
||||
if "death" in layer:
|
||||
ends = {}
|
||||
for r in sel:
|
||||
for layer in M["path_layers"]:
|
||||
sel = [r for r in runs if r["source"] in layer["sources"]]
|
||||
kinds = {"lived": [], "chose": [], "failed": []}
|
||||
for r in sel:
|
||||
kinds["lived" if r["outcome"] not in DEATHS else "chose" if deliberate(r) else "failed"].append(r)
|
||||
ends = {}
|
||||
for k in ("chose", "failed"):
|
||||
e = {}
|
||||
for r in kinds[k]:
|
||||
seq = place_path(r)
|
||||
if seq:
|
||||
ends[seq[-1]] = ends.get(seq[-1], 0) + 1
|
||||
item["ends"] = dict(sorted(ends.items(), key=lambda kv: -kv[1]))
|
||||
out.append(item)
|
||||
e[seq[-1]] = e.get(seq[-1], 0) + 1
|
||||
ends[k] = dict(sorted(e.items(), key=lambda kv: -kv[1]))
|
||||
out.append({"key": layer["key"], "label": layer["label"], "runs": len(sel),
|
||||
"counts": {k: len(v) for k, v in kinds.items()},
|
||||
"lines": {k: valley(v)["edges"] for k, v in kinds.items()}, "ends": ends})
|
||||
unrouted = {s: sum(1 for r in runs if r["source"] == s) for s in M.get("path_unrouted", [])}
|
||||
return {"layers": out, "unrouted": unrouted}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user