Add pedigree lookup and ancestry tree page

New 🌳 Pedigree view: enter a dog's ISO chip or SKK registration number
and see its ancestry rendered as a tree. SKK has no public API, so the
server drives SKK Hunddata like a browser: it resolves the input to an
internal hundid via the Hund_sok.aspx/HundData page-method, renders 7
generations per pedigree page, parses the rowspan grid into ahnentafel
positions, and follows each generation's leaves deeper by reading their
hundid out of the __doPostBack response viewstate.

A lookup returns the first 7 generations immediately and crawls deeper in
the background; the client polls and fills the tree in as ancestors
arrive. Finished trees are cached per dog in a new pedigree_cache table
(pedigrees don't change), so a dog is crawled once and repeats are instant.
The endpoints sit behind auth like the rest of /api/*, and the crawl is
kept polite (warmed session, delay between requests, one coalesced job per
dog, hard caps).
This commit is contained in:
Alexander Heldt
2026-07-26 09:22:14 +00:00
parent 374e630d8f
commit 26ebe3bd86
11 changed files with 1458 additions and 1 deletions
+27
View File
@@ -70,6 +70,7 @@
<div id="puppy-age" class="puppy-age" hidden></div>
</div>
<div class="header-actions">
<button type="button" id="pedigree-btn" class="ghost icon-btn" aria-label="Pedigree" title="Pedigree">🌳</button>
<button type="button" id="settings-btn" class="ghost icon-btn" aria-label="Settings" title="Settings">⚙️</button>
<button type="button" id="logout-btn" class="ghost icon-btn" aria-label="Log out" title="Log out">🚪</button>
<div id="online-status" class="status-pill"></div>
@@ -272,6 +273,32 @@
</footer>
</div><!-- /#app -->
<!-- Pedigree lookup. A distinct full-screen view (hides #app while open)
that resolves a dog by chip / registration number / name against SKK
and renders its ancestry as a tree. Online-only. -->
<div id="pedigree-screen" class="pedigree-screen" hidden>
<header class="pedigree-header">
<button type="button" id="pedigree-back" class="ghost icon-btn" aria-label="Back to tracker" title="Back"></button>
<h1>🌳 Pedigree</h1>
</header>
<main class="pedigree-main">
<form id="pedigree-form" class="pedigree-form">
<input type="text" id="pedigree-q" autocomplete="off" spellcheck="false"
placeholder="Chip or registration number" aria-label="Dog chip or registration number" />
<button type="submit" id="pedigree-lookup">Look up</button>
</form>
<p class="muted-note pedigree-hint">
Looks up a dog in <strong>SKK Hunddata</strong> by ISO chip number
(e.g. 752095600044144) or registration number (e.g. SE23536/2026),
then traces its ancestry. Needs an internet connection.
</p>
<p id="pedigree-status" class="pedigree-status" hidden></p>
<div id="pedigree-choose" class="pedigree-choose" hidden></div>
<div id="pedigree-subject" class="pedigree-subject" hidden></div>
<div id="pedigree-tree" class="pedigree-tree"></div>
</main>
</div><!-- /#pedigree-screen -->
<dialog id="changelog-dialog">
<form method="dialog" id="changelog-form">
<h3>Changelog</h3>