Skip to content

Add search site and printable QR location stickers - #3

Merged
sr320 merged 1 commit into
mainfrom
phase2-search-site
Aug 3, 2026
Merged

Add search site and printable QR location stickers#3
sr320 merged 1 commit into
mainfrom
phase2-search-site

Conversation

@sr320

@sr320 sr320 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Phase 2: make the inventory findable before anyone is asked to enter data into it. Search value has to land first or this goes the way of the spreadsheet.

build_site.py inlines the data into a single self-contained _site/index.html rather than fetching a JSON sidecar, so the built page works over file:// -- no local server to preview it, and no CORS surprises.

No search library. At 499 items, a precomputed lowercase haystack per item plus a scored linear scan is faster than any index would be, and there is nothing vendored to keep alive. Every query token must match somewhere; name-prefix scores above name-substring above any-field. Location labels are part of the haystack, so "fridge door" and "cabinet 3" are queries too.

Location deep links (#209-CAB-01) roll up descendants: scanning the sticker on the -20 freezer shows all 49 items across its shelves and drawers, not the zero items filed directly against the freezer itself. That rollup is the whole point of the QR path.

make_qr_labels.py emits HTML, not PDF, so there is no PDF toolchain to maintain -- open it and print. Sticker geometry lives in CSS variables at the top of the generated file so it can be nudged to fit label stock without touching the script. QR payloads in CI take their base URL from configure-pages output rather than a hardcoded string.

Two bugs found by actually loading the page instead of assuming:

  • The data placeholder was /*__INVENTORY_DATA__*/null but only the comment was substituted, leaving const DATA = {...}null; -- a syntax error that silently produced a blank page. The placeholder now swallows the null, and the template stays valid JavaScript.
  • segno's default SVG has width/height but no viewBox, so the CSS sticker size only enlarged the viewport while the code stayed at intrinsic size in the corner. omitsize=True emits a viewBox instead.

Also tightened three legacy-migration warts that were visible in the UI: multiple parenthetical dates now keep the earliest as received and preserve the rest in notes; unbalanced parentheses left by date stripping (and present in the source, e.g. "2-Mercaptoethanol (8/6/2018) (opened (8/8/2018)") move their fragment to notes instead of shipping a name ending mid-parenthesis; and documentation now outranks content words, so "DNeasy blood and tissue handbook" is office rather than a blood sample, while "sample tubes" is a container rather than a sample.

Pages deploy needs one manual step this workflow cannot do for itself: Settings > Pages > Source = GitHub Actions.

Phase 2: make the inventory findable before anyone is asked to enter data
into it. Search value has to land first or this goes the way of the
spreadsheet.

build_site.py inlines the data into a single self-contained _site/index.html
rather than fetching a JSON sidecar, so the built page works over file:// --
no local server to preview it, and no CORS surprises.

No search library. At 499 items, a precomputed lowercase haystack per item
plus a scored linear scan is faster than any index would be, and there is
nothing vendored to keep alive. Every query token must match somewhere;
name-prefix scores above name-substring above any-field. Location labels are
part of the haystack, so "fridge door" and "cabinet 3" are queries too.

Location deep links (#209-CAB-01) roll up descendants: scanning the sticker on
the -20 freezer shows all 49 items across its shelves and drawers, not the
zero items filed directly against the freezer itself. That rollup is the whole
point of the QR path.

make_qr_labels.py emits HTML, not PDF, so there is no PDF toolchain to
maintain -- open it and print. Sticker geometry lives in CSS variables at the
top of the generated file so it can be nudged to fit label stock without
touching the script. QR payloads in CI take their base URL from
configure-pages output rather than a hardcoded string.

Two bugs found by actually loading the page instead of assuming:

- The data placeholder was `/*__INVENTORY_DATA__*/null` but only the comment
  was substituted, leaving `const DATA = {...}null;` -- a syntax error that
  silently produced a blank page. The placeholder now swallows the `null`, and
  the template stays valid JavaScript.
- segno's default SVG has width/height but no viewBox, so the CSS sticker size
  only enlarged the viewport while the code stayed at intrinsic size in the
  corner. omitsize=True emits a viewBox instead.

Also tightened three legacy-migration warts that were visible in the UI:
multiple parenthetical dates now keep the earliest as received and preserve
the rest in notes; unbalanced parentheses left by date stripping (and present
in the source, e.g. "2-Mercaptoethanol (8/6/2018) (opened (8/8/2018)") move
their fragment to notes instead of shipping a name ending mid-parenthesis;
and documentation now outranks content words, so "DNeasy blood and tissue
handbook" is office rather than a blood sample, while "sample tubes" is a
container rather than a sample.

Pages deploy needs one manual step this workflow cannot do for itself:
Settings > Pages > Source = GitHub Actions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sr320
sr320 requested a review from kubu4 as a code owner August 3, 2026 18:43
@sr320
sr320 merged commit 5f02be8 into main Aug 3, 2026
1 check passed
@sr320
sr320 deleted the phase2-search-site branch August 3, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant