Add search site and printable QR location stickers - #3
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
/*__INVENTORY_DATA__*/nullbut only the comment was substituted, leavingconst DATA = {...}null;-- a syntax error that silently produced a blank page. The placeholder now swallows thenull, and the template stays valid JavaScript.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.